Removed winuser16.h from x11drv.h.
[wine/hacks.git] / include / x11drv.h
blob153b6c5e70fb9e20438d9b44bc5b934b20124685
1 /*
2 * X11 display driver definitions
3 */
5 #ifndef __WINE_X11DRV_H
6 #define __WINE_X11DRV_H
8 #include "config.h"
10 #ifndef X_DISPLAY_MISSING
11 #include <X11/Xlib.h>
12 #include <X11/Xresource.h>
13 #include <X11/Xutil.h>
14 #include <X11/Xatom.h>
15 #endif /* !defined(X_DISPLAY_MISSING) */
17 #include "winbase.h"
18 #include "gdi.h"
19 #include "windef.h"
21 struct tagCLASS;
22 struct tagDC;
23 struct tagDeviceCaps;
24 struct tagWND;
25 struct tagCREATESTRUCTA;
26 struct tagWINDOWPOS;
27 struct tagCURSORICONINFO;
29 /* X physical pen */
30 typedef struct
32 int style;
33 int endcap;
34 int linejoin;
35 int pixel;
36 int width;
37 char * dashes;
38 int dash_len;
39 int type; /* GEOMETRIC || COSMETIC */
40 } X_PHYSPEN;
42 /* X physical brush */
43 typedef struct
45 int style;
46 int fillStyle;
47 int pixel;
48 Pixmap pixmap;
49 } X_PHYSBRUSH;
51 /* X physical font */
52 typedef UINT X_PHYSFONT;
54 /* X physical device */
55 typedef struct
57 GC gc; /* X Window GC */
58 Drawable drawable;
59 X_PHYSFONT font;
60 X_PHYSPEN pen;
61 X_PHYSBRUSH brush;
62 int backgroundPixel;
63 int textPixel;
64 } X11DRV_PDEVICE;
67 typedef struct {
68 Pixmap pixmap;
69 } X11DRV_PHYSBITMAP;
71 /* GCs used for B&W and color bitmap operations */
72 extern GC BITMAP_monoGC, BITMAP_colorGC;
74 #define BITMAP_GC(bmp) \
75 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
78 /* Wine driver X11 functions */
80 extern BOOL X11DRV_Init(void);
81 extern BOOL X11DRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst,
82 INT width, INT height, struct tagDC *dcSrc,
83 INT xSrc, INT ySrc, DWORD rop );
84 extern BOOL X11DRV_EnumDeviceFonts( struct tagDC *dc, LPLOGFONT16 plf,
85 DEVICEFONTENUMPROC dfeproc, LPARAM lp );
86 extern BOOL X11DRV_GetCharWidth( struct tagDC *dc, UINT firstChar,
87 UINT lastChar, LPINT buffer );
88 extern BOOL X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCSTR str,
89 INT count, LPSIZE size );
90 extern BOOL X11DRV_GetTextMetrics(struct tagDC *dc, TEXTMETRICA *metrics);
91 extern BOOL X11DRV_PatBlt( struct tagDC *dc, INT left, INT top,
92 INT width, INT height, DWORD rop );
93 extern VOID X11DRV_SetDeviceClipping(struct tagDC *dc);
94 extern BOOL X11DRV_StretchBlt( struct tagDC *dcDst, INT xDst, INT yDst,
95 INT widthDst, INT heightDst,
96 struct tagDC *dcSrc, INT xSrc, INT ySrc,
97 INT widthSrc, INT heightSrc, DWORD rop );
98 extern BOOL X11DRV_MoveToEx( struct tagDC *dc, INT x, INT y,LPPOINT pt);
99 extern BOOL X11DRV_LineTo( struct tagDC *dc, INT x, INT y);
100 extern BOOL X11DRV_Arc( struct tagDC *dc, INT left, INT top, INT right,
101 INT bottom, INT xstart, INT ystart, INT xend,
102 INT yend );
103 extern BOOL X11DRV_Pie( struct tagDC *dc, INT left, INT top, INT right,
104 INT bottom, INT xstart, INT ystart, INT xend,
105 INT yend );
106 extern BOOL X11DRV_Chord( struct tagDC *dc, INT left, INT top,
107 INT right, INT bottom, INT xstart,
108 INT ystart, INT xend, INT yend );
109 extern BOOL X11DRV_Ellipse( struct tagDC *dc, INT left, INT top,
110 INT right, INT bottom );
111 extern BOOL X11DRV_Rectangle(struct tagDC *dc, INT left, INT top,
112 INT right, INT bottom);
113 extern BOOL X11DRV_RoundRect( struct tagDC *dc, INT left, INT top,
114 INT right, INT bottom, INT ell_width,
115 INT ell_height );
116 extern COLORREF X11DRV_SetPixel( struct tagDC *dc, INT x, INT y,
117 COLORREF color );
118 extern COLORREF X11DRV_GetPixel( struct tagDC *dc, INT x, INT y);
119 extern BOOL X11DRV_PaintRgn( struct tagDC *dc, HRGN hrgn );
120 extern BOOL X11DRV_Polyline( struct tagDC *dc,const POINT* pt,INT count);
121 extern BOOL X11DRV_PolyBezier( struct tagDC *dc, const POINT start, const POINT* lppt, DWORD cPoints);
122 extern BOOL X11DRV_Polygon( struct tagDC *dc, const POINT* pt, INT count );
123 extern BOOL X11DRV_PolyPolygon( struct tagDC *dc, const POINT* pt,
124 const INT* counts, UINT polygons);
125 extern BOOL X11DRV_PolyPolyline( struct tagDC *dc, const POINT* pt,
126 const DWORD* counts, DWORD polylines);
128 extern HGDIOBJ X11DRV_SelectObject( struct tagDC *dc, HGDIOBJ handle );
130 extern COLORREF X11DRV_SetBkColor( struct tagDC *dc, COLORREF color );
131 extern COLORREF X11DRV_SetTextColor( struct tagDC *dc, COLORREF color );
132 extern BOOL X11DRV_ExtFloodFill( struct tagDC *dc, INT x, INT y,
133 COLORREF color, UINT fillType );
134 extern BOOL X11DRV_ExtTextOut( struct tagDC *dc, INT x, INT y,
135 UINT flags, const RECT *lprect,
136 LPCSTR str, UINT count, const INT *lpDx );
137 extern BOOL X11DRV_CreateBitmap( HBITMAP hbitmap );
138 extern BOOL X11DRV_DeleteObject( HGDIOBJ handle );
139 extern LONG X11DRV_BitmapBits( HBITMAP hbitmap, void *bits, LONG count,
140 WORD flags );
141 extern INT X11DRV_SetDIBitsToDevice( struct tagDC *dc, INT xDest,
142 INT yDest, DWORD cx, DWORD cy,
143 INT xSrc, INT ySrc,
144 UINT startscan, UINT lines,
145 LPCVOID bits, const BITMAPINFO *info,
146 UINT coloruse );
147 extern INT X11DRV_DeviceBitmapBits( struct tagDC *dc, HBITMAP hbitmap,
148 WORD fGet, UINT startscan,
149 UINT lines, LPSTR bits,
150 LPBITMAPINFO info, UINT coloruse );
151 extern HANDLE X11DRV_LoadOEMResource( WORD id, WORD type );
153 /* X11 driver internal functions */
155 extern BOOL X11DRV_BITMAP_Init(void);
156 extern BOOL X11DRV_BRUSH_Init(void);
157 extern BOOL X11DRV_DIB_Init(void);
158 extern BOOL X11DRV_FONT_Init( struct tagDeviceCaps* );
159 extern BOOL X11DRV_OBM_Init(void);
161 struct tagBITMAPOBJ;
162 extern XImage *X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ *bmp );
163 extern int X11DRV_DIB_GetXImageWidthBytes( int width, int depth );
164 extern BOOL X11DRV_DIB_Init(void);
165 extern X11DRV_PHYSBITMAP *X11DRV_AllocBitmap( struct tagBITMAPOBJ *bmp );
167 extern BOOL X11DRV_SetupGCForPatBlt( struct tagDC *dc, GC gc,
168 BOOL fMapColors );
169 extern BOOL X11DRV_SetupGCForBrush( struct tagDC *dc );
170 extern BOOL X11DRV_SetupGCForPen( struct tagDC *dc );
171 extern BOOL X11DRV_SetupGCForText( struct tagDC *dc );
173 extern const int X11DRV_XROPfunction[];
175 /* Xlib critical section */
177 extern CRITICAL_SECTION X11DRV_CritSection;
179 extern void _XInitImageFuncPtrs(XImage *);
181 #define XCREATEIMAGE(image,width,height,bpp) \
183 int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
184 (image) = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()), \
185 (bpp), ZPixmap, 0, xcalloc( (height)*width_bytes ),\
186 (width), (height), 32, width_bytes ); \
189 /* exported dib functions for now */
191 /* This structure holds the arguments for DIB_SetImageBits() */
192 typedef struct
194 struct tagDC *dc;
195 LPCVOID bits;
196 XImage *image;
197 int lines;
198 DWORD infoWidth;
199 WORD depth;
200 WORD infoBpp;
201 WORD compression;
202 int *colorMap;
203 int nColorMap;
204 Drawable drawable;
205 GC gc;
206 int xSrc;
207 int ySrc;
208 int xDest;
209 int yDest;
210 int width;
211 int height;
212 } DIB_SETIMAGEBITS_DESCR;
214 extern int X11DRV_DIB_GetImageBits( const DIB_SETIMAGEBITS_DESCR *descr );
215 extern int X11DRV_DIB_SetImageBits( const DIB_SETIMAGEBITS_DESCR *descr );
216 extern int *X11DRV_DIB_BuildColorMap( struct tagDC *dc, WORD coloruse,
217 WORD depth, const BITMAPINFO *info,
218 int *nColors );
220 /* X11 clipboard driver */
222 extern struct _CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver;
224 extern void X11DRV_CLIPBOARD_EmptyClipboard(void);
225 extern void X11DRV_CLIPBOARD_SetClipboardData(UINT wFormat);
226 extern BOOL X11DRV_CLIPBOARD_RequestSelection(void);
227 extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL bFooBar);
229 void X11DRV_CLIPBOARD_ReadSelection(Window w, Atom prop);
230 void X11DRV_CLIPBOARD_ReleaseSelection(Window w, HWND hwnd);
232 /* X11 color driver */
234 extern Colormap X11DRV_COLOR_GetColormap(void);
236 /* X11 desktop driver */
238 extern struct _DESKTOP_DRIVER X11DRV_DESKTOP_Driver;
240 typedef struct _X11DRV_DESKTOP_DATA {
241 } X11DRV_DESKTOP_DATA;
243 struct tagDESKTOP;
245 extern Screen *X11DRV_DESKTOP_GetXScreen(struct tagDESKTOP *pDesktop);
246 extern Window X11DRV_DESKTOP_GetXRootWindow(struct tagDESKTOP *pDesktop);
248 extern void X11DRV_DESKTOP_Initialize(struct tagDESKTOP *pDesktop);
249 extern void X11DRV_DESKTOP_Finalize(struct tagDESKTOP *pDesktop);
250 extern int X11DRV_DESKTOP_GetScreenWidth(struct tagDESKTOP *pDesktop);
251 extern int X11DRV_DESKTOP_GetScreenHeight(struct tagDESKTOP *pDesktop);
252 extern int X11DRV_DESKTOP_GetScreenDepth(struct tagDESKTOP *pDesktop);
254 /* X11 event driver */
256 extern struct _EVENT_DRIVER X11DRV_EVENT_Driver;
258 extern BOOL X11DRV_EVENT_Init(void);
259 extern void X11DRV_EVENT_AddIO(int fd, unsigned flag);
260 extern void X11DRV_EVENT_DeleteIO(int fd, unsigned flag);
261 extern BOOL X11DRV_EVENT_WaitNetEvent(BOOL sleep, BOOL peek);
262 extern void X11DRV_EVENT_Synchronize(void);
263 extern BOOL X11DRV_EVENT_CheckFocus( void );
264 extern BOOL X11DRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state);
265 extern void X11DRV_EVENT_DummyMotionNotify(void);
266 extern BOOL X11DRV_EVENT_Pending(void);
267 extern BOOL16 X11DRV_EVENT_IsUserIdle(void);
268 extern void X11DRV_EVENT_WakeUp(void);
270 /* X11 keyboard driver */
272 extern struct _KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver;
274 extern void X11DRV_KEYBOARD_Init(void);
275 extern WORD X11DRV_KEYBOARD_VkKeyScan(CHAR cChar);
276 extern UINT16 X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
277 extern INT16 X11DRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
278 extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
279 extern void KEYBOARD_HandleEvent( struct tagWND *pWnd, XKeyEvent *event );
280 extern void KEYBOARD_UpdateState ( void );
282 /* X11 main driver */
284 extern Display *display;
285 extern Screen *X11DRV_GetXScreen(void);
286 extern Window X11DRV_GetXRootWindow(void);
288 extern void X11DRV_MAIN_Finalize(void);
289 extern void X11DRV_MAIN_Initialize(void);
290 extern void X11DRV_MAIN_ParseOptions(int *argc, char *argv[]);
291 extern void X11DRV_MAIN_Create(void);
292 extern void X11DRV_MAIN_SaveSetup(void);
293 extern void X11DRV_MAIN_RestoreSetup(void);
295 /* X11 monitor driver */
297 extern struct tagMONITOR_DRIVER X11DRV_MONITOR_Driver;
299 typedef struct _X11DRV_MONITOR_DATA {
300 Screen *screen;
301 Window rootWindow;
302 int width;
303 int height;
304 int depth;
305 } X11DRV_MONITOR_DATA;
307 struct tagMONITOR;
309 extern Screen *X11DRV_MONITOR_GetXScreen(struct tagMONITOR *pMonitor);
310 extern Window X11DRV_MONITOR_GetXRootWindow(struct tagMONITOR *pMonitor);
312 extern void X11DRV_MONITOR_Initialize(struct tagMONITOR *pMonitor);
313 extern void X11DRV_MONITOR_Finalize(struct tagMONITOR *pMonitor);
314 extern int X11DRV_MONITOR_GetWidth(struct tagMONITOR *pMonitor);
315 extern int X11DRV_MONITOR_GetHeight(struct tagMONITOR *pMonitor);
316 extern int X11DRV_MONITOR_GetDepth(struct tagMONITOR *pMonitor);
318 /* X11 mouse driver */
320 extern struct _MOUSE_DRIVER X11DRV_MOUSE_Driver;
322 extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor);
323 extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
325 /* X11 windows driver */
327 extern struct _WND_DRIVER X11DRV_WND_Driver;
329 typedef struct _X11DRV_WND_DATA {
330 Window window;
331 } X11DRV_WND_DATA;
333 extern Window X11DRV_WND_GetXWindow(struct tagWND *wndPtr);
334 extern Window X11DRV_WND_FindXWindow(struct tagWND *wndPtr);
335 extern Screen *X11DRV_WND_GetXScreen(struct tagWND *wndPtr);
336 extern Window X11DRV_WND_GetXRootWindow(struct tagWND *wndPtr);
338 extern void X11DRV_WND_Initialize(struct tagWND *wndPtr);
339 extern void X11DRV_WND_Finalize(struct tagWND *wndPtr);
340 extern BOOL X11DRV_WND_CreateDesktopWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, BOOL bUnicode);
341 extern BOOL X11DRV_WND_CreateWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, struct tagCREATESTRUCTA *cs, BOOL bUnicode);
342 extern BOOL X11DRV_WND_DestroyWindow(struct tagWND *pWnd);
343 extern struct tagWND *X11DRV_WND_SetParent(struct tagWND *wndPtr, struct tagWND *pWndParent);
344 extern void X11DRV_WND_ForceWindowRaise(struct tagWND *pWnd);
345 extern void X11DRV_WND_SetWindowPos(struct tagWND *wndPtr, const struct tagWINDOWPOS *winpos, BOOL bSMC_SETXPOS);
346 extern void X11DRV_WND_SetText(struct tagWND *wndPtr, LPCSTR text);
347 extern void X11DRV_WND_SetFocus(struct tagWND *wndPtr);
348 extern void X11DRV_WND_PreSizeMove(struct tagWND *wndPtr);
349 extern void X11DRV_WND_PostSizeMove(struct tagWND *wndPtr);
350 extern void X11DRV_WND_ScrollWindow(struct tagWND *wndPtr, struct tagDC *dcPtr, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
351 extern void X11DRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD flags, BOOL bSetClipOrigin);
352 extern BOOL X11DRV_WND_IsSelfClipping(struct tagWND *wndPtr);
354 #endif /* __WINE_X11DRV_H */