summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2009-07-08 17:48:03 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-03-31 11:37:06 +0100
commit6dfc6b9cd3051ed219b8c132322720405c3346c9 (patch)
tree37bb3045822ab766aa2e47505417f28677a1a8d4
parent6ecb76308587874ba85e910c4b1163d365f4f37c (diff)
Process _NET_WM_STATE_SKIP_TASKBAR hint in multiwindow mode.
Set WS_EX_TOOLWINDOW style to hide window from Alt-Tab switcher Use ITaskBarList interface to ensure that the taskbar notices if the window has changed it's style in a way which affects if the taskbar shows it or not Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
-rw-r--r--hw/xwin/winmultiwindowwm.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 159c27a7b..79c3fad44 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -867,6 +867,9 @@ winMultiWindowWMProc (void *pArg)
{
HWND zstyle = HWND_NOTOPMOST;
UINT flags;
+ Bool onTaskbar;
+
+ /* XXX: probably should check for override-redirect and not do anything */
pNode->msg.hwndWindow = getHwnd(pWMInfo, pNode->msg.iWindow);
@@ -878,6 +881,18 @@ winMultiWindowWMProc (void *pArg)
flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
if (zstyle == HWND_NOTOPMOST) flags |= SWP_NOZORDER | SWP_NOOWNERZORDER;
SetWindowPos(pNode->msg.hwndWindow, NULL, 0, 0, 0, 0, flags);
+
+ /*
+ Use the WS_EX_TOOLWINDOW style to remove window from Alt-Tab window switcher
+
+ According to MSDN, this is supposed to remove the window from the taskbar as well,
+ if we SW_HIDE before changing the style followed by SW_SHOW afterwards.
+
+ But that doesn't seem to work reliably, so also use iTaskbarList interface to
+ tell the taskbar to show or hide this window.
+ */
+ onTaskbar = GetWindowLongPtr(pNode->msg.hwndWindow, GWL_EXSTYLE) & WS_EX_APPWINDOW;
+ wintaskbar(pNode->msg.hwndWindow, onTaskbar);
}
break;
@@ -1668,6 +1683,7 @@ winDeinitMultiWindowWM (void)
#define HINT_NOMAXIMIZE (1L<<4)
#define HINT_NOMINIMIZE (1L<<5)
#define HINT_NOSYSMENU (1L<<6)
+#define HINT_SKIPTASKBAR (1L<<7)
/* These two are used on their own */
#define HINT_MAX (1L<<0)
#define HINT_MIN (1L<<1)
@@ -1676,12 +1692,13 @@ static void
winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
{
static Atom windowState, motif_wm_hints, windowType;
- static Atom hiddenState, fullscreenState, belowState, aboveState;
+ static Atom hiddenState, fullscreenState, belowState, aboveState, skiptaskbarState;
static Atom dockWindow;
static int generation;
Atom type, *pAtom = NULL;
int format;
- unsigned long hint = 0, maxmin = 0, style, nitems = 0 , left = 0;
+ unsigned long hint = 0, maxmin = 0, nitems = 0 , left = 0;
+ unsigned long style, exStyle;
MwmHints *mwm_hint = NULL;
if (!hWnd) return;
@@ -1697,6 +1714,7 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False);
aboveState = XInternAtom(pDisplay, "_NET_WM_STATE_ABOVE", False);
dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False);
+ skiptaskbarState = XInternAtom(pDisplay, "_NET_WM_STATE_SKIP_TASKBAR", False);
}
if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
@@ -1708,6 +1726,7 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
unsigned long i;
for (i = 0; i < nitems; i++)
{
+ if (*pAtom == skiptaskbarState) hint |= HINT_SKIPTASKBAR;
if (*pAtom == hiddenState) maxmin |= HINT_MIN;
else if (*pAtom == fullscreenState) maxmin |= HINT_MAX;
if (*pAtom == belowState) *zstyle = HWND_BOTTOM;
@@ -1843,9 +1862,9 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
/* Now apply styles to window */
style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */
- if (!style) return;
+ if (!style) return; /* GetWindowLongPointer returns 0 on failure, we hope this isn't a valid style */
- if (!hint) /* All on */
+ if (!(hint & ~HINT_SKIPTASKBAR)) /* All on */
style = style | WS_CAPTION | WS_SIZEBOX;
else if (hint & HINT_NOFRAME) /* All off */
style = style & ~WS_CAPTION & ~WS_SIZEBOX;
@@ -1863,6 +1882,16 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
style = style & ~WS_SYSMENU;
SetWindowLongPtr (hWnd, GWL_STYLE, style);
+
+ /* now we have iTaskbar, use that as well */
+ exStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
+ if (hint & HINT_SKIPTASKBAR)
+ exStyle = (exStyle & ~WS_EX_APPWINDOW) | WS_EX_TOOLWINDOW;
+ else
+ exStyle = (exStyle & ~WS_EX_TOOLWINDOW) | WS_EX_APPWINDOW;
+ SetWindowLongPtr(hWnd, GWL_EXSTYLE, exStyle);
+
+ winDebug("winApplyHints: iWindow 0x%08x hints 0x%08x style 0x%08x exstyle 0x%08x\n", iWindow, hint, style, exStyle);
}
void