From 8114b8127f01fc81390fc13e3d09bcc50e41a66f Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Wed, 1 Jul 2015 16:30:36 +0100 Subject: [PATCH] hw/xwin: In multiwindow mode, do window minimization entirely in the WM Remove winMinimizeWindow(), implement as UpdateState() in the WM instead, which uses getHwnd() to map a Window XID to a HWND (like everything else in the WM), rather than peering into the servers internal data structures. Signed-off-by: Jon Turney Reviewed-by: Colin Harrison --- hw/xwin/winmultiwindowwindow.c | 38 ---------------------------------- hw/xwin/winmultiwindowwm.c | 22 ++++++++++++++++++-- hw/xwin/winwindow.h | 3 --- 3 files changed, 20 insertions(+), 43 deletions(-) diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index e82d91591..4ec5634af 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -799,44 +799,6 @@ winReorderWindowsMultiWindow(void) fRestacking = FALSE; } -/* - * winMinimizeWindow - Minimize in response to WM_CHANGE_STATE - */ - -void -winMinimizeWindow(Window id) -{ - WindowPtr pWin; - winPrivWinPtr pWinPriv; - - HWND hWnd; - ScreenPtr pScreen = NULL; - winPrivScreenPtr pScreenPriv = NULL; - -#if CYGWINDOWING_DEBUG - ErrorF("winMinimizeWindow\n"); -#endif - - dixLookupResourceByType((void *) &pWin, id, RT_WINDOW, NullClient, - DixUnknownAccess); - if (!pWin) { - ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__); - return; - } - - pScreen = pWin->drawable.pScreen; - if (pScreen) - pScreenPriv = winGetScreenPriv(pScreen); - - if (pScreenPriv) - { - pWinPriv = winGetWindowPriv(pWin); - hWnd = pWinPriv->hWnd; - } - - ShowWindow(hWnd, SW_MINIMIZE); -} - /* * CopyWindow - See Porting Layer Definition - p. 39 */ diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index e594794c1..80bb483cb 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -672,6 +672,25 @@ UpdateStyle(WMInfoPtr pWMInfo, Window iWindow) WS_EX_APPWINDOW) ? TRUE : FALSE); } +/* + * Updates the state of a HWND + * (only minimization supported at the moment) + */ + +static void +UpdateState(WMInfoPtr pWMInfo, Window iWindow) +{ + HWND hWnd; + + winDebug("UpdateState: iWindow 0x%08x\n", (int)iWindow); + + hWnd = getHwnd(pWMInfo, iWindow); + if (!hWnd) + return; + + ShowWindow(hWnd, SW_MINIMIZE); +} + #if 0 /* * Fix up any differences between the X11 and Win32 window stacks @@ -879,8 +898,7 @@ winMultiWindowWMProc(void *pArg) break; case WM_WM_CHANGE_STATE: - /* Minimize the window in Windows */ - winMinimizeWindow(pNode->msg.iWindow); + UpdateState(pWMInfo, pNode->msg.iWindow); break; default: diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h index 5a1759d1e..e07b6a867 100644 --- a/hw/xwin/winwindow.h +++ b/hw/xwin/winwindow.h @@ -144,9 +144,6 @@ winInitWM(void **ppWMInfo, void winDeinitMultiWindowWM(void); -void - winMinimizeWindow(Window id); - void winPropertyStoreInit(void);