Added full support for xbuttons (side mouse buttons).
This commit is contained in:
parent
37698099d9
commit
f4767f1424
@ -47,7 +47,7 @@ WINE_DECLARE_DEBUG_CHANNEL(relay);
|
|||||||
WINE_DECLARE_DEBUG_CHANNEL(key);
|
WINE_DECLARE_DEBUG_CHANNEL(key);
|
||||||
|
|
||||||
#define WM_NCMOUSEFIRST WM_NCMOUSEMOVE
|
#define WM_NCMOUSEFIRST WM_NCMOUSEMOVE
|
||||||
#define WM_NCMOUSELAST WM_NCMBUTTONDBLCLK
|
#define WM_NCMOUSELAST (WM_NCMOUSEFIRST+(WM_MOUSELAST-WM_MOUSEFIRST))
|
||||||
|
|
||||||
#define MAX_PACK_COUNT 4
|
#define MAX_PACK_COUNT 4
|
||||||
|
|
||||||
@ -1704,7 +1704,8 @@ static BOOL process_mouse_message( MSG *msg, ULONG_PTR extra_info, HWND hwnd_fil
|
|||||||
|
|
||||||
if ((msg->message == WM_LBUTTONDOWN) ||
|
if ((msg->message == WM_LBUTTONDOWN) ||
|
||||||
(msg->message == WM_RBUTTONDOWN) ||
|
(msg->message == WM_RBUTTONDOWN) ||
|
||||||
(msg->message == WM_MBUTTONDOWN))
|
(msg->message == WM_MBUTTONDOWN) ||
|
||||||
|
(msg->message == WM_XBUTTONDOWN))
|
||||||
{
|
{
|
||||||
BOOL update = remove;
|
BOOL update = remove;
|
||||||
|
|
||||||
@ -1718,6 +1719,7 @@ static BOOL process_mouse_message( MSG *msg, ULONG_PTR extra_info, HWND hwnd_fil
|
|||||||
{
|
{
|
||||||
if ((msg->message == clk_msg.message) &&
|
if ((msg->message == clk_msg.message) &&
|
||||||
(msg->hwnd == clk_msg.hwnd) &&
|
(msg->hwnd == clk_msg.hwnd) &&
|
||||||
|
(msg->wParam == clk_msg.wParam) &&
|
||||||
(msg->time - clk_msg.time < GetDoubleClickTime()) &&
|
(msg->time - clk_msg.time < GetDoubleClickTime()) &&
|
||||||
(abs(msg->pt.x - clk_msg.pt.x) < GetSystemMetrics(SM_CXDOUBLECLK)/2) &&
|
(abs(msg->pt.x - clk_msg.pt.x) < GetSystemMetrics(SM_CXDOUBLECLK)/2) &&
|
||||||
(abs(msg->pt.y - clk_msg.pt.y) < GetSystemMetrics(SM_CYDOUBLECLK)/2))
|
(abs(msg->pt.y - clk_msg.pt.y) < GetSystemMetrics(SM_CYDOUBLECLK)/2))
|
||||||
@ -1774,7 +1776,8 @@ static BOOL process_mouse_message( MSG *msg, ULONG_PTR extra_info, HWND hwnd_fil
|
|||||||
|
|
||||||
if ((msg->message == WM_LBUTTONDOWN) ||
|
if ((msg->message == WM_LBUTTONDOWN) ||
|
||||||
(msg->message == WM_RBUTTONDOWN) ||
|
(msg->message == WM_RBUTTONDOWN) ||
|
||||||
(msg->message == WM_MBUTTONDOWN))
|
(msg->message == WM_MBUTTONDOWN) ||
|
||||||
|
(msg->message == WM_XBUTTONDOWN))
|
||||||
{
|
{
|
||||||
/* Send the WM_PARENTNOTIFY,
|
/* Send the WM_PARENTNOTIFY,
|
||||||
* note that even for double/nonclient clicks
|
* note that even for double/nonclient clicks
|
||||||
|
@ -41,7 +41,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(cursor);
|
|||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
#define NB_BUTTONS 5 /* Windows can handle 3 buttons and the wheel too */
|
#ifndef Button6Mask
|
||||||
|
#define Button6Mask (1<<13)
|
||||||
|
#endif
|
||||||
|
#ifndef Button7Mask
|
||||||
|
#define Button7Mask (1<<14)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NB_BUTTONS 7 /* Windows can handle 5 buttons and the wheel too */
|
||||||
|
|
||||||
static const UINT button_down_flags[NB_BUTTONS] =
|
static const UINT button_down_flags[NB_BUTTONS] =
|
||||||
{
|
{
|
||||||
@ -49,7 +56,9 @@ static const UINT button_down_flags[NB_BUTTONS] =
|
|||||||
MOUSEEVENTF_MIDDLEDOWN,
|
MOUSEEVENTF_MIDDLEDOWN,
|
||||||
MOUSEEVENTF_RIGHTDOWN,
|
MOUSEEVENTF_RIGHTDOWN,
|
||||||
MOUSEEVENTF_WHEEL,
|
MOUSEEVENTF_WHEEL,
|
||||||
MOUSEEVENTF_WHEEL
|
MOUSEEVENTF_WHEEL,
|
||||||
|
MOUSEEVENTF_XDOWN,
|
||||||
|
MOUSEEVENTF_XDOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
static const UINT button_up_flags[NB_BUTTONS] =
|
static const UINT button_up_flags[NB_BUTTONS] =
|
||||||
@ -58,7 +67,9 @@ static const UINT button_up_flags[NB_BUTTONS] =
|
|||||||
MOUSEEVENTF_MIDDLEUP,
|
MOUSEEVENTF_MIDDLEUP,
|
||||||
MOUSEEVENTF_RIGHTUP,
|
MOUSEEVENTF_RIGHTUP,
|
||||||
0,
|
0,
|
||||||
0
|
0,
|
||||||
|
MOUSEEVENTF_XUP,
|
||||||
|
MOUSEEVENTF_XUP
|
||||||
};
|
};
|
||||||
|
|
||||||
POINT cursor_pos;
|
POINT cursor_pos;
|
||||||
@ -89,6 +100,8 @@ static inline void update_button_state( unsigned int state )
|
|||||||
key_state_table[VK_LBUTTON] = (state & Button1Mask ? 0x80 : 0);
|
key_state_table[VK_LBUTTON] = (state & Button1Mask ? 0x80 : 0);
|
||||||
key_state_table[VK_MBUTTON] = (state & Button2Mask ? 0x80 : 0);
|
key_state_table[VK_MBUTTON] = (state & Button2Mask ? 0x80 : 0);
|
||||||
key_state_table[VK_RBUTTON] = (state & Button3Mask ? 0x80 : 0);
|
key_state_table[VK_RBUTTON] = (state & Button3Mask ? 0x80 : 0);
|
||||||
|
key_state_table[VK_XBUTTON1]= (state & Button6Mask ? 0x80 : 0);
|
||||||
|
key_state_table[VK_XBUTTON2]= (state & Button7Mask ? 0x80 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -130,7 +143,7 @@ static void update_mouse_state( HWND hwnd, Window window, int x, int y, unsigned
|
|||||||
|
|
||||||
if (window != data->grab_window &&
|
if (window != data->grab_window &&
|
||||||
/* ignore event if a button is pressed, since the mouse is then grabbed too */
|
/* ignore event if a button is pressed, since the mouse is then grabbed too */
|
||||||
!(state & (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)))
|
!(state & (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask|Button6Mask|Button7Mask)))
|
||||||
{
|
{
|
||||||
SERVER_START_REQ( update_window_zorder )
|
SERVER_START_REQ( update_window_zorder )
|
||||||
{
|
{
|
||||||
@ -325,6 +338,18 @@ void X11DRV_send_mouse_input( HWND hwnd, DWORD flags, DWORD x, DWORD y,
|
|||||||
queue_raw_mouse_message( WM_MOUSEWHEEL, hwnd, pt.x, pt.y, data, time,
|
queue_raw_mouse_message( WM_MOUSEWHEEL, hwnd, pt.x, pt.y, data, time,
|
||||||
extra_info, injected_flags );
|
extra_info, injected_flags );
|
||||||
}
|
}
|
||||||
|
if (flags & MOUSEEVENTF_XDOWN)
|
||||||
|
{
|
||||||
|
key_state_table[VK_XBUTTON1 + data - 1] |= 0xc0;
|
||||||
|
queue_raw_mouse_message( WM_XBUTTONDOWN, hwnd, pt.x, pt.y, data, time,
|
||||||
|
extra_info, injected_flags );
|
||||||
|
}
|
||||||
|
if (flags & MOUSEEVENTF_XUP)
|
||||||
|
{
|
||||||
|
key_state_table[VK_XBUTTON1 + data - 1] &= ~0x80;
|
||||||
|
queue_raw_mouse_message( WM_XBUTTONUP, hwnd, pt.x, pt.y, data, time,
|
||||||
|
extra_info, injected_flags );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -724,6 +749,12 @@ void X11DRV_ButtonPress( HWND hwnd, XEvent *xev )
|
|||||||
case 4:
|
case 4:
|
||||||
wData = -WHEEL_DELTA;
|
wData = -WHEEL_DELTA;
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
wData = XBUTTON1;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
wData = XBUTTON2;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
|
update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
|
||||||
@ -740,15 +771,26 @@ void X11DRV_ButtonRelease( HWND hwnd, XEvent *xev )
|
|||||||
{
|
{
|
||||||
XButtonEvent *event = &xev->xbutton;
|
XButtonEvent *event = &xev->xbutton;
|
||||||
int buttonNum = event->button - 1;
|
int buttonNum = event->button - 1;
|
||||||
|
WORD wData = 0;
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
|
||||||
if (buttonNum >= NB_BUTTONS || !button_up_flags[buttonNum]) return;
|
if (buttonNum >= NB_BUTTONS || !button_up_flags[buttonNum]) return;
|
||||||
if (!hwnd) return;
|
if (!hwnd) return;
|
||||||
|
|
||||||
|
switch (buttonNum)
|
||||||
|
{
|
||||||
|
case 5:
|
||||||
|
wData = XBUTTON1;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
wData = XBUTTON2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
|
update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
|
||||||
|
|
||||||
X11DRV_send_mouse_input( hwnd, button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE,
|
X11DRV_send_mouse_input( hwnd, button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE,
|
||||||
pt.x, pt.y, 0, EVENT_x11_time_to_win32_time(event->time), 0, 0 );
|
pt.x, pt.y, wData, EVENT_x11_time_to_win32_time(event->time), 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1115,6 +1115,9 @@ BOOL WINAPI SetSysColors(INT,const INT*,const COLORREF*);
|
|||||||
#define WM_XBUTTONUP 0x020C
|
#define WM_XBUTTONUP 0x020C
|
||||||
#define WM_XBUTTONDBLCLK 0x020D
|
#define WM_XBUTTONDBLCLK 0x020D
|
||||||
|
|
||||||
|
#define XBUTTON1 0x0001
|
||||||
|
#define XBUTTON2 0x0002
|
||||||
|
|
||||||
#define WM_MOUSEFIRST 0x0200
|
#define WM_MOUSEFIRST 0x0200
|
||||||
#define WM_MOUSELAST 0x020D
|
#define WM_MOUSELAST 0x020D
|
||||||
|
|
||||||
@ -2558,6 +2561,8 @@ typedef struct tagCBTACTIVATESTRUCT
|
|||||||
#define MOUSEEVENTF_RIGHTUP 0x0010
|
#define MOUSEEVENTF_RIGHTUP 0x0010
|
||||||
#define MOUSEEVENTF_MIDDLEDOWN 0x0020
|
#define MOUSEEVENTF_MIDDLEDOWN 0x0020
|
||||||
#define MOUSEEVENTF_MIDDLEUP 0x0040
|
#define MOUSEEVENTF_MIDDLEUP 0x0040
|
||||||
|
#define MOUSEEVENTF_XDOWN 0x0080
|
||||||
|
#define MOUSEEVENTF_XUP 0x0100
|
||||||
#define MOUSEEVENTF_WHEEL 0x0800
|
#define MOUSEEVENTF_WHEEL 0x0800
|
||||||
#define MOUSEEVENTF_ABSOLUTE 0x8000
|
#define MOUSEEVENTF_ABSOLUTE 0x8000
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user