Export SYSDEPS_SwitchToThreadStack() functionality from libwine as
[wine] / include / user.h
1 /*
2  * USER definitions
3  *
4  * Copyright 1993 Alexandre Julliard
5  *
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.
10  *
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.
15  *
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __WINE_USER_H
22 #define __WINE_USER_H
23
24 #include <winbase.h>
25 #include <wingdi.h>
26 #include <winuser.h>
27
28 #include <local.h>
29
30 extern WORD USER_HeapSel;
31
32 #define USER_HEAP_ALLOC(size) \
33             ((HANDLE)(ULONG_PTR)LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) ))
34 #define USER_HEAP_REALLOC(handle,size) \
35             ((HANDLE)(ULONG_PTR)LOCAL_ReAlloc( USER_HeapSel, LOWORD(handle), (size), LMEM_FIXED ))
36 #define USER_HEAP_FREE(handle) \
37             LOCAL_Free( USER_HeapSel, LOWORD(handle) )
38 #define USER_HEAP_LIN_ADDR(handle)  \
39          ((handle) ? MapSL(MAKESEGPTR(USER_HeapSel, LOWORD(handle))) : NULL)
40
41 #define GET_WORD(ptr)  (*(WORD *)(ptr))
42 #define GET_DWORD(ptr) (*(DWORD *)(ptr))
43
44 #define USUD_LOCALALLOC        0x0001
45 #define USUD_LOCALFREE         0x0002
46 #define USUD_LOCALCOMPACT      0x0003
47 #define USUD_LOCALHEAP         0x0004
48 #define USUD_FIRSTCLASS        0x0005
49
50 struct tagCURSORICONINFO;
51
52 /* internal messages codes */
53 enum wine_internal_message
54 {
55     WM_WINE_DESTROYWINDOW = 0x80000000,
56     WM_WINE_SETWINDOWPOS,
57     WM_WINE_SHOWWINDOW,
58     WM_WINE_SETPARENT,
59     WM_WINE_SETWINDOWLONG,
60     WM_WINE_ENABLEWINDOW,
61     WM_WINE_SETACTIVEWINDOW,
62     WM_WINE_KEYBOARD_LL_HOOK,
63     WM_WINE_MOUSE_LL_HOOK
64 };
65
66 /* internal SendInput codes (FIXME) */
67 #define WINE_INTERNAL_INPUT_MOUSE    (16+INPUT_MOUSE)
68 #define WINE_INTERNAL_INPUT_KEYBOARD (16+INPUT_KEYBOARD)
69
70 typedef struct tagUSER_DRIVER {
71     /* keyboard functions */
72     void   (*pInitKeyboard)(LPBYTE);
73     WORD   (*pVkKeyScan)(CHAR);
74     UINT   (*pMapVirtualKey)(UINT,UINT);
75     INT    (*pGetKeyNameText)(LONG,LPSTR,INT);
76     INT    (*pToUnicode)(UINT, UINT, LPBYTE, LPWSTR, int, UINT);
77     void   (*pBeep)(void);
78     /* mouse functions */
79     void   (*pInitMouse)(LPBYTE);
80     void   (*pSetCursor)(struct tagCURSORICONINFO *);
81     void   (*pGetCursorPos)(LPPOINT);
82     void   (*pSetCursorPos)(INT,INT);
83     /* screen saver functions */
84     BOOL   (*pGetScreenSaveActive)(void);
85     void   (*pSetScreenSaveActive)(BOOL);
86     /* clipboard functions */
87     void   (*pAcquireClipboard)(HWND);                     /* Acquire selection */
88     BOOL   (*pCountClipboardFormats)(void);                /* Count available clipboard formats */
89     void   (*pEmptyClipboard)(void);                       /* Empty clipboard data */
90     BOOL   (*pEndClipboardUpdate)(void);                   /* End clipboard update */
91     BOOL   (*pEnumClipboardFormats)(UINT);                 /* Enumerate clipboard formats */
92     BOOL   (*pGetClipboardData)(UINT, HANDLE16*, HANDLE*); /* Get specified selection data */
93     BOOL   (*pGetClipboardFormatName)(UINT, LPSTR, UINT);  /* Get a clipboard format name */
94     BOOL   (*pIsClipboardFormatAvailable)(UINT);           /* Check if specified format is available */
95     INT    (*pRegisterClipboardFormat)(LPCSTR);            /* Register a clipboard format */
96     void   (*pResetSelectionOwner)(HWND, BOOL);
97     BOOL   (*pSetClipboardData)(UINT, HANDLE16, HANDLE);   /* Set specified selection data */
98     /* display modes */
99     LONG   (*pChangeDisplaySettingsExW)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
100     BOOL   (*pEnumDisplaySettingsExW)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
101     /* windowing functions */
102     BOOL   (*pCreateWindow)(HWND,CREATESTRUCTA*,BOOL);
103     BOOL   (*pDestroyWindow)(HWND);
104     BOOL   (*pGetDC)(HWND,HDC,HRGN,DWORD);
105     void   (*pForceWindowRaise)(HWND);
106     DWORD  (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
107     void   (*pReleaseDC)(HWND,HDC);
108     BOOL   (*pScrollDC)(HDC,INT,INT,const RECT*,const RECT*,HRGN,LPRECT);
109     INT    (*pScrollWindowEx)(HWND,INT,INT,const RECT*,const RECT*,HRGN,LPRECT,UINT);
110     void   (*pSetFocus)(HWND);
111     HWND   (*pSetParent)(HWND,HWND);
112     BOOL   (*pSetWindowPos)(WINDOWPOS *);
113     int    (*pSetWindowRgn)(HWND,HRGN,BOOL);
114     HICON  (*pSetWindowIcon)(HWND,HICON,BOOL);
115     void   (*pSetWindowStyle)(HWND,DWORD);
116     BOOL   (*pSetWindowText)(HWND,LPCWSTR);
117     BOOL   (*pShowWindow)(HWND,INT);
118     void   (*pSysCommandSizeMove)(HWND,WPARAM);
119 } USER_DRIVER;
120
121 extern USER_DRIVER USER_Driver;
122
123 /* user lock */
124 extern void USER_Lock(void);
125 extern void USER_Unlock(void);
126 extern void USER_CheckNotLock(void);
127
128 extern BOOL USER_IsExitingThread( DWORD tid );
129
130 /* Wine look */
131
132 typedef enum
133 {
134     WIN31_LOOK,
135     WIN95_LOOK,
136     WIN98_LOOK
137 } WINE_LOOK;
138
139 extern WINE_LOOK TWEAK_WineLook;
140
141 /* gray brush cache */
142 extern HBRUSH CACHE_GetPattern55AABrush(void);
143
144 /* hook.c */
145 extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode );
146 extern BOOL HOOK_IsHooked( INT id );
147
148 /* input.c */
149 extern BYTE InputKeyStateTable[256];
150 extern BYTE AsyncKeyStateTable[256];
151
152 /* syscolor.c */
153 extern void SYSCOLOR_Init(void);
154 extern HPEN SYSCOLOR_GetPen( INT index );
155
156 /* sysmetrics.c */
157 extern void SYSMETRICS_Init(void);
158 extern INT SYSMETRICS_Set( INT index, INT value );
159
160 /* Wine extensions */
161 #define SM_WINE_BPP (SM_CMETRICS+1)  /* screen bpp */
162 #define SM_WINE_CMETRICS SM_WINE_BPP
163
164 /* sysparams.c */
165 extern void SYSPARAMS_GetDoubleClickSize( INT *width, INT *height );
166 extern INT SYSPARAMS_GetMouseButtonSwap( void );
167
168 extern HPALETTE WINAPI SelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBackground );
169
170 extern BOOL CLIPBOARD_ReleaseOwner(void);
171
172 extern DWORD USER16_AlertableWait;
173
174 /* HANDLE16 <-> HANDLE conversions */
175 #define HCURSOR_16(h32)    (LOWORD(h32))
176 #define HICON_16(h32)      (LOWORD(h32))
177 #define HINSTANCE_16(h32)  (LOWORD(h32))
178
179 #define HCURSOR_32(h16)    ((HCURSOR)(ULONG_PTR)(h16))
180 #define HICON_32(h16)      ((HICON)(ULONG_PTR)(h16))
181 #define HINSTANCE_32(h16)  ((HINSTANCE)(ULONG_PTR)(h16))
182 #define HMODULE_32(h16)    ((HMODULE)(ULONG_PTR)(h16))
183
184 #endif  /* __WINE_USER_H */