server: Fill the key state in mouse events from the server-side state.

This commit is contained in:
Alexandre Julliard 2011-02-28 21:37:09 +01:00
parent c7089361b2
commit b9e4b5a28c
2 changed files with 16 additions and 44 deletions

View File

@ -144,19 +144,6 @@ static inline void clip_point_to_rect( LPCRECT rect, LPPOINT pt )
else if (pt->y >= rect->bottom) pt->y = rect->bottom - 1;
}
/***********************************************************************
* 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
*/
@ -298,32 +285,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
*/
@ -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 );

View File

@ -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)))
{