qasf: Build without -DWINE_NO_LONG_TYPES.
[wine.git] / dlls / user32 / user_private.h
blob9e65e9f1f66c4536e30d8f57a9c8cb7edf027c10
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 "ntuser.h"
29 #include "winreg.h"
30 #include "winternl.h"
31 #include "hidusage.h"
32 #include "wine/gdi_driver.h"
33 #include "wine/heap.h"
35 #define GET_WORD(ptr) (*(const WORD *)(ptr))
36 #define GET_DWORD(ptr) (*(const DWORD *)(ptr))
37 #define GET_LONG(ptr) (*(const LONG *)(ptr))
39 #define WM_SYSTIMER 0x0118
40 #define WM_POPUPSYSTEMMENU 0x0313
42 #define WINE_MOUSE_HANDLE ((HANDLE)1)
43 #define WINE_KEYBOARD_HANDLE ((HANDLE)2)
45 struct window_surface;
47 /* internal messages codes */
48 enum wine_internal_message
50 WM_WINE_DESTROYWINDOW = 0x80000000,
51 WM_WINE_SETWINDOWPOS,
52 WM_WINE_SHOWWINDOW,
53 WM_WINE_SETPARENT,
54 WM_WINE_SETWINDOWLONG,
55 WM_WINE_SETSTYLE,
56 WM_WINE_SETACTIVEWINDOW,
57 WM_WINE_KEYBOARD_LL_HOOK,
58 WM_WINE_MOUSE_LL_HOOK,
59 WM_WINE_CLIPCURSOR,
60 WM_WINE_UPDATEWINDOWSTATE,
61 WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */
62 WM_WINE_LAST_DRIVER_MSG = 0x80001fff
65 extern const struct user_driver_funcs *USER_Driver DECLSPEC_HIDDEN;
67 extern void USER_unload_driver(void) DECLSPEC_HIDDEN;
69 struct received_message_info;
71 enum user_obj_type
73 USER_WINDOW = 1, /* window */
74 USER_MENU, /* menu */
75 USER_ACCEL, /* accelerator */
76 USER_ICON, /* icon or cursor */
77 USER_DWP /* DeferWindowPos structure */
80 struct user_object
82 HANDLE handle;
83 enum user_obj_type type;
86 #define OBJ_OTHER_PROCESS ((void *)1) /* returned by get_user_handle_ptr on unknown handles */
88 HANDLE alloc_user_handle( struct user_object *ptr, enum user_obj_type type ) DECLSPEC_HIDDEN;
89 void *get_user_handle_ptr( HANDLE handle, enum user_obj_type type ) DECLSPEC_HIDDEN;
90 void release_user_handle_ptr( void *ptr ) DECLSPEC_HIDDEN;
91 void *free_user_handle( HANDLE handle, enum user_obj_type type ) DECLSPEC_HIDDEN;
93 /* type of message-sending functions that need special WM_CHAR handling */
94 enum wm_char_mapping
96 WMCHAR_MAP_POSTMESSAGE,
97 WMCHAR_MAP_SENDMESSAGE,
98 WMCHAR_MAP_SENDMESSAGETIMEOUT,
99 WMCHAR_MAP_RECVMESSAGE,
100 WMCHAR_MAP_DISPATCHMESSAGE,
101 WMCHAR_MAP_CALLWINDOWPROC,
102 WMCHAR_MAP_COUNT,
103 WMCHAR_MAP_NOMAPPING = WMCHAR_MAP_COUNT
106 /* data to store state for A/W mappings of WM_CHAR */
107 struct wm_char_mapping_data
109 BYTE lead_byte[WMCHAR_MAP_COUNT];
110 MSG get_msg;
113 /* on windows the buffer capacity is quite large as well, enough to */
114 /* hold up to 10s of 1kHz mouse rawinput events */
115 #define RAWINPUT_BUFFER_SIZE (512*1024)
117 struct rawinput_thread_data
119 UINT hw_id; /* current rawinput message id */
120 RAWINPUT buffer[1]; /* rawinput message data buffer */
123 extern LONG global_key_state_counter DECLSPEC_HIDDEN;
124 extern BOOL (WINAPI *imm_register_window)(HWND) DECLSPEC_HIDDEN;
125 extern void (WINAPI *imm_unregister_window)(HWND) DECLSPEC_HIDDEN;
126 #define WM_IME_INTERNAL 0x287
127 #define IME_INTERNAL_ACTIVATE 0x17
128 #define IME_INTERNAL_DEACTIVATE 0x18
130 struct user_key_state_info
132 UINT time; /* Time of last key state refresh */
133 INT counter; /* Counter to invalidate the key state */
134 BYTE state[256]; /* State for each key */
137 struct hook_extra_info
139 HHOOK handle;
140 LPARAM lparam;
143 static inline struct user_thread_info *get_user_thread_info(void)
145 return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo;
148 /* check if hwnd is a broadcast magic handle */
149 static inline BOOL is_broadcast( HWND hwnd )
151 return (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST);
154 extern HMODULE user32_module DECLSPEC_HIDDEN;
156 struct dce;
157 struct tagWND;
159 struct hardware_msg_data;
160 extern BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data);
161 extern BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage);
162 extern struct rawinput_thread_data *rawinput_thread_data(void);
163 extern void rawinput_update_device_list(void);
165 extern void create_offscreen_window_surface( const RECT *visible_rect, struct window_surface **surface ) DECLSPEC_HIDDEN;
167 extern void CLIPBOARD_ReleaseOwner( HWND hwnd ) DECLSPEC_HIDDEN;
168 extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN;
169 extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECLSPEC_HIDDEN;
170 extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN;
171 extern void invalidate_dce( struct tagWND *win, const RECT *rect ) DECLSPEC_HIDDEN;
172 extern HDC get_display_dc(void) DECLSPEC_HIDDEN;
173 extern void release_display_dc( HDC hdc ) DECLSPEC_HIDDEN;
174 extern void erase_now( HWND hwnd, UINT rdw_flags ) DECLSPEC_HIDDEN;
175 extern void move_window_bits( HWND hwnd, struct window_surface *old_surface,
176 struct window_surface *new_surface,
177 const RECT *visible_rect, const RECT *old_visible_rect,
178 const RECT *window_rect, const RECT *valid_rects ) DECLSPEC_HIDDEN;
179 extern void move_window_bits_parent( HWND hwnd, HWND parent, const RECT *window_rect,
180 const RECT *valid_rects ) DECLSPEC_HIDDEN;
181 extern void update_window_state( HWND hwnd ) DECLSPEC_HIDDEN;
182 extern void wait_graphics_driver_ready(void) DECLSPEC_HIDDEN;
183 extern void *get_hook_proc( void *proc, const WCHAR *module, HMODULE *free_module ) DECLSPEC_HIDDEN;
184 extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;
185 extern RECT get_primary_monitor_rect(void) DECLSPEC_HIDDEN;
186 extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
187 extern DWORD get_input_codepage( void ) DECLSPEC_HIDDEN;
188 extern BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
189 extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput, UINT flags ) DECLSPEC_HIDDEN;
190 extern LRESULT MSG_SendInternalMessageTimeout( DWORD dest_pid, DWORD dest_tid,
191 UINT msg, WPARAM wparam, LPARAM lparam,
192 UINT flags, UINT timeout, PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN;
193 extern HPEN SYSCOLOR_GetPen( INT index ) DECLSPEC_HIDDEN;
194 extern HBRUSH SYSCOLOR_Get55AABrush(void) DECLSPEC_HIDDEN;
195 extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN;
196 extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
197 extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN;
199 extern BOOL USER_SetWindowPos( WINDOWPOS * winpos, int parent_x, int parent_y ) DECLSPEC_HIDDEN;
201 typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
202 LRESULT *result, void *arg );
204 extern WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode ) DECLSPEC_HIDDEN;
205 extern WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode ) DECLSPEC_HIDDEN;
206 extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val ) DECLSPEC_HIDDEN;
208 extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
209 WPARAM wParam, LPARAM lParam, LRESULT *result, void *arg,
210 enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
212 extern INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
213 extern INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
214 extern BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
215 LRESULT *result, BOOL unicode, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
217 extern const WCHAR *CLASS_GetVersionedName(const WCHAR *classname, UINT *basename_offset,
218 WCHAR *combined, BOOL register_class) DECLSPEC_HIDDEN;
220 /* kernel callbacks */
222 BOOL WINAPI User32CallEnumDisplayMonitor( struct enum_display_monitor_params *params, ULONG size );
224 /* message spy definitions */
226 #define SPY_DISPATCHMESSAGE 0x0100
227 #define SPY_SENDMESSAGE 0x0101
228 #define SPY_DEFWNDPROC 0x0102
230 #define SPY_RESULT_OK 0x0001
231 #define SPY_RESULT_DEFWND 0x0002
233 extern const char *SPY_GetClassLongOffsetName( INT offset ) DECLSPEC_HIDDEN;
234 extern const char *SPY_GetMsgName( UINT msg, HWND hWnd ) DECLSPEC_HIDDEN;
235 extern const char *SPY_GetVKeyName(WPARAM wParam) DECLSPEC_HIDDEN;
236 extern void SPY_EnterMessage( INT iFlag, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
237 extern void SPY_ExitMessage( INT iFlag, HWND hwnd, UINT msg,
238 LRESULT lReturn, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
240 #include "pshpack1.h"
242 typedef struct
244 BYTE bWidth;
245 BYTE bHeight;
246 BYTE bColorCount;
247 BYTE bReserved;
248 } ICONRESDIR;
250 typedef struct
252 WORD wWidth;
253 WORD wHeight;
254 } CURSORDIR;
256 typedef struct
257 { union
258 { ICONRESDIR icon;
259 CURSORDIR cursor;
260 } ResInfo;
261 WORD wPlanes;
262 WORD wBitCount;
263 DWORD dwBytesInRes;
264 WORD wResId;
265 } CURSORICONDIRENTRY;
267 typedef struct
269 WORD idReserved;
270 WORD idType;
271 WORD idCount;
272 CURSORICONDIRENTRY idEntries[1];
273 } CURSORICONDIR;
275 typedef struct {
276 BYTE bWidth;
277 BYTE bHeight;
278 BYTE bColorCount;
279 BYTE bReserved;
280 WORD xHotspot;
281 WORD yHotspot;
282 DWORD dwDIBSize;
283 DWORD dwDIBOffset;
284 } CURSORICONFILEDIRENTRY;
286 typedef struct
288 WORD idReserved;
289 WORD idType;
290 WORD idCount;
291 CURSORICONFILEDIRENTRY idEntries[1];
292 } CURSORICONFILEDIR;
294 #include "poppack.h"
296 extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN;
297 extern BOOL get_icon_size( HICON handle, SIZE *size ) DECLSPEC_HIDDEN;
299 extern struct user_api_hook *user_api DECLSPEC_HIDDEN;
300 LRESULT WINAPI USER_DefDlgProc(HWND, UINT, WPARAM, LPARAM, BOOL) DECLSPEC_HIDDEN;
301 LRESULT WINAPI USER_ScrollBarProc(HWND, UINT, WPARAM, LPARAM, BOOL) DECLSPEC_HIDDEN;
302 void WINAPI USER_ScrollBarDraw(HWND, HDC, INT, enum SCROLL_HITTEST,
303 const struct SCROLL_TRACKING_INFO *, BOOL, BOOL, RECT *, INT, INT,
304 INT, BOOL) DECLSPEC_HIDDEN;
305 void SCROLL_SetStandardScrollPainted(HWND hwnd, INT bar, BOOL visible);
307 #endif /* __WINE_USER_PRIVATE_H */