Commit 3628559e authored by Jon Turney's avatar Jon Turney
Browse files

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's avatarJon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: default avatarColin Harrison <colin.harrison@virgin.net>
parent 066ecbd1
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment