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) */
22 #define MAX_PIXELFORMATS 8
26 struct tagCREATESTRUCTA
;
27 struct tagCURSORICONINFO
;
33 struct tagKEYBOARD_CONFIG
;
34 struct DIDEVICEOBJECTDATA
;
46 int type
; /* GEOMETRIC || COSMETIC */
49 /* X physical brush */
59 typedef UINT X_PHYSFONT
;
61 /* X physical device */
64 GC gc
; /* X Window GC */
71 XVisualInfo
*visuals
[MAX_PIXELFORMATS
];
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 const DC_FUNCTIONS X11DRV_DC_Funcs
;
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_GetDCOrgEx( struct tagDC
*dc
, LPPOINT lpp
);
97 extern BOOL
X11DRV_GetTextExtentPoint( struct tagDC
*dc
, LPCWSTR str
,
98 INT count
, LPSIZE size
);
99 extern BOOL
X11DRV_GetTextMetrics(struct tagDC
*dc
, TEXTMETRICA
*metrics
);
100 extern BOOL
X11DRV_PatBlt( struct tagDC
*dc
, INT left
, INT top
,
101 INT width
, INT height
, DWORD rop
);
102 extern VOID
X11DRV_SetDeviceClipping(struct tagDC
*dc
);
103 extern BOOL
X11DRV_StretchBlt( struct tagDC
*dcDst
, INT xDst
, INT yDst
,
104 INT widthDst
, INT heightDst
,
105 struct tagDC
*dcSrc
, INT xSrc
, INT ySrc
,
106 INT widthSrc
, INT heightSrc
, DWORD rop
);
107 extern BOOL
X11DRV_LineTo( struct tagDC
*dc
, INT x
, INT y
);
108 extern BOOL
X11DRV_Arc( struct tagDC
*dc
, INT left
, INT top
, INT right
,
109 INT bottom
, INT xstart
, INT ystart
, INT xend
,
111 extern BOOL
X11DRV_Pie( struct tagDC
*dc
, INT left
, INT top
, INT right
,
112 INT bottom
, INT xstart
, INT ystart
, INT xend
,
114 extern BOOL
X11DRV_Chord( struct tagDC
*dc
, INT left
, INT top
,
115 INT right
, INT bottom
, INT xstart
,
116 INT ystart
, INT xend
, INT yend
);
117 extern BOOL
X11DRV_Ellipse( struct tagDC
*dc
, INT left
, INT top
,
118 INT right
, INT bottom
);
119 extern BOOL
X11DRV_Rectangle(struct tagDC
*dc
, INT left
, INT top
,
120 INT right
, INT bottom
);
121 extern BOOL
X11DRV_RoundRect( struct tagDC
*dc
, INT left
, INT top
,
122 INT right
, INT bottom
, INT ell_width
,
124 extern COLORREF
X11DRV_SetPixel( struct tagDC
*dc
, INT x
, INT y
,
126 extern COLORREF
X11DRV_GetPixel( struct tagDC
*dc
, INT x
, INT y
);
127 extern BOOL
X11DRV_PaintRgn( struct tagDC
*dc
, HRGN hrgn
);
128 extern BOOL
X11DRV_Polyline( struct tagDC
*dc
,const POINT
* pt
,INT count
);
129 extern BOOL
X11DRV_Polygon( struct tagDC
*dc
, const POINT
* pt
, INT count
);
130 extern BOOL
X11DRV_PolyPolygon( struct tagDC
*dc
, const POINT
* pt
,
131 const INT
* counts
, UINT polygons
);
132 extern BOOL
X11DRV_PolyPolyline( struct tagDC
*dc
, const POINT
* pt
,
133 const DWORD
* counts
, DWORD polylines
);
135 extern HGDIOBJ
X11DRV_SelectObject( struct tagDC
*dc
, HGDIOBJ handle
);
137 extern COLORREF
X11DRV_SetBkColor( struct tagDC
*dc
, COLORREF color
);
138 extern COLORREF
X11DRV_SetTextColor( struct tagDC
*dc
, COLORREF color
);
139 extern BOOL
X11DRV_ExtFloodFill( struct tagDC
*dc
, INT x
, INT y
,
140 COLORREF color
, UINT fillType
);
141 extern BOOL
X11DRV_ExtTextOut( struct tagDC
*dc
, INT x
, INT y
,
142 UINT flags
, const RECT
*lprect
,
143 LPCWSTR str
, UINT count
, const INT
*lpDx
);
144 extern BOOL
X11DRV_CreateBitmap( HBITMAP hbitmap
);
145 extern BOOL
X11DRV_DeleteObject( HGDIOBJ handle
);
146 extern LONG
X11DRV_BitmapBits( HBITMAP hbitmap
, void *bits
, LONG count
,
148 extern INT
X11DRV_SetDIBitsToDevice( struct tagDC
*dc
, INT xDest
,
149 INT yDest
, DWORD cx
, DWORD cy
,
151 UINT startscan
, UINT lines
,
152 LPCVOID bits
, const BITMAPINFO
*info
,
154 extern INT
X11DRV_DeviceBitmapBits( struct tagDC
*dc
, HBITMAP hbitmap
,
155 WORD fGet
, UINT startscan
,
156 UINT lines
, LPSTR bits
,
157 LPBITMAPINFO info
, UINT coloruse
);
158 extern HANDLE
X11DRV_LoadOEMResource( WORD id
, WORD type
);
160 /* OpenGL / X11 driver functions */
161 extern int X11DRV_ChoosePixelFormat(DC
*dc
, const PIXELFORMATDESCRIPTOR
*pppfd
) ;
162 extern int X11DRV_DescribePixelFormat(DC
*dc
, int iPixelFormat
, UINT nBytes
, PIXELFORMATDESCRIPTOR
*ppfd
) ;
163 extern int X11DRV_GetPixelFormat(DC
*dc
) ;
164 extern BOOL
X11DRV_SetPixelFormat(DC
*dc
, int iPixelFormat
, const PIXELFORMATDESCRIPTOR
*ppfd
) ;
165 extern BOOL
X11DRV_SwapBuffers(DC
*dc
) ;
167 /* X11 driver internal functions */
169 extern BOOL
X11DRV_BITMAP_Init(void);
170 extern BOOL
X11DRV_BRUSH_Init(void);
171 extern BOOL
X11DRV_DIB_Init(void);
172 extern BOOL
X11DRV_FONT_Init( struct tagDeviceCaps
* );
173 extern BOOL
X11DRV_OBM_Init(void);
176 extern XImage
*X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ
*bmp
);
177 extern int X11DRV_DIB_GetXImageWidthBytes( int width
, int depth
);
178 extern HBITMAP
X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap
);
179 extern HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap
, HDC hdc
, BOOL bDeletePixmap
);
180 extern HBITMAP
X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap
, BOOL bDeletePixmap
);
181 extern Pixmap
X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB
, HDC hdc
);
182 extern Pixmap
X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp
, HDC hdc
);
184 extern BOOL
X11DRV_SetupGCForPatBlt( struct tagDC
*dc
, GC gc
,
186 extern BOOL
X11DRV_SetupGCForBrush( struct tagDC
*dc
);
187 extern BOOL
X11DRV_SetupGCForPen( struct tagDC
*dc
);
188 extern BOOL
X11DRV_SetupGCForText( struct tagDC
*dc
);
190 extern const int X11DRV_XROPfunction
[];
192 /* Xlib critical section */
194 extern CRITICAL_SECTION X11DRV_CritSection
;
196 extern void _XInitImageFuncPtrs(XImage
*);
198 #define XCREATEIMAGE(image,width,height,bpp) \
200 int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
201 (image) = TSXCreateImage(display, X11DRV_GetVisual(), \
202 (bpp), ZPixmap, 0, calloc( (height), width_bytes ),\
203 (width), (height), 32, width_bytes ); \
206 /* exported dib functions for now */
208 /* Additional info for DIB section objects */
211 /* Windows DIB section */
212 DIBSECTION dibSection
;
215 enum { X11DRV_DIB_NoHandler
, X11DRV_DIB_InSync
, X11DRV_DIB_AppMod
, X11DRV_DIB_GdiMod
} status
;
224 /* Selector for 16-bit access to bits */
227 /* Shared memory segment info */
228 XShmSegmentInfo shminfo
;
232 /* This structure holds the arguments for DIB_SetImageBits() */
238 PALETTEENTRY
*palentry
;
259 } X11DRV_DIB_IMAGEBITS_DESCR
;
261 extern int *X11DRV_DIB_BuildColorMap( struct tagDC
*dc
, WORD coloruse
,
262 WORD depth
, const BITMAPINFO
*info
,
264 extern void X11DRV_DIB_UpdateDIBSection(struct tagDC
*dc
, BOOL toDIB
);
266 extern HBITMAP
X11DRV_DIB_CreateDIBSection(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT usage
,
267 LPVOID
*bits
, HANDLE section
, DWORD offset
, DWORD ovr_pitch
);
268 extern HBITMAP16
X11DRV_DIB_CreateDIBSection16(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT16 usage
,
269 SEGPTR
*bits
, HANDLE section
, DWORD offset
, DWORD ovr_pitch
);
271 extern struct tagBITMAP_DRIVER X11DRV_BITMAP_Driver
;
273 extern INT
X11DRV_DIB_SetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
274 UINT lines
, LPCVOID bits
, const BITMAPINFO
*info
,
275 UINT coloruse
, HBITMAP hbitmap
);
276 extern INT
X11DRV_DIB_GetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
277 UINT lines
, LPVOID bits
, BITMAPINFO
*info
,
278 UINT coloruse
, HBITMAP hbitmap
);
279 extern void X11DRV_DIB_DeleteDIBSection(struct tagBITMAPOBJ
*bmp
);
281 /**************************************************************************
285 BOOL
X11DRV_GDI_Initialize(void);
286 void X11DRV_GDI_Finalize(void);
288 /* X11 GDI palette driver */
290 #define X11DRV_PALETTE_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
291 #define X11DRV_PALETTE_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
293 #define X11DRV_PALETTE_PRIVATE 0x1000 /* private colormap, identity mapping */
294 #define X11DRV_PALETTE_WHITESET 0x2000
296 extern Colormap X11DRV_PALETTE_PaletteXColormap
;
297 extern UINT16 X11DRV_PALETTE_PaletteFlags
;
299 extern int *X11DRV_PALETTE_PaletteToXPixel
;
300 extern int *X11DRV_PALETTE_XPixelToPalette
;
302 extern int X11DRV_PALETTE_mapEGAPixel
[16];
304 extern BOOL
X11DRV_PALETTE_Init(void);
305 extern void X11DRV_PALETTE_Cleanup(void);
307 extern COLORREF
X11DRV_PALETTE_ToLogical(int pixel
);
308 extern int X11DRV_PALETTE_ToPhysical(struct tagDC
*dc
, COLORREF color
);
310 extern struct tagPALETTE_DRIVER X11DRV_PALETTE_Driver
;
312 extern int X11DRV_PALETTE_SetMapping(struct tagPALETTEOBJ
*palPtr
, UINT uStart
, UINT uNum
, BOOL mapOnly
);
313 extern int X11DRV_PALETTE_UpdateMapping(struct tagPALETTEOBJ
*palPtr
);
314 extern BOOL
X11DRV_PALETTE_IsDark(int pixel
);
316 /**************************************************************************
320 extern Display
*display
;
321 extern Screen
*screen
;
322 extern Visual
*visual
;
323 extern Window root_window
;
324 extern int screen_depth
;
326 static inline Screen
*X11DRV_GetXScreen(void) { return screen
; }
327 static inline Visual
*X11DRV_GetVisual(void) { return visual
; }
328 static inline Window
X11DRV_GetXRootWindow(void) { return root_window
; }
329 static inline int X11DRV_GetDepth(void) { return screen_depth
; }
331 extern BOOL
X11DRV_GetScreenSaveActive(void);
332 extern void X11DRV_SetScreenSaveActive(BOOL bActivate
);
333 extern int X11DRV_GetScreenSaveTimeout(void);
334 extern void X11DRV_SetScreenSaveTimeout(int nTimeout
);
335 extern BOOL
X11DRV_IsSingleWindow(void);
337 /* X11 clipboard driver */
339 extern struct tagCLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver
;
341 extern void X11DRV_CLIPBOARD_FreeResources( Atom property
);
342 extern BOOL
X11DRV_CLIPBOARD_RegisterPixmapResource( Atom property
, Pixmap pixmap
);
344 extern void X11DRV_CLIPBOARD_Acquire(void);
345 extern void X11DRV_CLIPBOARD_Release(void);
346 extern void X11DRV_CLIPBOARD_SetData(UINT wFormat
);
347 extern BOOL
X11DRV_CLIPBOARD_GetData(UINT wFormat
);
348 extern BOOL
X11DRV_CLIPBOARD_IsFormatAvailable(UINT wFormat
);
349 extern BOOL
X11DRV_CLIPBOARD_IsNativeProperty(Atom prop
);
350 extern BOOL
X11DRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName
);
351 extern BOOL
X11DRV_CLIPBOARD_IsSelectionowner();
352 extern UINT
X11DRV_CLIPBOARD_MapPropertyToFormat(char *itemFmtName
);
353 extern Atom
X11DRV_CLIPBOARD_MapFormatToProperty(UINT id
);
354 extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND
*pWnd
, BOOL bFooBar
);
355 extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType
, Window w
, HWND hwnd
);
357 /* X11 event driver */
359 extern WORD
X11DRV_EVENT_XStateToKeyState( int state
) ;
361 extern BOOL
X11DRV_EVENT_Init(void);
362 extern void X11DRV_EVENT_Synchronize( void );
363 extern BOOL
X11DRV_EVENT_CheckFocus( void );
364 extern void X11DRV_EVENT_UserRepaintDisable( BOOL bDisable
);
367 X11DRV_INPUT_RELATIVE
,
368 X11DRV_INPUT_ABSOLUTE
370 extern INPUT_TYPE
X11DRV_EVENT_SetInputMethod(INPUT_TYPE type
);
372 #ifdef HAVE_LIBXXF86DGA2
373 void X11DRV_EVENT_SetDGAStatus(HWND hwnd
, int event_base
) ;
377 /* X11 keyboard driver */
379 extern void X11DRV_KEYBOARD_Init(void);
380 extern WORD
X11DRV_KEYBOARD_VkKeyScan(CHAR cChar
);
381 extern UINT16
X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode
, UINT16 wMapType
);
382 extern INT16
X11DRV_KEYBOARD_GetKeyNameText(LONG lParam
, LPSTR lpBuffer
, INT16 nSize
);
383 extern INT16
X11DRV_KEYBOARD_ToAscii(UINT16 virtKey
, UINT16 scanCode
, LPBYTE lpKeyState
, LPVOID lpChar
, UINT16 flags
);
384 extern BOOL
X11DRV_KEYBOARD_GetBeepActive(void);
385 extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate
);
386 extern void X11DRV_KEYBOARD_Beep(void);
387 extern BOOL
X11DRV_KEYBOARD_GetDIState(DWORD len
, LPVOID ptr
);
388 extern BOOL
X11DRV_KEYBOARD_GetDIData(BYTE
*keystate
, DWORD dodsize
, struct DIDEVICEOBJECTDATA
*dod
, LPDWORD entries
, DWORD flags
);
389 extern void X11DRV_KEYBOARD_GetKeyboardConfig(struct tagKEYBOARD_CONFIG
*cfg
);
390 extern void X11DRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG
*cfg
, DWORD mask
);
392 extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND
*pWnd
, XKeyEvent
*event
);
394 /* X11 mouse driver */
396 extern void X11DRV_MOUSE_Init();
397 extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO
*lpCursor
);
398 extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX
, WORD wAbsY
);
399 extern LONG
X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable
);
401 /* X11 windows driver */
403 extern struct tagWND_DRIVER X11DRV_WND_Driver
;
405 typedef struct _X11DRV_WND_DATA
{
407 HBITMAP hWMIconBitmap
;
412 extern Window
X11DRV_WND_GetXWindow(struct tagWND
*wndPtr
);
413 extern Window
X11DRV_WND_FindXWindow(struct tagWND
*wndPtr
);
415 extern void X11DRV_WND_Initialize(struct tagWND
*wndPtr
);
416 extern void X11DRV_WND_Finalize(struct tagWND
*wndPtr
);
417 extern BOOL
X11DRV_WND_CreateDesktopWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, BOOL bUnicode
);
418 extern BOOL
X11DRV_WND_CreateWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, struct tagCREATESTRUCTA
*cs
, BOOL bUnicode
);
419 extern BOOL
X11DRV_WND_DestroyWindow(struct tagWND
*pWnd
);
420 extern struct tagWND
*X11DRV_WND_SetParent(struct tagWND
*wndPtr
, struct tagWND
*pWndParent
);
421 extern void X11DRV_WND_ForceWindowRaise(struct tagWND
*pWnd
);
422 extern void X11DRV_WND_SetWindowPos(struct tagWND
*wndPtr
, const struct tagWINDOWPOS
*winpos
, BOOL bSMC_SETXPOS
);
423 extern void X11DRV_WND_SetText(struct tagWND
*wndPtr
, LPCSTR text
);
424 extern void X11DRV_WND_SetFocus(struct tagWND
*wndPtr
);
425 extern void X11DRV_WND_PreSizeMove(struct tagWND
*wndPtr
);
426 extern void X11DRV_WND_PostSizeMove(struct tagWND
*wndPtr
);
427 extern void X11DRV_WND_SurfaceCopy(struct tagWND
*wndPtr
, struct tagDC
*dcPtr
, INT dx
, INT dy
, const RECT
*clipRect
, BOOL bUpdate
);
428 extern void X11DRV_WND_SetDrawable(struct tagWND
*wndPtr
, struct tagDC
*dc
, WORD flags
, BOOL bSetClipOrigin
);
429 extern BOOL
X11DRV_WND_SetHostAttr(struct tagWND
*wndPtr
, INT haKey
, INT value
);
430 extern BOOL
X11DRV_WND_IsSelfClipping(struct tagWND
*wndPtr
);
431 extern void X11DRV_WND_DockWindow(struct tagWND
*wndPtr
);
433 extern int X11DRV_EVENT_PrepareShmCompletion( Drawable dw
);
434 extern void X11DRV_EVENT_WaitShmCompletion( int compl );
435 extern void X11DRV_EVENT_WaitShmCompletions( Drawable dw
);
436 extern void X11DRV_EVENT_WaitReplaceShmCompletion( int *compl, Drawable dw
);
438 #endif /* __WINE_X11DRV_H */