diff options
Diffstat (limited to 'xorg-server/hw/xwin/winwndproc.c')
-rw-r--r-- | xorg-server/hw/xwin/winwndproc.c | 112 |
1 files changed, 58 insertions, 54 deletions
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c index a89857a14..d4e3c4529 100644 --- a/xorg-server/hw/xwin/winwndproc.c +++ b/xorg-server/hw/xwin/winwndproc.c @@ -43,10 +43,16 @@ #include "winmonitors.h" #include "inputstr.h" +#ifndef XKB_IN_SERVER +#define XKB_IN_SERVER +#endif +#include <xkbsrv.h> + /* * Global variables */ +extern Bool g_fClipboardStarted; Bool g_fCursor = TRUE; Bool g_fButton[3] = { FALSE, FALSE, FALSE }; @@ -71,9 +77,7 @@ winWindowProc (HWND hwnd, UINT message, int iScanCode; int i; -#if CYGDEBUG winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam); -#endif /* Watch for server regeneration */ if (g_ulServerGeneration != s_ulServerGeneration) @@ -86,9 +90,7 @@ winWindowProc (HWND hwnd, UINT message, if ((s_pScreenPriv == NULL || hwnd != s_hwndLastPrivates) && (s_pScreenPriv = GetProp (hwnd, WIN_SCR_PROP)) != NULL) { -#if CYGDEBUG winDebug ("winWindowProc - Setting privates handle\n"); -#endif s_pScreenInfo = s_pScreenPriv->pScreenInfo; s_pScreen = s_pScreenInfo->pScreen; s_hwndLastPrivates = hwnd; @@ -109,9 +111,7 @@ winWindowProc (HWND hwnd, UINT message, s_pScreenPriv); case WM_CREATE: -#if CYGDEBUG winDebug ("winWindowProc - WM_CREATE\n"); -#endif /* * Add a property to our display window that references @@ -144,7 +144,7 @@ winWindowProc (HWND hwnd, UINT message, s_pScreenPriv->hwndScreen = hwnd; - winInitNotifyIcon (s_pScreenPriv); + winInitNotifyIcon (s_pScreenPriv,FALSE); } return 0; @@ -178,10 +178,14 @@ winWindowProc (HWND hwnd, UINT message, break; } - ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d " + winDebug ("winWindowProc - WM_DISPLAYCHANGE - new width: %d " "new height: %d new bpp: %d\n", LOWORD (lParam), HIWORD (lParam), wParam); + /* 0 bpp has no defined meaning, ignore this message */ + if (wParam == 0) + break; + /* * Check for a disruptive change in depth. * We can only display a message for a disruptive depth change, @@ -201,7 +205,7 @@ winWindowProc (HWND hwnd, UINT message, )) { /* Cannot display the visual until the depth is restored */ - ErrorF ("winWindowProc - Disruptive change in depth\n"); + winDebug ("winWindowProc - Disruptive change in depth\n"); /* Display depth change dialog */ winDisplayDepthChangeDialog (s_pScreenPriv); @@ -248,7 +252,7 @@ winWindowProc (HWND hwnd, UINT message, #endif )) { - DWORD dwWidth, dwHeight; + DWORD dwWidth = 0, dwHeight = 0; if (s_pScreenInfo->fMultipleMonitors) { @@ -314,15 +318,31 @@ winWindowProc (HWND hwnd, UINT message, winDebug ("winWindowProc - WM_DISPLAYCHANGE - Releasing and recreating primary surface\n"); - /* Release the old primary surface */ - (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen); - - /* Create the new primary surface */ - (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen); + /* Reallocate the framebuffer used by the drawing engine */ + (*s_pScreenPriv->pwinFreeFB)(s_pScreen); + if (!(*s_pScreenPriv->pwinAllocateFB)(s_pScreen)) + { + ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Could not reallocate framebuffer\n"); + } + /* Update the screen pixmap to point to the new framebuffer */ + winUpdateFBPointer(s_pScreen, s_pScreenPriv->pScreenInfo->pfb); + // Restore the ability to update screen, now with new dimensions + SetRootClip(s_pScreen, TRUE); + + // and arrange for it to be repainted + miPaintWindow(s_pScreen->root, &s_pScreen->root->borderClip, PW_BACKGROUND); } } break; + + case WM_SYSCOMMAND: + if (wParam == SC_MAXIMIZE||wParam == SC_RESTORE) + { + winDebug("Posting WM_EXITSIZEMOVE message since windows does not send it when the maximised/restored button is clicked.\n"); + PostMessage(hwnd, WM_EXITSIZEMOVE, 0, 0); + } + break; case WM_SIZE: { @@ -330,9 +350,7 @@ winWindowProc (HWND hwnd, UINT message, RECT rcWindow; int iWidth, iHeight; -#if CYGDEBUG winDebug ("winWindowProc - WM_SIZE\n"); -#endif /* Break if we do not allow resizing */ if ((s_pScreenInfo->iResizeMode == notAllowed) @@ -351,7 +369,7 @@ winWindowProc (HWND hwnd, UINT message, if (wParam == SIZE_MINIMIZED) return 0; - ErrorF ("winWindowProc - WM_SIZE - new client area w: %d h: %d\n", + winDebug ("winWindowProc - WM_SIZE - new client area w: %d h: %d\n", LOWORD (lParam), HIWORD (lParam)); if (s_pScreenInfo->iResizeMode == resizeWithRandr) @@ -433,13 +451,13 @@ winWindowProc (HWND hwnd, UINT message, s_pScreenInfo->dwYOffset = -si.nPos; } return 0; - + case WM_ENTERSIZEMOVE: - ErrorF("winWindowProc - WM_ENTERSIZEMOVE\n"); + winDebug("winWindowProc - WM_ENTERSIZEMOVE\n"); break; case WM_EXITSIZEMOVE: - ErrorF("winWindowProc - WM_EXITSIZEMOVE\n"); + winDebug("winWindowProc - WM_EXITSIZEMOVE\n"); if (s_pScreenInfo->iResizeMode == resizeWithRandr) { @@ -470,9 +488,7 @@ winWindowProc (HWND hwnd, UINT message, SCROLLINFO si; int iVertPos; -#if CYGDEBUG winDebug ("winWindowProc - WM_VSCROLL\n"); -#endif /* Get vertical scroll bar info */ si.cbSize = sizeof (si); @@ -555,9 +571,7 @@ winWindowProc (HWND hwnd, UINT message, SCROLLINFO si; int iHorzPos; -#if CYGDEBUG winDebug ("winWindowProc - WM_HSCROLL\n"); -#endif /* Get horizontal scroll bar info */ si.cbSize = sizeof (si); @@ -641,10 +655,8 @@ winWindowProc (HWND hwnd, UINT message, int iCaptionHeight; int iBorderHeight, iBorderWidth; -#if CYGDEBUG winDebug ("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n", s_pScreenInfo); -#endif /* Can't do anything without screen info */ if (s_pScreenInfo == NULL @@ -687,9 +699,7 @@ winWindowProc (HWND hwnd, UINT message, return 0; case WM_ERASEBKGND: -#if CYGDEBUG winDebug ("winWindowProc - WM_ERASEBKGND\n"); -#endif /* * Pretend that we did erase the background but we don't care, * the application uses the full window estate. This avoids some @@ -698,9 +708,6 @@ winWindowProc (HWND hwnd, UINT message, return TRUE; case WM_PAINT: -#if CYGDEBUG - winDebug ("winWindowProc - WM_PAINT\n"); -#endif /* Only paint if we have privates and the server is enabled */ if (s_pScreenPriv == NULL || !s_pScreenPriv->fEnabled @@ -721,9 +728,7 @@ winWindowProc (HWND hwnd, UINT message, case WM_PALETTECHANGED: { -#if CYGDEBUG winDebug ("winWindowProc - WM_PALETTECHANGED\n"); -#endif /* * Don't process if we don't have privates or a colormap, * or if we have an invalid depth. @@ -973,11 +978,11 @@ winWindowProc (HWND hwnd, UINT message, wShift = (GetKeyState (VK_SHIFT) & 0x8000)?MK_SHIFT:0; wCtrl = (GetKeyState (VK_CONTROL) & 0x8000)?MK_CONTROL:0; lPos = MAKELPARAM(point.x, point.y); - if (g_fButton[0] & !wL) + if (g_fButton[0] && !wL) PostMessage (hwnd, WM_LBUTTONUP, wCtrl|wM|wR|wShift, lPos); - if (g_fButton[1] & !wM) + if (g_fButton[1] && !wM) PostMessage (hwnd, WM_MBUTTONUP, wCtrl|wL|wR|wShift, lPos); - if (g_fButton[2] & !wR) + if (g_fButton[2] && !wR) PostMessage (hwnd, WM_RBUTTONUP, wCtrl|wL|wM|wShift, lPos); } } @@ -991,9 +996,7 @@ winWindowProc (HWND hwnd, UINT message, case WM_MOUSEWHEEL: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; -#if CYGDEBUG winDebug ("winWindowProc - WM_MOUSEWHEEL\n"); -#endif winMouseWheel (s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam)); break; @@ -1045,7 +1048,7 @@ winWindowProc (HWND hwnd, UINT message, * user enters Alt + F4 and is surprised when the application * quits. */ - ErrorF ("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n"); + winDebug ("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n"); /* Display Exit dialog */ winDisplayExitDialog (s_pScreenPriv); @@ -1060,6 +1063,10 @@ winWindowProc (HWND hwnd, UINT message, if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL) break; + /* Discard fake Ctrl_L events that precede AltGR on non-US keyboards */ + if (winIsFakeCtrl_L (message, wParam, lParam)) + return 0; + /* * Discard presses generated from Windows auto-repeat */ @@ -1080,10 +1087,6 @@ winWindowProc (HWND hwnd, UINT message, } } - /* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */ - if (winIsFakeCtrl_L (message, wParam, lParam)) - return 0; - /* Translate Windows key code to X scan code */ winTranslateKey (wParam, lParam, &iScanCode); @@ -1138,7 +1141,7 @@ winWindowProc (HWND hwnd, UINT message, /* TODO: Override display of window when we have a bad depth */ if (LOWORD(wParam) != WA_INACTIVE && s_pScreenPriv->fBadDepth) { - ErrorF ("winWindowProc - WM_ACTIVATE - Bad depth, trying " + winDebug ("winWindowProc - WM_ACTIVATE - Bad depth, trying " "to override window activation\n"); /* Minimize the window */ @@ -1160,9 +1163,7 @@ winWindowProc (HWND hwnd, UINT message, return 0; } -#if CYGDEBUG winDebug ("winWindowProc - WM_ACTIVATE\n"); -#endif /* * Focus is being changed to another window. @@ -1188,9 +1189,7 @@ winWindowProc (HWND hwnd, UINT message, || s_pScreenInfo->fIgnoreInput) break; -#if CYGDEBUG || TRUE winDebug ("winWindowProc - WM_ACTIVATEAPP\n"); -#endif /* Activate or deactivate */ s_pScreenPriv->fActive = wParam; @@ -1206,13 +1205,13 @@ winWindowProc (HWND hwnd, UINT message, #ifdef XWIN_CLIPBOARD /* Make sure the clipboard chain is ok. */ - winFixClipboardChain (); + winFixClipboardChain (0); #endif /* Call engine specific screen activation/deactivation function */ (*s_pScreenPriv->pwinActivateApp) (s_pScreen); -#ifdef XWIN_MULTIWINDOWEXTWM +#ifdef XWIN_MULTIWINDOWINTWM if (s_pScreenPriv->fActive) { /* Restack all window unless using built-in wm. */ @@ -1260,6 +1259,7 @@ winWindowProc (HWND hwnd, UINT message, if (s_pScreenInfo->fMultiWindow) winDeinitMultiWindowWM (); #endif + g_fClipboardStarted=FALSE; /* This is to avoid dead-locls caused by the clipboard thread still doing some stuff */ GiveUp (0); return 0; @@ -1278,32 +1278,36 @@ winWindowProc (HWND hwnd, UINT message, #ifdef XWIN_MULTIWINDOWEXTWM case WM_MANAGE: - ErrorF ("winWindowProc - WM_MANAGE\n"); + winDebug ("winWindowProc - WM_MANAGE\n"); s_pScreenInfo->fAnotherWMRunning = FALSE; +#ifdef XWIN_MULTIWINDOWINTWM if (s_pScreenInfo->fInternalWM) { EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0); //RootlessRepositionWindows (s_pScreen); } +#endif break; case WM_UNMANAGE: - ErrorF ("winWindowProc - WM_UNMANAGE\n"); + winDebug ("winWindowProc - WM_UNMANAGE\n"); s_pScreenInfo->fAnotherWMRunning = TRUE; +#ifdef XWIN_MULTIWINDOWINTWM if (s_pScreenInfo->fInternalWM) { EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0); winMWExtWMRestackWindows (s_pScreen); } +#endif break; #endif default: if(message == s_uTaskbarRestart) { - winInitNotifyIcon (s_pScreenPriv); + winInitNotifyIcon (s_pScreenPriv,FALSE); } break; } |