CtrlCore: TopWindow::Urgent (RM #19)

git-svn-id: svn://ultimatepp.org/upp/trunk@3131 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-01-31 11:05:58 +00:00
parent 4384374408
commit c0c1ebf3bb
4 changed files with 45 additions and 1 deletions

View file

@ -4,6 +4,26 @@ NAMESPACE_UPP
#define LLOG(x) // LOG(x)
#if defined(COMPILER_MINGW) && !defined(FLASHW_ALL)
// MINGW headers don't include this in (some versions of) windows
extern "C"{
struct FLASHWINFO {
UINT cbSize;
HWND hwnd;
DWORD dwFlags;
UINT uCount;
DWORD dwTimeout;
};
WINUSERAPI BOOL WINAPI FlashWindowEx(FLASHWINFO*);
}
#define FLASHW_STOP 0
#define FLASHW_CAPTION 0x00000001
#define FLASHW_TRAY 0x00000002
#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY)
#define FLASHW_TIMER 0x00000004
#define FLASHW_TIMERNOFG 0x0000000C
#endif
#ifdef PLATFORM_WIN32
void TopWindow::SyncSizeHints() {}
@ -122,6 +142,15 @@ void TopWindow::SyncCaption0()
::SetWindowLong(hwnd, GWL_STYLE, style);
::SetWindowLong(hwnd, GWL_EXSTYLE, exstyle);
SyncTitle();
if(urgent) {
if(IsForeground()) urgent = false;
FLASHWINFO fi;
memset(&fi, 0, sizeof(fi));
fi.cbSize = sizeof(fi);
fi.hwnd = hwnd;
fi.dwFlags = urgent ? FLASHW_TIMER|FLASHW_ALL : FLASHW_STOP;
FlashWindowEx(&fi);
}
}
DeleteIco();
#ifndef PLATFORM_WINCE //TODO!!!

View file

@ -145,6 +145,8 @@ void TopWindow::SyncCaption0()
// XChangeProperty(Xdisplay, GetWindow(), XAtom("_NET_WM_STATE"), XAtom("ATOM"), 32,
// PropModeReplace, (const unsigned char *)wina, n);
wm_hints->flags = InputHint|WindowGroupHint|StateHint;
if(IsForeground()) urgent = false;
if(urgent) wm_hints->flags |= XUrgencyHint;
wm_hints->initial_state = NormalState;
wm_hints->input = XTrue;
Ctrl *owner = GetOwner();

View file

@ -34,6 +34,8 @@ void TopWindow::Activate()
UsrLogT(3, "ACTIVATE " + Desc(this));
if(activefocus && (HasFocus() || !GetFocusChildDeep()) && IsEnabled())
activefocus->SetWantFocus();
if(urgent)
SyncCaption();
LLOG("Activate End");
}
@ -410,6 +412,14 @@ TopWindow& TopWindow::ToolWindow(bool b)
return *this;
}
TopWindow& TopWindow::Urgent(bool b)
{
GuiLock __;
urgent = b;
SyncCaption();
return *this;
}
void TopWindow::SerializePlacement(Stream& s, bool reminimize)
{
GuiLock __;
@ -518,7 +528,7 @@ TopWindow::TopWindow()
WhenClose = THISBACK(Close);
overlapped.Clear();
dokeys = true;
fullscreen = frameless = false;
fullscreen = frameless = urgent = false;
}
TopWindow::~TopWindow()

View file

@ -120,6 +120,7 @@ private:
bool sizeable:1;
bool tool:1;
bool frameless:1;
bool urgent:1;
byte state;
Image icon, largeicon;
#ifdef PLATFORM_X11
@ -203,6 +204,8 @@ public:
bool IsFullScreen() const { return fullscreen; }
TopWindow& FrameLess(bool b = true) { frameless = b; return *this; }
bool IsFrameLess() const { return frameless; }
TopWindow& Urgent(bool b = true);
bool IsUrgent() const { return urgent; }
TopWindow& NoAccessKeysDistribution() { dokeys = false; return *this; }
TopWindow& NoCloseBox(bool b = true) { noclosebox = b; return *this; }