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"
33 BOOL (WINAPI
*pAdjustWindowRectEx
)( RECT
*, DWORD
, BOOL
, DWORD
);
34 HANDLE (WINAPI
*pCopyImage
)( HANDLE
, UINT
, INT
, INT
, UINT
);
35 BOOL (WINAPI
*pDestroyCaret
)(void);
36 BOOL (WINAPI
*pEndMenu
)(void);
37 BOOL (WINAPI
*pHideCaret
)( HWND hwnd
);
38 BOOL (WINAPI
*pPostMessageW
)( HWND
, UINT
, WPARAM
, LPARAM
);
39 UINT (WINAPI
*pSendInput
)( UINT count
, INPUT
*inputs
, int size
);
40 LRESULT (WINAPI
*pSendMessageTimeoutW
)( HWND
, UINT
, WPARAM
, LPARAM
, UINT
, UINT
, PDWORD_PTR
);
41 LRESULT (WINAPI
*pSendMessageA
)( HWND
, UINT
, WPARAM
, LPARAM
);
42 LRESULT (WINAPI
*pSendMessageW
)( HWND
, UINT
, WPARAM
, LPARAM
);
43 BOOL (WINAPI
*pSendNotifyMessageW
)( HWND
, UINT
, WPARAM
, LPARAM
);
44 BOOL (WINAPI
*pSetSystemMenu
)( HWND hwnd
, HMENU menu
);
45 BOOL (WINAPI
*pShowCaret
)( HWND hwnd
);
46 DWORD (WINAPI
*pWaitForInputIdle
)( HANDLE
, DWORD
);
47 void (CDECL
*free_menu_items
)( void *ptr
);
48 void (CDECL
*free_win_ptr
)( struct tagWND
*win
);
49 HWND (CDECL
*is_menu_active
)(void);
50 void (CDECL
*notify_ime
)( HWND hwnd
, UINT param
);
51 void (CDECL
*register_builtin_classes
)(void);
52 LRESULT (WINAPI
*send_ll_message
)( DWORD
, DWORD
, UINT
, WPARAM
, LPARAM
, UINT
, UINT
, PDWORD_PTR
);
53 BOOL (CDECL
*set_menu
)( HWND hwnd
, HMENU menu
);
54 void (WINAPI
*set_standard_scroll_painted
)( HWND hwnd
, INT bar
, BOOL visible
);
55 void (CDECL
*set_user_driver
)( void *, UINT
);
56 BOOL (WINAPI
*register_imm
)( HWND hwnd
);
57 void (WINAPI
*unregister_imm
)( HWND hwnd
);
60 #define WM_SYSTIMER 0x0118
61 #define WM_POPUPSYSTEMMENU 0x0313
69 #define OBJ_OTHER_PROCESS ((void *)1) /* returned by get_user_handle_ptr on unknown handles */
71 HANDLE
alloc_user_handle( struct user_object
*ptr
, unsigned int type
) DECLSPEC_HIDDEN
;
72 void *get_user_handle_ptr( HANDLE handle
, unsigned int type
) DECLSPEC_HIDDEN
;
73 void release_user_handle_ptr( void *ptr
) DECLSPEC_HIDDEN
;
74 void *free_user_handle( HANDLE handle
, unsigned int type
) DECLSPEC_HIDDEN
;
78 struct user_object obj
; /* object header */
79 HWND parent
; /* Window parent */
80 HWND owner
; /* Window owner */
81 struct tagCLASS
*class; /* Window class */
82 struct dce
*dce
; /* DCE pointer */
83 WNDPROC winproc
; /* Window procedure */
84 DWORD tid
; /* Owner thread id */
85 HINSTANCE hInstance
; /* Window hInstance (from CreateWindow) */
86 RECT client_rect
; /* Client area rel. to parent client area */
87 RECT window_rect
; /* Whole window rel. to parent client area */
88 RECT visible_rect
; /* Visible part of the whole rect, rel. to parent client area */
89 RECT normal_rect
; /* Normal window rect saved when maximized/minimized */
90 POINT min_pos
; /* Position for minimized window */
91 POINT max_pos
; /* Position for maximized window */
92 WCHAR
*text
; /* Window text */
93 void *pScroll
; /* Scroll-bar info */
94 DWORD dwStyle
; /* Window style (from CreateWindow) */
95 DWORD dwExStyle
; /* Extended style (from CreateWindowEx) */
96 UINT_PTR wIDmenu
; /* ID or hmenu (from CreateWindow) */
97 DWORD helpContext
; /* Help context ID */
98 UINT flags
; /* Misc. flags (see below) */
99 HMENU hSysMenu
; /* window's copy of System Menu */
100 HICON hIcon
; /* window's icon */
101 HICON hIconSmall
; /* window's small icon */
102 HICON hIconSmall2
; /* window's secondary small icon, derived from hIcon */
103 UINT dpi
; /* window DPI */
104 DPI_AWARENESS dpi_awareness
; /* DPI awareness */
105 struct window_surface
*surface
; /* Window surface if any */
106 struct tagDIALOGINFO
*dlgInfo
; /* Dialog additional info (dialogs only) */
107 int pixel_format
; /* Pixel format set by the graphics driver */
108 int cbWndExtra
; /* class cbWndExtra at window creation */
109 DWORD_PTR userdata
; /* User private data */
110 DWORD wExtra
[1]; /* Window extra bytes */
113 /* WND flags values */
114 #define WIN_RESTORE_MAX 0x0001 /* Maximize when restoring */
115 #define WIN_NEED_SIZE 0x0002 /* Internal WM_SIZE is needed */
116 #define WIN_NCACTIVATED 0x0004 /* last WM_NCACTIVATE was positive */
117 #define WIN_ISMDICLIENT 0x0008 /* Window is an MDIClient */
118 #define WIN_ISUNICODE 0x0010 /* Window is Unicode */
119 #define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0020 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
120 #define WIN_CHILDREN_MOVED 0x0040 /* children may have moved, ignore stored positions */
121 #define WIN_HAS_IME_WIN 0x0080 /* the window has been registered with imm32 */
123 #define WND_OTHER_PROCESS ((WND *)1) /* returned by WIN_GetPtr on unknown window handles */
124 #define WND_DESKTOP ((WND *)2) /* returned by WIN_GetPtr on the desktop window */
126 /* check if hwnd is a broadcast magic handle */
127 static inline BOOL
is_broadcast( HWND hwnd
)
129 return hwnd
== HWND_BROADCAST
|| hwnd
== HWND_TOPMOST
;
132 #define WM_IME_INTERNAL 0x287
133 #define IME_INTERNAL_ACTIVATE 0x17
134 #define IME_INTERNAL_DEACTIVATE 0x18
136 /* this is the structure stored in TEB->Win32ClientInfo */
137 /* no attempt is made to keep the layout compatible with the Windows one */
138 struct user_thread_info
140 HANDLE server_queue
; /* Handle to server-side queue */
141 DWORD wake_mask
; /* Current queue wake mask */
142 DWORD changed_mask
; /* Current queue changed mask */
143 WORD recursion_count
; /* SendMessage recursion counter */
144 WORD message_count
; /* Get/PeekMessage loop counter */
145 WORD hook_call_depth
; /* Number of recursively called hook procs */
146 WORD hook_unicode
; /* Is current hook unicode? */
147 HHOOK hook
; /* Current hook */
148 UINT active_hooks
; /* Bitmap of active hooks */
149 DPI_AWARENESS dpi_awareness
; /* DPI awareness */
150 INPUT_MESSAGE_SOURCE msg_source
; /* Message source for current message */
151 struct received_message_info
*receive_info
; /* Message being currently received */
152 struct wm_char_mapping_data
*wmchar_data
; /* Data for WM_CHAR mappings */
153 DWORD GetMessageTimeVal
; /* Value for GetMessageTime */
154 DWORD GetMessagePosVal
; /* Value for GetMessagePos */
155 ULONG_PTR GetMessageExtraInfoVal
; /* Value for GetMessageExtraInfo */
156 struct user_key_state_info
*key_state
; /* Cache of global key state */
157 HKL kbd_layout
; /* Current keyboard layout */
158 DWORD kbd_layout_id
; /* Current keyboard layout ID */
159 HWND top_window
; /* Desktop window */
160 HWND msg_window
; /* HWND_MESSAGE parent window */
161 struct rawinput_thread_data
*rawinput
; /* RawInput thread local data / buffer */
162 UINT spy_indent
; /* Current spy indent */
165 C_ASSERT( sizeof(struct user_thread_info
) <= sizeof(((TEB
*)0)->Win32ClientInfo
) );
167 struct user_key_state_info
169 UINT time
; /* Time of last key state refresh */
170 INT counter
; /* Counter to invalidate the key state */
171 BYTE state
[256]; /* State for each key */
174 struct hook_extra_info
180 enum builtin_winprocs
193 /* unicode-only procs */
199 NB_BUILTIN_AW_WINPROCS
= WINPROC_DESKTOP
204 /* FIXME: make it private to menu.c */
207 struct user_object obj
;
208 WORD wFlags
; /* Menu flags (MF_POPUP, MF_SYSMENU) */
209 WORD Width
; /* Width of the whole menu */
210 WORD Height
; /* Height of the whole menu */
211 UINT nItems
; /* Number of items in the menu */
212 HWND hWnd
; /* Window containing the menu */
213 struct menu_item
*items
; /* Array of menu items */
214 UINT FocusedItem
; /* Currently focused item */
215 HWND hwndOwner
; /* window receiving the messages for ownerdraw */
216 BOOL bScrolling
; /* Scroll arrows are active */
217 UINT nScrollPos
; /* Current scroll position */
218 UINT nTotalHeight
; /* Total height of menu items inside menu */
219 RECT items_rect
; /* Rectangle within which the items lie. Excludes margins and scroll arrows */
221 /* ------------ MENUINFO members ------ */
222 DWORD dwStyle
; /* Extended menu style */
223 UINT cyMax
; /* max height of the whole menu, 0 is screen height */
224 HBRUSH hbrBack
; /* brush for menu background */
225 DWORD dwContextHelpID
;
226 ULONG_PTR dwMenuData
; /* application defined value */
227 HMENU hSysMenuOwner
; /* Handle to the dummy sys menu holder */
228 WORD textOffset
; /* Offset of text when items have both bitmaps and text */
229 } POPUPMENU
, *LPPOPUPMENU
;
231 /* FIXME: make it private to class.c */
232 typedef struct tagWINDOWPROC
234 WNDPROC procA
; /* ANSI window proc */
235 WNDPROC procW
; /* Unicode window proc */
238 #define WINPROC_HANDLE (~0u >> 16)
239 #define BUILTIN_WINPROC(index) ((WNDPROC)(ULONG_PTR)((index) | (WINPROC_HANDLE << 16)))
241 #define MAX_ATOM_LEN 255
243 /* Built-in class names (see _Undocumented_Windows_ p.418) */
244 #define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768) /* PopupMenu */
245 #define DESKTOP_CLASS_ATOM MAKEINTATOM(32769) /* Desktop */
246 #define DIALOG_CLASS_ATOM MAKEINTATOM(32770) /* Dialog */
247 #define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771) /* WinSwitch */
248 #define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772) /* IconTitle */
250 /* message spy definitions */
252 #define SPY_DISPATCHMESSAGE 0x0100
253 #define SPY_SENDMESSAGE 0x0101
254 #define SPY_DEFWNDPROC 0x0102
256 #define SPY_RESULT_OK 0x0001
257 #define SPY_RESULT_DEFWND 0x0002
259 /* info about the message currently being received by the current thread */
260 struct received_message_info
264 UINT flags
; /* InSendMessageEx return flags */
265 struct received_message_info
*prev
;
268 extern const char *debugstr_msg_name( UINT msg
, HWND hwnd
) DECLSPEC_HIDDEN
;
269 extern const char *debugstr_vkey_name( WPARAM wParam
) DECLSPEC_HIDDEN
;
270 extern void spy_enter_message( INT flag
, HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
271 extern void spy_exit_message( INT flag
, HWND hwnd
, UINT msg
,
272 LRESULT lreturn
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
275 WNDPROC
alloc_winproc( WNDPROC func
, BOOL ansi
) DECLSPEC_HIDDEN
;
276 WINDOWPROC
*get_winproc_ptr( WNDPROC handle
) DECLSPEC_HIDDEN
;
277 BOOL
is_winproc_unicode( WNDPROC proc
, BOOL def_val
) DECLSPEC_HIDDEN
;
278 DWORD
get_class_long( HWND hwnd
, INT offset
, BOOL ansi
) DECLSPEC_HIDDEN
;
279 WNDPROC
get_class_winproc( struct tagCLASS
*class ) DECLSPEC_HIDDEN
;
280 ULONG_PTR
get_class_long_ptr( HWND hwnd
, INT offset
, BOOL ansi
) DECLSPEC_HIDDEN
;
281 WORD
get_class_word( HWND hwnd
, INT offset
) DECLSPEC_HIDDEN
;
282 ATOM
get_int_atom_value( UNICODE_STRING
*name
) DECLSPEC_HIDDEN
;
283 WNDPROC
get_winproc( WNDPROC proc
, BOOL ansi
) DECLSPEC_HIDDEN
;
284 void get_winproc_params( struct win_proc_params
*params
) DECLSPEC_HIDDEN
;
285 struct dce
*get_class_dce( struct tagCLASS
*class ) DECLSPEC_HIDDEN
;
286 struct dce
*set_class_dce( struct tagCLASS
*class, struct dce
*dce
) DECLSPEC_HIDDEN
;
289 HICON
alloc_cursoricon_handle( BOOL is_icon
) DECLSPEC_HIDDEN
;
292 extern void free_dce( struct dce
*dce
, HWND hwnd
) DECLSPEC_HIDDEN
;
293 extern void invalidate_dce( WND
*win
, const RECT
*extra_rect
) DECLSPEC_HIDDEN
;
296 LRESULT
handle_internal_message( HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
299 HANDLE
alloc_user_handle( struct user_object
*ptr
, unsigned int type
) DECLSPEC_HIDDEN
;
300 void *free_user_handle( HANDLE handle
, unsigned int type
) DECLSPEC_HIDDEN
;
301 void *get_user_handle_ptr( HANDLE handle
, unsigned int type
) DECLSPEC_HIDDEN
;
302 void release_user_handle_ptr( void *ptr
) DECLSPEC_HIDDEN
;
303 UINT
win_set_flags( HWND hwnd
, UINT set_mask
, UINT clear_mask
) DECLSPEC_HIDDEN
;
305 static inline UINT
win_get_flags( HWND hwnd
)
307 return win_set_flags( hwnd
, 0, 0 );
310 WND
*get_win_ptr( HWND hwnd
) DECLSPEC_HIDDEN
;
311 BOOL
is_child( HWND parent
, HWND child
);
312 BOOL
is_window( HWND hwnd
) DECLSPEC_HIDDEN
;
314 #endif /* __WINE_NTUSER_PRIVATE_H */