aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winwndproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/winwndproc.c')
-rw-r--r--xorg-server/hw/xwin/winwndproc.c128
1 files changed, 52 insertions, 76 deletions
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c
index c73a75c6f..6d4cb3a51 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 };
@@ -68,9 +74,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int iScanCode;
int i;
-#if CYGDEBUG
winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam);
-#endif
/* Watch for server regeneration */
if (g_ulServerGeneration != s_ulServerGeneration) {
@@ -81,9 +85,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
/* Only retrieve new privates pointers if window handle is null or changed */
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;
@@ -102,9 +104,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
s_pScreenPriv);
case WM_CREATE:
-#if CYGDEBUG
winDebug("winWindowProc - WM_CREATE\n");
-#endif
/*
* Add a property to our display window that references
@@ -135,7 +135,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
s_pScreenPriv->hwndScreen = hwnd;
- winInitNotifyIcon(s_pScreenPriv);
+ winInitNotifyIcon(s_pScreenPriv,FALSE);
}
return 0;
@@ -168,9 +168,9 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
}
- ErrorF("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
- "new height: %d new bpp: %d\n",
- LOWORD(lParam), HIWORD(lParam), wParam);
+ 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)
@@ -194,7 +194,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
#endif
)) {
/* 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);
@@ -244,7 +244,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
fMultiWindow
#endif
)) {
- DWORD dwWidth, dwHeight;
+ DWORD dwWidth = 0, dwHeight = 0;
if (s_pScreenInfo->fMultipleMonitors) {
/* resize to new virtual desktop size */
@@ -308,25 +308,31 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
winDebug
("winWindowProc - WM_DISPLAYCHANGE - Releasing and recreating primary surface\n");
- /* Release the old primary surface */
- (*s_pScreenPriv->pwinReleasePrimarySurface) (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);
- /* Create the new primary surface */
- (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen);
+ // and arrange for it to be repainted
+ miPaintWindow(s_pScreen->root, &s_pScreen->root->borderClip, PW_BACKGROUND);
}
}
break;
-
+
case WM_SIZE:
{
SCROLLINFO si;
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)
@@ -345,8 +351,8 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (wParam == SIZE_MINIMIZED)
return 0;
- ErrorF("winWindowProc - WM_SIZE - new client area w: %d h: %d\n",
- LOWORD(lParam), HIWORD(lParam));
+ winDebug ("winWindowProc - WM_SIZE - new client area w: %d h: %d\n",
+ LOWORD(lParam), HIWORD(lParam));
if (s_pScreenInfo->iResizeMode == resizeWithRandr) {
/* Actual resizing is done on WM_EXITSIZEMOVE */
@@ -425,20 +431,22 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
s_pScreenInfo->dwYOffset = -si.nPos;
}
return 0;
-
- case WM_SYSCOMMAND:
- if (s_pScreenInfo->iResizeMode == resizeWithRandr &&
- ((wParam & 0xfff0) == SC_MAXIMIZE ||
- (wParam & 0xfff0) == SC_RESTORE))
- PostMessage(hwnd, WM_EXITSIZEMOVE, 0, 0);
+
+ case WM_SYSCOMMAND:
+ if ((wParam & 0xfff0) == SC_MAXIMIZE ||
+ (wParam & 0xfff0) == 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_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) {
/* Set screen size to match new client area, if it is different to current */
@@ -467,9 +475,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
SCROLLINFO si;
int iVertPos;
-#if CYGDEBUG
winDebug("winWindowProc - WM_VSCROLL\n");
-#endif
/* Get vertical scroll bar info */
si.cbSize = sizeof(si);
@@ -546,9 +552,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
SCROLLINFO si;
int iHorzPos;
-#if CYGDEBUG
winDebug("winWindowProc - WM_HSCROLL\n");
-#endif
/* Get horizontal scroll bar info */
si.cbSize = sizeof(si);
@@ -625,10 +629,8 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
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
@@ -669,9 +671,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
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
@@ -680,9 +680,6 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
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
@@ -702,9 +699,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
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.
@@ -955,11 +950,11 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
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);
}
}
@@ -973,9 +968,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOUSEWHEEL:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
-#if CYGDEBUG
winDebug("winWindowProc - WM_MOUSEWHEEL\n");
-#endif
/* Button4 = WheelUp */
/* Button5 = WheelDown */
winMouseWheel(&(s_pScreenPriv->iDeltaZ), GET_WHEEL_DELTA_WPARAM(wParam), Button4, Button5);
@@ -984,9 +977,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOUSEHWHEEL:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
-#if CYGDEBUG
winDebug("winWindowProc - WM_MOUSEHWHEEL\n");
-#endif
/* Button7 = TiltRight */
/* Button6 = TiltLeft */
winMouseWheel(&(s_pScreenPriv->iDeltaV), GET_WHEEL_DELTA_WPARAM(wParam), 7, 6);
@@ -1039,21 +1030,13 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
* 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);
return 0;
}
- /*
- * Don't do anything for the Windows keys, as focus will soon
- * be returned to Windows. We may be able to trap the Windows keys,
- * but we should determine if that is desirable before doing so.
- */
- 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;
@@ -1093,14 +1076,6 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
- /*
- * Don't do anything for the Windows keys, as focus will soon
- * be returned to Windows. We may be able to trap the Windows keys,
- * but we should determine if that is desirable before doing so.
- */
- if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
- break;
-
/* Ignore the fake Ctrl_L that follows an AltGr release */
if (winIsFakeCtrl_L(message, wParam, lParam))
return 0;
@@ -1128,7 +1103,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
/* 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 */
@@ -1148,9 +1123,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
return 0;
}
-#if CYGDEBUG
winDebug("winWindowProc - WM_ACTIVATE\n");
-#endif
/*
* Focus is being changed to another window.
@@ -1174,9 +1147,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
-#if CYGDEBUG || TRUE
winDebug("winWindowProc - WM_ACTIVATEAPP\n");
-#endif
/* Activate or deactivate */
s_pScreenPriv->fActive = wParam;
@@ -1190,13 +1161,13 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
#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. */
if (s_pScreenInfo->fInternalWM && s_pScreenInfo->fAnotherWMRunning)
@@ -1241,6 +1212,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
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;
@@ -1259,29 +1231,33 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
#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;
}