From 29237c1977e454511e0d0244c68d34d572b68458 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 3 Mar 2006 09:50:55 +0000 Subject: [PATCH] https://bugs.freedesktop.org/show_bug.cgi?id=4538 Fix mouse button release on multiwindows scrolling. --- hw/xwin/ChangeLog | 7 +++++++ hw/xwin/winmultiwindowwndproc.c | 7 +++++++ hw/xwin/winwndproc.c | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog index bdf8417dd..862595b42 100644 --- a/hw/xwin/ChangeLog +++ b/hw/xwin/ChangeLog @@ -1,3 +1,10 @@ +2006-03-03 Alan Hourihane + + * winmultiwindowwndproc.c: (winTopLevelWindowProc): + * winwndproc.c: (winWindowProc): + https://bugs.freedesktop.org/show_bug.cgi?id=4538 + Fix mouse button release on multiwindows scrolling. + 2006-03-03 Alan Hourihane * winmultiwindowicons.c: (winXIconToHICON), (winUpdateIcon): diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 50397d8b0..e12b7f42c 100755 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -47,6 +47,7 @@ extern Bool g_fCursor; extern Bool g_fKeyboardHookLL; extern Bool g_fSoftwareCursor; +extern Bool g_fButton[3]; /* @@ -592,33 +593,39 @@ winTopLevelWindowProc (HWND hwnd, UINT message, case WM_LBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + g_fButton[0] = TRUE; return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam); case WM_LBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + g_fButton[0] = FALSE; return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam); case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + g_fButton[1] = TRUE; return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam); case WM_MBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + g_fButton[1] = FALSE; return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam); case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + g_fButton[2] = TRUE; return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam); case WM_RBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + g_fButton[2] = FALSE; return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); case WM_XBUTTONDBLCLK: diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index 0864fc638..13d759578 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -53,6 +53,7 @@ extern void winFixShiftKeys (int iScanCode); */ Bool g_fCursor = TRUE; +Bool g_fButton[3] = { FALSE, FALSE, FALSE }; /* @@ -917,6 +918,8 @@ winWindowProc (HWND hwnd, UINT message, case WIN_POLLING_MOUSE_TIMER_ID: { POINT point; + WPARAM wL, wM, wR, wShift, wCtrl; + LPARAM lPos; /* Get the current position of the mouse cursor */ GetCursorPos (&point); @@ -928,6 +931,21 @@ winWindowProc (HWND hwnd, UINT message, /* Deliver absolute cursor position to X Server */ miPointerAbsoluteCursor (point.x, point.y, g_c32LastInputEventTime = GetTickCount()); + + /* Check if a button was released but we didn't see it */ + GetCursorPos (&point); + wL = (GetKeyState (VK_LBUTTON) & 0x8000)?MK_LBUTTON:0; + wM = (GetKeyState (VK_MBUTTON) & 0x8000)?MK_MBUTTON:0; + wR = (GetKeyState (VK_RBUTTON) & 0x8000)?MK_RBUTTON:0; + 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) + PostMessage (hwnd, WM_LBUTTONUP, wCtrl|wM|wR|wShift, lPos); + if (g_fButton[1] & !wM) + PostMessage (hwnd, WM_MBUTTONUP, wCtrl|wL|wR|wShift, lPos); + if (g_fButton[2] & !wR) + PostMessage (hwnd, WM_RBUTTONUP, wCtrl|wL|wM|wShift, lPos); } } return 0;