diff options
-rw-r--r-- | hw/xwin/winmultiwindowwm.c | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 66ced75c4..76b46837c 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -477,23 +477,23 @@ SendXMessage(Display * pDisplay, Window iWin, Atom atmType, long nData) } /* - * Updates the name of a HWND according to its X WM_NAME property + * See if we can get the stored HWND for this window... */ - -static void -UpdateName(WMInfoPtr pWMInfo, Window iWindow) +static HWND +getHwnd(WMInfoPtr pWMInfo, Window iWindow) { - wchar_t *pszName; Atom atmType; int fmtRet; unsigned long items, remain; - HWND *retHwnd, hWnd; - XWindowAttributes attr; - - hWnd = 0; - - /* See if we can get the cached HWND for this window... */ - if (XGetWindowProperty(pWMInfo->pDisplay, iWindow, pWMInfo->atmPrivMap, 0, 1, False, XA_INTEGER, //pWMInfo->atmPrivMap, + HWND *retHwnd, hWnd = NULL; + + if (XGetWindowProperty(pWMInfo->pDisplay, + iWindow, + pWMInfo->atmPrivMap, + 0, + 1, + False, + XA_INTEGER, &atmType, &fmtRet, &items, @@ -506,8 +506,26 @@ UpdateName(WMInfoPtr pWMInfo, Window iWindow) /* Some sanity checks */ if (!hWnd) - return; + return NULL; if (!IsWindow(hWnd)) + return NULL; + + return hWnd; +} + +/* + * Updates the name of a HWND according to its X WM_NAME property + */ + +static void +UpdateName(WMInfoPtr pWMInfo, Window iWindow) +{ + wchar_t *pszName; + HWND hWnd; + XWindowAttributes attr; + + hWnd = getHwnd(pWMInfo, iWindow); + if (!hWnd) return; /* Set the Windows window name */ @@ -532,27 +550,12 @@ UpdateName(WMInfoPtr pWMInfo, Window iWindow) static void PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction) { - Atom atmType; - int fmtRet; - unsigned long items, remain; - HWND hWnd, *retHwnd; + HWND hWnd; DWORD myWinProcID, winProcID; Window xWindow; WINDOWPLACEMENT wndPlace; - hWnd = NULL; - /* See if we can get the cached HWND for this window... */ - if (XGetWindowProperty(pWMInfo->pDisplay, iWindow, pWMInfo->atmPrivMap, 0, 1, False, XA_INTEGER, //pWMInfo->atmPrivMap, - &atmType, - &fmtRet, - &items, - &remain, (unsigned char **) &retHwnd) == Success) { - if (retHwnd) { - hWnd = *retHwnd; - XFree(retHwnd); - } - } - + hWnd = getHwnd(pWMInfo, iWindow); if (!hWnd) return; |