2 * X11 driver definitions
5 #ifndef __WINE_X11DRV_H
6 #define __WINE_X11DRV_H
11 #include <X11/Xresource.h>
12 #include <X11/Xutil.h>
13 #include <X11/Xatom.h>
15 # include <X11/extensions/XShm.h>
16 #endif /* defined(HAVE_LIBXXSHM) */
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 */
73 /* GCs used for B&W and color bitmap operations */
74 extern GC BITMAP_monoGC
, BITMAP_colorGC
;
76 #define BITMAP_GC(bmp) \
77 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
79 extern DeviceCaps X11DRV_DevCaps
;
81 /* Wine driver X11 functions */
83 extern const DC_FUNCTIONS X11DRV_DC_Funcs
;
85 extern BOOL
X11DRV_BitBlt( struct tagDC
*dcDst
, INT xDst
, INT yDst
,
86 INT width
, INT height
, struct tagDC
*dcSrc
,
87 INT xSrc
, INT ySrc
, DWORD rop
);
88 extern BOOL
X11DRV_EnumDeviceFonts( struct tagDC
*dc
, LPLOGFONT16 plf
,
89 DEVICEFONTENUMPROC dfeproc
, LPARAM lp
);
90 extern BOOL
X11DRV_GetCharWidth( struct tagDC
*dc
, UINT firstChar
,
91 UINT lastChar
, LPINT buffer
);
92 extern BOOL
X11DRV_GetDCOrgEx( struct tagDC
*dc
, LPPOINT lpp
);
93 extern BOOL
X11DRV_GetTextExtentPoint( struct tagDC
*dc
, LPCWSTR str
,
94 INT count
, LPSIZE size
);
95 extern BOOL
X11DRV_GetTextMetrics(struct tagDC
*dc
, TEXTMETRICA
*metrics
);
96 extern BOOL
X11DRV_PatBlt( struct tagDC
*dc
, INT left
, INT top
,
97 INT width
, INT height
, DWORD rop
);
98 extern VOID
X11DRV_SetDeviceClipping(struct tagDC
*dc
);
99 extern BOOL
X11DRV_StretchBlt( struct tagDC
*dcDst
, INT xDst
, INT yDst
,
100 INT widthDst
, INT heightDst
,
101 struct tagDC
*dcSrc
, INT xSrc
, INT ySrc
,
102 INT widthSrc
, INT heightSrc
, DWORD rop
);
103 extern BOOL
X11DRV_LineTo( struct tagDC
*dc
, INT x
, INT y
);
104 extern BOOL
X11DRV_Arc( struct tagDC
*dc
, INT left
, INT top
, INT right
,
105 INT bottom
, INT xstart
, INT ystart
, INT xend
,
107 extern BOOL
X11DRV_Pie( struct tagDC
*dc
, INT left
, INT top
, INT right
,
108 INT bottom
, INT xstart
, INT ystart
, INT xend
,
110 extern BOOL
X11DRV_Chord( struct tagDC
*dc
, INT left
, INT top
,
111 INT right
, INT bottom
, INT xstart
,
112 INT ystart
, INT xend
, INT yend
);
113 extern BOOL
X11DRV_Ellipse( struct tagDC
*dc
, INT left
, INT top
,
114 INT right
, INT bottom
);
115 extern BOOL
X11DRV_Rectangle(struct tagDC
*dc
, INT left
, INT top
,
116 INT right
, INT bottom
);
117 extern BOOL
X11DRV_RoundRect( struct tagDC
*dc
, INT left
, INT top
,
118 INT right
, INT bottom
, INT ell_width
,
120 extern COLORREF
X11DRV_SetPixel( struct tagDC
*dc
, INT x
, INT y
,
122 extern COLORREF
X11DRV_GetPixel( struct tagDC
*dc
, INT x
, INT y
);
123 extern BOOL
X11DRV_PaintRgn( struct tagDC
*dc
, HRGN hrgn
);
124 extern BOOL
X11DRV_Polyline( struct tagDC
*dc
,const POINT
* pt
,INT count
);
125 extern BOOL
X11DRV_Polygon( struct tagDC
*dc
, const POINT
* pt
, INT count
);
126 extern BOOL
X11DRV_PolyPolygon( struct tagDC
*dc
, const POINT
* pt
,
127 const INT
* counts
, UINT polygons
);
128 extern BOOL
X11DRV_PolyPolyline( struct tagDC
*dc
, const POINT
* pt
,
129 const DWORD
* counts
, DWORD polylines
);
131 extern HGDIOBJ
X11DRV_SelectObject( struct tagDC
*dc
, HGDIOBJ handle
);
133 extern COLORREF
X11DRV_SetBkColor( struct tagDC
*dc
, COLORREF color
);
134 extern COLORREF
X11DRV_SetTextColor( struct tagDC
*dc
, COLORREF color
);
135 extern BOOL
X11DRV_ExtFloodFill( struct tagDC
*dc
, INT x
, INT y
,
136 COLORREF color
, UINT fillType
);
137 extern BOOL
X11DRV_ExtTextOut( struct tagDC
*dc
, INT x
, INT y
,
138 UINT flags
, const RECT
*lprect
,
139 LPCWSTR str
, UINT count
, const INT
*lpDx
);
140 extern BOOL
X11DRV_CreateBitmap( HBITMAP hbitmap
);
141 extern BOOL
X11DRV_DeleteObject( HGDIOBJ handle
);
142 extern LONG
X11DRV_BitmapBits( HBITMAP hbitmap
, void *bits
, LONG count
,
144 extern INT
X11DRV_SetDIBitsToDevice( struct tagDC
*dc
, INT xDest
,
145 INT yDest
, DWORD cx
, DWORD cy
,
147 UINT startscan
, UINT lines
,
148 LPCVOID bits
, const BITMAPINFO
*info
,
150 extern INT
X11DRV_DeviceBitmapBits( struct tagDC
*dc
, HBITMAP hbitmap
,
151 WORD fGet
, UINT startscan
,
152 UINT lines
, LPSTR bits
,
153 LPBITMAPINFO info
, UINT coloruse
);
154 extern HANDLE
X11DRV_LoadOEMResource( WORD id
, WORD type
);
156 /* X11 driver internal functions */
158 extern BOOL
X11DRV_BITMAP_Init(void);
159 extern BOOL
X11DRV_BRUSH_Init(void);
160 extern BOOL
X11DRV_DIB_Init(void);
161 extern BOOL
X11DRV_FONT_Init( struct tagDeviceCaps
* );
162 extern BOOL
X11DRV_OBM_Init(void);
165 extern XImage
*X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ
*bmp
);
166 extern int X11DRV_DIB_GetXImageWidthBytes( int width
, int depth
);
167 extern BOOL
X11DRV_DIB_Init(void);
168 extern HBITMAP
X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap
);
169 extern HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap
, HDC hdc
, BOOL bDeletePixmap
);
170 extern HBITMAP
X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap
, BOOL bDeletePixmap
);
171 extern Pixmap
X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB
, HDC hdc
);
172 extern Pixmap
X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp
, HDC hdc
);
174 extern BOOL
X11DRV_SetupGCForPatBlt( struct tagDC
*dc
, GC gc
,
176 extern BOOL
X11DRV_SetupGCForBrush( struct tagDC
*dc
);
177 extern BOOL
X11DRV_SetupGCForPen( struct tagDC
*dc
);
178 extern BOOL
X11DRV_SetupGCForText( struct tagDC
*dc
);
180 extern const int X11DRV_XROPfunction
[];
182 /* Xlib critical section */
184 extern CRITICAL_SECTION X11DRV_CritSection
;
186 extern void _XInitImageFuncPtrs(XImage
*);
188 #define XCREATEIMAGE(image,width,height,bpp) \
190 int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
191 (image) = TSXCreateImage(display, X11DRV_GetVisual(), \
192 (bpp), ZPixmap, 0, calloc( (height), width_bytes ),\
193 (width), (height), 32, width_bytes ); \
196 /* exported dib functions for now */
198 /* Additional info for DIB section objects */
201 /* Windows DIB section */
202 DIBSECTION dibSection
;
205 enum { X11DRV_DIB_NoHandler
, X11DRV_DIB_InSync
, X11DRV_DIB_AppMod
, X11DRV_DIB_GdiMod
} status
;
214 /* Selector for 16-bit access to bits */
217 /* Shared memory segment info */
218 XShmSegmentInfo shminfo
;
222 /* This structure holds the arguments for DIB_SetImageBits() */
228 PALETTEENTRY
*palentry
;
249 } X11DRV_DIB_IMAGEBITS_DESCR
;
251 extern int *X11DRV_DIB_BuildColorMap( struct tagDC
*dc
, WORD coloruse
,
252 WORD depth
, const BITMAPINFO
*info
,
254 extern void X11DRV_DIB_UpdateDIBSection(struct tagDC
*dc
, BOOL toDIB
);
256 extern HBITMAP
X11DRV_DIB_CreateDIBSection(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT usage
,
257 LPVOID
*bits
, HANDLE section
, DWORD offset
, DWORD ovr_pitch
);
258 extern HBITMAP16
X11DRV_DIB_CreateDIBSection16(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT16 usage
,
259 SEGPTR
*bits
, HANDLE section
, DWORD offset
, DWORD ovr_pitch
);
261 extern struct tagBITMAP_DRIVER X11DRV_BITMAP_Driver
;
263 extern INT
X11DRV_DIB_SetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
264 UINT lines
, LPCVOID bits
, const BITMAPINFO
*info
,
265 UINT coloruse
, HBITMAP hbitmap
);
266 extern INT
X11DRV_DIB_GetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
267 UINT lines
, LPVOID bits
, BITMAPINFO
*info
,
268 UINT coloruse
, HBITMAP hbitmap
);
269 extern void X11DRV_DIB_DeleteDIBSection(struct tagBITMAPOBJ
*bmp
);
271 /**************************************************************************
275 BOOL
X11DRV_GDI_Initialize(void);
276 void X11DRV_GDI_Finalize(void);
278 /* X11 GDI palette driver */
280 #define X11DRV_PALETTE_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
281 #define X11DRV_PALETTE_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
283 #define X11DRV_PALETTE_PRIVATE 0x1000 /* private colormap, identity mapping */
284 #define X11DRV_PALETTE_WHITESET 0x2000
286 extern Colormap X11DRV_PALETTE_PaletteXColormap
;
287 extern UINT16 X11DRV_PALETTE_PaletteFlags
;
289 extern int *X11DRV_PALETTE_PaletteToXPixel
;
290 extern int *X11DRV_PALETTE_XPixelToPalette
;
292 extern int X11DRV_PALETTE_mapEGAPixel
[16];
294 extern BOOL
X11DRV_PALETTE_Init(void);
295 extern void X11DRV_PALETTE_Cleanup(void);
297 extern COLORREF
X11DRV_PALETTE_ToLogical(int pixel
);
298 extern int X11DRV_PALETTE_ToPhysical(struct tagDC
*dc
, COLORREF color
);
300 extern struct tagPALETTE_DRIVER X11DRV_PALETTE_Driver
;
302 extern int X11DRV_PALETTE_SetMapping(struct tagPALETTEOBJ
*palPtr
, UINT uStart
, UINT uNum
, BOOL mapOnly
);
303 extern int X11DRV_PALETTE_UpdateMapping(struct tagPALETTEOBJ
*palPtr
);
304 extern BOOL
X11DRV_PALETTE_IsDark(int pixel
);
306 /**************************************************************************
310 extern Display
*display
;
311 extern Screen
*screen
;
312 extern Visual
*visual
;
313 extern Window root_window
;
314 extern int screen_depth
;
316 static inline Screen
*X11DRV_GetXScreen(void) { return screen
; }
317 static inline Visual
*X11DRV_GetVisual(void) { return visual
; }
318 static inline Window
X11DRV_GetXRootWindow(void) { return root_window
; }
319 static inline int X11DRV_GetDepth(void) { return screen_depth
; }
321 extern BOOL
X11DRV_GetScreenSaveActive(void);
322 extern void X11DRV_SetScreenSaveActive(BOOL bActivate
);
323 extern int X11DRV_GetScreenSaveTimeout(void);
324 extern void X11DRV_SetScreenSaveTimeout(int nTimeout
);
325 extern BOOL
X11DRV_IsSingleWindow(void);
327 /* X11 clipboard driver */
329 extern struct tagCLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver
;
331 extern void X11DRV_CLIPBOARD_FreeResources( Atom property
);
332 extern BOOL
X11DRV_CLIPBOARD_RegisterPixmapResource( Atom property
, Pixmap pixmap
);
334 extern void X11DRV_CLIPBOARD_Acquire(void);
335 extern void X11DRV_CLIPBOARD_Release(void);
336 extern void X11DRV_CLIPBOARD_SetData(UINT wFormat
);
337 extern BOOL
X11DRV_CLIPBOARD_GetData(UINT wFormat
);
338 extern BOOL
X11DRV_CLIPBOARD_IsFormatAvailable(UINT wFormat
);
339 extern BOOL
X11DRV_CLIPBOARD_IsNativeProperty(Atom prop
);
340 extern BOOL
X11DRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName
);
341 extern BOOL
X11DRV_CLIPBOARD_IsSelectionowner();
342 extern UINT
X11DRV_CLIPBOARD_MapPropertyToFormat(char *itemFmtName
);
343 extern Atom
X11DRV_CLIPBOARD_MapFormatToProperty(UINT id
);
344 extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND
*pWnd
, BOOL bFooBar
);
345 extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType
, Window w
, HWND hwnd
);
347 /* X11 event driver */
349 extern WORD
X11DRV_EVENT_XStateToKeyState( int state
) ;
351 extern BOOL
X11DRV_EVENT_Init(void);
352 extern void X11DRV_EVENT_Synchronize( void );
353 extern BOOL
X11DRV_EVENT_CheckFocus( void );
354 extern void X11DRV_EVENT_UserRepaintDisable( BOOL bDisable
);
357 X11DRV_INPUT_RELATIVE
,
358 X11DRV_INPUT_ABSOLUTE
360 extern INPUT_TYPE
X11DRV_EVENT_SetInputMethod(INPUT_TYPE type
);
362 #ifdef HAVE_LIBXXF86DGA2
363 void X11DRV_EVENT_SetDGAStatus(HWND hwnd
, int event_base
) ;
367 /* X11 keyboard driver */
369 extern void X11DRV_KEYBOARD_Init(void);
370 extern WORD
X11DRV_KEYBOARD_VkKeyScan(CHAR cChar
);
371 extern UINT16
X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode
, UINT16 wMapType
);
372 extern INT16
X11DRV_KEYBOARD_GetKeyNameText(LONG lParam
, LPSTR lpBuffer
, INT16 nSize
);
373 extern INT16
X11DRV_KEYBOARD_ToAscii(UINT16 virtKey
, UINT16 scanCode
, LPBYTE lpKeyState
, LPVOID lpChar
, UINT16 flags
);
374 extern BOOL
X11DRV_KEYBOARD_GetBeepActive(void);
375 extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate
);
376 extern void X11DRV_KEYBOARD_Beep(void);
377 extern BOOL
X11DRV_KEYBOARD_GetDIState(DWORD len
, LPVOID ptr
);
378 extern BOOL
X11DRV_KEYBOARD_GetDIData(BYTE
*keystate
, DWORD dodsize
, struct DIDEVICEOBJECTDATA
*dod
, LPDWORD entries
, DWORD flags
);
379 extern void X11DRV_KEYBOARD_GetKeyboardConfig(struct tagKEYBOARD_CONFIG
*cfg
);
380 extern void X11DRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG
*cfg
, DWORD mask
);
382 extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND
*pWnd
, XKeyEvent
*event
);
384 /* X11 mouse driver */
386 extern void X11DRV_MOUSE_Init();
387 extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO
*lpCursor
);
388 extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX
, WORD wAbsY
);
389 extern LONG
X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable
);
391 /* X11 windows driver */
393 extern struct tagWND_DRIVER X11DRV_WND_Driver
;
395 typedef struct _X11DRV_WND_DATA
{
397 HBITMAP hWMIconBitmap
;
401 extern Window
X11DRV_WND_GetXWindow(struct tagWND
*wndPtr
);
402 extern Window
X11DRV_WND_FindXWindow(struct tagWND
*wndPtr
);
404 extern void X11DRV_WND_Initialize(struct tagWND
*wndPtr
);
405 extern void X11DRV_WND_Finalize(struct tagWND
*wndPtr
);
406 extern BOOL
X11DRV_WND_CreateDesktopWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, BOOL bUnicode
);
407 extern BOOL
X11DRV_WND_CreateWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, struct tagCREATESTRUCTA
*cs
, BOOL bUnicode
);
408 extern BOOL
X11DRV_WND_DestroyWindow(struct tagWND
*pWnd
);
409 extern struct tagWND
*X11DRV_WND_SetParent(struct tagWND
*wndPtr
, struct tagWND
*pWndParent
);
410 extern void X11DRV_WND_ForceWindowRaise(struct tagWND
*pWnd
);
411 extern void X11DRV_WND_SetWindowPos(struct tagWND
*wndPtr
, const struct tagWINDOWPOS
*winpos
, BOOL bSMC_SETXPOS
);
412 extern void X11DRV_WND_SetText(struct tagWND
*wndPtr
, LPCSTR text
);
413 extern void X11DRV_WND_SetFocus(struct tagWND
*wndPtr
);
414 extern void X11DRV_WND_PreSizeMove(struct tagWND
*wndPtr
);
415 extern void X11DRV_WND_PostSizeMove(struct tagWND
*wndPtr
);
416 extern void X11DRV_WND_SurfaceCopy(struct tagWND
*wndPtr
, struct tagDC
*dcPtr
, INT dx
, INT dy
, const RECT
*clipRect
, BOOL bUpdate
);
417 extern void X11DRV_WND_SetDrawable(struct tagWND
*wndPtr
, struct tagDC
*dc
, WORD flags
, BOOL bSetClipOrigin
);
418 extern BOOL
X11DRV_WND_SetHostAttr(struct tagWND
*wndPtr
, INT haKey
, INT value
);
419 extern BOOL
X11DRV_WND_IsSelfClipping(struct tagWND
*wndPtr
);
420 extern void X11DRV_WND_DockWindow(struct tagWND
*wndPtr
);
422 extern int X11DRV_EVENT_PrepareShmCompletion( Drawable dw
);
423 extern void X11DRV_EVENT_WaitShmCompletion( int compl );
424 extern void X11DRV_EVENT_WaitShmCompletions( Drawable dw
);
425 extern void X11DRV_EVENT_WaitReplaceShmCompletion( int *compl, Drawable dw
);
427 #endif /* __WINE_X11DRV_H */