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.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c
index 3f5d66b96..77a3a76ba 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 };
@@ -69,9 +75,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) {
@@ -82,9 +86,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;
@@ -103,9 +105,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
@@ -137,7 +137,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
s_pScreenPriv->hwndScreen = hwnd;
- winInitNotifyIcon(s_pScreenPriv);
+ winInitNotifyIcon (s_pScreenPriv,FALSE);
}
return 0;
@@ -170,9 +170,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)
@@ -196,7 +196,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);
@@ -246,7 +246,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 */
@@ -310,15 +310,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_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:
{
@@ -326,9 +342,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
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)
@@ -347,8 +361,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 */
@@ -427,13 +441,13 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
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) {
/* Set screen size to match new client area, if it is different to current */
@@ -462,9 +476,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 +553,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 +630,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
@@ -664,9 +672,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 +681,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 +700,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.
@@ -945,11 +946,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);
}
}
@@ -963,9 +964,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
winMouseWheel(s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam));
break;
@@ -1016,7 +1015,7 @@ 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);
@@ -1105,7 +1104,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 */
@@ -1125,9 +1124,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.
@@ -1150,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;
@@ -1166,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)
@@ -1218,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;
@@ -1236,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;
}