aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winmultiwindowwndproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/winmultiwindowwndproc.c')
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwndproc.c73
1 files changed, 40 insertions, 33 deletions
diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c
index 97f7e8945..6ac6c141c 100644
--- a/xorg-server/hw/xwin/winmultiwindowwndproc.c
+++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c
@@ -216,7 +216,8 @@ ValidateSizing (HWND hwnd, WindowPtr pWin,
WinXSizeHints sizeHints;
RECT *rect;
int iWidth, iHeight;
- unsigned long rcStyle;
+ RECT rcClient, rcWindow;
+ int iBorderWidthX, iBorderWidthY;
/* Invalid input checking */
if (pWin==NULL || lParam==0)
@@ -239,30 +240,19 @@ ValidateSizing (HWND hwnd, WindowPtr pWin,
iHeight = rect->bottom - rect->top;
/* Now remove size of any borders and title bar */
- rcStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
- if (rcStyle & WS_CAPTION)
- {
- iHeight -= GetSystemMetrics(SM_CYCAPTION);
- }
- if (rcStyle & WS_SIZEBOX)
- {
- iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
- iHeight -= 2 * GetSystemMetrics(SM_CYSIZEFRAME);
- }
+ GetClientRect(hwnd, &rcClient);
+ GetWindowRect(hwnd, &rcWindow);
+ iBorderWidthX = (rcWindow.right - rcWindow.left) - (rcClient.right - rcClient.left);
+ iBorderWidthY = (rcWindow.bottom - rcWindow.top) - (rcClient.bottom - rcClient.top);
+ iWidth -= iBorderWidthX;
+ iHeight -= iBorderWidthY;
/* Constrain the size to legal values */
ConstrainSize (sizeHints, &iWidth, &iHeight);
/* Add back the size of borders and title bar */
- if (rcStyle & WS_CAPTION)
- {
- iHeight += GetSystemMetrics(SM_CYCAPTION);
- }
- if (rcStyle & WS_SIZEBOX)
- {
- iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
- iHeight += 2 * GetSystemMetrics(SM_CYSIZEFRAME);
- }
+ iWidth += iBorderWidthX;
+ iHeight += iBorderWidthY;
/* Adjust size according to where we're dragging from */
switch(wParam) {
@@ -474,6 +464,14 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
HandleCustomWM_INITMENU ((unsigned long)hwnd, wParam);
break;
+ case WM_ERASEBKGND:
+ /*
+ * Pretend that we did erase the background but we don't care,
+ * since we repaint the entire region anyhow
+ * This avoids some flickering when resizing.
+ */
+ return TRUE;
+
case WM_PAINT:
/* Only paint if our window handle is valid */
if (hwndScreen == NULL)
@@ -518,15 +516,24 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
return 0;
case WM_MOUSEMOVE:
- winGetPtMouseScreen(hwnd, lParam, &ptMouse);
+ /* Unpack the client area mouse coordinates */
+ ptMouse.x = GET_X_LPARAM(lParam);
+ ptMouse.y = GET_Y_LPARAM(lParam);
+
+ /* Translate the client area mouse coordinates to screen coordinates */
+ ClientToScreen (hwnd, &ptMouse);
+
+ /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
+ ptMouse.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
+ ptMouse.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
/* We can't do anything without privates */
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
/* Has the mouse pointer crossed screens? */
- if (s_pScreen != miPointerGetScreen(inputInfo.pointer))
- miPointerSetScreen (inputInfo.pointer, s_pScreenInfo->dwScreen,
+ if (s_pScreen != miPointerGetScreen(g_pwinPointer))
+ miPointerSetScreen (g_pwinPointer, s_pScreenInfo->dwScreen,
ptMouse.x - s_pScreenInfo->dwXOffset,
ptMouse.y - s_pScreenInfo->dwYOffset);
@@ -618,7 +625,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
break;
g_fButton[0] = TRUE;
SetCapture(hwnd);
- return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonPress, Button1, wParam, hwnd, lParam);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam);
case WM_LBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -626,7 +633,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
g_fButton[0] = FALSE;
ReleaseCapture();
winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonRelease, Button1, wParam, hwnd, lParam);
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam);
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
@@ -634,7 +641,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
break;
g_fButton[1] = TRUE;
SetCapture(hwnd);
- return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonPress, Button2, wParam, hwnd, lParam);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam);
case WM_MBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -642,7 +649,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
g_fButton[1] = FALSE;
ReleaseCapture();
winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonRelease, Button2, wParam, hwnd, lParam);
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam);
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
@@ -650,7 +657,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
break;
g_fButton[2] = TRUE;
SetCapture(hwnd);
- return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonPress, Button3, wParam, hwnd, lParam);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam);
case WM_RBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -658,21 +665,21 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
g_fButton[2] = FALSE;
ReleaseCapture();
winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonRelease, Button3, wParam, hwnd, lParam);
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
case WM_XBUTTONDBLCLK:
case WM_XBUTTONDOWN:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
SetCapture(hwnd);
- return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonPress, HIWORD(wParam) + 5, wParam, hwnd, lParam);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
case WM_XBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
ReleaseCapture();
winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandleScreen (s_pScreen, DeviceButtonRelease, HIWORD(wParam) + 5, wParam, hwnd, lParam);
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
case WM_MOUSEWHEEL:
if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) == HTCLIENT)
@@ -707,7 +714,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
/* Remove our keyboard hook if it is installed */
winRemoveKeyboardHookLL ();
if (!wParam)
- /* Revert the X focus as well, but only if the Windows focus is going to another thread */
+ /* Revert the X focus as well, but only if the Windows focus is going to another window */
DeleteWindowFromAnyEvents(pWin, FALSE);
return 0;
@@ -893,7 +900,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
winUpdateWindowPosition (hwnd, FALSE, &zstyle);
SetForegroundWindow (hwnd);
}
- wmMsg.msg = WM_WM_MAP;
+ wmMsg.msg = WM_WM_MAP3;
}
else /* It is an overridden window so make it top of Z stack */
{