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"
31 struct hardware_msg_data
;
35 BOOL (WINAPI
*pAdjustWindowRectEx
)( RECT
*, DWORD
, BOOL
, DWORD
);
36 HANDLE (WINAPI
*pCopyImage
)( HANDLE
, UINT
, INT
, INT
, UINT
);
37 BOOL (WINAPI
*pDestroyCaret
)(void);
38 BOOL (WINAPI
*pEndMenu
)(void);
39 BOOL (WINAPI
*pHideCaret
)( HWND hwnd
);
40 BOOL (WINAPI
*pImmProcessKey
)(HWND
, HKL
, UINT
, LPARAM
, DWORD
);
41 BOOL (WINAPI
*pImmTranslateMessage
)(HWND
, UINT
, WPARAM
, LPARAM
);
42 BOOL (WINAPI
*pSetSystemMenu
)( HWND hwnd
, HMENU menu
);
43 BOOL (WINAPI
*pShowCaret
)( HWND hwnd
);
44 void (CDECL
*free_menu_items
)( void *ptr
);
45 void (CDECL
*free_win_ptr
)( struct tagWND
*win
);
46 HWND (CDECL
*is_menu_active
)(void);
47 void (CDECL
*notify_ime
)( HWND hwnd
, UINT param
);
48 BOOL (CDECL
*post_dde_message
)( HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
, DWORD dest_tid
,
50 BOOL (CDECL
*process_rawinput_message
)( MSG
*msg
, UINT hw_id
, const struct hardware_msg_data
*msg_data
);
51 BOOL (CDECL
*rawinput_device_get_usages
)(HANDLE handle
, USHORT
*usage_page
, USHORT
*usage
);
52 void (CDECL
*register_builtin_classes
)(void);
53 BOOL (CDECL
*set_menu
)( HWND hwnd
, HMENU menu
);
54 void (WINAPI
*set_standard_scroll_painted
)( HWND hwnd
, INT bar
, BOOL visible
);
55 BOOL (CDECL
*unpack_dde_message
)( HWND hwnd
, UINT message
, WPARAM
*wparam
, LPARAM
*lparam
,
56 void **buffer
, size_t size
);
57 BOOL (WINAPI
*register_imm
)( HWND hwnd
);
58 void (WINAPI
*unregister_imm
)( HWND hwnd
);
61 #define WM_SYSTIMER 0x0118
62 #define WM_POPUPSYSTEMMENU 0x0313
70 #define OBJ_OTHER_PROCESS ((void *)1) /* returned by get_user_handle_ptr on unknown handles */
72 HANDLE
alloc_user_handle( struct user_object
*ptr
, unsigned int type
) DECLSPEC_HIDDEN
;
73 void *get_user_handle_ptr( HANDLE handle
, unsigned int type
) DECLSPEC_HIDDEN
;
74 void release_user_handle_ptr( void *ptr
) DECLSPEC_HIDDEN
;
75 void *free_user_handle( HANDLE handle
, unsigned int type
) DECLSPEC_HIDDEN
;
79 struct user_object obj
; /* object header */
80 HWND parent
; /* Window parent */
81 HWND owner
; /* Window owner */
82 struct tagCLASS
*class; /* Window class */
83 struct dce
*dce
; /* DCE pointer */
84 WNDPROC winproc
; /* Window procedure */
85 DWORD tid
; /* Owner thread id */
86 HINSTANCE hInstance
; /* Window hInstance (from CreateWindow) */
87 RECT client_rect
; /* Client area rel. to parent client area */
88 RECT window_rect
; /* Whole window rel. to parent client area */
89 RECT visible_rect
; /* Visible part of the whole rect, rel. to parent client area */
90 RECT normal_rect
; /* Normal window rect saved when maximized/minimized */
91 POINT min_pos
; /* Position for minimized window */
92 POINT max_pos
; /* Position for maximized window */
93 WCHAR
*text
; /* Window text */
94 void *pScroll
; /* Scroll-bar info */
95 DWORD dwStyle
; /* Window style (from CreateWindow) */
96 DWORD dwExStyle
; /* Extended style (from CreateWindowEx) */
97 UINT_PTR wIDmenu
; /* ID or hmenu (from CreateWindow) */
98 DWORD helpContext
; /* Help context ID */
99 UINT flags
; /* Misc. flags (see below) */
100 HMENU hSysMenu
; /* window's copy of System Menu */
101 HICON hIcon
; /* window's icon */
102 HICON hIconSmall
; /* window's small icon */
103 HICON hIconSmall2
; /* window's secondary small icon, derived from hIcon */
104 UINT dpi
; /* window DPI */
105 DPI_AWARENESS dpi_awareness
; /* DPI awareness */
106 struct window_surface
*surface
; /* Window surface if any */
107 struct tagDIALOGINFO
*dlgInfo
; /* Dialog additional info (dialogs only) */
108 int pixel_format
; /* Pixel format set by the graphics driver */
109 int cbWndExtra
; /* class cbWndExtra at window creation */
110 DWORD_PTR userdata
; /* User private data */
111 DWORD wExtra
[1]; /* Window extra bytes */
114 /* WND flags values */
115 #define WIN_RESTORE_MAX 0x0001 /* Maximize when restoring */
116 #define WIN_NEED_SIZE 0x0002 /* Internal WM_SIZE is needed */
117 #define WIN_NCACTIVATED 0x0004 /* last WM_NCACTIVATE was positive */
118 #define WIN_ISMDICLIENT 0x0008 /* Window is an MDIClient */
119 #define WIN_ISUNICODE 0x0010 /* Window is Unicode */
120 #define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0020 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
121 #define WIN_CHILDREN_MOVED 0x0040 /* children may have moved, ignore stored positions */
122 #define WIN_HAS_IME_WIN 0x0080 /* the window has been registered with imm32 */
124 #define WND_OTHER_PROCESS ((WND *)1) /* returned by WIN_GetPtr on unknown window handles */
125 #define WND_DESKTOP ((WND *)2) /* returned by WIN_GetPtr on the desktop window */
127 /* check if hwnd is a broadcast magic handle */
128 static inline BOOL
is_broadcast( HWND hwnd
)
130 return hwnd
== HWND_BROADCAST
|| hwnd
== HWND_TOPMOST
;
133 #define WM_IME_INTERNAL 0x287
134 #define IME_INTERNAL_ACTIVATE 0x17
135 #define IME_INTERNAL_DEACTIVATE 0x18
137 /* this is the structure stored in TEB->Win32ClientInfo */
138 /* no attempt is made to keep the layout compatible with the Windows one */
139 struct user_thread_info
141 struct ntuser_thread_info client_info
; /* Data shared with client */
142 HANDLE server_queue
; /* Handle to server-side queue */
143 DWORD wake_mask
; /* Current queue wake mask */
144 DWORD changed_mask
; /* Current queue changed mask */
145 WORD recursion_count
; /* SendMessage recursion counter */
146 WORD message_count
; /* Get/PeekMessage loop counter */
147 WORD hook_call_depth
; /* Number of recursively called hook procs */
148 WORD hook_unicode
; /* Is current hook unicode? */
149 HHOOK hook
; /* Current hook */
150 UINT active_hooks
; /* Bitmap of active hooks */
151 DPI_AWARENESS dpi_awareness
; /* DPI awareness */
152 INPUT_MESSAGE_SOURCE msg_source
; /* Message source for current message */
153 struct received_message_info
*receive_info
; /* Message being currently received */
154 struct wm_char_mapping_data
*wmchar_data
; /* Data for WM_CHAR mappings */
155 struct user_key_state_info
*key_state
; /* Cache of global key state */
156 HKL kbd_layout
; /* Current keyboard layout */
157 DWORD kbd_layout_id
; /* Current keyboard layout ID */
158 struct rawinput_thread_data
*rawinput
; /* RawInput thread local data / buffer */
159 UINT spy_indent
; /* Current spy indent */
162 C_ASSERT( sizeof(struct user_thread_info
) <= sizeof(((TEB
*)0)->Win32ClientInfo
) );
164 struct user_key_state_info
166 UINT time
; /* Time of last key state refresh */
167 INT counter
; /* Counter to invalidate the key state */
168 BYTE state
[256]; /* State for each key */
171 struct hook_extra_info
177 enum builtin_winprocs
190 /* unicode-only procs */
196 NB_BUILTIN_AW_WINPROCS
= WINPROC_DESKTOP
199 /* FIXME: make it private to menu.c */
201 /* Menu item structure */
202 typedef struct menu_item
204 /* ----------- MENUITEMINFO Stuff ----------- */
205 UINT fType
; /* Item type. */
206 UINT fState
; /* Item state. */
207 UINT_PTR wID
; /* Item id. */
208 HMENU hSubMenu
; /* Pop-up menu. */
209 HBITMAP hCheckBit
; /* Bitmap when checked. */
210 HBITMAP hUnCheckBit
; /* Bitmap when unchecked. */
211 LPWSTR text
; /* Item text. */
212 ULONG_PTR dwItemData
; /* Application defined. */
213 LPWSTR dwTypeData
; /* depends on fMask */
214 HBITMAP hbmpItem
; /* bitmap */
215 /* ----------- Wine stuff ----------- */
216 RECT rect
; /* Item area (relative to the items_rect),
217 * see MENU_AdjustMenuItemRect(). */
218 UINT xTab
; /* X position of text after Tab */
219 SIZE bmpsize
; /* size needed for the HBMMENU_CALLBACK bitmap */
224 struct user_object obj
;
225 WORD wFlags
; /* Menu flags (MF_POPUP, MF_SYSMENU) */
226 WORD Width
; /* Width of the whole menu */
227 WORD Height
; /* Height of the whole menu */
228 UINT nItems
; /* Number of items in the menu */
229 HWND hWnd
; /* Window containing the menu */
230 struct menu_item
*items
; /* Array of menu items */
231 UINT FocusedItem
; /* Currently focused item */
232 HWND hwndOwner
; /* window receiving the messages for ownerdraw */
233 BOOL bScrolling
; /* Scroll arrows are active */
234 UINT nScrollPos
; /* Current scroll position */
235 UINT nTotalHeight
; /* Total height of menu items inside menu */
236 RECT items_rect
; /* Rectangle within which the items lie. Excludes margins and scroll arrows */
238 /* ------------ MENUINFO members ------ */
239 DWORD dwStyle
; /* Extended menu style */
240 UINT cyMax
; /* max height of the whole menu, 0 is screen height */
241 HBRUSH hbrBack
; /* brush for menu background */
242 DWORD dwContextHelpID
;
243 ULONG_PTR dwMenuData
; /* application defined value */
244 HMENU hSysMenuOwner
; /* Handle to the dummy sys menu holder */
245 WORD textOffset
; /* Offset of text when items have both bitmaps and text */
246 } POPUPMENU
, *LPPOPUPMENU
;
248 /* FIXME: make it private to class.c */
249 typedef struct tagWINDOWPROC
251 WNDPROC procA
; /* ANSI window proc */
252 WNDPROC procW
; /* Unicode window proc */
255 #define WINPROC_HANDLE (~0u >> 16)
256 #define BUILTIN_WINPROC(index) ((WNDPROC)(ULONG_PTR)((index) | (WINPROC_HANDLE << 16)))
258 #define MAX_ATOM_LEN 255
260 /* Built-in class names (see _Undocumented_Windows_ p.418) */
261 #define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768) /* PopupMenu */
262 #define DESKTOP_CLASS_ATOM MAKEINTATOM(32769) /* Desktop */
263 #define DIALOG_CLASS_ATOM MAKEINTATOM(32770) /* Dialog */
264 #define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771) /* WinSwitch */
265 #define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772) /* IconTitle */
267 /* message spy definitions */
269 #define SPY_DISPATCHMESSAGE 0x0100
270 #define SPY_SENDMESSAGE 0x0101
271 #define SPY_DEFWNDPROC 0x0102
273 #define SPY_RESULT_OK 0x0001
274 #define SPY_RESULT_DEFWND 0x0002
276 /* info about the message currently being received by the current thread */
277 struct received_message_info
281 UINT flags
; /* InSendMessageEx return flags */
282 struct received_message_info
*prev
;
285 extern const char *debugstr_msg_name( UINT msg
, HWND hwnd
) DECLSPEC_HIDDEN
;
286 extern const char *debugstr_vkey_name( WPARAM wParam
) DECLSPEC_HIDDEN
;
287 extern void spy_enter_message( INT flag
, HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
288 extern void spy_exit_message( INT flag
, HWND hwnd
, UINT msg
,
289 LRESULT lreturn
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
292 WNDPROC
alloc_winproc( WNDPROC func
, BOOL ansi
) DECLSPEC_HIDDEN
;
293 WINDOWPROC
*get_winproc_ptr( WNDPROC handle
) DECLSPEC_HIDDEN
;
294 BOOL
is_winproc_unicode( WNDPROC proc
, BOOL def_val
) DECLSPEC_HIDDEN
;
295 DWORD
get_class_long( HWND hwnd
, INT offset
, BOOL ansi
) DECLSPEC_HIDDEN
;
296 WNDPROC
get_class_winproc( struct tagCLASS
*class ) DECLSPEC_HIDDEN
;
297 ULONG_PTR
get_class_long_ptr( HWND hwnd
, INT offset
, BOOL ansi
) DECLSPEC_HIDDEN
;
298 WORD
get_class_word( HWND hwnd
, INT offset
) DECLSPEC_HIDDEN
;
299 ATOM
get_int_atom_value( UNICODE_STRING
*name
) DECLSPEC_HIDDEN
;
300 WNDPROC
get_winproc( WNDPROC proc
, BOOL ansi
) DECLSPEC_HIDDEN
;
301 void get_winproc_params( struct win_proc_params
*params
) DECLSPEC_HIDDEN
;
302 struct dce
*get_class_dce( struct tagCLASS
*class ) DECLSPEC_HIDDEN
;
303 struct dce
*set_class_dce( struct tagCLASS
*class, struct dce
*dce
) DECLSPEC_HIDDEN
;
306 HICON
alloc_cursoricon_handle( BOOL is_icon
) DECLSPEC_HIDDEN
;
309 extern void free_dce( struct dce
*dce
, HWND hwnd
) DECLSPEC_HIDDEN
;
310 extern void invalidate_dce( WND
*win
, const RECT
*extra_rect
) DECLSPEC_HIDDEN
;
313 HANDLE
alloc_user_handle( struct user_object
*ptr
, unsigned int type
) DECLSPEC_HIDDEN
;
314 void *free_user_handle( HANDLE handle
, unsigned int type
) DECLSPEC_HIDDEN
;
315 void *get_user_handle_ptr( HANDLE handle
, unsigned int type
) DECLSPEC_HIDDEN
;
316 void release_user_handle_ptr( void *ptr
) DECLSPEC_HIDDEN
;
317 UINT
win_set_flags( HWND hwnd
, UINT set_mask
, UINT clear_mask
) DECLSPEC_HIDDEN
;
319 static inline UINT
win_get_flags( HWND hwnd
)
321 return win_set_flags( hwnd
, 0, 0 );
324 WND
*get_win_ptr( HWND hwnd
) DECLSPEC_HIDDEN
;
325 BOOL
is_child( HWND parent
, HWND child
);
326 BOOL
is_window( HWND hwnd
) DECLSPEC_HIDDEN
;
328 #endif /* __WINE_NTUSER_PRIVATE_H */