diff options
Diffstat (limited to 'hw/xwin/winwin32rootlesswndproc.c')
-rw-r--r-- | hw/xwin/winwin32rootlesswndproc.c | 240 |
1 files changed, 12 insertions, 228 deletions
diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c index 79d959161..85c9cbf22 100644 --- a/hw/xwin/winwin32rootlesswndproc.c +++ b/hw/xwin/winwin32rootlesswndproc.c @@ -42,6 +42,7 @@ #include "winmultiwindowclass.h" #include "winmsg.h" #include "inputstr.h" +#include "wmutil/keyboard.h" /* * Constant defines @@ -60,9 +61,9 @@ static UINT_PTR g_uipMousePollingTimerID = 0; * Local function */ -DEFINE_ATOM_HELPER(AtmWindowsWmRaiseOnClick, WINDOWSWM_RAISE_ON_CLICK) - DEFINE_ATOM_HELPER(AtmWindowsWMMouseActivate, WINDOWSWM_MOUSE_ACTIVATE) +DEFINE_ATOM_HELPER(AtmWindowsWMMouseActivate, WINDOWSWM_MOUSE_ACTIVATE) /* DEFINE_ATOM_HELPER(AtmWindowsWMClientWindow, WINDOWSWM_CLIENT_WINDOW) */ + /* * ConstrainSize - Taken from TWM sources - Respects hints for sizing */ @@ -272,55 +273,6 @@ ValidateSizing(HWND hwnd, WindowPtr pWin, WPARAM wParam, LPARAM lParam) } /* - * IsRaiseOnClick - */ - -static Bool -IsRaiseOnClick(WindowPtr pWin) -{ - - struct _Window *pwin; - struct _Property *prop; - - /* XXX We're getting inputInfo.poniter here, but this might be really wrong. - * Which pointer's current window do we want? */ - WindowPtr pRoot = GetCurrentRootWindow(inputInfo.pointer); - - if (!pWin) { - ErrorF("IsRaiseOnClick - no prop use default value:%d\n", - RAISE_ON_CLICK_DEFAULT); - return RAISE_ON_CLICK_DEFAULT; - } - - pwin = (struct _Window *) pWin; - - if (pwin->optional) - prop = (struct _Property *) pwin->optional->userProps; - else - prop = NULL; - - while (prop) { - if (prop->propertyName == AtmWindowsWmRaiseOnClick() - && prop->type == XA_INTEGER && prop->format == 32) { - return *(int *) prop->data; - } - else - prop = prop->next; - } - - if (pWin != pRoot) { - return IsRaiseOnClick(pRoot); - } - else { -#if CYGMULTIWINDOW_DEBUG - winDebug("IsRaiseOnClick - no prop use default value:%d\n", - RAISE_ON_CLICK_DEFAULT); -#endif - return RAISE_ON_CLICK_DEFAULT; - } -} - -/* * IsMouseActive */ @@ -388,8 +340,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) PAINTSTRUCT ps; LPWINDOWPOS pWinPos = NULL; RECT rcClient; - winWMMessageRec wmMsg; - Bool fWMMsgInitialized = FALSE; /* Check if the Windows window property for our X window pointer is valid */ if ((pRLWinPriv = @@ -403,26 +353,16 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (pScreenPriv) hwndScreen = pScreenPriv->hwndScreen; - wmMsg.msg = 0; - wmMsg.hwndWindow = hwnd; - wmMsg.iWindow = (Window) pWin->drawable.id; - - wmMsg.iX = pRLWinPriv->pFrame->x; - wmMsg.iY = pRLWinPriv->pFrame->y; - wmMsg.iWidth = pRLWinPriv->pFrame->width; - wmMsg.iHeight = pRLWinPriv->pFrame->height; - - fWMMsgInitialized = TRUE; #if CYGDEBUG winDebugWin32Message("winMWExtWMWindowProc", hwnd, message, wParam, lParam); - winDebug("\thWnd %08X\n", hwnd); - winDebug("\tpScreenPriv %08X\n", pScreenPriv); - winDebug("\tpScreenInfo %08X\n", pScreenInfo); - winDebug("\thwndScreen %08X\n", hwndScreen); - winDebug("winMWExtWMWindowProc (%08x) %08x %08x %08x\n", - pRLWinPriv, message, wParam, lParam); + winDebug("\thWnd %p\n", hwnd); + winDebug("\tpScreenPriv %p\n", pScreenPriv); + winDebug("\tpScreenInfo %p\n", pScreenInfo); + winDebug("\thwndScreen %p\n", hwndScreen); + winDebug("winMWExtWMWindowProc (%p) %08x %08x %08x\n", + pRLWinPriv, message, (int)wParam, (int)lParam); #endif } /* Branch on message type */ @@ -446,12 +386,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) DestroyWindow(hwnd); } else { - if (winIsInternalWMRunning(pScreenInfo)) { - /* Tell our Window Manager thread to kill the window */ - wmMsg.msg = WM_WM_KILL; - if (fWMMsgInitialized) - winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg); - } winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, @@ -680,19 +614,7 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) #if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMWindowProc - WM_MOUSEACTIVATE\n"); #endif -#if 1 - /* Check if this window needs to be made active when clicked */ - if (winIsInternalWMRunning(pScreenInfo) && pWin->overrideRedirect) { -#if CYGMULTIWINDOW_DEBUG - winDebug("winMWExtWMWindowProc - WM_MOUSEACTIVATE - " - "MA_NOACTIVATE\n"); -#endif - - /* */ - return MA_NOACTIVATE; - } -#endif - if (!winIsInternalWMRunning(pScreenInfo) && !IsMouseActive(pWin)) + if (!IsMouseActive(pWin)) return MA_NOACTIVATE; break; @@ -805,19 +727,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) winDebug("winMWExtWMWindowProc - WM_ACTIVATE\n"); #endif if (LOWORD(wParam) != WA_INACTIVE) { - if (winIsInternalWMRunning(pScreenInfo)) { -#if 0 - /* Raise the window to the top in Z order */ - wmMsg.msg = WM_WM_RAISE; - if (fWMMsgInitialized) - winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg); -#endif - /* Tell our Window Manager thread to activate the window */ - wmMsg.msg = WM_WM_ACTIVATE; - if (fWMMsgInitialized) - if (!pWin || !pWin->overrideRedirect) /* for OOo menus */ - winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg); - } winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, @@ -838,14 +747,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; } - if (winIsInternalWMRunning(pScreenInfo) || IsRaiseOnClick(pWin)) { -#if CYGMULTIWINDOW_DEBUG - winDebug("Win %p has WINDOWSWM_RAISE_ON_CLICK.\n", - pRLWinPriv); -#endif - break; - } - #if CYGMULTIWINDOW_DEBUG winDebug("Win %p forbid to change z order (%p).\n", pRLWinPriv, @@ -889,9 +790,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) (short) HIWORD(lParam)); #endif if (!pRLWinPriv->fMovingOrSizing) { - if (winIsInternalWMRunning(pScreenInfo)) - winAdjustXWindow(pWin, hwnd); - winMWExtWMMoveXWindow(pWin, (LOWORD(lParam) - wBorderWidth(pWin) - GetSystemMetrics(SM_XVIRTUALSCREEN)), (HIWORD(lParam) - wBorderWidth(pWin) @@ -907,31 +805,8 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (!wParam) return 0; - if (!pScreenInfo->fInternalWM) //XXXX - return 0; - winMWExtWMUpdateWindowDecoration(pRLWinPriv, pScreenInfo); - if (winIsInternalWMRunning(pScreenInfo)) { -#if CYGMULTIWINDOW_DEBUG || TRUE - winDebug("\tMapWindow\n"); -#endif - /* Tell X to map the window */ - MapWindow(pWin, wClient(pWin)); - - if (!pRLWinPriv->pFrame->win->overrideRedirect) - /* Bring the Windows window to the foreground */ - SetForegroundWindow(hwnd); - - /* Setup the Window Manager message */ - wmMsg.msg = WM_WM_MAP; - wmMsg.iWidth = pRLWinPriv->pFrame->width; - wmMsg.iHeight = pRLWinPriv->pFrame->height; - - /* Tell our Window Manager thread to map the window */ - if (fWMMsgInitialized) - winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg); - } break; case WM_SIZING: @@ -967,72 +842,12 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (pWinPos->flags & SWP_HIDEWINDOW) break; - /* Reorder if window z order was changed */ - if ((pScreenPriv != NULL) - && !(pWinPos->flags & SWP_NOZORDER) - && !(pWinPos->flags & SWP_SHOWWINDOW) - && winIsInternalWMRunning(pScreenInfo)) { -#if CYGMULTIWINDOW_DEBUG - winDebug("\twindow z order was changed\n"); -#endif - if (pWinPos->hwndInsertAfter == HWND_TOP - || pWinPos->hwndInsertAfter == HWND_TOPMOST - || pWinPos->hwndInsertAfter == HWND_NOTOPMOST) { -#if CYGMULTIWINDOW_DEBUG - winDebug("\traise to top\n"); -#endif - /* Raise the window to the top in Z order */ - wmMsg.msg = WM_WM_RAISE; - if (fWMMsgInitialized) - winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg); - } -#if 1 - else if (pWinPos->hwndInsertAfter == HWND_BOTTOM) { - } - else { - /* Check if this window is top of X windows. */ - HWND hWndAbove = NULL; - DWORD dwCurrentProcessID = GetCurrentProcessId(); - DWORD dwWindowProcessID = 0; - - for (hWndAbove = pWinPos->hwndInsertAfter; - hWndAbove != NULL; - hWndAbove = GetNextWindow(hWndAbove, GW_HWNDPREV)) { - /* Ignore other XWin process's window */ - GetWindowThreadProcessId(hWndAbove, &dwWindowProcessID); - - if ((dwWindowProcessID == dwCurrentProcessID) - && GetProp(hWndAbove, WIN_WINDOW_PROP) - && !IsWindowVisible(hWndAbove) - && !IsIconic(hWndAbove)) /* ignore minimized windows */ - break; - } - /* If this is top of X windows in Windows stack, - raise it in X stack. */ - if (hWndAbove == NULL) { -#if CYGMULTIWINDOW_DEBUG - winDebug("\traise to top\n"); -#endif - /* Raise the window to the top in Z order */ - wmMsg.msg = WM_WM_RAISE; - if (fWMMsgInitialized) - winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg); - } - } -#endif - } - if (!(pWinPos->flags & SWP_NOSIZE)) { if (IsIconic(hwnd)) { #if CYGMULTIWINDOW_DEBUG winDebug("\tIconic -> MINIMIZED\n"); #endif - if (winIsInternalWMRunning(pScreenInfo)) { - /* Raise the window to the top in Z order */ - wmMsg.msg = WM_WM_LOWER; - if (fWMMsgInitialized) - winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg); - } + winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, @@ -1072,8 +887,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) #if CYGMULTIWINDOW_DEBUG winDebug("\tmove & resize\n"); #endif - if (winIsInternalWMRunning(pScreenInfo)) - winAdjustXWindow(pWin, hwnd); winMWExtWMMoveResizeXWindow(pWin, rcClient.left - @@ -1095,8 +908,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) #if CYGMULTIWINDOW_DEBUG winDebug("\tmove\n"); #endif - if (winIsInternalWMRunning(pScreenInfo)) - winAdjustXWindow(pWin, hwnd); winMWExtWMMoveResizeXWindow(pWin, rcClient.left - @@ -1118,8 +929,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) #if CYGMULTIWINDOW_DEBUG winDebug("\tmove\n"); #endif - if (winIsInternalWMRunning(pScreenInfo)) - winAdjustXWindow(pWin, hwnd); winMWExtWMMoveXWindow(pWin, rcClient.left - wBorderWidth(pWin) @@ -1132,8 +941,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) #if CYGMULTIWINDOW_DEBUG winDebug("\tresize\n"); #endif - if (winIsInternalWMRunning(pScreenInfo)) - winAdjustXWindow(pWin, hwnd); winMWExtWMResizeXWindow(pWin, rcClient.right - rcClient.left @@ -1168,12 +975,7 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) #if CYGMULTIWINDOW_DEBUG winDebug("\tSIZE_MINIMIZED\n"); #endif - if (winIsInternalWMRunning(pScreenInfo)) { - /* Raise the window to the top in Z order */ - wmMsg.msg = WM_WM_LOWER; - if (fWMMsgInitialized) - winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg); - } + winWindowsWMSendEvent(WindowsWMControllerNotify, WindowsWMControllerNotifyMask, 1, @@ -1209,9 +1011,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* Perform the resize and notify the X client */ if (!pRLWinPriv->fMovingOrSizing) { - if (winIsInternalWMRunning(pScreenInfo)) - winAdjustXWindow(pWin, hwnd); - winMWExtWMResizeXWindow(pWin, (short) LOWORD(lParam) - wBorderWidth(pWin) * 2, (short) HIWORD(lParam) @@ -1224,10 +1023,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) winDebug("winMWExtWMWindowProc - WM_ACTIVATEAPP\n"); #endif if (wParam) { - if (winIsInternalWMRunning(pScreenInfo)) { - } - else { - } winWindowsWMSendEvent(WindowsWMActivationNotify, WindowsWMActivationNotifyMask, 1, @@ -1268,9 +1063,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) &rcClient, 2); - if (winIsInternalWMRunning(pScreenInfo)) - winAdjustXWindow(pWin, hwnd); - winMWExtWMMoveResizeXWindow(pWin, rcClient.left - wBorderWidth(pWin) - GetSystemMetrics(SM_XVIRTUALSCREEN), rcClient.top - wBorderWidth(pWin) @@ -1281,14 +1073,6 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) - wBorderWidth(pWin) * 2); break; - case WM_MANAGE: - ErrorF("winMWExtWMWindowProc - WM_MANAGE\n"); - break; - - case WM_UNMANAGE: - ErrorF("winMWExtWMWindowProc - WM_UNMANAGE\n"); - break; - default: break; } |