Delay the creation of the X atoms until we really need them, to allow
[wine] / dlls / x11drv / x11drv.h
1 /*
2  * X11 driver definitions
3  *
4  * Copyright 1996 Alexandre Julliard
5  * Copyright 1999 Patrik Stridvall
6  *
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.
11  *
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.
16  *
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #ifndef __WINE_X11DRV_H
23 #define __WINE_X11DRV_H
24
25 #ifndef __WINE_CONFIG_H
26 # error You must include config.h to use this header
27 #endif
28
29 #include <stdarg.h>
30 #include <X11/Xlib.h>
31 #include <X11/Xresource.h>
32 #include <X11/Xutil.h>
33 #include <X11/Xatom.h>
34 #ifdef HAVE_LIBXXSHM
35 # include <X11/extensions/XShm.h>
36 #endif /* defined(HAVE_LIBXXSHM) */
37
38 #undef Status  /* avoid conflict with wintrnl.h */
39 typedef int Status;
40
41 #include "windef.h"
42 #include "winbase.h"
43 #include "gdi.h"
44 #include "user.h"
45 #include "win.h"
46 #include "ddrawi.h"
47 #include "thread.h"
48
49 #define MAX_PIXELFORMATS 8
50
51 struct tagBITMAPOBJ;
52 struct tagCURSORICONINFO;
53 struct tagPALETTEOBJ;
54 struct tagWINDOWPOS;
55
56   /* X physical pen */
57 typedef struct
58 {
59     int          style;
60     int          endcap;
61     int          linejoin;
62     int          pixel;
63     int          width;
64     char *       dashes;
65     int          dash_len;
66     int          type;          /* GEOMETRIC || COSMETIC */
67 } X_PHYSPEN;
68
69   /* X physical brush */
70 typedef struct
71 {
72     int          style;
73     int          fillStyle;
74     int          pixel;
75     Pixmap       pixmap;
76 } X_PHYSBRUSH;
77
78   /* X physical font */
79 typedef UINT     X_PHYSFONT;
80
81 typedef struct tagXRENDERINFO *XRENDERINFO;
82
83   /* X physical device */
84 typedef struct
85 {
86     HDC           hdc;
87     DC           *dc;          /* direct pointer to DC, should go away */
88     GC            gc;          /* X Window GC */
89     Drawable      drawable;
90     POINT         org;          /* DC origin relative to drawable */
91     POINT         drawable_org; /* Origin of drawable relative to screen */
92     X_PHYSFONT    font;
93     X_PHYSPEN     pen;
94     X_PHYSBRUSH   brush;
95     int           backgroundPixel;
96     int           textPixel;
97     int           exposures;   /* count of graphics exposures operations */
98     XVisualInfo  *visuals[MAX_PIXELFORMATS];
99     int           used_visuals;
100     int           current_pf;
101     XRENDERINFO   xrender;
102 } X11DRV_PDEVICE;
103
104
105   /* GCs used for B&W and color bitmap operations */
106 extern GC BITMAP_monoGC, BITMAP_colorGC;
107 extern Pixmap BITMAP_stock_pixmap;   /* pixmap for the default stock bitmap */
108
109 #define BITMAP_GC(bmp) \
110   (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
111
112 extern unsigned int X11DRV_server_startticks;
113
114 /* Wine driver X11 functions */
115
116 extern BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
117                              INT width, INT height, X11DRV_PDEVICE *physDevSrc,
118                              INT xSrc, INT ySrc, DWORD rop );
119 extern BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
120                                     DEVICEFONTENUMPROC dfeproc, LPARAM lp );
121 extern LONG X11DRV_GetBitmapBits( HBITMAP hbitmap, void *bits, LONG count );
122 extern BOOL X11DRV_GetCharWidth( X11DRV_PDEVICE *physDev, UINT firstChar,
123                                    UINT lastChar, LPINT buffer );
124 extern BOOL X11DRV_GetDCOrgEx( X11DRV_PDEVICE *physDev, LPPOINT lpp );
125 extern BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str,
126                                          INT count, LPSIZE size );
127 extern BOOL X11DRV_GetTextMetrics(X11DRV_PDEVICE *physDev, TEXTMETRICW *metrics);
128 extern BOOL X11DRV_PatBlt( X11DRV_PDEVICE *physDev, INT left, INT top,
129                              INT width, INT height, DWORD rop );
130 extern BOOL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
131                                  INT widthDst, INT heightDst,
132                                  X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
133                                  INT widthSrc, INT heightSrc, DWORD rop );
134 extern BOOL X11DRV_LineTo( X11DRV_PDEVICE *physDev, INT x, INT y);
135 extern BOOL X11DRV_Arc( X11DRV_PDEVICE *physDev, INT left, INT top, INT right,
136                           INT bottom, INT xstart, INT ystart, INT xend,
137                           INT yend );
138 extern BOOL X11DRV_Pie( X11DRV_PDEVICE *physDev, INT left, INT top, INT right,
139                           INT bottom, INT xstart, INT ystart, INT xend,
140                           INT yend );
141 extern BOOL X11DRV_Chord( X11DRV_PDEVICE *physDev, INT left, INT top,
142                             INT right, INT bottom, INT xstart,
143                             INT ystart, INT xend, INT yend );
144 extern BOOL X11DRV_Ellipse( X11DRV_PDEVICE *physDev, INT left, INT top,
145                               INT right, INT bottom );
146 extern BOOL X11DRV_Rectangle(X11DRV_PDEVICE *physDev, INT left, INT top,
147                               INT right, INT bottom);
148 extern BOOL X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top,
149                                 INT right, INT bottom, INT ell_width,
150                                 INT ell_height );
151 extern COLORREF X11DRV_SetPixel( X11DRV_PDEVICE *physDev, INT x, INT y,
152                                  COLORREF color );
153 extern COLORREF X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y);
154 extern BOOL X11DRV_PaintRgn( X11DRV_PDEVICE *physDev, HRGN hrgn );
155 extern BOOL X11DRV_Polyline( X11DRV_PDEVICE *physDev,const POINT* pt,INT count);
156 extern BOOL X11DRV_Polygon( X11DRV_PDEVICE *physDev, const POINT* pt, INT count );
157 extern BOOL X11DRV_PolyPolygon( X11DRV_PDEVICE *physDev, const POINT* pt,
158                                   const INT* counts, UINT polygons);
159 extern BOOL X11DRV_PolyPolyline( X11DRV_PDEVICE *physDev, const POINT* pt,
160                                   const DWORD* counts, DWORD polylines);
161
162 extern COLORREF X11DRV_SetBkColor( X11DRV_PDEVICE *physDev, COLORREF color );
163 extern COLORREF X11DRV_SetTextColor( X11DRV_PDEVICE *physDev, COLORREF color );
164 extern BOOL X11DRV_ExtFloodFill( X11DRV_PDEVICE *physDev, INT x, INT y,
165                                    COLORREF color, UINT fillType );
166 extern BOOL X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y,
167                                  UINT flags, const RECT *lprect,
168                                  LPCWSTR str, UINT count, const INT *lpDx );
169 extern LONG X11DRV_SetBitmapBits( HBITMAP hbitmap, const void *bits, LONG count );
170 extern INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest,
171                                        INT yDest, DWORD cx, DWORD cy,
172                                        INT xSrc, INT ySrc,
173                                        UINT startscan, UINT lines,
174                                        LPCVOID bits, const BITMAPINFO *info,
175                                        UINT coloruse );
176 extern BOOL X11DRV_GetDeviceGammaRamp( X11DRV_PDEVICE *physDev, LPVOID ramp );
177 extern BOOL X11DRV_SetDeviceGammaRamp( X11DRV_PDEVICE *physDev, LPVOID ramp );
178
179 /* OpenGL / X11 driver functions */
180 extern int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
181                                       const PIXELFORMATDESCRIPTOR *pppfd);
182 extern int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev,
183                                         int iPixelFormat, UINT nBytes,
184                                         PIXELFORMATDESCRIPTOR *ppfd);
185 extern int X11DRV_GetPixelFormat(X11DRV_PDEVICE *physDev);
186 extern BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev);
187
188 /* X11 driver internal functions */
189
190 extern BOOL X11DRV_BITMAP_Init(void);
191 extern void X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y );
192
193 struct tagBITMAPOBJ;
194 extern XImage *X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ *bmp );
195 extern XImage *X11DRV_DIB_CreateXImage( int width, int height, int depth );
196 extern HBITMAP X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap);
197 extern HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc, BOOL bDeletePixmap);
198 extern HBITMAP X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap, BOOL bDeletePixmap);
199 extern Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc );
200 extern Pixmap X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp, HDC hdc );
201
202 extern RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp );
203 extern void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, const POINT *org,
204                                 const POINT *drawable_org );
205 extern void X11DRV_StartGraphicsExposures( HDC hdc );
206 extern void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn );
207
208 extern BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors );
209 extern BOOL X11DRV_SetupGCForBrush( X11DRV_PDEVICE *physDev );
210 extern BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev );
211 extern BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev );
212
213 extern const int X11DRV_XROPfunction[];
214
215 extern void _XInitImageFuncPtrs(XImage *);
216
217 extern int client_side_with_core;
218 extern int client_side_with_render;
219 extern int client_side_antialias_with_core;
220 extern int client_side_antialias_with_render;
221 extern int using_client_side_fonts;
222 extern void X11DRV_XRender_Init(void);
223 extern void X11DRV_XRender_Finalize(void);
224 extern BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE*, HFONT);
225 extern void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE*);
226 extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
227                                       const RECT *lprect, LPCWSTR wstr,
228                                       UINT count, const INT *lpDx);
229 extern void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev);
230
231 extern void X11DRV_OpenGL_Init(Display *display);
232 extern XVisualInfo *X11DRV_setup_opengl_visual(Display *display);
233
234 extern int X11DRV_XDND_Event(HWND hWnd, XClientMessageEvent *event);
235
236 /* exported dib functions for now */
237
238 /* Additional info for DIB section objects */
239 typedef struct
240 {
241     /* Windows DIB section */
242     DIBSECTION  dibSection;
243
244     /* Mapping status */
245     int         status, p_status;
246
247     /* Color map info */
248     int         nColorMap;
249     int        *colorMap;
250
251     /* Cached XImage */
252     XImage     *image;
253
254 #ifdef HAVE_LIBXXSHM
255     /* Shared memory segment info */
256     XShmSegmentInfo shminfo;
257 #endif
258
259     /* Aux buffer access function */
260     void (*copy_aux)(void*ctx, int req);
261     void *aux_ctx;
262
263     /* GDI access lock */
264     CRITICAL_SECTION lock;
265
266 } X11DRV_DIBSECTION;
267
268 extern int *X11DRV_DIB_BuildColorMap( X11DRV_PDEVICE *physDev, WORD coloruse,
269                                       WORD depth, const BITMAPINFO *info,
270                                       int *nColors );
271 extern INT X11DRV_CoerceDIBSection(X11DRV_PDEVICE *physDev,INT,BOOL);
272 extern INT X11DRV_LockDIBSection(X11DRV_PDEVICE *physDev,INT,BOOL);
273 extern void X11DRV_UnlockDIBSection(X11DRV_PDEVICE *physDev,BOOL);
274 extern INT X11DRV_CoerceDIBSection2(HBITMAP bmp,INT,BOOL);
275 extern INT X11DRV_LockDIBSection2(HBITMAP bmp,INT,BOOL);
276 extern void X11DRV_UnlockDIBSection2(HBITMAP bmp,BOOL);
277
278 extern HBITMAP X11DRV_DIB_CreateDIBSection(X11DRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage,
279                                            LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch);
280 extern void X11DRV_DIB_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
281 extern INT X11DRV_DIB_Coerce(struct tagBITMAPOBJ *,INT,BOOL);
282 extern INT X11DRV_DIB_Lock(struct tagBITMAPOBJ *,INT,BOOL);
283 extern void X11DRV_DIB_Unlock(struct tagBITMAPOBJ *,BOOL);
284 void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst,
285                                DWORD xSrc, DWORD ySrc, DWORD xDest, DWORD yDest,
286                                DWORD width, DWORD height);
287 struct _DCICMD;
288 extern INT X11DRV_DCICommand(INT cbInput, const struct _DCICMD *lpCmd, LPVOID lpOutData);
289
290 /**************************************************************************
291  * X11 GDI driver
292  */
293
294 BOOL X11DRV_GDI_Initialize( Display *display );
295 void X11DRV_GDI_Finalize(void);
296
297 extern Display *gdi_display;  /* display to use for all GDI functions */
298
299 /* X11 GDI palette driver */
300
301 #define X11DRV_PALETTE_FIXED    0x0001 /* read-only colormap - have to use XAllocColor (if not virtual) */
302 #define X11DRV_PALETTE_VIRTUAL  0x0002 /* no mapping needed - pixel == pixel color */
303
304 #define X11DRV_PALETTE_PRIVATE  0x1000 /* private colormap, identity mapping */
305 #define X11DRV_PALETTE_WHITESET 0x2000
306
307 extern Colormap X11DRV_PALETTE_PaletteXColormap;
308 extern UINT16 X11DRV_PALETTE_PaletteFlags;
309
310 extern int *X11DRV_PALETTE_PaletteToXPixel;
311 extern int *X11DRV_PALETTE_XPixelToPalette;
312
313 extern int X11DRV_PALETTE_mapEGAPixel[16];
314
315 extern int X11DRV_PALETTE_Init(void);
316 extern void X11DRV_PALETTE_Cleanup(void);
317 extern BOOL X11DRV_IsSolidColor(COLORREF color);
318
319 extern COLORREF X11DRV_PALETTE_ToLogical(int pixel);
320 extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color);
321
322 /* GDI escapes */
323
324 #define X11DRV_ESCAPE 6789
325 enum x11drv_escape_codes
326 {
327     X11DRV_GET_DISPLAY,   /* get X11 display for a DC */
328     X11DRV_GET_DRAWABLE,  /* get current drawable for a DC */
329     X11DRV_GET_FONT,      /* get current X font for a DC */
330 };
331
332 /**************************************************************************
333  * X11 USER driver
334  */
335
336 struct x11drv_thread_data
337 {
338     Display *display;
339     HANDLE   display_fd;
340     int      process_event_count;  /* recursion count for event processing */
341     Cursor   cursor;               /* current cursor */
342     Window   cursor_window;        /* current window that contains the cursor */
343     HWND     last_focus;           /* last window that had focus */
344     XIM      xim;                  /* input method */
345 };
346
347 extern struct x11drv_thread_data *x11drv_init_thread_data(void);
348
349 inline static struct x11drv_thread_data *x11drv_thread_data(void)
350 {
351     struct x11drv_thread_data *data = NtCurrentTeb()->driver_data;
352     if (!data) data = x11drv_init_thread_data();
353     return data;
354 }
355
356 inline static Display *thread_display(void) { return x11drv_thread_data()->display; }
357
358 extern Visual *visual;
359 extern Window root_window;
360 extern DWORD desktop_tid;
361 extern unsigned int screen_width;
362 extern unsigned int screen_height;
363 extern unsigned int screen_depth;
364 extern unsigned int text_caps;
365 extern int use_xkb;
366 extern int use_take_focus;
367 extern int managed_mode;
368
369 /* atoms */
370
371 enum x11drv_atoms
372 {
373     FIRST_XATOM = XA_LAST_PREDEFINED + 1,
374     XATOM_CLIPBOARD = FIRST_XATOM,
375     XATOM_COMPOUND_TEXT,
376     XATOM_MULTIPLE,
377     XATOM_SELECTION_DATA,
378     XATOM_TARGETS,
379     XATOM_TEXT,
380     XATOM_UTF8_STRING,
381     XATOM_RAW_ASCENT,
382     XATOM_RAW_DESCENT,
383     XATOM_RAW_CAP_HEIGHT,
384     XATOM_WM_PROTOCOLS,
385     XATOM_WM_DELETE_WINDOW,
386     XATOM_WM_TAKE_FOCUS,
387     XATOM_KWM_DOCKWINDOW,
388     XATOM_DndProtocol,
389     XATOM_DndSelection,
390     XATOM__MOTIF_WM_HINTS,
391     XATOM__KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR,
392     XATOM__NET_WM_PID,
393     XATOM__NET_WM_PING,
394     XATOM__NET_WM_NAME,
395     XATOM_XdndAware,
396     XATOM_XdndEnter,
397     XATOM_XdndPosition,
398     XATOM_XdndStatus,
399     XATOM_XdndLeave,
400     XATOM_XdndFinished,
401     XATOM_XdndDrop,
402     XATOM_XdndActionCopy,
403     XATOM_XdndActionMove,
404     XATOM_XdndActionLink,
405     XATOM_XdndActionAsk,
406     XATOM_XdndActionPrivate,
407     XATOM_XdndSelection,
408     XATOM_XdndTarget,
409     XATOM_XdndTypeList,
410     XATOM_image_gif,
411     XATOM_text_html,
412     XATOM_text_plain,
413     XATOM_text_rtf,
414     XATOM_text_richtext,
415     NB_XATOMS
416 };
417
418 extern Atom X11DRV_Atoms[NB_XATOMS - FIRST_XATOM];
419
420 #define x11drv_atom(name) (X11DRV_Atoms[XATOM_##name - FIRST_XATOM])
421
422 /* X11 clipboard driver */
423
424 typedef struct tagWINE_CLIPDATA {
425     UINT        wFormatID;
426     HANDLE16    hData16;
427     HANDLE      hData32;
428     UINT        wFlags;
429     struct tagWINE_CLIPDATA *PrevData;
430     struct tagWINE_CLIPDATA *NextData;
431 } WINE_CLIPDATA, *LPWINE_CLIPDATA;
432
433 typedef HANDLE (*DRVEXPORTFUNC)(Window requestor, Atom aTarget, Atom rprop,
434     LPWINE_CLIPDATA lpData, LPDWORD lpBytes);
435 typedef HANDLE (*DRVIMPORTFUNC)(LPBYTE hData, UINT cBytes);
436
437 typedef struct tagWINE_CLIPFORMAT {
438     UINT        wFormatID;
439     LPSTR       Name;
440     UINT        drvData;
441     UINT        wFlags;
442     DRVIMPORTFUNC  lpDrvImportFunc;
443     DRVEXPORTFUNC  lpDrvExportFunc;
444     struct tagWINE_CLIPFORMAT *PrevFormat;
445     struct tagWINE_CLIPFORMAT *NextFormat;
446 } WINE_CLIPFORMAT, *LPWINE_CLIPFORMAT;
447
448 #define CF_FLAG_BUILTINFMT   1 /* Built-in windows format */
449 #define CF_FLAG_SYNTHESIZED  8 /* Implicitly converted data */
450
451 extern void X11DRV_InitClipboard(void);
452 extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType, Window w, HWND hwnd);
453 extern INT X11DRV_CountClipboardFormats(void);
454 extern UINT X11DRV_EnumClipboardFormats(UINT wFormat);
455 extern LPWINE_CLIPFORMAT X11DRV_CLIPBOARD_LookupFormat(WORD wID);
456 extern LPWINE_CLIPFORMAT X11DRV_CLIPBOARD_LookupProperty(UINT drvData);
457 extern LPWINE_CLIPDATA X11DRV_CLIPBOARD_LookupData(DWORD wID);
458 extern UINT X11DRV_CLIPBOARD_LookupPropertyAlias(UINT drvDataProperty);
459 extern LPWINE_CLIPFORMAT X11DRV_CLIPBOARD_LookupAliasProperty(UINT drvDataAlias);
460
461 /* X11 event driver */
462
463 typedef enum {
464   X11DRV_INPUT_RELATIVE,
465   X11DRV_INPUT_ABSOLUTE
466 } INPUT_TYPE;
467 extern INPUT_TYPE X11DRV_EVENT_SetInputMethod(INPUT_TYPE type);
468
469 #ifdef HAVE_LIBXXF86DGA2
470 void X11DRV_EVENT_SetDGAStatus(HWND hwnd, int event_base) ;
471 #endif
472
473 /* x11drv private window data */
474 struct x11drv_win_data
475 {
476     Window  whole_window;   /* X window for the complete window */
477     Window  client_window;  /* X window for the client area */
478     Window  icon_window;    /* X window for the icon */
479     RECT    whole_rect;     /* X window rectangle for the whole window relative to parent */
480     RECT    client_rect;    /* client area relative to whole window */
481     XIC     xic;            /* X input context */
482     HBITMAP hWMIconBitmap;
483     HBITMAP hWMIconMask;
484 };
485
486 typedef struct x11drv_win_data X11DRV_WND_DATA;
487
488 extern Window X11DRV_get_client_window( HWND hwnd );
489 extern Window X11DRV_get_whole_window( HWND hwnd );
490 extern XIC X11DRV_get_ic( HWND hwnd );
491
492 inline static Window get_client_window( WND *wnd )
493 {
494     struct x11drv_win_data *data = wnd->pDriverData;
495     return data->client_window;
496 }
497
498 inline static Window get_whole_window( WND *wnd )
499 {
500     struct x11drv_win_data *data = wnd->pDriverData;
501     return data->whole_window;
502 }
503
504 inline static BOOL is_window_top_level( WND *win )
505 {
506     return (root_window == DefaultRootWindow(gdi_display) && win->parent == GetDesktopWindow());
507 }
508
509 extern void X11DRV_SetFocus( HWND hwnd );
510 extern Cursor X11DRV_GetCursor( Display *display, struct tagCURSORICONINFO *ptr );
511
512 typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void *arg );
513
514 extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg );
515 extern int X11DRV_check_error(void);
516 extern void X11DRV_register_window( Display *display, HWND hwnd, struct x11drv_win_data *data );
517 extern void X11DRV_set_iconic_state( WND *win );
518 extern void X11DRV_window_to_X_rect( WND *win, RECT *rect );
519 extern void X11DRV_X_to_window_rect( WND *win, RECT *rect );
520 extern void X11DRV_create_desktop_thread(void);
521 extern Window X11DRV_create_desktop( XVisualInfo *desktop_vi, const char *geometry );
522 extern void X11DRV_sync_window_style( Display *display, WND *win );
523 extern int X11DRV_sync_whole_window_position( Display *display, WND *win, int zorder );
524 extern int X11DRV_sync_client_window_position( Display *display, WND *win );
525 extern void X11DRV_set_wm_hints( Display *display, WND *win );
526
527 extern void X11DRV_Settings_AddDepthModes(void);
528 extern void X11DRV_Settings_AddOneMode(unsigned int width, unsigned int height, unsigned int bpp, unsigned int freq);
529 extern int X11DRV_Settings_CreateDriver(LPDDHALINFO info);
530 extern LPDDHALMODEINFO X11DRV_Settings_CreateModes(unsigned int max_modes, int reserve_depths);
531 unsigned int X11DRV_Settings_GetModeCount(void);
532 void X11DRV_Settings_Init(void);
533 extern void X11DRV_Settings_SetDefaultMode(int mode);
534 LPDDHALMODEINFO X11DRV_Settings_SetHandlers(const char *name, 
535                                             int (*pNewGCM)(void), 
536                                             void (*pNewSCM)(int), 
537                                             unsigned int nmodes, 
538                                             int reserve_depths);
539
540 #endif  /* __WINE_X11DRV_H */