[PATCH] user32: Remove unused GetAsyncKeyState() driver entry.

Huw Davies huw at codeweavers.com
Wed Nov 6 04:06:23 CST 2019


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/user32/driver.c       | 13 --------
 dlls/user32/input.c        | 68 ++++++++++++++++++--------------------
 dlls/user32/user_private.h |  1 -
 3 files changed, 32 insertions(+), 50 deletions(-)

diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c
index 921ea2c962..66b26ca51a 100644
--- a/dlls/user32/driver.c
+++ b/dlls/user32/driver.c
@@ -106,7 +106,6 @@ static const USER_DRIVER *load_driver(void)
 
         GET_USER_FUNC(ActivateKeyboardLayout);
         GET_USER_FUNC(Beep);
-        GET_USER_FUNC(GetAsyncKeyState);
         GET_USER_FUNC(GetKeyNameText);
         GET_USER_FUNC(GetKeyboardLayout);
         GET_USER_FUNC(GetKeyboardLayoutList);
@@ -206,11 +205,6 @@ static void CDECL nulldrv_Beep(void)
 {
 }
 
-static SHORT CDECL nulldrv_GetAsyncKeyState( INT key )
-{
-    return -1;
-}
-
 static UINT CDECL nulldrv_GetKeyboardLayoutList( INT size, HKL *layouts )
 {
     HKEY hKeyKeyboard;
@@ -494,7 +488,6 @@ static USER_DRIVER null_driver =
     /* keyboard functions */
     nulldrv_ActivateKeyboardLayout,
     nulldrv_Beep,
-    nulldrv_GetAsyncKeyState,
     nulldrv_GetKeyNameText,
     nulldrv_GetKeyboardLayout,
     nulldrv_GetKeyboardLayoutList,
@@ -566,11 +559,6 @@ static void CDECL loaderdrv_Beep(void)
     load_driver()->pBeep();
 }
 
-static SHORT CDECL loaderdrv_GetAsyncKeyState( INT key )
-{
-    return load_driver()->pGetAsyncKeyState( key );
-}
-
 static INT CDECL loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
 {
     return load_driver()->pGetKeyNameText( lparam, buffer, size );
@@ -715,7 +703,6 @@ static USER_DRIVER lazy_load_driver =
     /* keyboard functions */
     loaderdrv_ActivateKeyboardLayout,
     loaderdrv_Beep,
-    loaderdrv_GetAsyncKeyState,
     loaderdrv_GetKeyNameText,
     loaderdrv_GetKeyboardLayout,
     loaderdrv_GetKeyboardLayoutList,
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 8b2ae805aa..0325e2ce3d 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -401,51 +401,47 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState( INT key )
 
     check_for_events( QS_INPUT );
 
-    if ((ret = USER_Driver->pGetAsyncKeyState( key )) == -1)
+    if (key_state_info && !(key_state_info->state[key] & 0xc0) &&
+        key_state_info->counter == counter && GetTickCount() - key_state_info->time < 50)
     {
-        if (key_state_info &&
-            !(key_state_info->state[key] & 0xc0) &&
-            key_state_info->counter == counter &&
-            GetTickCount() - key_state_info->time < 50)
-        {
-            /* use cached value */
-            return 0;
-        }
-        else if (!key_state_info)
+        /* use cached value */
+        return 0;
+    }
+    else if (!key_state_info)
+    {
+        key_state_info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*key_state_info) );
+        get_user_thread_info()->key_state = key_state_info;
+    }
+
+    ret = 0;
+    SERVER_START_REQ( get_key_state )
+    {
+        req->tid = 0;
+        req->key = key;
+        if (key_state_info)
         {
-            key_state_info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*key_state_info) );
-            get_user_thread_info()->key_state = key_state_info;
+            prev_key_state = key_state_info->state[key];
+            wine_server_set_reply( req, key_state_info->state, sizeof(key_state_info->state) );
         }
-
-        ret = 0;
-        SERVER_START_REQ( get_key_state )
+        if (!wine_server_call( req ))
         {
-            req->tid = 0;
-            req->key = key;
+            if (reply->state & 0x40) ret |= 0x0001;
+            if (reply->state & 0x80) ret |= 0x8000;
             if (key_state_info)
             {
-                prev_key_state = key_state_info->state[key];
-                wine_server_set_reply( req, key_state_info->state, sizeof(key_state_info->state) );
-            }
-            if (!wine_server_call( req ))
-            {
-                if (reply->state & 0x40) ret |= 0x0001;
-                if (reply->state & 0x80) ret |= 0x8000;
-                if (key_state_info)
-                {
-                    /* force refreshing the key state cache - some multithreaded programs
-                     * (like Adobe Photoshop CS5) expect that changes to the async key state
-                     * are also immediately available in other threads. */
-                    if (prev_key_state != key_state_info->state[key])
-                        counter = interlocked_xchg_add( &global_key_state_counter, 1 ) + 1;
-
-                    key_state_info->time    = GetTickCount();
-                    key_state_info->counter = counter;
-                }
+                /* force refreshing the key state cache - some multithreaded programs
+                 * (like Adobe Photoshop CS5) expect that changes to the async key state
+                 * are also immediately available in other threads. */
+                if (prev_key_state != key_state_info->state[key])
+                    counter = interlocked_xchg_add( &global_key_state_counter, 1 ) + 1;
+
+                key_state_info->time    = GetTickCount();
+                key_state_info->counter = counter;
             }
         }
-        SERVER_END_REQ;
     }
+    SERVER_END_REQ;
+
     return ret;
 }
 
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index c11aae707c..7e294558ef 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -64,7 +64,6 @@ typedef struct tagUSER_DRIVER {
     /* keyboard functions */
     HKL    (CDECL *pActivateKeyboardLayout)(HKL, UINT);
     void   (CDECL *pBeep)(void);
-    SHORT  (CDECL *pGetAsyncKeyState)(INT);
     INT    (CDECL *pGetKeyNameText)(LONG, LPWSTR, INT);
     HKL    (CDECL *pGetKeyboardLayout)(DWORD);
     UINT   (CDECL *pGetKeyboardLayoutList)(INT, HKL *);
-- 
2.23.0




More information about the wine-devel mailing list