Alexandre Julliard : server: Fill the key state in mouse events from the server-side state.
Alexandre Julliard
julliard at winehq.org
Tue Mar 1 11:07:14 CST 2011
Module: wine
Branch: master
Commit: b9e4b5a28ca6178d5988dc63e098c523015b5bab
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b9e4b5a28ca6178d5988dc63e098c523015b5bab
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Feb 28 21:37:09 2011 +0100
server: Fill the key state in mouse events from the server-side state.
---
dlls/winex11.drv/mouse.c | 42 +-----------------------------------------
server/queue.c | 18 +++++++++++++++---
2 files changed, 16 insertions(+), 44 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 4060018..e4a6ab5 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -145,19 +145,6 @@ static inline void clip_point_to_rect( LPCRECT rect, LPPOINT pt )
}
/***********************************************************************
- * update_button_state
- *
- * Update the button state with what X provides us
- */
-static inline void update_button_state( unsigned int state )
-{
- key_state_table[VK_LBUTTON] = (state & Button1Mask ? 0x80 : 0);
- key_state_table[VK_MBUTTON] = (state & Button2Mask ? 0x80 : 0);
- key_state_table[VK_RBUTTON] = (state & Button3Mask ? 0x80 : 0);
- /* X-buttons are not reported from XQueryPointer */
-}
-
-/***********************************************************************
* get_empty_cursor
*/
static Cursor get_empty_cursor(void)
@@ -299,32 +286,6 @@ static HWND update_mouse_state( HWND hwnd, Window window, int x, int y, unsigned
/***********************************************************************
- * get_key_state
- */
-static WORD get_key_state(void)
-{
- WORD ret = 0;
-
- if (GetSystemMetrics( SM_SWAPBUTTON ))
- {
- if (key_state_table[VK_RBUTTON] & 0x80) ret |= MK_LBUTTON;
- if (key_state_table[VK_LBUTTON] & 0x80) ret |= MK_RBUTTON;
- }
- else
- {
- if (key_state_table[VK_LBUTTON] & 0x80) ret |= MK_LBUTTON;
- if (key_state_table[VK_RBUTTON] & 0x80) ret |= MK_RBUTTON;
- }
- if (key_state_table[VK_MBUTTON] & 0x80) ret |= MK_MBUTTON;
- if (key_state_table[VK_SHIFT] & 0x80) ret |= MK_SHIFT;
- if (key_state_table[VK_CONTROL] & 0x80) ret |= MK_CONTROL;
- if (key_state_table[VK_XBUTTON1] & 0x80) ret |= MK_XBUTTON1;
- if (key_state_table[VK_XBUTTON2] & 0x80) ret |= MK_XBUTTON2;
- return ret;
-}
-
-
-/***********************************************************************
* queue_raw_mouse_message
*/
static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y,
@@ -348,7 +309,7 @@ static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y,
req->id = (injected_flags & LLMHF_INJECTED) ? 0 : GetCurrentThreadId();
req->win = wine_server_user_handle( hwnd );
req->msg = message;
- req->wparam = MAKEWPARAM( get_key_state(), data );
+ req->wparam = MAKEWPARAM( 0, data );
req->lparam = 0;
req->x = x;
req->y = y;
@@ -1113,7 +1074,6 @@ BOOL CDECL X11DRV_GetCursorPos(LPPOINT pos)
XQueryPointer( display, root_window, &root, &child,
&rootX, &rootY, &winX, &winY, &xstate ))
{
- update_button_state( xstate );
winX += virtual_screen_rect.left;
winY += virtual_screen_rect.top;
TRACE("pointer at (%d,%d)\n", winX, winY );
diff --git a/server/queue.c b/server/queue.c
index 281c8bc..690687e 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1280,11 +1280,23 @@ static void queue_hardware_message( struct desktop *desktop, struct thread_input
unsigned int msg_code;
struct hardware_msg_data *data = msg->data;
- if (msg->msg == WM_MOUSEMOVE) set_cursor_pos( desktop, data->x, data->y );
- data->x = desktop->cursor_x;
- data->y = desktop->cursor_y;
update_input_key_state( desktop->keystate, msg );
last_input_time = get_tick_count();
+
+ if (!is_keyboard_msg( msg ))
+ {
+ if (msg->msg == WM_MOUSEMOVE) set_cursor_pos( desktop, data->x, data->y );
+ if (desktop->keystate[VK_LBUTTON] & 0x80) msg->wparam |= MK_LBUTTON;
+ if (desktop->keystate[VK_MBUTTON] & 0x80) msg->wparam |= MK_MBUTTON;
+ if (desktop->keystate[VK_RBUTTON] & 0x80) msg->wparam |= MK_RBUTTON;
+ if (desktop->keystate[VK_SHIFT] & 0x80) msg->wparam |= MK_SHIFT;
+ if (desktop->keystate[VK_CONTROL] & 0x80) msg->wparam |= MK_CONTROL;
+ if (desktop->keystate[VK_XBUTTON1] & 0x80) msg->wparam |= MK_XBUTTON1;
+ if (desktop->keystate[VK_XBUTTON2] & 0x80) msg->wparam |= MK_XBUTTON2;
+ }
+ data->x = desktop->cursor_x;
+ data->y = desktop->cursor_y;
+
win = find_hardware_message_window( input, msg, &msg_code );
if (!win || !(thread = get_window_thread(win)))
{
More information about the wine-cvs
mailing list