From 84ee125fd92d96d7753735ebb3a770ef791b9fb5 Mon Sep 17 00:00:00 2001 From: Francis Beaudet Date: Sat, 30 Jan 1999 12:59:09 +0000 Subject: [PATCH] Make sure that the keystate received by the WM_XBUTTONUP and WM_XBUTTONDOWN matches the message. In X, the keystate is changed after the message is processed. In Windows, it is changed before. --- windows/x11drv/event.c | 50 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c index 5a09b74a5d5..82045e14eb6 100644 --- a/windows/x11drv/event.c +++ b/windows/x11drv/event.c @@ -695,12 +695,35 @@ static void EVENT_ButtonPress( WND *pWnd, XButtonEvent *event ) int xOffset = pWnd? pWnd->rectWindow.left : 0; int yOffset = pWnd? pWnd->rectWindow.top : 0; + WORD keystate; if (buttonNum >= NB_BUTTONS) return; + /* + * Get the compatible keystate + */ + keystate = EVENT_XStateToKeyState( event->state ); + + /* + * Make sure that the state of the button that was just + * pressed is "down". + */ + switch (buttonNum) + { + case 0: + keystate |= MK_LBUTTON; + break; + case 1: + keystate |= MK_MBUTTON; + break; + case 2: + keystate |= MK_RBUTTON; + break; + } + MOUSE_SendEvent( statusCodes[buttonNum], xOffset + event->x, yOffset + event->y, - EVENT_XStateToKeyState( event->state ), + keystate, event->time - MSG_WineStartTicks, pWnd? pWnd->hwndSelf : 0 ); } @@ -717,12 +740,35 @@ static void EVENT_ButtonRelease( WND *pWnd, XButtonEvent *event ) int xOffset = pWnd? pWnd->rectWindow.left : 0; int yOffset = pWnd? pWnd->rectWindow.top : 0; + WORD keystate; if (buttonNum >= NB_BUTTONS) return; + /* + * Get the compatible keystate + */ + keystate = EVENT_XStateToKeyState( event->state ); + + /* + * Make sure that the state of the button that was just + * released is "up". + */ + switch (buttonNum) + { + case 0: + keystate &= ~MK_LBUTTON; + break; + case 1: + keystate &= ~MK_MBUTTON; + break; + case 2: + keystate &= ~MK_RBUTTON; + break; + } + MOUSE_SendEvent( statusCodes[buttonNum], xOffset + event->x, yOffset + event->y, - EVENT_XStateToKeyState( event->state ), + keystate, event->time - MSG_WineStartTicks, pWnd? pWnd->hwndSelf : 0 ); }