mfmediaengine: Handle B8G8R8X8 format for d3d11 texture output.
[wine.git] / dlls / user32 / user_private.h
blob7c4d901597671c827c0270655cd272ac13677a25
1 /*
2 * USER private definitions
4 * Copyright 1993 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_USER_PRIVATE_H
22 #define __WINE_USER_PRIVATE_H
24 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "winreg.h"
30 #include "winternl.h"
31 #include "hidusage.h"
32 #include "wine/heap.h"
34 #define GET_WORD(ptr) (*(const WORD *)(ptr))
35 #define GET_DWORD(ptr) (*(const DWORD *)(ptr))
36 #define GET_LONG(ptr) (*(const LONG *)(ptr))
38 #define WM_SYSTIMER 0x0118
39 #define WM_POPUPSYSTEMMENU 0x0313
41 #define WINE_MOUSE_HANDLE ((HANDLE)1)
42 #define WINE_KEYBOARD_HANDLE ((HANDLE)2)
44 struct window_surface;
46 /* internal messages codes */
47 enum wine_internal_message
49 WM_WINE_DESTROYWINDOW = 0x80000000,
50 WM_WINE_SETWINDOWPOS,
51 WM_WINE_SHOWWINDOW,
52 WM_WINE_SETPARENT,
53 WM_WINE_SETWINDOWLONG,
54 WM_WINE_SETSTYLE,
55 WM_WINE_SETACTIVEWINDOW,
56 WM_WINE_KEYBOARD_LL_HOOK,
57 WM_WINE_MOUSE_LL_HOOK,
58 WM_WINE_CLIPCURSOR,
59 WM_WINE_UPDATEWINDOWSTATE,
60 WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */
61 WM_WINE_LAST_DRIVER_MSG = 0x80001fff
64 typedef struct tagUSER_DRIVER {
65 /* keyboard functions */
66 BOOL (CDECL *pActivateKeyboardLayout)(HKL, UINT);
67 void (CDECL *pBeep)(void);
68 INT (CDECL *pGetKeyNameText)(LONG, LPWSTR, INT);
69 UINT (CDECL *pGetKeyboardLayoutList)(INT, HKL *);
70 UINT (CDECL *pMapVirtualKeyEx)(UINT, UINT, HKL);
71 BOOL (CDECL *pRegisterHotKey)(HWND, UINT, UINT);
72 INT (CDECL *pToUnicodeEx)(UINT, UINT, const BYTE *, LPWSTR, int, UINT, HKL);
73 void (CDECL *pUnregisterHotKey)(HWND, UINT, UINT);
74 SHORT (CDECL *pVkKeyScanEx)(WCHAR, HKL);
75 /* cursor/icon functions */
76 void (CDECL *pDestroyCursorIcon)(HCURSOR);
77 void (CDECL *pSetCursor)(HCURSOR);
78 BOOL (CDECL *pGetCursorPos)(LPPOINT);
79 BOOL (CDECL *pSetCursorPos)(INT,INT);
80 BOOL (CDECL *pClipCursor)(LPCRECT);
81 /* clipboard functions */
82 void (CDECL *pUpdateClipboard)(void);
83 /* display modes */
84 LONG (CDECL *pChangeDisplaySettingsEx)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
85 BOOL (CDECL *pEnumDisplayMonitors)(HDC,LPRECT,MONITORENUMPROC,LPARAM);
86 BOOL (CDECL *pEnumDisplaySettingsEx)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
87 BOOL (CDECL *pGetMonitorInfo)(HMONITOR,MONITORINFO*);
88 /* windowing functions */
89 BOOL (CDECL *pCreateDesktopWindow)(HWND);
90 BOOL (CDECL *pCreateWindow)(HWND);
91 void (CDECL *pDestroyWindow)(HWND);
92 void (CDECL *pFlashWindowEx)(FLASHWINFO*);
93 void (CDECL *pGetDC)(HDC,HWND,HWND,const RECT *,const RECT *,DWORD);
94 DWORD (CDECL *pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
95 void (CDECL *pReleaseDC)(HWND,HDC);
96 BOOL (CDECL *pScrollDC)(HDC,INT,INT,HRGN);
97 void (CDECL *pSetCapture)(HWND,UINT);
98 void (CDECL *pSetFocus)(HWND);
99 void (CDECL *pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
100 void (CDECL *pSetParent)(HWND,HWND,HWND);
101 void (CDECL *pSetWindowRgn)(HWND,HRGN,BOOL);
102 void (CDECL *pSetWindowIcon)(HWND,UINT,HICON);
103 void (CDECL *pSetWindowStyle)(HWND,INT,STYLESTRUCT*);
104 void (CDECL *pSetWindowText)(HWND,LPCWSTR);
105 UINT (CDECL *pShowWindow)(HWND,INT,RECT*,UINT);
106 LRESULT (CDECL *pSysCommand)(HWND,WPARAM,LPARAM);
107 BOOL (CDECL *pUpdateLayeredWindow)(HWND,const UPDATELAYEREDWINDOWINFO *,const RECT *);
108 LRESULT (CDECL *pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
109 BOOL (CDECL *pWindowPosChanging)(HWND,HWND,UINT,const RECT *,const RECT *,RECT *,struct window_surface**);
110 void (CDECL *pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *,const RECT *,struct window_surface*);
111 /* system parameters */
112 BOOL (CDECL *pSystemParametersInfo)(UINT,UINT,void*,UINT);
113 /* thread management */
114 void (CDECL *pThreadDetach)(void);
115 } USER_DRIVER;
117 extern const USER_DRIVER *USER_Driver DECLSPEC_HIDDEN;
119 extern void USER_unload_driver(void) DECLSPEC_HIDDEN;
121 extern BOOL CDECL nulldrv_EnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp ) DECLSPEC_HIDDEN;
122 extern BOOL CDECL nulldrv_GetMonitorInfo( HMONITOR handle, MONITORINFO *info ) DECLSPEC_HIDDEN;
124 struct received_message_info;
126 enum user_obj_type
128 USER_WINDOW = 1, /* window */
129 USER_MENU, /* menu */
130 USER_ACCEL, /* accelerator */
131 USER_ICON, /* icon or cursor */
132 USER_DWP /* DeferWindowPos structure */
135 struct user_object
137 HANDLE handle;
138 enum user_obj_type type;
141 #define OBJ_OTHER_PROCESS ((void *)1) /* returned by get_user_handle_ptr on unknown handles */
143 HANDLE alloc_user_handle( struct user_object *ptr, enum user_obj_type type ) DECLSPEC_HIDDEN;
144 void *get_user_handle_ptr( HANDLE handle, enum user_obj_type type ) DECLSPEC_HIDDEN;
145 void release_user_handle_ptr( void *ptr ) DECLSPEC_HIDDEN;
146 void *free_user_handle( HANDLE handle, enum user_obj_type type ) DECLSPEC_HIDDEN;
148 /* type of message-sending functions that need special WM_CHAR handling */
149 enum wm_char_mapping
151 WMCHAR_MAP_POSTMESSAGE,
152 WMCHAR_MAP_SENDMESSAGE,
153 WMCHAR_MAP_SENDMESSAGETIMEOUT,
154 WMCHAR_MAP_RECVMESSAGE,
155 WMCHAR_MAP_DISPATCHMESSAGE,
156 WMCHAR_MAP_CALLWINDOWPROC,
157 WMCHAR_MAP_COUNT,
158 WMCHAR_MAP_NOMAPPING = WMCHAR_MAP_COUNT
161 /* data to store state for A/W mappings of WM_CHAR */
162 struct wm_char_mapping_data
164 BYTE lead_byte[WMCHAR_MAP_COUNT];
165 MSG get_msg;
168 /* on windows the buffer capacity is quite large as well, enough to */
169 /* hold up to 10s of 1kHz mouse rawinput events */
170 #define RAWINPUT_BUFFER_SIZE (512*1024)
172 struct rawinput_thread_data
174 UINT hw_id; /* current rawinput message id */
175 RAWINPUT buffer[1]; /* rawinput message data buffer */
178 /* this is the structure stored in TEB->Win32ClientInfo */
179 /* no attempt is made to keep the layout compatible with the Windows one */
180 struct user_thread_info
182 HANDLE server_queue; /* Handle to server-side queue */
183 DWORD wake_mask; /* Current queue wake mask */
184 DWORD changed_mask; /* Current queue changed mask */
185 WORD recursion_count; /* SendMessage recursion counter */
186 WORD message_count; /* Get/PeekMessage loop counter */
187 WORD hook_call_depth; /* Number of recursively called hook procs */
188 WORD hook_unicode; /* Is current hook unicode? */
189 HHOOK hook; /* Current hook */
190 UINT active_hooks; /* Bitmap of active hooks */
191 DPI_AWARENESS dpi_awareness; /* DPI awareness */
192 INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */
193 struct received_message_info *receive_info; /* Message being currently received */
194 struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */
195 DWORD GetMessageTimeVal; /* Value for GetMessageTime */
196 DWORD GetMessagePosVal; /* Value for GetMessagePos */
197 ULONG_PTR GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
198 struct user_key_state_info *key_state; /* Cache of global key state */
199 HKL kbd_layout; /* Current keyboard layout */
200 DWORD kbd_layout_id; /* Current keyboard layout ID */
201 HWND top_window; /* Desktop window */
202 HWND msg_window; /* HWND_MESSAGE parent window */
203 struct rawinput_thread_data *rawinput; /* RawInput thread local data / buffer */
206 C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo) );
208 extern INT global_key_state_counter DECLSPEC_HIDDEN;
209 extern BOOL (WINAPI *imm_register_window)(HWND) DECLSPEC_HIDDEN;
210 extern void (WINAPI *imm_unregister_window)(HWND) DECLSPEC_HIDDEN;
212 struct user_key_state_info
214 UINT time; /* Time of last key state refresh */
215 INT counter; /* Counter to invalidate the key state */
216 BYTE state[256]; /* State for each key */
219 struct hook_extra_info
221 HHOOK handle;
222 LPARAM lparam;
225 static inline struct user_thread_info *get_user_thread_info(void)
227 return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo;
230 /* check if hwnd is a broadcast magic handle */
231 static inline BOOL is_broadcast( HWND hwnd )
233 return (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST);
236 extern HMODULE user32_module DECLSPEC_HIDDEN;
238 struct dce;
239 struct tagWND;
241 struct hardware_msg_data;
242 extern BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data);
243 extern BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage);
244 extern struct rawinput_thread_data *rawinput_thread_data(void);
246 extern void keyboard_init(void) DECLSPEC_HIDDEN;
247 extern void create_offscreen_window_surface( const RECT *visible_rect, struct window_surface **surface ) DECLSPEC_HIDDEN;
249 extern void CLIPBOARD_ReleaseOwner( HWND hwnd ) DECLSPEC_HIDDEN;
250 extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN;
251 extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECLSPEC_HIDDEN;
252 extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN;
253 extern void invalidate_dce( struct tagWND *win, const RECT *rect ) DECLSPEC_HIDDEN;
254 extern HDC get_display_dc(void) DECLSPEC_HIDDEN;
255 extern void release_display_dc( HDC hdc ) DECLSPEC_HIDDEN;
256 extern void erase_now( HWND hwnd, UINT rdw_flags ) DECLSPEC_HIDDEN;
257 extern void move_window_bits( HWND hwnd, struct window_surface *old_surface,
258 struct window_surface *new_surface,
259 const RECT *visible_rect, const RECT *old_visible_rect,
260 const RECT *window_rect, const RECT *valid_rects ) DECLSPEC_HIDDEN;
261 extern void move_window_bits_parent( HWND hwnd, HWND parent, const RECT *window_rect,
262 const RECT *valid_rects ) DECLSPEC_HIDDEN;
263 extern void update_window_state( HWND hwnd ) DECLSPEC_HIDDEN;
264 extern void wait_graphics_driver_ready(void) DECLSPEC_HIDDEN;
265 extern void *get_hook_proc( void *proc, const WCHAR *module, HMODULE *free_module ) DECLSPEC_HIDDEN;
266 extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;
267 extern RECT get_primary_monitor_rect(void) DECLSPEC_HIDDEN;
268 extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
269 extern DWORD get_input_codepage( void ) DECLSPEC_HIDDEN;
270 extern BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
271 extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput, UINT flags ) DECLSPEC_HIDDEN;
272 extern LRESULT MSG_SendInternalMessageTimeout( DWORD dest_pid, DWORD dest_tid,
273 UINT msg, WPARAM wparam, LPARAM lparam,
274 UINT flags, UINT timeout, PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN;
275 extern HPEN SYSCOLOR_GetPen( INT index ) DECLSPEC_HIDDEN;
276 extern HBRUSH SYSCOLOR_Get55AABrush(void) DECLSPEC_HIDDEN;
277 extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN;
278 extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
279 extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN;
281 extern BOOL USER_SetWindowPos( WINDOWPOS * winpos, int parent_x, int parent_y ) DECLSPEC_HIDDEN;
283 typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
284 LRESULT *result, void *arg );
286 extern WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode ) DECLSPEC_HIDDEN;
287 extern WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode ) DECLSPEC_HIDDEN;
288 extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val ) DECLSPEC_HIDDEN;
290 extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
291 WPARAM wParam, LPARAM lParam, LRESULT *result, void *arg,
292 enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
294 extern INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
295 extern INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
296 extern BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
297 LRESULT *result, BOOL unicode, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
299 extern const WCHAR *CLASS_GetVersionedName(const WCHAR *classname, UINT *basename_offset,
300 WCHAR *combined, BOOL register_class) DECLSPEC_HIDDEN;
302 /* message spy definitions */
304 #define SPY_DISPATCHMESSAGE 0x0100
305 #define SPY_SENDMESSAGE 0x0101
306 #define SPY_DEFWNDPROC 0x0102
308 #define SPY_RESULT_OK 0x0001
309 #define SPY_RESULT_DEFWND 0x0002
311 extern const char *SPY_GetClassLongOffsetName( INT offset ) DECLSPEC_HIDDEN;
312 extern const char *SPY_GetMsgName( UINT msg, HWND hWnd ) DECLSPEC_HIDDEN;
313 extern const char *SPY_GetVKeyName(WPARAM wParam) DECLSPEC_HIDDEN;
314 extern void SPY_EnterMessage( INT iFlag, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
315 extern void SPY_ExitMessage( INT iFlag, HWND hwnd, UINT msg,
316 LRESULT lReturn, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
318 #include "pshpack1.h"
320 typedef struct
322 BYTE bWidth;
323 BYTE bHeight;
324 BYTE bColorCount;
325 BYTE bReserved;
326 } ICONRESDIR;
328 typedef struct
330 WORD wWidth;
331 WORD wHeight;
332 } CURSORDIR;
334 typedef struct
335 { union
336 { ICONRESDIR icon;
337 CURSORDIR cursor;
338 } ResInfo;
339 WORD wPlanes;
340 WORD wBitCount;
341 DWORD dwBytesInRes;
342 WORD wResId;
343 } CURSORICONDIRENTRY;
345 typedef struct
347 WORD idReserved;
348 WORD idType;
349 WORD idCount;
350 CURSORICONDIRENTRY idEntries[1];
351 } CURSORICONDIR;
353 typedef struct {
354 BYTE bWidth;
355 BYTE bHeight;
356 BYTE bColorCount;
357 BYTE bReserved;
358 WORD xHotspot;
359 WORD yHotspot;
360 DWORD dwDIBSize;
361 DWORD dwDIBOffset;
362 } CURSORICONFILEDIRENTRY;
364 typedef struct
366 WORD idReserved;
367 WORD idType;
368 WORD idCount;
369 CURSORICONFILEDIRENTRY idEntries[1];
370 } CURSORICONFILEDIR;
372 #include "poppack.h"
374 extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN;
375 extern BOOL get_icon_size( HICON handle, SIZE *size ) DECLSPEC_HIDDEN;
377 struct png_funcs
379 BOOL (CDECL *get_png_info)(const void *png_data, DWORD size, int *width, int *height, int *bpp);
380 BITMAPINFO * (CDECL *load_png)(const char *png_data, DWORD *size);
383 /* Mingw's assert() imports MessageBoxA and gets confused by user32 exporting it */
384 #ifdef __MINGW32__
385 #undef assert
386 #define assert(expr) ((void)0)
387 #endif
389 extern struct user_api_hook *user_api DECLSPEC_HIDDEN;
390 LRESULT WINAPI USER_DefDlgProc(HWND, UINT, WPARAM, LPARAM, BOOL) DECLSPEC_HIDDEN;
391 LRESULT WINAPI USER_ScrollBarProc(HWND, UINT, WPARAM, LPARAM, BOOL) DECLSPEC_HIDDEN;
392 void WINAPI USER_ScrollBarDraw(HWND, HDC, INT, enum SCROLL_HITTEST,
393 const struct SCROLL_TRACKING_INFO *, BOOL, BOOL, RECT *, INT, INT,
394 INT, BOOL) DECLSPEC_HIDDEN;
396 #endif /* __WINE_USER_PRIVATE_H */