2 * X11 driver definitions
5 #ifndef __WINE_X11DRV_H
6 #define __WINE_X11DRV_H
10 #ifndef X_DISPLAY_MISSING
12 #include <X11/Xresource.h>
13 #include <X11/Xutil.h>
14 #include <X11/Xatom.h>
15 #endif /* !defined(X_DISPLAY_MISSING) */
24 #include <X11/extensions/XShm.h>
28 struct tagCREATESTRUCTA
;
29 struct tagCURSORICONINFO
;
46 int type
; /* GEOMETRIC || COSMETIC */
49 /* X physical brush */
59 typedef UINT X_PHYSFONT
;
61 /* X physical device */
64 GC gc
; /* X Window GC */
78 /* GCs used for B&W and color bitmap operations */
79 extern GC BITMAP_monoGC
, BITMAP_colorGC
;
81 #define BITMAP_GC(bmp) \
82 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
84 extern DeviceCaps X11DRV_DevCaps
;
86 /* Wine driver X11 functions */
88 extern BOOL
X11DRV_Init(void);
89 extern BOOL
X11DRV_BitBlt( struct tagDC
*dcDst
, INT xDst
, INT yDst
,
90 INT width
, INT height
, struct tagDC
*dcSrc
,
91 INT xSrc
, INT ySrc
, DWORD rop
);
92 extern BOOL
X11DRV_EnumDeviceFonts( struct tagDC
*dc
, LPLOGFONT16 plf
,
93 DEVICEFONTENUMPROC dfeproc
, LPARAM lp
);
94 extern BOOL
X11DRV_GetCharWidth( struct tagDC
*dc
, UINT firstChar
,
95 UINT lastChar
, LPINT buffer
);
96 extern BOOL
X11DRV_GetTextExtentPoint( struct tagDC
*dc
, LPCWSTR str
,
97 INT count
, LPSIZE size
);
98 extern BOOL
X11DRV_GetTextMetrics(struct tagDC
*dc
, TEXTMETRICA
*metrics
);
99 extern BOOL
X11DRV_PatBlt( struct tagDC
*dc
, INT left
, INT top
,
100 INT width
, INT height
, DWORD rop
);
101 extern VOID
X11DRV_SetDeviceClipping(struct tagDC
*dc
);
102 extern BOOL
X11DRV_StretchBlt( struct tagDC
*dcDst
, INT xDst
, INT yDst
,
103 INT widthDst
, INT heightDst
,
104 struct tagDC
*dcSrc
, INT xSrc
, INT ySrc
,
105 INT widthSrc
, INT heightSrc
, DWORD rop
);
106 extern BOOL
X11DRV_LineTo( struct tagDC
*dc
, INT x
, INT y
);
107 extern BOOL
X11DRV_Arc( struct tagDC
*dc
, INT left
, INT top
, INT right
,
108 INT bottom
, INT xstart
, INT ystart
, INT xend
,
110 extern BOOL
X11DRV_Pie( struct tagDC
*dc
, INT left
, INT top
, INT right
,
111 INT bottom
, INT xstart
, INT ystart
, INT xend
,
113 extern BOOL
X11DRV_Chord( struct tagDC
*dc
, INT left
, INT top
,
114 INT right
, INT bottom
, INT xstart
,
115 INT ystart
, INT xend
, INT yend
);
116 extern BOOL
X11DRV_Ellipse( struct tagDC
*dc
, INT left
, INT top
,
117 INT right
, INT bottom
);
118 extern BOOL
X11DRV_Rectangle(struct tagDC
*dc
, INT left
, INT top
,
119 INT right
, INT bottom
);
120 extern BOOL
X11DRV_RoundRect( struct tagDC
*dc
, INT left
, INT top
,
121 INT right
, INT bottom
, INT ell_width
,
123 extern COLORREF
X11DRV_SetPixel( struct tagDC
*dc
, INT x
, INT y
,
125 extern COLORREF
X11DRV_GetPixel( struct tagDC
*dc
, INT x
, INT y
);
126 extern BOOL
X11DRV_PaintRgn( struct tagDC
*dc
, HRGN hrgn
);
127 extern BOOL
X11DRV_Polyline( struct tagDC
*dc
,const POINT
* pt
,INT count
);
128 extern BOOL
X11DRV_Polygon( struct tagDC
*dc
, const POINT
* pt
, INT count
);
129 extern BOOL
X11DRV_PolyPolygon( struct tagDC
*dc
, const POINT
* pt
,
130 const INT
* counts
, UINT polygons
);
131 extern BOOL
X11DRV_PolyPolyline( struct tagDC
*dc
, const POINT
* pt
,
132 const DWORD
* counts
, DWORD polylines
);
134 extern HGDIOBJ
X11DRV_SelectObject( struct tagDC
*dc
, HGDIOBJ handle
);
136 extern COLORREF
X11DRV_SetBkColor( struct tagDC
*dc
, COLORREF color
);
137 extern COLORREF
X11DRV_SetTextColor( struct tagDC
*dc
, COLORREF color
);
138 extern BOOL
X11DRV_ExtFloodFill( struct tagDC
*dc
, INT x
, INT y
,
139 COLORREF color
, UINT fillType
);
140 extern BOOL
X11DRV_ExtTextOut( struct tagDC
*dc
, INT x
, INT y
,
141 UINT flags
, const RECT
*lprect
,
142 LPCWSTR str
, UINT count
, const INT
*lpDx
);
143 extern BOOL
X11DRV_CreateBitmap( HBITMAP hbitmap
);
144 extern BOOL
X11DRV_DeleteObject( HGDIOBJ handle
);
145 extern LONG
X11DRV_BitmapBits( HBITMAP hbitmap
, void *bits
, LONG count
,
147 extern INT
X11DRV_SetDIBitsToDevice( struct tagDC
*dc
, INT xDest
,
148 INT yDest
, DWORD cx
, DWORD cy
,
150 UINT startscan
, UINT lines
,
151 LPCVOID bits
, const BITMAPINFO
*info
,
153 extern INT
X11DRV_DeviceBitmapBits( struct tagDC
*dc
, HBITMAP hbitmap
,
154 WORD fGet
, UINT startscan
,
155 UINT lines
, LPSTR bits
,
156 LPBITMAPINFO info
, UINT coloruse
);
157 extern HANDLE
X11DRV_LoadOEMResource( WORD id
, WORD type
);
159 /* X11 driver internal functions */
161 extern BOOL
X11DRV_BITMAP_Init(void);
162 extern BOOL
X11DRV_BRUSH_Init(void);
163 extern BOOL
X11DRV_DIB_Init(void);
164 extern BOOL
X11DRV_FONT_Init( struct tagDeviceCaps
* );
165 extern BOOL
X11DRV_OBM_Init(void);
168 extern XImage
*X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ
*bmp
);
169 extern int X11DRV_DIB_GetXImageWidthBytes( int width
, int depth
);
170 extern BOOL
X11DRV_DIB_Init(void);
171 extern X11DRV_PHYSBITMAP
*X11DRV_AllocBitmap( struct tagBITMAPOBJ
*bmp
);
172 extern HBITMAP
X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap
);
173 extern HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap
, HDC hdc
, BOOL bDeletePixmap
);
174 extern HBITMAP
X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap
, BOOL bDeletePixmap
);
175 extern Pixmap
X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB
, HDC hdc
);
176 extern Pixmap
X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp
, HDC hdc
);
178 extern BOOL
X11DRV_SetupGCForPatBlt( struct tagDC
*dc
, GC gc
,
180 extern BOOL
X11DRV_SetupGCForBrush( struct tagDC
*dc
);
181 extern BOOL
X11DRV_SetupGCForPen( struct tagDC
*dc
);
182 extern BOOL
X11DRV_SetupGCForText( struct tagDC
*dc
);
184 extern const int X11DRV_XROPfunction
[];
186 /* Xlib critical section */
188 extern CRITICAL_SECTION X11DRV_CritSection
;
190 extern void _XInitImageFuncPtrs(XImage
*);
192 #define XCREATEIMAGE(image,width,height,bpp) \
194 int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
195 (image) = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()), \
196 (bpp), ZPixmap, 0, xcalloc( (height)*width_bytes ),\
197 (width), (height), 32, width_bytes ); \
200 /* exported dib functions for now */
202 /* Additional info for DIB section objects */
205 /* Windows DIB section */
206 DIBSECTION dibSection
;
209 enum { X11DRV_DIB_NoHandler
, X11DRV_DIB_InSync
, X11DRV_DIB_AppMod
, X11DRV_DIB_GdiMod
} status
;
218 /* Selector for 16-bit access to bits */
221 /* Shared memory segment info */
222 XShmSegmentInfo shminfo
;
226 /* This structure holds the arguments for DIB_SetImageBits() */
232 PALETTEENTRY
*palentry
;
253 } X11DRV_DIB_IMAGEBITS_DESCR
;
255 extern int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR
*descr
);
256 extern int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR
*descr
);
257 extern int *X11DRV_DIB_BuildColorMap( struct tagDC
*dc
, WORD coloruse
,
258 WORD depth
, const BITMAPINFO
*info
,
260 extern void X11DRV_DIB_UpdateDIBSection(struct tagDC
*dc
, BOOL toDIB
);
262 extern HBITMAP
X11DRV_DIB_CreateDIBSection(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT usage
,
263 LPVOID
*bits
, HANDLE section
, DWORD offset
);
264 extern HBITMAP16
X11DRV_DIB_CreateDIBSection16(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT16 usage
,
265 SEGPTR
*bits
, HANDLE section
, DWORD offset
);
267 extern struct tagBITMAP_DRIVER X11DRV_BITMAP_Driver
;
269 extern INT
X11DRV_DIB_SetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
270 UINT lines
, LPCVOID bits
, const BITMAPINFO
*info
,
271 UINT coloruse
, HBITMAP hbitmap
);
272 extern INT
X11DRV_DIB_GetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
273 UINT lines
, LPVOID bits
, BITMAPINFO
*info
,
274 UINT coloruse
, HBITMAP hbitmap
);
275 extern void X11DRV_DIB_DeleteDIBSection(struct tagBITMAPOBJ
*bmp
);
277 /**************************************************************************
281 extern struct tagGDI_DRIVER X11DRV_GDI_Driver
;
283 BOOL
X11DRV_GDI_Initialize(void);
284 void X11DRV_GDI_Finalize(void);
286 /* X11 GDI palette driver */
288 #define X11DRV_PALETTE_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
289 #define X11DRV_PALETTE_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
291 #define X11DRV_PALETTE_PRIVATE 0x1000 /* private colormap, identity mapping */
292 #define X11DRV_PALETTE_WHITESET 0x2000
294 extern Colormap X11DRV_PALETTE_PaletteXColormap
;
295 extern UINT16 X11DRV_PALETTE_PaletteFlags
;
297 extern int *X11DRV_PALETTE_PaletteToXPixel
;
298 extern int *X11DRV_PALETTE_XPixelToPalette
;
300 extern int X11DRV_PALETTE_mapEGAPixel
[16];
302 extern BOOL
X11DRV_PALETTE_Init(void);
303 extern void X11DRV_PALETTE_Cleanup(void);
305 extern COLORREF
X11DRV_PALETTE_ToLogical(int pixel
);
306 extern int X11DRV_PALETTE_ToPhysical(struct tagDC
*dc
, COLORREF color
);
308 extern struct tagPALETTE_DRIVER X11DRV_PALETTE_Driver
;
310 extern int X11DRV_PALETTE_SetMapping(struct tagPALETTEOBJ
*palPtr
, UINT uStart
, UINT uNum
, BOOL mapOnly
);
311 extern int X11DRV_PALETTE_UpdateMapping(struct tagPALETTEOBJ
*palPtr
);
312 extern BOOL
X11DRV_PALETTE_IsDark(int pixel
);
314 /**************************************************************************
318 extern struct tagUSER_DRIVER X11DRV_USER_Driver
;
320 extern Display
*display
;
321 extern Screen
*X11DRV_GetXScreen(void);
322 extern Window
X11DRV_GetXRootWindow(void);
324 extern BOOL
X11DRV_USER_Initialize(void);
325 extern void X11DRV_USER_Finalize(void);
326 extern void X11DRV_USER_BeginDebugging(void);
327 extern void X11DRV_USER_EndDebugging(void);
329 /* X11 clipboard driver */
331 extern struct tagCLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver
;
333 extern void X11DRV_CLIPBOARD_FreeResources( Atom property
);
334 extern BOOL
X11DRV_CLIPBOARD_RegisterPixmapResource( Atom property
, Pixmap pixmap
);
336 extern void X11DRV_CLIPBOARD_Acquire(void);
337 extern void X11DRV_CLIPBOARD_Release(void);
338 extern void X11DRV_CLIPBOARD_SetData(UINT wFormat
);
339 extern BOOL
X11DRV_CLIPBOARD_GetData(UINT wFormat
);
340 extern BOOL
X11DRV_CLIPBOARD_IsFormatAvailable(UINT wFormat
);
341 extern BOOL
X11DRV_CLIPBOARD_IsNativeProperty(Atom prop
);
342 extern BOOL
X11DRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName
);
343 extern BOOL
X11DRV_CLIPBOARD_IsSelectionowner();
344 extern UINT
X11DRV_CLIPBOARD_MapPropertyToFormat(char *itemFmtName
);
345 extern Atom
X11DRV_CLIPBOARD_MapFormatToProperty(UINT id
);
346 extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND
*pWnd
, BOOL bFooBar
);
347 extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType
, Window w
, HWND hwnd
);
349 /* X11 desktop driver */
351 extern struct tagDESKTOP_DRIVER X11DRV_DESKTOP_Driver
;
353 typedef struct _X11DRV_DESKTOP_DATA
{
355 } X11DRV_DESKTOP_DATA
;
359 extern Screen
*X11DRV_DESKTOP_GetXScreen(struct tagDESKTOP
*pDesktop
);
360 extern Window
X11DRV_DESKTOP_GetXRootWindow(struct tagDESKTOP
*pDesktop
);
362 extern void X11DRV_DESKTOP_Initialize(struct tagDESKTOP
*pDesktop
);
363 extern void X11DRV_DESKTOP_Finalize(struct tagDESKTOP
*pDesktop
);
364 extern int X11DRV_DESKTOP_GetScreenWidth(struct tagDESKTOP
*pDesktop
);
365 extern int X11DRV_DESKTOP_GetScreenHeight(struct tagDESKTOP
*pDesktop
);
366 extern int X11DRV_DESKTOP_GetScreenDepth(struct tagDESKTOP
*pDesktop
);
368 /* X11 event driver */
370 extern struct tagEVENT_DRIVER X11DRV_EVENT_Driver
;
372 extern WORD
X11DRV_EVENT_XStateToKeyState( int state
) ;
374 extern BOOL
X11DRV_EVENT_Init(void);
375 extern void X11DRV_EVENT_Synchronize( void );
376 extern BOOL
X11DRV_EVENT_CheckFocus( void );
377 extern void X11DRV_EVENT_UserRepaintDisable( BOOL bDisable
);
380 X11DRV_INPUT_RELATIVE
,
381 X11DRV_INPUT_ABSOLUTE
383 extern INPUT_TYPE
X11DRV_EVENT_SetInputMehod(INPUT_TYPE type
);
385 #ifdef HAVE_LIBXXF86DGA2
386 void X11DRV_EVENT_SetDGAStatus(HWND hwnd
, int event_base
) ;
390 /* X11 keyboard driver */
392 extern struct tagKEYBOARD_DRIVER X11DRV_KEYBOARD_Driver
;
394 extern void X11DRV_KEYBOARD_Init(void);
395 extern WORD
X11DRV_KEYBOARD_VkKeyScan(CHAR cChar
);
396 extern UINT16
X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode
, UINT16 wMapType
);
397 extern INT16
X11DRV_KEYBOARD_GetKeyNameText(LONG lParam
, LPSTR lpBuffer
, INT16 nSize
);
398 extern INT16
X11DRV_KEYBOARD_ToAscii(UINT16 virtKey
, UINT16 scanCode
, LPBYTE lpKeyState
, LPVOID lpChar
, UINT16 flags
);
399 extern BOOL
X11DRV_KEYBOARD_GetBeepActive(void);
400 extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate
);
401 extern void X11DRV_KEYBOARD_Beep(void);
402 extern BOOL
X11DRV_KEYBOARD_GetDIState(DWORD len
, LPVOID ptr
);
403 extern BOOL
X11DRV_KEYBOARD_GetDIData(BYTE
*keystate
, DWORD dodsize
, LPDIDEVICEOBJECTDATA dod
, LPDWORD entries
, DWORD flags
);
404 extern void X11DRV_KEYBOARD_GetKeyboardConfig(KEYBOARD_CONFIG
*cfg
);
405 extern void X11DRV_KEYBOARD_SetKeyboardConfig(KEYBOARD_CONFIG
*cfg
, DWORD mask
);
407 extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND
*pWnd
, XKeyEvent
*event
);
409 /* X11 monitor driver */
411 extern struct tagMONITOR_DRIVER X11DRV_MONITOR_Driver
;
413 typedef struct _X11DRV_MONITOR_DATA
{
419 } X11DRV_MONITOR_DATA
;
423 extern Screen
*X11DRV_MONITOR_GetXScreen(struct tagMONITOR
*pMonitor
);
424 extern Window
X11DRV_MONITOR_GetXRootWindow(struct tagMONITOR
*pMonitor
);
426 extern void X11DRV_MONITOR_Initialize(struct tagMONITOR
*pMonitor
);
427 extern void X11DRV_MONITOR_Finalize(struct tagMONITOR
*pMonitor
);
428 extern BOOL
X11DRV_MONITOR_IsSingleWindow(struct tagMONITOR
*pMonitor
);
429 extern int X11DRV_MONITOR_GetWidth(struct tagMONITOR
*pMonitor
);
430 extern int X11DRV_MONITOR_GetHeight(struct tagMONITOR
*pMonitor
);
431 extern int X11DRV_MONITOR_GetDepth(struct tagMONITOR
*pMonitor
);
432 extern BOOL
X11DRV_MONITOR_GetScreenSaveActive(struct tagMONITOR
*pMonitor
);
433 extern void X11DRV_MONITOR_SetScreenSaveActive(struct tagMONITOR
*pMonitor
, BOOL bActivate
);
434 extern int X11DRV_MONITOR_GetScreenSaveTimeout(struct tagMONITOR
*pMonitor
);
435 extern void X11DRV_MONITOR_SetScreenSaveTimeout(struct tagMONITOR
*pMonitor
, int nTimeout
);
437 /* X11 mouse driver */
439 extern struct tagMOUSE_DRIVER X11DRV_MOUSE_Driver
;
441 extern BOOL X11DRV_MOUSE_DisableWarpPointer
;
442 extern void X11DRV_MOUSE_Init();
443 extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO
*lpCursor
);
444 extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX
, WORD wAbsY
);
445 extern BOOL
X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable
);
447 /* X11 windows driver */
449 extern struct tagWND_DRIVER X11DRV_WND_Driver
;
451 typedef struct _X11DRV_WND_DATA
{
453 HBITMAP hWMIconBitmap
;
457 extern Window
X11DRV_WND_GetXWindow(struct tagWND
*wndPtr
);
458 extern Window
X11DRV_WND_FindXWindow(struct tagWND
*wndPtr
);
459 extern Screen
*X11DRV_WND_GetXScreen(struct tagWND
*wndPtr
);
460 extern Window
X11DRV_WND_GetXRootWindow(struct tagWND
*wndPtr
);
462 extern void X11DRV_WND_Initialize(struct tagWND
*wndPtr
);
463 extern void X11DRV_WND_Finalize(struct tagWND
*wndPtr
);
464 extern BOOL
X11DRV_WND_CreateDesktopWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, BOOL bUnicode
);
465 extern BOOL
X11DRV_WND_CreateWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, struct tagCREATESTRUCTA
*cs
, BOOL bUnicode
);
466 extern BOOL
X11DRV_WND_DestroyWindow(struct tagWND
*pWnd
);
467 extern struct tagWND
*X11DRV_WND_SetParent(struct tagWND
*wndPtr
, struct tagWND
*pWndParent
);
468 extern void X11DRV_WND_ForceWindowRaise(struct tagWND
*pWnd
);
469 extern void X11DRV_WND_SetWindowPos(struct tagWND
*wndPtr
, const struct tagWINDOWPOS
*winpos
, BOOL bSMC_SETXPOS
);
470 extern void X11DRV_WND_SetText(struct tagWND
*wndPtr
, LPCSTR text
);
471 extern void X11DRV_WND_SetFocus(struct tagWND
*wndPtr
);
472 extern void X11DRV_WND_PreSizeMove(struct tagWND
*wndPtr
);
473 extern void X11DRV_WND_PostSizeMove(struct tagWND
*wndPtr
);
474 extern void X11DRV_WND_SurfaceCopy(struct tagWND
*wndPtr
, struct tagDC
*dcPtr
, INT dx
, INT dy
, const RECT
*clipRect
, BOOL bUpdate
);
475 extern void X11DRV_WND_SetDrawable(struct tagWND
*wndPtr
, struct tagDC
*dc
, WORD flags
, BOOL bSetClipOrigin
);
476 extern BOOL
X11DRV_WND_SetHostAttr(struct tagWND
*wndPtr
, INT haKey
, INT value
);
477 extern BOOL
X11DRV_WND_IsSelfClipping(struct tagWND
*wndPtr
);
478 extern void X11DRV_WND_DockWindow(struct tagWND
*wndPtr
);
480 extern int X11DRV_EVENT_PrepareShmCompletion( Drawable dw
);
481 extern void X11DRV_EVENT_WaitShmCompletion( int compl );
482 extern void X11DRV_EVENT_WaitShmCompletions( Drawable dw
);
483 extern void X11DRV_EVENT_WaitReplaceShmCompletion( int *compl, Drawable dw
);
485 #endif /* __WINE_X11DRV_H */