From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/message.c | 32 ++++++++++------------------ dlls/win32u/winstation.c | 7 +++++- server/protocol.def | 17 --------------- server/queue.c | 46 ---------------------------------------- 4 files changed, 17 insertions(+), 85 deletions(-)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 88222c815da..3e29a1ca5c1 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2135,7 +2135,6 @@ BOOL WINAPI NtUserGetGUIThreadInfo( DWORD id, GUITHREADINFO *info ) struct object_lock lock = OBJECT_LOCK_INIT; const input_shm_t *input_shm; NTSTATUS status; - BOOL ret;
if (info->cbSize != sizeof(*info)) { @@ -2158,28 +2157,19 @@ BOOL WINAPI NtUserGetGUIThreadInfo( DWORD id, GUITHREADINFO *info ) if (input_shm->caret) info->flags |= GUI_CARETBLINKING; }
- if (!status) return TRUE; - - SERVER_START_REQ( get_thread_input_data ) + if (status) { - req->tid = id; - if ((ret = !wine_server_call_err( req ))) - { - info->flags = 0; - info->hwndActive = wine_server_ptr_handle( reply->active ); - info->hwndFocus = wine_server_ptr_handle( reply->focus ); - info->hwndCapture = wine_server_ptr_handle( reply->capture ); - info->hwndMenuOwner = wine_server_ptr_handle( reply->menu_owner ); - info->hwndMoveSize = wine_server_ptr_handle( reply->move_size ); - info->hwndCaret = wine_server_ptr_handle( reply->caret ); - info->rcCaret = wine_server_get_rect( reply->rect ); - if (reply->menu_owner) info->flags |= GUI_INMENUMODE; - if (reply->move_size) info->flags |= GUI_INMOVESIZE; - if (reply->caret) info->flags |= GUI_CARETBLINKING; - } + info->flags = 0; + info->hwndActive = 0; + info->hwndFocus = 0; + info->hwndCapture = 0; + info->hwndMenuOwner = 0; + info->hwndMoveSize = 0; + info->hwndCaret = 0; + memset( &info->rcCaret, 0, sizeof(info->rcCaret) ); } - SERVER_END_REQ; - return ret; + + return TRUE; }
/*********************************************************************** diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 5ed08433b27..297a3b788ad 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -49,6 +49,7 @@ struct shared_input_cache { const shared_object_t *object; UINT64 id; + DWORD tid; };
struct session_thread_data @@ -57,6 +58,7 @@ struct session_thread_data const shared_object_t *shared_queue; /* thread message queue shared session cached object */ struct shared_input_cache shared_input; /* current thread input shared session cached object */ struct shared_input_cache shared_foreground; /* foreground thread input shared session cached object */ + struct shared_input_cache other_thread_input; /* other thread input shared session cached object */ };
struct session_block @@ -315,7 +317,10 @@ NTSTATUS get_shared_input( UINT tid, struct object_lock *lock, const input_shm_t
if (tid == GetCurrentThreadId()) cache = &data->shared_input; else if (!tid) cache = &data->shared_foreground; - else return STATUS_INVALID_HANDLE; + else cache = &data->other_thread_input; + + if (tid != cache->tid) memset( cache, 0, sizeof(*cache) ); + cache->tid = tid;
do { status = try_get_shared_input( tid, lock, input_shm, cache ); } while (!status && !cache->id); diff --git a/server/protocol.def b/server/protocol.def index 063fa502929..91257fce3a1 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2928,23 +2928,6 @@ enum coords_relative @END
-/* Get input data for a given thread */ -@REQ(get_thread_input_data) - thread_id_t tid; /* id of thread */ -@REPLY - user_handle_t focus; /* handle to the focus window */ - user_handle_t capture; /* handle to the capture window */ - user_handle_t active; /* handle to the active window */ - user_handle_t foreground; /* handle to the global foreground window */ - user_handle_t menu_owner; /* handle to the menu owner */ - user_handle_t move_size; /* handle to the moving/resizing window */ - user_handle_t caret; /* handle to the caret window */ - user_handle_t cursor; /* handle to the cursor */ - int show_count; /* cursor show count */ - rectangle_t rect; /* caret rectangle */ -@END - - /* Get the thread input of the given thread */ @REQ(get_thread_input) thread_id_t tid; /* id of thread */ diff --git a/server/queue.c b/server/queue.c index 9fd4a372730..23a6f3e5e41 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3668,52 +3668,6 @@ DECL_HANDLER(attach_thread_input) }
-/* get thread input data */ -DECL_HANDLER(get_thread_input_data) -{ - struct thread *thread = NULL; - struct desktop *desktop; - struct thread_input *input; - - if (req->tid) - { - if (!(thread = get_thread_from_id( req->tid ))) return; - if (!(desktop = get_thread_desktop( thread, 0 ))) - { - release_object( thread ); - return; - } - input = thread->queue ? thread->queue->input : NULL; - } - else - { - if (!(desktop = get_thread_desktop( current, 0 ))) return; - input = desktop->foreground_input; /* get the foreground thread info */ - } - - if (input) - { - const input_shm_t *input_shm = input->shared; - reply->focus = input_shm->focus; - reply->capture = input_shm->capture; - reply->active = input_shm->active; - reply->menu_owner = input_shm->menu_owner; - reply->move_size = input_shm->move_size; - reply->caret = input_shm->caret; - reply->cursor = input_shm->cursor; - reply->show_count = input_shm->cursor_count; - reply->rect = input_shm->caret_rect; - } - - /* foreground window is active window of foreground thread */ - if (!(input = desktop->foreground_input)) reply->foreground = 0; - else reply->foreground = input->shared->active; - - if (thread) release_object( thread ); - release_object( desktop ); -} - - /* get the thread input of the given thread */ DECL_HANDLER(get_thread_input) {