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, X11DRV_GetVisual(), \
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 BOOL
X11DRV_GDI_Initialize(void);
279 void X11DRV_GDI_Finalize(void);
281 /* X11 GDI palette driver */
283 #define X11DRV_PALETTE_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
284 #define X11DRV_PALETTE_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
286 #define X11DRV_PALETTE_PRIVATE 0x1000 /* private colormap, identity mapping */
287 #define X11DRV_PALETTE_WHITESET 0x2000
289 extern Colormap X11DRV_PALETTE_PaletteXColormap
;
290 extern UINT16 X11DRV_PALETTE_PaletteFlags
;
292 extern int *X11DRV_PALETTE_PaletteToXPixel
;
293 extern int *X11DRV_PALETTE_XPixelToPalette
;
295 extern int X11DRV_PALETTE_mapEGAPixel
[16];
297 extern BOOL
X11DRV_PALETTE_Init(void);
298 extern void X11DRV_PALETTE_Cleanup(void);
300 extern COLORREF
X11DRV_PALETTE_ToLogical(int pixel
);
301 extern int X11DRV_PALETTE_ToPhysical(struct tagDC
*dc
, COLORREF color
);
303 extern struct tagPALETTE_DRIVER X11DRV_PALETTE_Driver
;
305 extern int X11DRV_PALETTE_SetMapping(struct tagPALETTEOBJ
*palPtr
, UINT uStart
, UINT uNum
, BOOL mapOnly
);
306 extern int X11DRV_PALETTE_UpdateMapping(struct tagPALETTEOBJ
*palPtr
);
307 extern BOOL
X11DRV_PALETTE_IsDark(int pixel
);
309 /**************************************************************************
313 extern Display
*display
;
314 extern Screen
*screen
;
315 extern Visual
*visual
;
316 extern Window root_window
;
317 extern int screen_depth
;
319 static inline Screen
*X11DRV_GetXScreen(void) { return screen
; }
320 static inline Visual
*X11DRV_GetVisual(void) { return visual
; }
321 static inline Window
X11DRV_GetXRootWindow(void) { return root_window
; }
322 static inline int X11DRV_GetDepth(void) { return screen_depth
; }
324 extern BOOL
X11DRV_GetScreenSaveActive(void);
325 extern void X11DRV_SetScreenSaveActive(BOOL bActivate
);
326 extern int X11DRV_GetScreenSaveTimeout(void);
327 extern void X11DRV_SetScreenSaveTimeout(int nTimeout
);
328 extern BOOL
X11DRV_IsSingleWindow(void);
330 /* X11 clipboard driver */
332 extern struct tagCLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver
;
334 extern void X11DRV_CLIPBOARD_FreeResources( Atom property
);
335 extern BOOL
X11DRV_CLIPBOARD_RegisterPixmapResource( Atom property
, Pixmap pixmap
);
337 extern void X11DRV_CLIPBOARD_Acquire(void);
338 extern void X11DRV_CLIPBOARD_Release(void);
339 extern void X11DRV_CLIPBOARD_SetData(UINT wFormat
);
340 extern BOOL
X11DRV_CLIPBOARD_GetData(UINT wFormat
);
341 extern BOOL
X11DRV_CLIPBOARD_IsFormatAvailable(UINT wFormat
);
342 extern BOOL
X11DRV_CLIPBOARD_IsNativeProperty(Atom prop
);
343 extern BOOL
X11DRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName
);
344 extern BOOL
X11DRV_CLIPBOARD_IsSelectionowner();
345 extern UINT
X11DRV_CLIPBOARD_MapPropertyToFormat(char *itemFmtName
);
346 extern Atom
X11DRV_CLIPBOARD_MapFormatToProperty(UINT id
);
347 extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND
*pWnd
, BOOL bFooBar
);
348 extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType
, Window w
, HWND hwnd
);
350 /* X11 event driver */
352 extern WORD
X11DRV_EVENT_XStateToKeyState( int state
) ;
354 extern BOOL
X11DRV_EVENT_Init(void);
355 extern void X11DRV_EVENT_Synchronize( void );
356 extern BOOL
X11DRV_EVENT_CheckFocus( void );
357 extern void X11DRV_EVENT_UserRepaintDisable( BOOL bDisable
);
360 X11DRV_INPUT_RELATIVE
,
361 X11DRV_INPUT_ABSOLUTE
363 extern INPUT_TYPE
X11DRV_EVENT_SetInputMehod(INPUT_TYPE type
);
365 #ifdef HAVE_LIBXXF86DGA2
366 void X11DRV_EVENT_SetDGAStatus(HWND hwnd
, int event_base
) ;
370 /* X11 keyboard driver */
372 extern void X11DRV_KEYBOARD_Init(void);
373 extern WORD
X11DRV_KEYBOARD_VkKeyScan(CHAR cChar
);
374 extern UINT16
X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode
, UINT16 wMapType
);
375 extern INT16
X11DRV_KEYBOARD_GetKeyNameText(LONG lParam
, LPSTR lpBuffer
, INT16 nSize
);
376 extern INT16
X11DRV_KEYBOARD_ToAscii(UINT16 virtKey
, UINT16 scanCode
, LPBYTE lpKeyState
, LPVOID lpChar
, UINT16 flags
);
377 extern BOOL
X11DRV_KEYBOARD_GetBeepActive(void);
378 extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate
);
379 extern void X11DRV_KEYBOARD_Beep(void);
380 extern BOOL
X11DRV_KEYBOARD_GetDIState(DWORD len
, LPVOID ptr
);
381 extern BOOL
X11DRV_KEYBOARD_GetDIData(BYTE
*keystate
, DWORD dodsize
, struct DIDEVICEOBJECTDATA
*dod
, LPDWORD entries
, DWORD flags
);
382 extern void X11DRV_KEYBOARD_GetKeyboardConfig(struct tagKEYBOARD_CONFIG
*cfg
);
383 extern void X11DRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG
*cfg
, DWORD mask
);
385 extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND
*pWnd
, XKeyEvent
*event
);
387 /* X11 mouse driver */
389 extern void X11DRV_MOUSE_Init();
390 extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO
*lpCursor
);
391 extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX
, WORD wAbsY
);
392 extern LONG
X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable
);
394 /* X11 windows driver */
396 extern struct tagWND_DRIVER X11DRV_WND_Driver
;
398 typedef struct _X11DRV_WND_DATA
{
400 HBITMAP hWMIconBitmap
;
404 extern Window
X11DRV_WND_GetXWindow(struct tagWND
*wndPtr
);
405 extern Window
X11DRV_WND_FindXWindow(struct tagWND
*wndPtr
);
407 extern void X11DRV_WND_Initialize(struct tagWND
*wndPtr
);
408 extern void X11DRV_WND_Finalize(struct tagWND
*wndPtr
);
409 extern BOOL
X11DRV_WND_CreateDesktopWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, BOOL bUnicode
);
410 extern BOOL
X11DRV_WND_CreateWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, struct tagCREATESTRUCTA
*cs
, BOOL bUnicode
);
411 extern BOOL
X11DRV_WND_DestroyWindow(struct tagWND
*pWnd
);
412 extern struct tagWND
*X11DRV_WND_SetParent(struct tagWND
*wndPtr
, struct tagWND
*pWndParent
);
413 extern void X11DRV_WND_ForceWindowRaise(struct tagWND
*pWnd
);
414 extern void X11DRV_WND_SetWindowPos(struct tagWND
*wndPtr
, const struct tagWINDOWPOS
*winpos
, BOOL bSMC_SETXPOS
);
415 extern void X11DRV_WND_SetText(struct tagWND
*wndPtr
, LPCSTR text
);
416 extern void X11DRV_WND_SetFocus(struct tagWND
*wndPtr
);
417 extern void X11DRV_WND_PreSizeMove(struct tagWND
*wndPtr
);
418 extern void X11DRV_WND_PostSizeMove(struct tagWND
*wndPtr
);
419 extern void X11DRV_WND_SurfaceCopy(struct tagWND
*wndPtr
, struct tagDC
*dcPtr
, INT dx
, INT dy
, const RECT
*clipRect
, BOOL bUpdate
);
420 extern void X11DRV_WND_SetDrawable(struct tagWND
*wndPtr
, struct tagDC
*dc
, WORD flags
, BOOL bSetClipOrigin
);
421 extern BOOL
X11DRV_WND_SetHostAttr(struct tagWND
*wndPtr
, INT haKey
, INT value
);
422 extern BOOL
X11DRV_WND_IsSelfClipping(struct tagWND
*wndPtr
);
423 extern void X11DRV_WND_DockWindow(struct tagWND
*wndPtr
);
425 extern int X11DRV_EVENT_PrepareShmCompletion( Drawable dw
);
426 extern void X11DRV_EVENT_WaitShmCompletion( int compl );
427 extern void X11DRV_EVENT_WaitShmCompletions( Drawable dw
);
428 extern void X11DRV_EVENT_WaitReplaceShmCompletion( int *compl, Drawable dw
);
430 #endif /* __WINE_X11DRV_H */