2 * X11 driver definitions
4 * Copyright 1996 Alexandre Julliard
5 * Copyright 1999 Patrik Stridvall
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_X11DRV_H
23 #define __WINE_X11DRV_H
25 #ifndef __WINE_CONFIG_H
26 # error You must include config.h to use this header
31 #include <X11/Xresource.h>
32 #include <X11/Xutil.h>
33 #include <X11/Xatom.h>
35 # include <X11/extensions/XShm.h>
36 #endif /* defined(HAVE_LIBXXSHM) */
45 #include <X11/Xproto.h>
54 #undef Status /* avoid conflict with wintrnl.h */
62 #include "wine/list.h"
64 #define MAX_PIXELFORMATS 8
65 #define MAX_DASHLEN 16
67 struct tagCURSORICONINFO
;
69 extern void CDECL
wine_tsx11_lock(void);
70 extern void CDECL
wine_tsx11_unlock(void);
80 char dashes
[MAX_DASHLEN
];
82 int type
; /* GEOMETRIC || COSMETIC */
83 int ext
; /* extended pen - 1, otherwise - 0 */
86 /* X physical brush */
102 /* X physical bitmap */
109 /* the following fields are only used for DIB section bitmaps */
110 int status
, p_status
; /* mapping status */
111 XImage
*image
; /* cached XImage */
112 int *colorMap
; /* color map info */
114 CRITICAL_SECTION lock
; /* GDI access lock */
115 enum x11drv_shm_mode shm_mode
;
117 XShmSegmentInfo shminfo
; /* shared memory segment info */
119 struct list entry
; /* Entry in global DIB list */
120 BYTE
*base
; /* Base address */
121 SIZE_T size
; /* Size in bytes */
124 /* X physical font */
125 typedef UINT X_PHYSFONT
;
127 typedef struct tagXRENDERINFO
*XRENDERINFO
;
129 /* X physical device */
133 GC gc
; /* X Window GC */
135 RECT dc_rect
; /* DC rectangle relative to drawable */
136 RECT drawable_rect
; /* Drawable rectangle relative to screen */
137 HRGN region
; /* Device region (visible region & clip region) */
141 X_PHYSBITMAP
*bitmap
; /* currently selected bitmap for memory DCs */
142 BOOL has_gdi_font
; /* is current font a GDI font? */
145 int depth
; /* bit depth of the DC */
146 int exposures
; /* count of graphics exposures operations */
148 Drawable gl_drawable
;
149 Pixmap pixmap
; /* Pixmap for a GLXPixmap gl_drawable */
155 extern X_PHYSBITMAP BITMAP_stock_phys_bitmap
; /* phys bitmap for the default stock bitmap */
157 /* Retrieve the GC used for bitmap operations */
158 extern GC
get_bitmap_gc(int depth
);
160 /* Wine driver X11 functions */
162 extern BOOL CDECL
X11DRV_AlphaBlend( X11DRV_PDEVICE
*physDevDst
, INT xDst
, INT yDst
,
163 INT widthDst
, INT heightDst
,
164 X11DRV_PDEVICE
*physDevSrc
, INT xSrc
, INT ySrc
,
165 INT widthSrc
, INT heightSrc
, BLENDFUNCTION blendfn
);
166 extern BOOL CDECL
X11DRV_BitBlt( X11DRV_PDEVICE
*physDevDst
, INT xDst
, INT yDst
,
167 INT width
, INT height
, X11DRV_PDEVICE
*physDevSrc
,
168 INT xSrc
, INT ySrc
, DWORD rop
);
169 extern BOOL CDECL
X11DRV_EnumDeviceFonts( X11DRV_PDEVICE
*physDev
, LPLOGFONTW plf
,
170 FONTENUMPROCW dfeproc
, LPARAM lp
);
171 extern LONG CDECL
X11DRV_GetBitmapBits( HBITMAP hbitmap
, void *bits
, LONG count
);
172 extern BOOL CDECL
X11DRV_GetCharWidth( X11DRV_PDEVICE
*physDev
, UINT firstChar
,
173 UINT lastChar
, LPINT buffer
);
174 extern BOOL CDECL
X11DRV_GetDCOrgEx( X11DRV_PDEVICE
*physDev
, LPPOINT lpp
);
175 extern BOOL CDECL
X11DRV_GetTextExtentExPoint( X11DRV_PDEVICE
*physDev
, LPCWSTR str
, INT count
,
176 INT maxExt
, LPINT lpnFit
, LPINT alpDx
, LPSIZE size
);
177 extern BOOL CDECL
X11DRV_GetTextMetrics(X11DRV_PDEVICE
*physDev
, TEXTMETRICW
*metrics
);
178 extern BOOL CDECL
X11DRV_PatBlt( X11DRV_PDEVICE
*physDev
, INT left
, INT top
,
179 INT width
, INT height
, DWORD rop
);
180 extern BOOL CDECL
X11DRV_StretchBlt( X11DRV_PDEVICE
*physDevDst
, INT xDst
, INT yDst
,
181 INT widthDst
, INT heightDst
,
182 X11DRV_PDEVICE
*physDevSrc
, INT xSrc
, INT ySrc
,
183 INT widthSrc
, INT heightSrc
, DWORD rop
);
184 extern BOOL CDECL
X11DRV_LineTo( X11DRV_PDEVICE
*physDev
, INT x
, INT y
);
185 extern BOOL CDECL
X11DRV_Arc( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
186 INT bottom
, INT xstart
, INT ystart
, INT xend
, INT yend
);
187 extern BOOL CDECL
X11DRV_Pie( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
188 INT bottom
, INT xstart
, INT ystart
, INT xend
,
190 extern BOOL CDECL
X11DRV_Chord( X11DRV_PDEVICE
*physDev
, INT left
, INT top
,
191 INT right
, INT bottom
, INT xstart
,
192 INT ystart
, INT xend
, INT yend
);
193 extern BOOL CDECL
X11DRV_Ellipse( X11DRV_PDEVICE
*physDev
, INT left
, INT top
,
194 INT right
, INT bottom
);
195 extern BOOL CDECL
X11DRV_Rectangle(X11DRV_PDEVICE
*physDev
, INT left
, INT top
,
196 INT right
, INT bottom
);
197 extern BOOL CDECL
X11DRV_RoundRect( X11DRV_PDEVICE
*physDev
, INT left
, INT top
,
198 INT right
, INT bottom
, INT ell_width
,
200 extern COLORREF CDECL
X11DRV_SetPixel( X11DRV_PDEVICE
*physDev
, INT x
, INT y
, COLORREF color
);
201 extern COLORREF CDECL
X11DRV_GetPixel( X11DRV_PDEVICE
*physDev
, INT x
, INT y
);
202 extern BOOL CDECL
X11DRV_PaintRgn( X11DRV_PDEVICE
*physDev
, HRGN hrgn
);
203 extern BOOL CDECL
X11DRV_Polyline( X11DRV_PDEVICE
*physDev
,const POINT
* pt
,INT count
);
204 extern BOOL CDECL
X11DRV_Polygon( X11DRV_PDEVICE
*physDev
, const POINT
* pt
, INT count
);
205 extern BOOL CDECL
X11DRV_PolyPolygon( X11DRV_PDEVICE
*physDev
, const POINT
* pt
,
206 const INT
* counts
, UINT polygons
);
207 extern BOOL CDECL
X11DRV_PolyPolyline( X11DRV_PDEVICE
*physDev
, const POINT
* pt
,
208 const DWORD
* counts
, DWORD polylines
);
210 extern COLORREF CDECL
X11DRV_SetBkColor( X11DRV_PDEVICE
*physDev
, COLORREF color
);
211 extern COLORREF CDECL
X11DRV_SetTextColor( X11DRV_PDEVICE
*physDev
, COLORREF color
);
212 extern BOOL CDECL
X11DRV_ExtFloodFill( X11DRV_PDEVICE
*physDev
, INT x
, INT y
,
213 COLORREF color
, UINT fillType
);
214 extern BOOL CDECL
X11DRV_ExtTextOut( X11DRV_PDEVICE
*physDev
, INT x
, INT y
,
215 UINT flags
, const RECT
*lprect
,
216 LPCWSTR str
, UINT count
, const INT
*lpDx
);
217 extern LONG CDECL
X11DRV_SetBitmapBits( HBITMAP hbitmap
, const void *bits
, LONG count
);
218 extern void CDECL
X11DRV_SetDeviceClipping( X11DRV_PDEVICE
*physDev
, HRGN vis_rgn
, HRGN clip_rgn
);
219 extern INT CDECL
X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE
*physDev
, INT xDest
,
220 INT yDest
, DWORD cx
, DWORD cy
,
222 UINT startscan
, UINT lines
,
223 LPCVOID bits
, const BITMAPINFO
*info
,
225 extern BOOL CDECL
X11DRV_GetDeviceGammaRamp( X11DRV_PDEVICE
*physDev
, LPVOID ramp
);
226 extern BOOL CDECL
X11DRV_SetDeviceGammaRamp( X11DRV_PDEVICE
*physDev
, LPVOID ramp
);
228 /* OpenGL / X11 driver functions */
229 extern int CDECL
X11DRV_ChoosePixelFormat(X11DRV_PDEVICE
*physDev
,
230 const PIXELFORMATDESCRIPTOR
*pppfd
);
231 extern int CDECL
X11DRV_DescribePixelFormat(X11DRV_PDEVICE
*physDev
,
232 int iPixelFormat
, UINT nBytes
,
233 PIXELFORMATDESCRIPTOR
*ppfd
);
234 extern int CDECL
X11DRV_GetPixelFormat(X11DRV_PDEVICE
*physDev
);
235 extern BOOL CDECL
X11DRV_SwapBuffers(X11DRV_PDEVICE
*physDev
);
236 extern void X11DRV_OpenGL_Cleanup(void);
238 /* X11 driver internal functions */
240 extern void X11DRV_Xcursor_Init(void);
241 extern void X11DRV_BITMAP_Init(void);
242 extern void X11DRV_FONT_Init( int log_pixels_x
, int log_pixels_y
);
244 extern int bitmap_info_size( const BITMAPINFO
* info
, WORD coloruse
);
245 extern XImage
*X11DRV_DIB_CreateXImage( int width
, int height
, int depth
);
246 extern void X11DRV_DIB_DestroyXImage( XImage
*image
);
247 extern HGLOBAL
X11DRV_DIB_CreateDIBFromBitmap(HDC hdc
, HBITMAP hBmp
);
248 extern HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap
, HDC hdc
);
249 extern Pixmap
X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB
, HDC hdc
);
250 extern X_PHYSBITMAP
*X11DRV_get_phys_bitmap( HBITMAP hbitmap
);
251 extern X_PHYSBITMAP
*X11DRV_init_phys_bitmap( HBITMAP hbitmap
);
252 extern Pixmap
X11DRV_get_pixmap( HBITMAP hbitmap
);
254 extern RGNDATA
*X11DRV_GetRegionData( HRGN hrgn
, HDC hdc_lptodp
);
256 extern BOOL
X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE
*physDev
, GC gc
, BOOL fMapColors
);
257 extern BOOL
X11DRV_SetupGCForBrush( X11DRV_PDEVICE
*physDev
);
258 extern BOOL
X11DRV_SetupGCForText( X11DRV_PDEVICE
*physDev
);
259 extern INT
X11DRV_XWStoDS( X11DRV_PDEVICE
*physDev
, INT width
);
260 extern INT
X11DRV_YWStoDS( X11DRV_PDEVICE
*physDev
, INT height
);
262 extern const int X11DRV_XROPfunction
[];
264 extern void _XInitImageFuncPtrs(XImage
*);
266 extern int client_side_with_core
;
267 extern int client_side_with_render
;
268 extern int client_side_antialias_with_core
;
269 extern int client_side_antialias_with_render
;
270 extern int using_client_side_fonts
;
271 extern void X11DRV_XRender_Init(void);
272 extern void X11DRV_XRender_Finalize(void);
273 extern BOOL
X11DRV_XRender_SelectFont(X11DRV_PDEVICE
*, HFONT
);
274 extern void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE
*);
275 extern BOOL
X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE
*physDev
, INT x
, INT y
, UINT flags
,
276 const RECT
*lprect
, LPCWSTR wstr
,
277 UINT count
, const INT
*lpDx
);
278 BOOL
X11DRV_XRender_GetSrcAreaStretch(X11DRV_PDEVICE
*physDevSrc
, X11DRV_PDEVICE
*physDevDst
,
279 Pixmap pixmap
, GC gc
,
280 INT widthSrc
, INT heightSrc
,
281 INT widthDst
, INT heightDst
,
282 RECT
*visRectSrc
, RECT
*visRectDst
);
283 extern void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE
*physDev
);
285 extern Drawable
get_glxdrawable(X11DRV_PDEVICE
*physDev
);
286 extern BOOL
destroy_glxpixmap(Display
*display
, XID glxpixmap
);
289 extern void IME_UnregisterClasses(void);
290 extern void IME_SetOpenStatus(BOOL fOpen
);
291 extern INT
IME_GetCursorPos();
292 extern void IME_SetCursorPos(DWORD pos
);
293 extern void IME_UpdateAssociation(HWND focus
);
294 extern BOOL
IME_SetCompositionString(DWORD dwIndex
, LPCVOID lpComp
,
295 DWORD dwCompLen
, LPCVOID lpRead
,
297 extern BOOL
IME_NotifyIME(DWORD dwAction
, DWORD dwIndex
, DWORD dwValue
);
299 extern void X11DRV_XDND_EnterEvent( HWND hWnd
, XClientMessageEvent
*event
);
300 extern void X11DRV_XDND_PositionEvent( HWND hWnd
, XClientMessageEvent
*event
);
301 extern void X11DRV_XDND_DropEvent( HWND hWnd
, XClientMessageEvent
*event
);
302 extern void X11DRV_XDND_LeaveEvent( HWND hWnd
, XClientMessageEvent
*event
);
304 /* exported dib functions for now */
306 /* DIB Section sync state */
307 enum { DIB_Status_None
, DIB_Status_InSync
, DIB_Status_GdiMod
, DIB_Status_AppMod
};
310 void (*Convert_5x5_asis
)(int width
, int height
,
311 const void* srcbits
, int srclinebytes
,
312 void* dstbits
, int dstlinebytes
);
313 void (*Convert_555_reverse
)(int width
, int height
,
314 const void* srcbits
, int srclinebytes
,
315 void* dstbits
, int dstlinebytes
);
316 void (*Convert_555_to_565_asis
)(int width
, int height
,
317 const void* srcbits
, int srclinebytes
,
318 void* dstbits
, int dstlinebytes
);
319 void (*Convert_555_to_565_reverse
)(int width
, int height
,
320 const void* srcbits
, int srclinebytes
,
321 void* dstbits
, int dstlinebytes
);
322 void (*Convert_555_to_888_asis
)(int width
, int height
,
323 const void* srcbits
, int srclinebytes
,
324 void* dstbits
, int dstlinebytes
);
325 void (*Convert_555_to_888_reverse
)(int width
, int height
,
326 const void* srcbits
, int srclinebytes
,
327 void* dstbits
, int dstlinebytes
);
328 void (*Convert_555_to_0888_asis
)(int width
, int height
,
329 const void* srcbits
, int srclinebytes
,
330 void* dstbits
, int dstlinebytes
);
331 void (*Convert_555_to_0888_reverse
)(int width
, int height
,
332 const void* srcbits
, int srclinebytes
,
333 void* dstbits
, int dstlinebytes
);
334 void (*Convert_5x5_to_any0888
)(int width
, int height
,
335 const void* srcbits
, int srclinebytes
,
336 WORD rsrc
, WORD gsrc
, WORD bsrc
,
337 void* dstbits
, int dstlinebytes
,
338 DWORD rdst
, DWORD gdst
, DWORD bdst
);
339 void (*Convert_565_reverse
)(int width
, int height
,
340 const void* srcbits
, int srclinebytes
,
341 void* dstbits
, int dstlinebytes
);
342 void (*Convert_565_to_555_asis
)(int width
, int height
,
343 const void* srcbits
, int srclinebytes
,
344 void* dstbits
, int dstlinebytes
);
345 void (*Convert_565_to_555_reverse
)(int width
, int height
,
346 const void* srcbits
, int srclinebytes
,
347 void* dstbits
, int dstlinebytes
);
348 void (*Convert_565_to_888_asis
)(int width
, int height
,
349 const void* srcbits
, int srclinebytes
,
350 void* dstbits
, int dstlinebytes
);
351 void (*Convert_565_to_888_reverse
)(int width
, int height
,
352 const void* srcbits
, int srclinebytes
,
353 void* dstbits
, int dstlinebytes
);
354 void (*Convert_565_to_0888_asis
)(int width
, int height
,
355 const void* srcbits
, int srclinebytes
,
356 void* dstbits
, int dstlinebytes
);
357 void (*Convert_565_to_0888_reverse
)(int width
, int height
,
358 const void* srcbits
, int srclinebytes
,
359 void* dstbits
, int dstlinebytes
);
360 void (*Convert_888_asis
)(int width
, int height
,
361 const void* srcbits
, int srclinebytes
,
362 void* dstbits
, int dstlinebytes
);
363 void (*Convert_888_reverse
)(int width
, int height
,
364 const void* srcbits
, int srclinebytes
,
365 void* dstbits
, int dstlinebytes
);
366 void (*Convert_888_to_555_asis
)(int width
, int height
,
367 const void* srcbits
, int srclinebytes
,
368 void* dstbits
, int dstlinebytes
);
369 void (*Convert_888_to_555_reverse
)(int width
, int height
,
370 const void* srcbits
, int srclinebytes
,
371 void* dstbits
, int dstlinebytes
);
372 void (*Convert_888_to_565_asis
)(int width
, int height
,
373 const void* srcbits
, int srclinebytes
,
374 void* dstbits
, int dstlinebytes
);
375 void (*Convert_888_to_565_reverse
)(int width
, int height
,
376 const void* srcbits
, int srclinebytes
,
377 void* dstbits
, int dstlinebytes
);
378 void (*Convert_888_to_0888_asis
)(int width
, int height
,
379 const void* srcbits
, int srclinebytes
,
380 void* dstbits
, int dstlinebytes
);
381 void (*Convert_888_to_0888_reverse
)(int width
, int height
,
382 const void* srcbits
, int srclinebytes
,
383 void* dstbits
, int dstlinebytes
);
384 void (*Convert_rgb888_to_any0888
)(int width
, int height
,
385 const void* srcbits
, int srclinebytes
,
386 void* dstbits
, int dstlinebytes
,
387 DWORD rdst
, DWORD gdst
, DWORD bdst
);
388 void (*Convert_bgr888_to_any0888
)(int width
, int height
,
389 const void* srcbits
, int srclinebytes
,
390 void* dstbits
, int dstlinebytes
,
391 DWORD rdst
, DWORD gdst
, DWORD bdst
);
392 void (*Convert_0888_asis
)(int width
, int height
,
393 const void* srcbits
, int srclinebytes
,
394 void* dstbits
, int dstlinebytes
);
395 void (*Convert_0888_reverse
)(int width
, int height
,
396 const void* srcbits
, int srclinebytes
,
397 void* dstbits
, int dstlinebytes
);
398 void (*Convert_0888_any
)(int width
, int height
,
399 const void* srcbits
, int srclinebytes
,
400 DWORD rsrc
, DWORD gsrc
, DWORD bsrc
,
401 void* dstbits
, int dstlinebytes
,
402 DWORD rdst
, DWORD gdst
, DWORD bdst
);
403 void (*Convert_0888_to_555_asis
)(int width
, int height
,
404 const void* srcbits
, int srclinebytes
,
405 void* dstbits
, int dstlinebytes
);
406 void (*Convert_0888_to_555_reverse
)(int width
, int height
,
407 const void* srcbits
, int srclinebytes
,
408 void* dstbits
, int dstlinebytes
);
409 void (*Convert_0888_to_565_asis
)(int width
, int height
,
410 const void* srcbits
, int srclinebytes
,
411 void* dstbits
, int dstlinebytes
);
412 void (*Convert_0888_to_565_reverse
)(int width
, int height
,
413 const void* srcbits
, int srclinebytes
,
414 void* dstbits
, int dstlinebytes
);
415 void (*Convert_any0888_to_5x5
)(int width
, int height
,
416 const void* srcbits
, int srclinebytes
,
417 DWORD rsrc
, DWORD gsrc
, DWORD bsrc
,
418 void* dstbits
, int dstlinebytes
,
419 WORD rdst
, WORD gdst
, WORD bdst
);
420 void (*Convert_0888_to_888_asis
)(int width
, int height
,
421 const void* srcbits
, int srclinebytes
,
422 void* dstbits
, int dstlinebytes
);
423 void (*Convert_0888_to_888_reverse
)(int width
, int height
,
424 const void* srcbits
, int srclinebytes
,
425 void* dstbits
, int dstlinebytes
);
426 void (*Convert_any0888_to_rgb888
)(int width
, int height
,
427 const void* srcbits
, int srclinebytes
,
428 DWORD rsrc
, DWORD gsrc
, DWORD bsrc
,
429 void* dstbits
, int dstlinebytes
);
430 void (*Convert_any0888_to_bgr888
)(int width
, int height
,
431 const void* srcbits
, int srclinebytes
,
432 DWORD rsrc
, DWORD gsrc
, DWORD bsrc
,
433 void* dstbits
, int dstlinebytes
);
436 extern const dib_conversions dib_normal
, dib_src_byteswap
, dib_dst_byteswap
;
438 extern INT
X11DRV_DIB_MaskToShift(DWORD mask
);
439 extern INT
X11DRV_CoerceDIBSection(X11DRV_PDEVICE
*physDev
,INT
);
440 extern INT
X11DRV_LockDIBSection(X11DRV_PDEVICE
*physDev
,INT
);
441 extern void X11DRV_UnlockDIBSection(X11DRV_PDEVICE
*physDev
,BOOL
);
443 extern void X11DRV_DIB_DeleteDIBSection(X_PHYSBITMAP
*physBitmap
, DIBSECTION
*dib
);
444 extern void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE
*physDevSrc
, X11DRV_PDEVICE
*physDevDst
,
445 DWORD xSrc
, DWORD ySrc
, DWORD xDest
, DWORD yDest
,
446 DWORD width
, DWORD height
);
448 extern INT
X11DRV_DCICommand(INT cbInput
, const struct _DCICMD
*lpCmd
, LPVOID lpOutData
);
450 /**************************************************************************
454 extern void X11DRV_GDI_Finalize(void);
456 extern Display
*gdi_display
; /* display to use for all GDI functions */
458 /* X11 GDI palette driver */
460 #define X11DRV_PALETTE_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual) */
461 #define X11DRV_PALETTE_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
463 #define X11DRV_PALETTE_PRIVATE 0x1000 /* private colormap, identity mapping */
464 #define X11DRV_PALETTE_WHITESET 0x2000
466 extern Colormap X11DRV_PALETTE_PaletteXColormap
;
467 extern UINT16 X11DRV_PALETTE_PaletteFlags
;
469 extern int *X11DRV_PALETTE_PaletteToXPixel
;
470 extern int *X11DRV_PALETTE_XPixelToPalette
;
472 extern int X11DRV_PALETTE_mapEGAPixel
[16];
474 extern int X11DRV_PALETTE_Init(void);
475 extern void X11DRV_PALETTE_Cleanup(void);
476 extern BOOL
X11DRV_IsSolidColor(COLORREF color
);
478 extern COLORREF
X11DRV_PALETTE_ToLogical(int pixel
);
479 extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE
*physDev
, COLORREF color
);
481 extern unsigned int depth_to_bpp( unsigned int depth
);
485 #define X11DRV_ESCAPE 6789
486 enum x11drv_escape_codes
488 X11DRV_GET_DISPLAY
, /* get X11 display for a DC */
489 X11DRV_GET_DRAWABLE
, /* get current drawable for a DC */
490 X11DRV_GET_FONT
, /* get current X font for a DC */
491 X11DRV_SET_DRAWABLE
, /* set current drawable for a DC */
492 X11DRV_START_EXPOSURES
, /* start graphics exposures */
493 X11DRV_END_EXPOSURES
, /* end graphics exposures */
494 X11DRV_GET_DCE
, /* no longer used */
495 X11DRV_SET_DCE
, /* no longer used */
496 X11DRV_GET_GLX_DRAWABLE
, /* get current glx drawable for a DC */
497 X11DRV_SYNC_PIXMAP
, /* sync the dibsection to its pixmap */
498 X11DRV_FLUSH_GL_DRAWABLE
/* flush changes made to the gl drawable */
501 struct x11drv_escape_set_drawable
503 enum x11drv_escape_codes code
; /* escape code (X11DRV_SET_DRAWABLE) */
504 Drawable drawable
; /* X drawable */
505 int mode
; /* ClipByChildren or IncludeInferiors */
506 RECT dc_rect
; /* DC rectangle relative to drawable */
507 RECT drawable_rect
;/* Drawable rectangle relative to screen */
508 XID fbconfig_id
; /* fbconfig id used by the GL drawable */
509 Drawable gl_drawable
; /* GL drawable */
510 Pixmap pixmap
; /* Pixmap for a GLXPixmap gl_drawable */
511 int gl_copy
; /* whether the GL contents need explicit copying */
514 /**************************************************************************
518 struct x11drv_thread_data
521 XEvent
*current_event
; /* event currently being processed */
522 Cursor cursor
; /* current cursor */
523 Window cursor_window
; /* current window that contains the cursor */
524 Window grab_window
; /* window that currently grabs the mouse */
525 HWND last_focus
; /* last window that had focus */
526 XIM xim
; /* input method */
527 XFontSet font_set
; /* international text drawing font set */
528 Window selection_wnd
; /* window used for selection interactions */
529 HKL kbd_layout
; /* active keyboard layout */
532 extern struct x11drv_thread_data
*x11drv_init_thread_data(void);
533 extern DWORD thread_data_tls_index
;
535 static inline struct x11drv_thread_data
*x11drv_thread_data(void)
537 return TlsGetValue( thread_data_tls_index
);
540 /* retrieve the thread display, or NULL if not created yet */
541 static inline Display
*thread_display(void)
543 struct x11drv_thread_data
*data
= x11drv_thread_data();
544 if (!data
) return NULL
;
545 return data
->display
;
548 /* retrieve the thread display, creating it if needed */
549 static inline Display
*thread_init_display(void)
551 return x11drv_init_thread_data()->display
;
554 static inline size_t get_property_size( int format
, unsigned long count
)
556 /* format==32 means long, which can be 64 bits... */
557 if (format
== 32) return count
* sizeof(long);
558 return count
* (format
/ 8);
561 extern Visual
*visual
;
562 extern Window root_window
;
563 extern unsigned int screen_width
;
564 extern unsigned int screen_height
;
565 extern unsigned int screen_bpp
;
566 extern unsigned int screen_depth
;
567 extern RECT virtual_screen_rect
;
568 extern unsigned int text_caps
;
571 extern int use_take_focus
;
572 extern int use_primary_selection
;
573 extern int usexcomposite
;
574 extern int managed_mode
;
575 extern int decorated_mode
;
576 extern int private_color_map
;
577 extern int primary_monitor
;
578 extern int copy_default_colors
;
579 extern int alloc_system_colors
;
580 extern int xrender_error_base
;
581 extern HMODULE x11drv_module
;
583 extern BYTE key_state_table
[256];
584 extern POINT cursor_pos
;
590 FIRST_XATOM
= XA_LAST_PREDEFINED
+ 1,
591 XATOM_CLIPBOARD
= FIRST_XATOM
,
595 XATOM_SELECTION_DATA
,
601 XATOM_RAW_CAP_HEIGHT
,
603 XATOM_WM_DELETE_WINDOW
,
609 XATOM__MOTIF_WM_HINTS
,
610 XATOM__NET_STARTUP_INFO_BEGIN
,
611 XATOM__NET_STARTUP_INFO
,
612 XATOM__NET_SUPPORTED
,
613 XATOM__NET_SYSTEM_TRAY_OPCODE
,
614 XATOM__NET_SYSTEM_TRAY_S0
,
615 XATOM__NET_WM_MOVERESIZE
,
620 XATOM__NET_WM_STATE_ABOVE
,
621 XATOM__NET_WM_STATE_FULLSCREEN
,
622 XATOM__NET_WM_STATE_MAXIMIZED_HORZ
,
623 XATOM__NET_WM_STATE_MAXIMIZED_VERT
,
624 XATOM__NET_WM_STATE_SKIP_PAGER
,
625 XATOM__NET_WM_STATE_SKIP_TASKBAR
,
626 XATOM__NET_WM_WINDOW_OPACITY
,
627 XATOM__NET_WM_WINDOW_TYPE
,
628 XATOM__NET_WM_WINDOW_TYPE_DIALOG
,
629 XATOM__NET_WM_WINDOW_TYPE_NORMAL
,
630 XATOM__NET_WM_WINDOW_TYPE_UTILITY
,
640 XATOM_XdndActionCopy
,
641 XATOM_XdndActionMove
,
642 XATOM_XdndActionLink
,
644 XATOM_XdndActionPrivate
,
660 extern Atom X11DRV_Atoms
[NB_XATOMS
- FIRST_XATOM
];
662 #define x11drv_atom(name) (X11DRV_Atoms[XATOM_##name - FIRST_XATOM])
664 /* X11 event driver */
666 typedef void (*x11drv_event_handler
)( HWND hwnd
, XEvent
*event
);
668 extern void X11DRV_register_event_handler( int type
, x11drv_event_handler handler
);
670 extern void X11DRV_ButtonPress( HWND hwnd
, XEvent
*event
);
671 extern void X11DRV_ButtonRelease( HWND hwnd
, XEvent
*event
);
672 extern void X11DRV_MotionNotify( HWND hwnd
, XEvent
*event
);
673 extern void X11DRV_EnterNotify( HWND hwnd
, XEvent
*event
);
674 extern void X11DRV_KeyEvent( HWND hwnd
, XEvent
*event
);
675 extern void X11DRV_KeymapNotify( HWND hwnd
, XEvent
*event
);
676 extern void X11DRV_DestroyNotify( HWND hwnd
, XEvent
*event
);
677 extern void X11DRV_SelectionRequest( HWND hWnd
, XEvent
*event
);
678 extern void X11DRV_SelectionClear( HWND hWnd
, XEvent
*event
);
679 extern void X11DRV_MappingNotify( HWND hWnd
, XEvent
*event
);
681 extern DWORD
EVENT_x11_time_to_win32_time(Time time
);
683 /* X11 driver private messages, must be in the range 0x80001000..0x80001fff */
684 enum x11drv_window_messages
686 WM_X11DRV_ACQUIRE_SELECTION
= 0x80001000,
687 WM_X11DRV_DELETE_WINDOW
,
688 WM_X11DRV_SET_WIN_FORMAT
,
689 WM_X11DRV_SET_WIN_REGION
,
690 WM_X11DRV_RESIZE_DESKTOP
693 /* _NET_WM_STATE properties that we keep track of */
694 enum x11drv_net_wm_state
696 NET_WM_STATE_FULLSCREEN
,
698 NET_WM_STATE_MAXIMIZED
,
699 NET_WM_STATE_SKIP_PAGER
,
700 NET_WM_STATE_SKIP_TASKBAR
,
704 /* x11drv private window data */
705 struct x11drv_win_data
707 HWND hwnd
; /* hwnd that this private data belongs to */
708 Window whole_window
; /* X window for the complete window */
709 Window client_window
; /* X window for the client area */
710 Window icon_window
; /* X window for the icon */
711 Colormap colormap
; /* Colormap for this window */
712 VisualID visualid
; /* visual id of the client window */
713 XID fbconfig_id
; /* fbconfig id for the GL drawable this hwnd uses */
714 Drawable gl_drawable
; /* Optional GL drawable for rendering the client area */
715 Pixmap pixmap
; /* Base pixmap for if gl_drawable is a GLXPixmap */
716 RECT window_rect
; /* USER window rectangle relative to parent */
717 RECT whole_rect
; /* X window rectangle for the whole window relative to parent */
718 RECT client_rect
; /* client area relative to parent */
719 XIC xic
; /* X input context */
720 XWMHints
*wm_hints
; /* window manager hints */
721 BOOL managed
: 1; /* is window managed? */
722 BOOL mapped
: 1; /* is window mapped? (in either normal or iconic state) */
723 BOOL iconic
: 1; /* is window in iconic state? */
724 BOOL embedded
: 1; /* is window an XEMBED client? */
725 BOOL shaped
: 1; /* is window using a custom region shape? */
726 int wm_state
; /* current value of the WM_STATE property */
727 DWORD net_wm_state
; /* bit mask of active x11drv_net_wm_state values */
728 HBITMAP hWMIconBitmap
;
732 extern struct x11drv_win_data
*X11DRV_get_win_data( HWND hwnd
);
733 extern struct x11drv_win_data
*X11DRV_create_win_data( HWND hwnd
);
734 extern Window
X11DRV_get_whole_window( HWND hwnd
);
735 extern XIC
X11DRV_get_ic( HWND hwnd
);
737 extern int pixelformat_from_fbconfig_id( XID fbconfig_id
);
738 extern XVisualInfo
*visual_from_fbconfig_id( XID fbconfig_id
);
739 extern void mark_drawable_dirty( Drawable old
, Drawable
new );
740 extern Drawable
create_glxpixmap( Display
*display
, XVisualInfo
*vis
, Pixmap parent
);
741 extern void flush_gl_drawable( X11DRV_PDEVICE
*physDev
);
743 extern void wait_for_withdrawn_state( Display
*display
, struct x11drv_win_data
*data
, BOOL set
);
744 extern void update_net_wm_states( Display
*display
, struct x11drv_win_data
*data
);
745 extern void make_window_embedded( Display
*display
, struct x11drv_win_data
*data
);
747 /* X context to associate a hwnd to an X window */
748 extern XContext winContext
;
750 extern void X11DRV_InitClipboard(void);
751 extern int CDECL
X11DRV_AcquireClipboard(HWND hWndClipWindow
);
752 extern void X11DRV_ResetSelectionOwner(void);
753 extern void CDECL
X11DRV_SetFocus( HWND hwnd
);
754 extern Cursor
X11DRV_GetCursor( Display
*display
, struct tagCURSORICONINFO
*ptr
);
755 extern void CDECL
X11DRV_SetCursor( struct tagCURSORICONINFO
*lpCursor
);
756 extern BOOL CDECL
X11DRV_ClipCursor( LPCRECT clip
);
757 extern void X11DRV_InitKeyboard( Display
*display
);
758 extern void X11DRV_send_keyboard_input( WORD wVk
, WORD wScan
, DWORD dwFlags
, DWORD time
,
759 DWORD dwExtraInfo
, UINT injected_flags
);
760 extern void X11DRV_send_mouse_input( HWND hwnd
, DWORD flags
, DWORD x
, DWORD y
,
761 DWORD data
, DWORD time
, DWORD extra_info
, UINT injected_flags
);
762 extern DWORD CDECL
X11DRV_MsgWaitForMultipleObjectsEx( DWORD count
, const HANDLE
*handles
, DWORD timeout
,
763 DWORD mask
, DWORD flags
);
765 typedef int (*x11drv_error_callback
)( Display
*display
, XErrorEvent
*event
, void *arg
);
767 extern void X11DRV_expect_error( Display
*display
, x11drv_error_callback callback
, void *arg
);
768 extern int X11DRV_check_error(void);
769 extern void X11DRV_X_to_window_rect( struct x11drv_win_data
*data
, RECT
*rect
);
770 extern void xinerama_init( unsigned int width
, unsigned int height
);
772 extern void X11DRV_init_desktop( Window win
, unsigned int width
, unsigned int height
);
773 extern void X11DRV_resize_desktop(unsigned int width
, unsigned int height
);
774 extern void X11DRV_Settings_AddDepthModes(void);
775 extern void X11DRV_Settings_AddOneMode(unsigned int width
, unsigned int height
, unsigned int bpp
, unsigned int freq
);
776 extern int X11DRV_Settings_CreateDriver(LPDDHALINFO info
);
777 extern LPDDHALMODEINFO
X11DRV_Settings_CreateModes(unsigned int max_modes
, int reserve_depths
);
778 unsigned int X11DRV_Settings_GetModeCount(void);
779 void X11DRV_Settings_Init(void);
780 LPDDHALMODEINFO
X11DRV_Settings_SetHandlers(const char *name
,
781 int (*pNewGCM
)(void),
782 LONG (*pNewSCM
)(int),
786 extern void X11DRV_DDHAL_SwitchMode(DWORD dwModeIndex
, LPVOID fb_addr
, LPVIDMEM fb_mem
);
789 extern BOOL
X11DRV_InitXIM( const char *input_style
) DECLSPEC_HIDDEN
;
790 extern XIC
X11DRV_CreateIC(XIM xim
, struct x11drv_win_data
*data
) DECLSPEC_HIDDEN
;
791 extern void X11DRV_SetupXIM(void) DECLSPEC_HIDDEN
;
792 extern void X11DRV_XIMLookupChars( const char *str
, DWORD count
) DECLSPEC_HIDDEN
;
793 extern void X11DRV_ForceXIMReset(HWND hwnd
) DECLSPEC_HIDDEN
;
795 /* FIXME: private functions imported from user32 */
796 extern LRESULT
HOOK_CallHooks( INT id
, INT code
, WPARAM wparam
, LPARAM lparam
, BOOL unicode
);
798 #define XEMBED_MAPPED (1 << 0)
800 #endif /* __WINE_X11DRV_H */