aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winwndproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/winwndproc.c')
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/winwndproc.c124
1 files changed, 50 insertions, 74 deletions
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c
index 1bf3f5cde..a88f7c68d 100644..100755
--- a/xorg-server/hw/xwin/winwndproc.c
+++ b/xorg-server/hw/xwin/winwndproc.c
@@ -46,10 +46,16 @@
#include "winclipboard/winclipboard.h"
#endif
+#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, 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) {
@@ -84,9 +88,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;
@@ -105,9 +107,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
@@ -126,7 +126,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
SetProp(hwnd, WIN_SCR_PROP, s_pScreenPriv);
/* Setup tray icon */
- if (!s_pScreenInfo->fNoTrayIcon) {
+ if (!s_pScreenInfo->fNoTrayIcon && !pref.fNoTrayIcon) {
/*
* NOTE: The WM_CREATE message is processed before CreateWindowEx
* returns, so s_pScreenPriv->hwndScreen is invalid at this point.
@@ -138,7 +138,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
s_pScreenPriv->hwndScreen = hwnd;
- winInitNotifyIcon(s_pScreenPriv);
+ winInitNotifyIcon(s_pScreenPriv,FALSE);
}
return 0;
@@ -167,9 +167,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)
@@ -189,7 +189,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD ||
s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) {
/* 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);
@@ -239,7 +239,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 */
@@ -303,25 +303,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)
@@ -340,8 +346,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 */
@@ -420,20 +426,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 */
@@ -462,9 +470,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);
@@ -541,9 +547,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);
@@ -620,10 +624,8 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int iCaptionHeight;
int iBorderHeight, iBorderWidth;
-#if CYGDEBUG
winDebug("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %p\n",
s_pScreenInfo);
-#endif
/* Can't do anything without screen info */
if (s_pScreenInfo == NULL
@@ -664,9 +666,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
@@ -675,9 +675,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
@@ -697,9 +694,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.
@@ -968,9 +963,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);
@@ -979,9 +972,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);
@@ -1034,21 +1025,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;
@@ -1088,14 +1071,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;
@@ -1123,7 +1098,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 */
@@ -1143,9 +1118,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.
@@ -1169,9 +1142,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;
@@ -1185,13 +1156,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)
@@ -1242,6 +1213,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;
@@ -1260,29 +1232,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;
}