user32: Retrieve the key state for GetAsyncKeyState from the server.

This commit is contained in:
Alexandre Julliard 2011-02-28 21:55:01 +01:00
parent 22468ec65c
commit a7da164949
5 changed files with 24 additions and 41 deletions

View File

@ -168,7 +168,7 @@ static void CDECL nulldrv_Beep(void)
static SHORT CDECL nulldrv_GetAsyncKeyState( INT key )
{
return 0;
return -1;
}
static INT CDECL nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )

View File

@ -300,11 +300,28 @@ HWND WINAPI GetCapture(void)
* bit set to 1 if currently pressed, low-order bit set to 1 if key has
* been pressed.
*/
SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState(INT nKey)
SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState( INT key )
{
if (nKey < 0 || nKey > 256)
return 0;
return USER_Driver->pGetAsyncKeyState( nKey );
SHORT ret;
if (key < 0 || key >= 256) return 0;
if ((ret = USER_Driver->pGetAsyncKeyState( key )) == -1)
{
ret = 0;
SERVER_START_REQ( get_key_state )
{
req->tid = 0;
req->key = key;
if (!wine_server_call( req ))
{
if (reply->state & 0x40) ret |= 0x0001;
if (reply->state & 0x80) ret |= 0x8000;
}
}
SERVER_END_REQ;
}
return ret;
}

View File

@ -65,7 +65,7 @@ WINE_DECLARE_DEBUG_CHANNEL(key);
0x40 -> key got pressed since last time
0x01 -> key is toggled
*/
BYTE key_state_table[256];
static BYTE key_state_table[256];
static BYTE TrackSysKey = 0; /* determine whether ALT key up will cause a WM_SYSKEYUP
or a WM_KEYUP message */
@ -1968,16 +1968,9 @@ static BOOL match_x11_keyboard_layout(HKL hkl)
*/
SHORT CDECL X11DRV_GetAsyncKeyState(INT key)
{
SHORT retval;
/* Photoshop livelocks unless mouse events are included here */
X11DRV_MsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_KEY | QS_MOUSE, 0 );
retval = ((key_state_table[key] & 0x40) ? 0x0001 : 0) |
((key_state_table[key] & 0x80) ? 0x8000 : 0);
key_state_table[key] &= ~0x40;
TRACE_(key)("(%X) -> %x\n", key, retval);
return retval;
return -1;
}

View File

@ -398,58 +398,32 @@ void X11DRV_send_mouse_input( HWND hwnd, DWORD flags, DWORD x, DWORD y,
}
}
if (flags & MOUSEEVENTF_LEFTDOWN)
{
key_state_table[VK_LBUTTON] |= 0xc0;
queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_RBUTTONDOWN : WM_LBUTTONDOWN,
hwnd, pt.x, pt.y, data, time, extra_info, injected_flags );
}
if (flags & MOUSEEVENTF_LEFTUP)
{
key_state_table[VK_LBUTTON] &= ~0x80;
queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_RBUTTONUP : WM_LBUTTONUP,
hwnd, pt.x, pt.y, data, time, extra_info, injected_flags );
}
if (flags & MOUSEEVENTF_RIGHTDOWN)
{
key_state_table[VK_RBUTTON] |= 0xc0;
queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_LBUTTONDOWN : WM_RBUTTONDOWN,
hwnd, pt.x, pt.y, data, time, extra_info, injected_flags );
}
if (flags & MOUSEEVENTF_RIGHTUP)
{
key_state_table[VK_RBUTTON] &= ~0x80;
queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_LBUTTONUP : WM_RBUTTONUP,
hwnd, pt.x, pt.y, data, time, extra_info, injected_flags );
}
if (flags & MOUSEEVENTF_MIDDLEDOWN)
{
key_state_table[VK_MBUTTON] |= 0xc0;
queue_raw_mouse_message( WM_MBUTTONDOWN, hwnd, pt.x, pt.y,
data, time, extra_info, injected_flags );
}
if (flags & MOUSEEVENTF_MIDDLEUP)
{
key_state_table[VK_MBUTTON] &= ~0x80;
queue_raw_mouse_message( WM_MBUTTONUP, hwnd, pt.x, pt.y,
data, time, extra_info, injected_flags );
}
if (flags & MOUSEEVENTF_WHEEL)
{
queue_raw_mouse_message( WM_MOUSEWHEEL, hwnd, pt.x, pt.y,
data, time, 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 );
}
}
#ifdef SONAME_LIBXCURSOR

View File

@ -609,7 +609,6 @@ extern int alloc_system_colors;
extern int xrender_error_base;
extern HMODULE x11drv_module;
extern BYTE key_state_table[256];
extern POINT cursor_pos;
/* atoms */