Commit bd604c80 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Reset thread info in NtUserSetThreadDesktop.

parent 308ca7f6
......@@ -709,7 +709,7 @@
@ stdcall SetSystemMenu(long long)
@ stdcall SetSystemTimer(long long long ptr)
@ stdcall SetTaskmanWindow (long)
@ stdcall SetThreadDesktop(long)
@ stdcall SetThreadDesktop(long) NtUserSetThreadDesktop
@ stdcall SetThreadDpiAwarenessContext(ptr)
@ stdcall SetTimer(long long long ptr)
@ stdcall SetUserObjectInformationA(long long ptr long)
......
......@@ -25,7 +25,7 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "ntuser.h"
#include "../win32u/ntuser_private.h"
#include "winreg.h"
#include "winternl.h"
#include "hidusage.h"
......@@ -109,13 +109,6 @@ extern void (WINAPI *imm_unregister_window)(HWND) DECLSPEC_HIDDEN;
#define IME_INTERNAL_ACTIVATE 0x17
#define IME_INTERNAL_DEACTIVATE 0x18
struct user_key_state_info
{
UINT time; /* Time of last key state refresh */
INT counter; /* Counter to invalidate the key state */
BYTE state[256]; /* State for each key */
};
struct hook_extra_info
{
HHOOK handle;
......
......@@ -310,25 +310,6 @@ HDESK WINAPI OpenDesktopW( LPCWSTR name, DWORD flags, BOOL inherit, ACCESS_MASK
/******************************************************************************
* SetThreadDesktop (USER32.@)
*/
BOOL WINAPI SetThreadDesktop( HDESK handle )
{
BOOL ret = NtUserSetThreadDesktop( handle );
if (ret) /* reset the desktop windows */
{
struct user_thread_info *thread_info = get_user_thread_info();
struct user_key_state_info *key_state_info = thread_info->key_state;
thread_info->top_window = 0;
thread_info->msg_window = 0;
if (key_state_info) key_state_info->time = 0;
}
return ret;
}
/******************************************************************************
* EnumDesktopsA (USER32.@)
*/
BOOL WINAPI EnumDesktopsA( HWINSTA winsta, DESKTOPENUMPROCA func, LPARAM lparam )
......
......@@ -27,6 +27,7 @@
#endif
#include "win32u_private.h"
#include "ntuser_private.h"
#include "wine/server.h"
#include "wine/debug.h"
......
/*
* User definitions
*
* Copyright 1993 Alexandre Julliard
* Copyright 2022 Jacek Caban
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_NTUSER_PRIVATE_H
#define __WINE_NTUSER_PRIVATE_H
#include "ntuser.h"
/* this is the structure stored in TEB->Win32ClientInfo */
/* no attempt is made to keep the layout compatible with the Windows one */
struct user_thread_info
{
HANDLE server_queue; /* Handle to server-side queue */
DWORD wake_mask; /* Current queue wake mask */
DWORD changed_mask; /* Current queue changed mask */
WORD recursion_count; /* SendMessage recursion counter */
WORD message_count; /* Get/PeekMessage loop counter */
WORD hook_call_depth; /* Number of recursively called hook procs */
WORD hook_unicode; /* Is current hook unicode? */
HHOOK hook; /* Current hook */
UINT active_hooks; /* Bitmap of active hooks */
DPI_AWARENESS dpi_awareness; /* DPI awareness */
INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */
struct received_message_info *receive_info; /* Message being currently received */
struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */
DWORD GetMessageTimeVal; /* Value for GetMessageTime */
DWORD GetMessagePosVal; /* Value for GetMessagePos */
ULONG_PTR GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
struct user_key_state_info *key_state; /* Cache of global key state */
HKL kbd_layout; /* Current keyboard layout */
DWORD kbd_layout_id; /* Current keyboard layout ID */
HWND top_window; /* Desktop window */
HWND msg_window; /* HWND_MESSAGE parent window */
struct rawinput_thread_data *rawinput; /* RawInput thread local data / buffer */
};
C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo) );
struct user_key_state_info
{
UINT time; /* Time of last key state refresh */
INT counter; /* Counter to invalidate the key state */
BYTE state[256]; /* State for each key */
};
#endif /* __WINE_NTUSER_PRIVATE_H */
......@@ -28,6 +28,7 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "ntgdi_private.h"
#include "ntuser_private.h"
#include "devpropdef.h"
#include "wine/wingdi16.h"
#include "wine/server.h"
......
......@@ -30,6 +30,7 @@
#include "ntuser.h"
#include "ddk/wdm.h"
#include "ntgdi_private.h"
#include "ntuser_private.h"
#include "wine/server.h"
#include "wine/debug.h"
......@@ -233,7 +234,14 @@ BOOL WINAPI NtUserSetThreadDesktop( HDESK handle )
}
SERVER_END_REQ;
/* FIXME: reset uset thread info */
if (ret) /* reset the desktop windows */
{
struct user_thread_info *thread_info = get_user_thread_info();
struct user_key_state_info *key_state_info = thread_info->key_state;
thread_info->top_window = 0;
thread_info->msg_window = 0;
if (key_state_info) key_state_info->time = 0;
}
return ret;
}
......
......@@ -85,36 +85,6 @@ enum
/* color index used to retrieve system 55aa brush */
#define COLOR_55AA_BRUSH 0x100
/* this is the structure stored in TEB->Win32ClientInfo */
/* no attempt is made to keep the layout compatible with the Windows one */
struct user_thread_info
{
HANDLE server_queue; /* Handle to server-side queue */
DWORD wake_mask; /* Current queue wake mask */
DWORD changed_mask; /* Current queue changed mask */
WORD recursion_count; /* SendMessage recursion counter */
WORD message_count; /* Get/PeekMessage loop counter */
WORD hook_call_depth; /* Number of recursively called hook procs */
WORD hook_unicode; /* Is current hook unicode? */
HHOOK hook; /* Current hook */
UINT active_hooks; /* Bitmap of active hooks */
DPI_AWARENESS dpi_awareness; /* DPI awareness */
INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */
struct received_message_info *receive_info; /* Message being currently received */
struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */
DWORD GetMessageTimeVal; /* Value for GetMessageTime */
DWORD GetMessagePosVal; /* Value for GetMessagePos */
ULONG_PTR GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
struct user_key_state_info *key_state; /* Cache of global key state */
HKL kbd_layout; /* Current keyboard layout */
DWORD kbd_layout_id; /* Current keyboard layout ID */
HWND top_window; /* Desktop window */
HWND msg_window; /* HWND_MESSAGE parent window */
struct rawinput_thread_data *rawinput; /* RawInput thread local data / buffer */
};
C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo) );
/* internal messages codes */
enum wine_internal_message
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment