Rémi Bernon (@rbernon) commented about dlls/win32u/input.c:
+ input_state = input_shm->keystate_lock ? 1 : -1; + keystate_serial = input_shm->desktop_keystate_serial; retval = (signed char)(input_shm->keystate[vkey & 0xff] & 0x81); }
- if (!ret) SERVER_START_REQ( get_key_state ) + if (input_state < 0) + { + struct object_lock lock = OBJECT_LOCK_INIT; + const desktop_shm_t *desktop_shm; + + while ((status = get_shared_desktop( &lock, &desktop_shm )) == STATUS_PENDING) + input_state = (keystate_serial == desktop_shm->keystate_serial); + } + + if (input_state != 1) SERVER_START_REQ( get_key_state ) Why change the BOOL to an int when it only has two possible values after all and is later set with a boolean value? What about this instead?
```suggestion:-16+0 ret = !!input_shm->keystate_lock; /* needs a request for sync_input_keystate */ keystate_serial = input_shm->keystate_serial; retval = (signed char)(input_shm->keystate[vkey & 0xff] & 0x81); } if (!ret) /* check if keystates are synced already and we can safely skip the request */ { struct object_lock lock = OBJECT_LOCK_INIT; const desktop_shm_t *desktop_shm; while ((status = get_shared_desktop( &lock, &desktop_shm )) == STATUS_PENDING) ret = keystate_serial == desktop_shm->keystate_serial; } if (!ret) SERVER_START_REQ( get_key_state ) ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8802#note_113384