4 * Copyright 1993 Alexandre Julliard
5 * Copyright 2022 Jacek Caban
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_NTUSER_PRIVATE_H
23 #define __WINE_NTUSER_PRIVATE_H
26 #include "wine/list.h"
29 #define WM_POPUPSYSTEMMENU 0x0313
33 SYSTEM_TIMER_TRACK_MOUSE
= 0xfffa,
34 SYSTEM_TIMER_CARET
= 0xffff,
37 struct rawinput_thread_data
39 UINT hw_id
; /* current rawinput message id */
40 RAWINPUT buffer
[1]; /* rawinput message data buffer */
43 /* on windows the buffer capacity is quite large as well, enough to */
44 /* hold up to 10s of 1kHz mouse rawinput events */
45 #define RAWINPUT_BUFFER_SIZE (512 * 1024)
53 #define OBJ_OTHER_PROCESS ((void *)1) /* returned by get_user_handle_ptr on unknown handles */
57 struct user_object obj
; /* object header */
58 HWND parent
; /* Window parent */
59 HWND owner
; /* Window owner */
60 struct tagCLASS
*class; /* Window class */
61 struct dce
*dce
; /* DCE pointer */
62 WNDPROC winproc
; /* Window procedure */
63 UINT tid
; /* Owner thread id */
64 HINSTANCE hInstance
; /* Window hInstance (from CreateWindow) */
65 RECT client_rect
; /* Client area rel. to parent client area */
66 RECT window_rect
; /* Whole window rel. to parent client area */
67 RECT visible_rect
; /* Visible part of the whole rect, rel. to parent client area */
68 RECT normal_rect
; /* Normal window rect saved when maximized/minimized */
69 POINT min_pos
; /* Position for minimized window */
70 POINT max_pos
; /* Position for maximized window */
71 WCHAR
*text
; /* Window text */
72 struct win_scroll_bar_info
*pScroll
; /* Scroll-bar info */
73 UINT dwStyle
; /* Window style (from CreateWindow) */
74 UINT dwExStyle
; /* Extended style (from CreateWindowEx) */
75 UINT_PTR wIDmenu
; /* ID or hmenu (from CreateWindow) */
76 UINT helpContext
; /* Help context ID */
77 UINT flags
; /* Misc. flags (see below) */
78 HMENU hSysMenu
; /* window's copy of System Menu */
79 HICON hIcon
; /* window's icon */
80 HICON hIconSmall
; /* window's small icon */
81 HICON hIconSmall2
; /* window's secondary small icon, derived from hIcon */
82 HIMC imc
; /* window's input context */
83 UINT dpi
; /* window DPI */
84 DPI_AWARENESS dpi_awareness
; /* DPI awareness */
85 struct window_surface
*surface
; /* Window surface if any */
86 struct tagDIALOGINFO
*dlgInfo
; /* Dialog additional info (dialogs only) */
87 int pixel_format
; /* Pixel format set by the graphics driver */
88 int internal_pixel_format
; /* Internal pixel format set via WGL_WINE_pixel_format_passthrough */
89 int cbWndExtra
; /* class cbWndExtra at window creation */
90 DWORD_PTR userdata
; /* User private data */
91 DWORD wExtra
[1]; /* Window extra bytes */
94 /* WND flags values */
95 #define WIN_RESTORE_MAX 0x0001 /* Maximize when restoring */
96 #define WIN_NEED_SIZE 0x0002 /* Internal WM_SIZE is needed */
97 #define WIN_NCACTIVATED 0x0004 /* last WM_NCACTIVATE was positive */
98 #define WIN_ISMDICLIENT 0x0008 /* Window is an MDIClient */
99 #define WIN_ISUNICODE 0x0010 /* Window is Unicode */
100 #define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0020 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
101 #define WIN_CHILDREN_MOVED 0x0040 /* children may have moved, ignore stored positions */
102 #define WIN_HAS_IME_WIN 0x0080 /* the window has been registered with imm32 */
104 #define WND_OTHER_PROCESS ((WND *)1) /* returned by get_win_ptr on unknown window handles */
105 #define WND_DESKTOP ((WND *)2) /* returned by get_win_ptr on the desktop window */
107 /* check if hwnd is a broadcast magic handle */
108 static inline BOOL
is_broadcast( HWND hwnd
)
110 return hwnd
== HWND_BROADCAST
|| hwnd
== HWND_TOPMOST
;
113 /* this is the structure stored in TEB->Win32ClientInfo */
114 /* no attempt is made to keep the layout compatible with the Windows one */
115 struct user_thread_info
117 struct ntuser_thread_info client_info
; /* Data shared with client */
118 HANDLE server_queue
; /* Handle to server-side queue */
119 DWORD wake_mask
; /* Current queue wake mask */
120 DWORD changed_mask
; /* Current queue changed mask */
121 WORD message_count
; /* Get/PeekMessage loop counter */
122 WORD hook_call_depth
; /* Number of recursively called hook procs */
123 WORD hook_unicode
; /* Is current hook unicode? */
124 HHOOK hook
; /* Current hook */
125 UINT active_hooks
; /* Bitmap of active hooks */
126 struct received_message_info
*receive_info
; /* Message being currently received */
127 struct user_key_state_info
*key_state
; /* Cache of global key state */
128 struct imm_thread_data
*imm_thread_data
; /* IMM thread data */
129 HKL kbd_layout
; /* Current keyboard layout */
130 UINT kbd_layout_id
; /* Current keyboard layout ID */
131 struct rawinput_thread_data
*rawinput
; /* RawInput thread local data / buffer */
132 UINT spy_indent
; /* Current spy indent */
133 BOOL clipping_cursor
; /* thread is currently clipping */
134 DWORD clipping_reset
; /* time when clipping was last reset */
137 C_ASSERT( sizeof(struct user_thread_info
) <= sizeof(((TEB
*)0)->Win32ClientInfo
) );
139 static inline struct user_thread_info
*get_user_thread_info(void)
141 return CONTAINING_RECORD( NtUserGetThreadInfo(), struct user_thread_info
, client_info
);
144 struct user_key_state_info
146 UINT time
; /* Time of last key state refresh */
147 INT counter
; /* Counter to invalidate the key state */
148 BYTE state
[256]; /* State for each key */
151 struct hook_extra_info
157 enum builtin_winprocs
170 /* unicode-only procs */
176 NB_BUILTIN_AW_WINPROCS
= WINPROC_DESKTOP
179 /* FIXME: make it private to scroll.c */
181 /* data for a single scroll bar */
184 INT curVal
; /* Current scroll-bar value */
185 INT minVal
; /* Minimum scroll-bar value */
186 INT maxVal
; /* Maximum scroll-bar value */
187 INT page
; /* Page size of scroll bar (Win32) */
188 UINT flags
; /* EnableScrollBar flags */
189 BOOL painted
; /* Whether the scroll bar is painted by DefWinProc() */
192 struct scroll_bar_win_data
195 struct scroll_info info
;
198 #define WINPROC_HANDLE (~0u >> 16)
199 #define BUILTIN_WINPROC(index) ((WNDPROC)(ULONG_PTR)((index) | (WINPROC_HANDLE << 16)))
201 #define MAX_ATOM_LEN 255
203 /* Built-in class names (see _Undocumented_Windows_ p.418) */
204 #define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768) /* PopupMenu */
205 #define DESKTOP_CLASS_ATOM MAKEINTATOM(32769) /* Desktop */
206 #define DIALOG_CLASS_ATOM MAKEINTATOM(32770) /* Dialog */
207 #define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771) /* WinSwitch */
208 #define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772) /* IconTitle */
210 extern const char *debugstr_msg_name( UINT msg
, HWND hwnd
) DECLSPEC_HIDDEN
;
211 extern const char *debugstr_vkey_name( WPARAM wParam
) DECLSPEC_HIDDEN
;
212 extern void spy_enter_message( INT flag
, HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
213 extern void spy_exit_message( INT flag
, HWND hwnd
, UINT msg
,
214 LRESULT lreturn
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
217 extern HINSTANCE user32_module DECLSPEC_HIDDEN
;
218 WNDPROC
alloc_winproc( WNDPROC func
, BOOL ansi
) DECLSPEC_HIDDEN
;
219 BOOL
is_winproc_unicode( WNDPROC proc
, BOOL def_val
) DECLSPEC_HIDDEN
;
220 DWORD
get_class_long( HWND hwnd
, INT offset
, BOOL ansi
) DECLSPEC_HIDDEN
;
221 WNDPROC
get_class_winproc( struct tagCLASS
*class ) DECLSPEC_HIDDEN
;
222 ULONG_PTR
get_class_long_ptr( HWND hwnd
, INT offset
, BOOL ansi
) DECLSPEC_HIDDEN
;
223 WORD
get_class_word( HWND hwnd
, INT offset
) DECLSPEC_HIDDEN
;
224 DLGPROC
get_dialog_proc( DLGPROC proc
, BOOL ansi
) DECLSPEC_HIDDEN
;
225 ATOM
get_int_atom_value( UNICODE_STRING
*name
) DECLSPEC_HIDDEN
;
226 WNDPROC
get_winproc( WNDPROC proc
, BOOL ansi
) DECLSPEC_HIDDEN
;
227 void get_winproc_params( struct win_proc_params
*params
, BOOL fixup_ansi_dst
) DECLSPEC_HIDDEN
;
228 struct dce
*get_class_dce( struct tagCLASS
*class ) DECLSPEC_HIDDEN
;
229 struct dce
*set_class_dce( struct tagCLASS
*class, struct dce
*dce
) DECLSPEC_HIDDEN
;
230 BOOL
needs_ime_window( HWND hwnd
) DECLSPEC_HIDDEN
;
231 extern void register_builtin_classes(void) DECLSPEC_HIDDEN
;
232 extern void register_desktop_class(void) DECLSPEC_HIDDEN
;
235 extern LRESULT
ime_driver_call( HWND hwnd
, enum wine_ime_call call
, WPARAM wparam
, LPARAM lparam
,
236 struct ime_driver_call_params
*params
) DECLSPEC_HIDDEN
;
239 HICON
alloc_cursoricon_handle( BOOL is_icon
) DECLSPEC_HIDDEN
;
242 extern void free_dce( struct dce
*dce
, HWND hwnd
) DECLSPEC_HIDDEN
;
243 extern void invalidate_dce( WND
*win
, const RECT
*extra_rect
) DECLSPEC_HIDDEN
;
246 HANDLE
alloc_user_handle( struct user_object
*ptr
, unsigned int type
) DECLSPEC_HIDDEN
;
247 void *free_user_handle( HANDLE handle
, unsigned int type
) DECLSPEC_HIDDEN
;
248 void *get_user_handle_ptr( HANDLE handle
, unsigned int type
) DECLSPEC_HIDDEN
;
249 void release_user_handle_ptr( void *ptr
) DECLSPEC_HIDDEN
;
250 void *next_process_user_handle_ptr( HANDLE
*handle
, unsigned int type
) DECLSPEC_HIDDEN
;
251 UINT
win_set_flags( HWND hwnd
, UINT set_mask
, UINT clear_mask
) DECLSPEC_HIDDEN
;
253 static inline UINT
win_get_flags( HWND hwnd
)
255 return win_set_flags( hwnd
, 0, 0 );
258 WND
*get_win_ptr( HWND hwnd
) DECLSPEC_HIDDEN
;
259 BOOL
is_child( HWND parent
, HWND child
) DECLSPEC_HIDDEN
;
260 BOOL
is_window( HWND hwnd
) DECLSPEC_HIDDEN
;
262 #endif /* __WINE_NTUSER_PRIVATE_H */