summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-02-05 11:25:39 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2013-01-16 16:49:50 +0000
commit3628559e594fcbdfcc14b1e8fa60aa841f184e19 (patch)
treeb049d0a03bd6cbbfc3a9946517e5170cb2aacf30 /hw
parent066ecbd11d516ea68d7ebc7470232d01c5717546 (diff)
hw/xwin: Add a new WM_WM_HINTS_EVENT event to update window style
Add a new WM_WM_HINTS_EVENT event to update window style if any of the properties which affect window style change Check PropertyNotify events for any of the window properties which we consider to decide on the window style, and update the window style by sending a WM_WM_HINTS_EVENT message to the WM. This allows the styling of the window to change during it's lifetime. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Diffstat (limited to 'hw')
-rw-r--r--hw/xwin/winmultiwindowwm.c59
-rw-r--r--hw/xwin/winwindow.h1
2 files changed, 53 insertions, 7 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index feefcf4df..12002430b 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -813,6 +813,26 @@ winMultiWindowWMProc(void *pArg)
UpdateIcon(pWMInfo, pNode->msg.iWindow);
break;
+ case WM_WM_HINTS_EVENT:
+ {
+ HWND zstyle = HWND_NOTOPMOST;
+ UINT flags;
+
+ pNode->msg.hwndWindow = getHwnd(pWMInfo, pNode->msg.iWindow);
+
+ /* Determine the Window style, which determines borders and clipping region... */
+ winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow,
+ pNode->msg.hwndWindow, &zstyle);
+ winUpdateWindowPosition(pNode->msg.hwndWindow, &zstyle);
+
+ /* Apply the updated window style, without changing it's show or activation state */
+ 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);
+ }
+ break;
+
case WM_WM_CHANGE_STATE:
/* Minimize the window in Windows */
winMinimizeWindow(pNode->msg.iWindow);
@@ -862,6 +882,7 @@ winMultiWindowXMsgProc(void *pArg)
Atom atmWmHints;
Atom atmWmChange;
Atom atmNetWmIcon;
+ Atom atmWindowState, atmMotifWmHints, atmWindowType, atmNormalHints;
int iReturn;
XIconSize *xis;
@@ -988,6 +1009,10 @@ winMultiWindowXMsgProc(void *pArg)
atmWmHints = XInternAtom(pProcArg->pDisplay, "WM_HINTS", False);
atmWmChange = XInternAtom(pProcArg->pDisplay, "WM_CHANGE_STATE", False);
atmNetWmIcon = XInternAtom(pProcArg->pDisplay, "_NET_WM_ICON", False);
+ atmWindowState = XInternAtom(pProcArg->pDisplay, "_NET_WM_STATE", False);
+ atmMotifWmHints = XInternAtom(pProcArg->pDisplay, "_MOTIF_WM_HINTS", False);
+ atmWindowType = XInternAtom(pProcArg->pDisplay, "_NET_WM_WINDOW_TYPE", False);
+ atmNormalHints = XInternAtom(pProcArg->pDisplay, "WM_NORMAL_HINTS", False);
/*
iiimxcf had a bug until 2009-04-27, assuming that the
@@ -1125,14 +1150,34 @@ winMultiWindowXMsgProc(void *pArg)
/* Other fields ignored */
winSendMessageToWM(pProcArg->pWMInfo, &msg);
}
- else if ((event.xproperty.atom == atmWmHints) ||
- (event.xproperty.atom == atmNetWmIcon)) {
- memset(&msg, 0, sizeof(msg));
- msg.msg = WM_WM_ICON_EVENT;
- msg.iWindow = event.xproperty.window;
+ else {
+ /*
+ Several properties are considered for WM hints, check if this property change affects any of them...
+ (this list needs to be kept in sync with winApplyHints())
+ */
+ if ((event.xproperty.atom == atmWmHints) ||
+ (event.xproperty.atom == atmWindowState) ||
+ (event.xproperty.atom == atmMotifWmHints) ||
+ (event.xproperty.atom == atmWindowType) ||
+ (event.xproperty.atom == atmNormalHints)) {
+ memset(&msg, 0, sizeof(msg));
+ msg.msg = WM_WM_HINTS_EVENT;
+ msg.iWindow = event.xproperty.window;
+
+ /* Other fields ignored */
+ winSendMessageToWM(pProcArg->pWMInfo, &msg);
+ }
- /* Other fields ignored */
- winSendMessageToWM(pProcArg->pWMInfo, &msg);
+ /* Not an else as WM_HINTS affects both style and icon */
+ if ((event.xproperty.atom == atmWmHints) ||
+ (event.xproperty.atom == atmNetWmIcon)) {
+ memset(&msg, 0, sizeof(msg));
+ msg.msg = WM_WM_ICON_EVENT;
+ msg.iWindow = event.xproperty.window;
+
+ /* Other fields ignored */
+ winSendMessageToWM(pProcArg->pWMInfo, &msg);
+ }
}
}
else if (event.type == ClientMessage
diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index 37b975224..25826ecc7 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -110,6 +110,7 @@ typedef struct _winWMMessageRec {
#define WM_WM_CHANGE_STATE (WM_USER + 11)
#define WM_WM_MAP2 (WM_USER + 12)
#define WM_WM_MAP3 (WM_USER + 13)
+#define WM_WM_HINTS_EVENT (WM_USER + 14)
#define WM_MANAGE (WM_USER + 100)
#define WM_UNMANAGE (WM_USER + 102)