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) */
21 #include <X11/extensions/XShm.h>
25 struct tagCREATESTRUCTA
;
26 struct tagCURSORICONINFO
;
32 struct tagKEYBOARD_CONFIG
;
33 struct DIDEVICEOBJECTDATA
;
45 int type
; /* GEOMETRIC || COSMETIC */
48 /* X physical brush */
58 typedef UINT X_PHYSFONT
;
60 /* X physical device */
63 GC gc
; /* X Window GC */
77 /* GCs used for B&W and color bitmap operations */
78 extern GC BITMAP_monoGC
, BITMAP_colorGC
;
80 #define BITMAP_GC(bmp) \
81 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
83 extern DeviceCaps X11DRV_DevCaps
;
85 /* Wine driver X11 functions */
87 extern BOOL
X11DRV_BitBlt( struct tagDC
*dcDst
, INT xDst
, INT yDst
,
88 INT width
, INT height
, struct tagDC
*dcSrc
,
89 INT xSrc
, INT ySrc
, DWORD rop
);
90 extern BOOL
X11DRV_EnumDeviceFonts( struct tagDC
*dc
, LPLOGFONT16 plf
,
91 DEVICEFONTENUMPROC dfeproc
, LPARAM lp
);
92 extern BOOL
X11DRV_GetCharWidth( struct tagDC
*dc
, UINT firstChar
,
93 UINT lastChar
, LPINT buffer
);
94 extern BOOL
X11DRV_GetDCOrgEx( struct tagDC
*dc
, LPPOINT lpp
);
95 extern BOOL
X11DRV_GetTextExtentPoint( struct tagDC
*dc
, LPCWSTR str
,
96 INT count
, LPSIZE size
);
97 extern BOOL
X11DRV_GetTextMetrics(struct tagDC
*dc
, TEXTMETRICA
*metrics
);
98 extern BOOL
X11DRV_PatBlt( struct tagDC
*dc
, INT left
, INT top
,
99 INT width
, INT height
, DWORD rop
);
100 extern VOID
X11DRV_SetDeviceClipping(struct tagDC
*dc
);
101 extern BOOL
X11DRV_StretchBlt( struct tagDC
*dcDst
, INT xDst
, INT yDst
,
102 INT widthDst
, INT heightDst
,
103 struct tagDC
*dcSrc
, INT xSrc
, INT ySrc
,
104 INT widthSrc
, INT heightSrc
, DWORD rop
);
105 extern BOOL
X11DRV_LineTo( struct tagDC
*dc
, INT x
, INT y
);
106 extern BOOL
X11DRV_Arc( struct tagDC
*dc
, INT left
, INT top
, INT right
,
107 INT bottom
, INT xstart
, INT ystart
, INT xend
,
109 extern BOOL
X11DRV_Pie( struct tagDC
*dc
, INT left
, INT top
, INT right
,
110 INT bottom
, INT xstart
, INT ystart
, INT xend
,
112 extern BOOL
X11DRV_Chord( struct tagDC
*dc
, INT left
, INT top
,
113 INT right
, INT bottom
, INT xstart
,
114 INT ystart
, INT xend
, INT yend
);
115 extern BOOL
X11DRV_Ellipse( struct tagDC
*dc
, INT left
, INT top
,
116 INT right
, INT bottom
);
117 extern BOOL
X11DRV_Rectangle(struct tagDC
*dc
, INT left
, INT top
,
118 INT right
, INT bottom
);
119 extern BOOL
X11DRV_RoundRect( struct tagDC
*dc
, INT left
, INT top
,
120 INT right
, INT bottom
, INT ell_width
,
122 extern COLORREF
X11DRV_SetPixel( struct tagDC
*dc
, INT x
, INT y
,
124 extern COLORREF
X11DRV_GetPixel( struct tagDC
*dc
, INT x
, INT y
);
125 extern BOOL
X11DRV_PaintRgn( struct tagDC
*dc
, HRGN hrgn
);
126 extern BOOL
X11DRV_Polyline( struct tagDC
*dc
,const POINT
* pt
,INT count
);
127 extern BOOL
X11DRV_Polygon( struct tagDC
*dc
, const POINT
* pt
, INT count
);
128 extern BOOL
X11DRV_PolyPolygon( struct tagDC
*dc
, const POINT
* pt
,
129 const INT
* counts
, UINT polygons
);
130 extern BOOL
X11DRV_PolyPolyline( struct tagDC
*dc
, const POINT
* pt
,
131 const DWORD
* counts
, DWORD polylines
);
133 extern HGDIOBJ
X11DRV_SelectObject( struct tagDC
*dc
, HGDIOBJ handle
);
135 extern COLORREF
X11DRV_SetBkColor( struct tagDC
*dc
, COLORREF color
);
136 extern COLORREF
X11DRV_SetTextColor( struct tagDC
*dc
, COLORREF color
);
137 extern BOOL
X11DRV_ExtFloodFill( struct tagDC
*dc
, INT x
, INT y
,
138 COLORREF color
, UINT fillType
);
139 extern BOOL
X11DRV_ExtTextOut( struct tagDC
*dc
, INT x
, INT y
,
140 UINT flags
, const RECT
*lprect
,
141 LPCWSTR str
, UINT count
, const INT
*lpDx
);
142 extern BOOL
X11DRV_CreateBitmap( HBITMAP hbitmap
);
143 extern BOOL
X11DRV_DeleteObject( HGDIOBJ handle
);
144 extern LONG
X11DRV_BitmapBits( HBITMAP hbitmap
, void *bits
, LONG count
,
146 extern INT
X11DRV_SetDIBitsToDevice( struct tagDC
*dc
, INT xDest
,
147 INT yDest
, DWORD cx
, DWORD cy
,
149 UINT startscan
, UINT lines
,
150 LPCVOID bits
, const BITMAPINFO
*info
,
152 extern INT
X11DRV_DeviceBitmapBits( struct tagDC
*dc
, HBITMAP hbitmap
,
153 WORD fGet
, UINT startscan
,
154 UINT lines
, LPSTR bits
,
155 LPBITMAPINFO info
, UINT coloruse
);
156 extern HANDLE
X11DRV_LoadOEMResource( WORD id
, WORD type
);
158 /* X11 driver internal functions */
160 extern BOOL
X11DRV_BITMAP_Init(void);
161 extern BOOL
X11DRV_BRUSH_Init(void);
162 extern BOOL
X11DRV_DIB_Init(void);
163 extern BOOL
X11DRV_FONT_Init( struct tagDeviceCaps
* );
164 extern BOOL
X11DRV_OBM_Init(void);
167 extern XImage
*X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ
*bmp
);
168 extern int X11DRV_DIB_GetXImageWidthBytes( int width
, int depth
);
169 extern BOOL
X11DRV_DIB_Init(void);
170 extern X11DRV_PHYSBITMAP
*X11DRV_AllocBitmap( struct tagBITMAPOBJ
*bmp
);
171 extern HBITMAP
X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap
);
172 extern HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap
, HDC hdc
, BOOL bDeletePixmap
);
173 extern HBITMAP
X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap
, BOOL bDeletePixmap
);
174 extern Pixmap
X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB
, HDC hdc
);
175 extern Pixmap
X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp
, HDC hdc
);
177 extern BOOL
X11DRV_SetupGCForPatBlt( struct tagDC
*dc
, GC gc
,
179 extern BOOL
X11DRV_SetupGCForBrush( struct tagDC
*dc
);
180 extern BOOL
X11DRV_SetupGCForPen( struct tagDC
*dc
);
181 extern BOOL
X11DRV_SetupGCForText( struct tagDC
*dc
);
183 extern const int X11DRV_XROPfunction
[];
185 /* Xlib critical section */
187 extern CRITICAL_SECTION X11DRV_CritSection
;
189 extern void _XInitImageFuncPtrs(XImage
*);
191 #define XCREATEIMAGE(image,width,height,bpp) \
193 int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
194 (image) = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()), \
195 (bpp), ZPixmap, 0, calloc( (height), width_bytes ),\
196 (width), (height), 32, width_bytes ); \
199 /* exported dib functions for now */
201 /* Additional info for DIB section objects */
204 /* Windows DIB section */
205 DIBSECTION dibSection
;
208 enum { X11DRV_DIB_NoHandler
, X11DRV_DIB_InSync
, X11DRV_DIB_AppMod
, X11DRV_DIB_GdiMod
} status
;
217 /* Selector for 16-bit access to bits */
220 /* Shared memory segment info */
221 XShmSegmentInfo shminfo
;
225 /* This structure holds the arguments for DIB_SetImageBits() */
231 PALETTEENTRY
*palentry
;
252 } X11DRV_DIB_IMAGEBITS_DESCR
;
254 extern int *X11DRV_DIB_BuildColorMap( struct tagDC
*dc
, WORD coloruse
,
255 WORD depth
, const BITMAPINFO
*info
,
257 extern void X11DRV_DIB_UpdateDIBSection(struct tagDC
*dc
, BOOL toDIB
);
259 extern HBITMAP
X11DRV_DIB_CreateDIBSection(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT usage
,
260 LPVOID
*bits
, HANDLE section
, DWORD offset
);
261 extern HBITMAP16
X11DRV_DIB_CreateDIBSection16(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT16 usage
,
262 SEGPTR
*bits
, HANDLE section
, DWORD offset
);
264 extern struct tagBITMAP_DRIVER X11DRV_BITMAP_Driver
;
266 extern INT
X11DRV_DIB_SetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
267 UINT lines
, LPCVOID bits
, const BITMAPINFO
*info
,
268 UINT coloruse
, HBITMAP hbitmap
);
269 extern INT
X11DRV_DIB_GetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
270 UINT lines
, LPVOID bits
, BITMAPINFO
*info
,
271 UINT coloruse
, HBITMAP hbitmap
);
272 extern void X11DRV_DIB_DeleteDIBSection(struct tagBITMAPOBJ
*bmp
);
274 /**************************************************************************
278 extern struct tagGDI_DRIVER X11DRV_GDI_Driver
;
280 BOOL
X11DRV_GDI_Initialize(void);
281 void X11DRV_GDI_Finalize(void);
283 /* X11 GDI palette driver */
285 #define X11DRV_PALETTE_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
286 #define X11DRV_PALETTE_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
288 #define X11DRV_PALETTE_PRIVATE 0x1000 /* private colormap, identity mapping */
289 #define X11DRV_PALETTE_WHITESET 0x2000
291 extern Colormap X11DRV_PALETTE_PaletteXColormap
;
292 extern UINT16 X11DRV_PALETTE_PaletteFlags
;
294 extern int *X11DRV_PALETTE_PaletteToXPixel
;
295 extern int *X11DRV_PALETTE_XPixelToPalette
;
297 extern int X11DRV_PALETTE_mapEGAPixel
[16];
299 extern BOOL
X11DRV_PALETTE_Init(void);
300 extern void X11DRV_PALETTE_Cleanup(void);
302 extern COLORREF
X11DRV_PALETTE_ToLogical(int pixel
);
303 extern int X11DRV_PALETTE_ToPhysical(struct tagDC
*dc
, COLORREF color
);
305 extern struct tagPALETTE_DRIVER X11DRV_PALETTE_Driver
;
307 extern int X11DRV_PALETTE_SetMapping(struct tagPALETTEOBJ
*palPtr
, UINT uStart
, UINT uNum
, BOOL mapOnly
);
308 extern int X11DRV_PALETTE_UpdateMapping(struct tagPALETTEOBJ
*palPtr
);
309 extern BOOL
X11DRV_PALETTE_IsDark(int pixel
);
311 /**************************************************************************
315 extern struct tagUSER_DRIVER X11DRV_USER_Driver
;
317 extern Display
*display
;
318 extern Screen
*X11DRV_GetXScreen(void);
319 extern Window
X11DRV_GetXRootWindow(void);
321 extern BOOL
X11DRV_USER_Initialize(void);
322 extern void X11DRV_USER_Finalize(void);
324 /* X11 clipboard driver */
326 extern struct tagCLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver
;
328 extern void X11DRV_CLIPBOARD_FreeResources( Atom property
);
329 extern BOOL
X11DRV_CLIPBOARD_RegisterPixmapResource( Atom property
, Pixmap pixmap
);
331 extern void X11DRV_CLIPBOARD_Acquire(void);
332 extern void X11DRV_CLIPBOARD_Release(void);
333 extern void X11DRV_CLIPBOARD_SetData(UINT wFormat
);
334 extern BOOL
X11DRV_CLIPBOARD_GetData(UINT wFormat
);
335 extern BOOL
X11DRV_CLIPBOARD_IsFormatAvailable(UINT wFormat
);
336 extern BOOL
X11DRV_CLIPBOARD_IsNativeProperty(Atom prop
);
337 extern BOOL
X11DRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName
);
338 extern BOOL
X11DRV_CLIPBOARD_IsSelectionowner();
339 extern UINT
X11DRV_CLIPBOARD_MapPropertyToFormat(char *itemFmtName
);
340 extern Atom
X11DRV_CLIPBOARD_MapFormatToProperty(UINT id
);
341 extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND
*pWnd
, BOOL bFooBar
);
342 extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType
, Window w
, HWND hwnd
);
344 /* X11 desktop driver */
346 extern struct tagDESKTOP_DRIVER X11DRV_DESKTOP_Driver
;
348 typedef struct _X11DRV_DESKTOP_DATA
{
350 } X11DRV_DESKTOP_DATA
;
354 extern Screen
*X11DRV_DESKTOP_GetXScreen(struct tagDESKTOP
*pDesktop
);
355 extern Window
X11DRV_DESKTOP_GetXRootWindow(struct tagDESKTOP
*pDesktop
);
357 extern void X11DRV_DESKTOP_Initialize(struct tagDESKTOP
*pDesktop
);
358 extern void X11DRV_DESKTOP_Finalize(struct tagDESKTOP
*pDesktop
);
359 extern int X11DRV_DESKTOP_GetScreenWidth(struct tagDESKTOP
*pDesktop
);
360 extern int X11DRV_DESKTOP_GetScreenHeight(struct tagDESKTOP
*pDesktop
);
361 extern int X11DRV_DESKTOP_GetScreenDepth(struct tagDESKTOP
*pDesktop
);
363 /* X11 event driver */
365 extern struct tagEVENT_DRIVER X11DRV_EVENT_Driver
;
367 extern WORD
X11DRV_EVENT_XStateToKeyState( int state
) ;
369 extern BOOL
X11DRV_EVENT_Init(void);
370 extern void X11DRV_EVENT_Synchronize( void );
371 extern BOOL
X11DRV_EVENT_CheckFocus( void );
372 extern void X11DRV_EVENT_UserRepaintDisable( BOOL bDisable
);
375 X11DRV_INPUT_RELATIVE
,
376 X11DRV_INPUT_ABSOLUTE
378 extern INPUT_TYPE
X11DRV_EVENT_SetInputMehod(INPUT_TYPE type
);
380 #ifdef HAVE_LIBXXF86DGA2
381 void X11DRV_EVENT_SetDGAStatus(HWND hwnd
, int event_base
) ;
385 /* X11 keyboard driver */
387 extern struct tagKEYBOARD_DRIVER X11DRV_KEYBOARD_Driver
;
389 extern void X11DRV_KEYBOARD_Init(void);
390 extern WORD
X11DRV_KEYBOARD_VkKeyScan(CHAR cChar
);
391 extern UINT16
X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode
, UINT16 wMapType
);
392 extern INT16
X11DRV_KEYBOARD_GetKeyNameText(LONG lParam
, LPSTR lpBuffer
, INT16 nSize
);
393 extern INT16
X11DRV_KEYBOARD_ToAscii(UINT16 virtKey
, UINT16 scanCode
, LPBYTE lpKeyState
, LPVOID lpChar
, UINT16 flags
);
394 extern BOOL
X11DRV_KEYBOARD_GetBeepActive(void);
395 extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate
);
396 extern void X11DRV_KEYBOARD_Beep(void);
397 extern BOOL
X11DRV_KEYBOARD_GetDIState(DWORD len
, LPVOID ptr
);
398 extern BOOL
X11DRV_KEYBOARD_GetDIData(BYTE
*keystate
, DWORD dodsize
, struct DIDEVICEOBJECTDATA
*dod
, LPDWORD entries
, DWORD flags
);
399 extern void X11DRV_KEYBOARD_GetKeyboardConfig(struct tagKEYBOARD_CONFIG
*cfg
);
400 extern void X11DRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG
*cfg
, DWORD mask
);
402 extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND
*pWnd
, XKeyEvent
*event
);
404 /* X11 monitor driver */
406 extern struct tagMONITOR_DRIVER X11DRV_MONITOR_Driver
;
408 typedef struct _X11DRV_MONITOR_DATA
{
414 } X11DRV_MONITOR_DATA
;
418 extern Screen
*X11DRV_MONITOR_GetXScreen(struct tagMONITOR
*pMonitor
);
419 extern Window
X11DRV_MONITOR_GetXRootWindow(struct tagMONITOR
*pMonitor
);
421 extern void X11DRV_MONITOR_Initialize(struct tagMONITOR
*pMonitor
);
422 extern void X11DRV_MONITOR_Finalize(struct tagMONITOR
*pMonitor
);
423 extern BOOL
X11DRV_MONITOR_IsSingleWindow(struct tagMONITOR
*pMonitor
);
424 extern int X11DRV_MONITOR_GetWidth(struct tagMONITOR
*pMonitor
);
425 extern int X11DRV_MONITOR_GetHeight(struct tagMONITOR
*pMonitor
);
426 extern int X11DRV_MONITOR_GetDepth(struct tagMONITOR
*pMonitor
);
427 extern BOOL
X11DRV_MONITOR_GetScreenSaveActive(struct tagMONITOR
*pMonitor
);
428 extern void X11DRV_MONITOR_SetScreenSaveActive(struct tagMONITOR
*pMonitor
, BOOL bActivate
);
429 extern int X11DRV_MONITOR_GetScreenSaveTimeout(struct tagMONITOR
*pMonitor
);
430 extern void X11DRV_MONITOR_SetScreenSaveTimeout(struct tagMONITOR
*pMonitor
, int nTimeout
);
432 /* X11 mouse driver */
434 extern struct tagMOUSE_DRIVER X11DRV_MOUSE_Driver
;
436 extern void X11DRV_MOUSE_Init();
437 extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO
*lpCursor
);
438 extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX
, WORD wAbsY
);
439 extern LONG
X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable
);
441 /* X11 windows driver */
443 extern struct tagWND_DRIVER X11DRV_WND_Driver
;
445 typedef struct _X11DRV_WND_DATA
{
447 HBITMAP hWMIconBitmap
;
451 extern Window
X11DRV_WND_GetXWindow(struct tagWND
*wndPtr
);
452 extern Window
X11DRV_WND_FindXWindow(struct tagWND
*wndPtr
);
453 extern Screen
*X11DRV_WND_GetXScreen(struct tagWND
*wndPtr
);
454 extern Window
X11DRV_WND_GetXRootWindow(struct tagWND
*wndPtr
);
456 extern void X11DRV_WND_Initialize(struct tagWND
*wndPtr
);
457 extern void X11DRV_WND_Finalize(struct tagWND
*wndPtr
);
458 extern BOOL
X11DRV_WND_CreateDesktopWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, BOOL bUnicode
);
459 extern BOOL
X11DRV_WND_CreateWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, struct tagCREATESTRUCTA
*cs
, BOOL bUnicode
);
460 extern BOOL
X11DRV_WND_DestroyWindow(struct tagWND
*pWnd
);
461 extern struct tagWND
*X11DRV_WND_SetParent(struct tagWND
*wndPtr
, struct tagWND
*pWndParent
);
462 extern void X11DRV_WND_ForceWindowRaise(struct tagWND
*pWnd
);
463 extern void X11DRV_WND_SetWindowPos(struct tagWND
*wndPtr
, const struct tagWINDOWPOS
*winpos
, BOOL bSMC_SETXPOS
);
464 extern void X11DRV_WND_SetText(struct tagWND
*wndPtr
, LPCSTR text
);
465 extern void X11DRV_WND_SetFocus(struct tagWND
*wndPtr
);
466 extern void X11DRV_WND_PreSizeMove(struct tagWND
*wndPtr
);
467 extern void X11DRV_WND_PostSizeMove(struct tagWND
*wndPtr
);
468 extern void X11DRV_WND_SurfaceCopy(struct tagWND
*wndPtr
, struct tagDC
*dcPtr
, INT dx
, INT dy
, const RECT
*clipRect
, BOOL bUpdate
);
469 extern void X11DRV_WND_SetDrawable(struct tagWND
*wndPtr
, struct tagDC
*dc
, WORD flags
, BOOL bSetClipOrigin
);
470 extern BOOL
X11DRV_WND_SetHostAttr(struct tagWND
*wndPtr
, INT haKey
, INT value
);
471 extern BOOL
X11DRV_WND_IsSelfClipping(struct tagWND
*wndPtr
);
472 extern void X11DRV_WND_DockWindow(struct tagWND
*wndPtr
);
474 extern int X11DRV_EVENT_PrepareShmCompletion( Drawable dw
);
475 extern void X11DRV_EVENT_WaitShmCompletion( int compl );
476 extern void X11DRV_EVENT_WaitShmCompletions( Drawable dw
);
477 extern void X11DRV_EVENT_WaitReplaceShmCompletion( int *compl, Drawable dw
);
479 #endif /* __WINE_X11DRV_H */