diff options
Diffstat (limited to 'xorg-server/hw/xwin/winmultiwindowwm.c')
-rwxr-xr-x[-rw-r--r--] | xorg-server/hw/xwin/winmultiwindowwm.c | 62 |
1 files changed, 49 insertions, 13 deletions
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 961f2fd8d..424da2bfa 100644..100755 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -1473,6 +1473,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) @@ -1481,12 +1482,14 @@ 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; WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP); MwmHints *mwm_hint = NULL; WinXSizeHints SizeHints; @@ -1507,6 +1510,8 @@ 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, @@ -1514,6 +1519,8 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) &nitems, &left, (unsigned char **) &pAtom) == Success) { if (pAtom && nitems == 1) { + if (*pAtom == skiptaskbarState) + hint |= HINT_SKIPTASKBAR; if (*pAtom == hiddenState) maxmin |= HINT_MIN; else if (*pAtom == fullscreenState) @@ -1602,9 +1609,13 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) XFree(normal_hint); } - /* Override hint settings from above with settings from config file */ + /* + Override hint settings from above with settings from config file and set + application id for grouping. + */ { XClassHint class_hint = { 0, 0 }; + char *application_id = 0; if (XGetClassHint(pDisplay, iWindow, &class_hint)) { char *window_name = 0; @@ -1618,17 +1629,23 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) #define APPLICATION_ID_FORMAT "%s.vcxsrv.%s" #define APPLICATION_ID_UNKNOWN "unknown" if (class_hint.res_class) { - asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, class_hint.res_class); + asprintf(&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, + class_hint.res_class); } else { - asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, APPLICATION_ID_UNKNOWN); + asprintf(&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, + APPLICATION_ID_UNKNOWN); } - winSetAppID (hWnd, application_id); + winSetAppUserModelID(hWnd, application_id); - if (class_hint.res_name) XFree(class_hint.res_name); - if (class_hint.res_class) XFree(class_hint.res_class); - if (application_id) free(application_id); - if (window_name) XFree(window_name); + if (class_hint.res_name) + XFree(class_hint.res_name); + if (class_hint.res_class) + XFree(class_hint.res_class); + if (application_id) + free(application_id); + if (window_name) + XFree(window_name); } else { style = STYLE_NONE; @@ -1661,10 +1678,15 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) (hint & ~HINT_BORDER & ~HINT_CAPTION) | HINT_NOFRAME; /* Now apply styles to window */ - style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */ - if (!hint) /* All on, but no resize of children is allowed */ + style = GetWindowLongPtr(hWnd, GWL_STYLE); + if (!style) + return; /* GetWindowLongPointer returns 0 on failure, we hope this isn't a valid style */ + + style &= ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */ + + if (!(hint & ~HINT_SKIPTASKBAR)) /* No hints, default */ style = style | WS_CAPTION; - else if (hint & HINT_NOFRAME) /* All off */ + else if (hint & HINT_NOFRAME) /* No frame, no decorations */ style = style & ~WS_CAPTION & ~WS_SIZEBOX; else style = style | ((hint & HINT_BORDER) ? WS_BORDER : 0) | @@ -1680,6 +1702,9 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) if (hint & HINT_NOSYSMENU) style = style & ~WS_SYSMENU; + if (hint & HINT_SKIPTASKBAR) + style = style & ~WS_MINIMIZEBOX; /* window will become lost if minimized */ + if (!IsWindow (hWnd)) { ErrorF("Windows window 0x%x has become invalid, so returning without applying hints\n",hWnd); @@ -1694,6 +1719,17 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) else style|=WS_SIZEBOX; SetWindowLongPtr(hWnd, GWL_STYLE, style); + + 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 |