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 struct tagCREATESTRUCTA
;
25 struct tagCURSORICONINFO
;
42 int type
; /* GEOMETRIC || COSMETIC */
45 /* X physical brush */
55 typedef UINT X_PHYSFONT
;
57 /* X physical device */
60 GC gc
; /* X Window GC */
74 /* GCs used for B&W and color bitmap operations */
75 extern GC BITMAP_monoGC
, BITMAP_colorGC
;
77 #define BITMAP_GC(bmp) \
78 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
80 extern DeviceCaps X11DRV_DevCaps
;
82 /* Wine driver X11 functions */
84 extern BOOL
X11DRV_Init(void);
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_GetTextExtentPoint( struct tagDC
*dc
, LPCSTR str
,
93 INT count
, LPSIZE size
);
94 extern BOOL
X11DRV_GetTextMetrics(struct tagDC
*dc
, TEXTMETRICA
*metrics
);
95 extern BOOL
X11DRV_PatBlt( struct tagDC
*dc
, INT left
, INT top
,
96 INT width
, INT height
, DWORD rop
);
97 extern VOID
X11DRV_SetDeviceClipping(struct tagDC
*dc
);
98 extern BOOL
X11DRV_StretchBlt( struct tagDC
*dcDst
, INT xDst
, INT yDst
,
99 INT widthDst
, INT heightDst
,
100 struct tagDC
*dcSrc
, INT xSrc
, INT ySrc
,
101 INT widthSrc
, INT heightSrc
, DWORD rop
);
102 extern BOOL
X11DRV_MoveToEx( struct tagDC
*dc
, INT x
, INT y
,LPPOINT pt
);
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_PolyBezier( struct tagDC
*dc
, const POINT start
, const POINT
* lppt
, DWORD cPoints
);
126 extern BOOL
X11DRV_Polygon( struct tagDC
*dc
, const POINT
* pt
, INT count
);
127 extern BOOL
X11DRV_PolyPolygon( struct tagDC
*dc
, const POINT
* pt
,
128 const INT
* counts
, UINT polygons
);
129 extern BOOL
X11DRV_PolyPolyline( struct tagDC
*dc
, const POINT
* pt
,
130 const DWORD
* counts
, DWORD polylines
);
132 extern HGDIOBJ
X11DRV_SelectObject( struct tagDC
*dc
, HGDIOBJ handle
);
134 extern COLORREF
X11DRV_SetBkColor( struct tagDC
*dc
, COLORREF color
);
135 extern COLORREF
X11DRV_SetTextColor( struct tagDC
*dc
, COLORREF color
);
136 extern BOOL
X11DRV_ExtFloodFill( struct tagDC
*dc
, INT x
, INT y
,
137 COLORREF color
, UINT fillType
);
138 extern BOOL
X11DRV_ExtTextOut( struct tagDC
*dc
, INT x
, INT y
,
139 UINT flags
, const RECT
*lprect
,
140 LPCSTR str
, UINT count
, const INT
*lpDx
);
141 extern BOOL
X11DRV_CreateBitmap( HBITMAP hbitmap
);
142 extern BOOL
X11DRV_DeleteObject( HGDIOBJ handle
);
143 extern LONG
X11DRV_BitmapBits( HBITMAP hbitmap
, void *bits
, LONG count
,
145 extern INT
X11DRV_SetDIBitsToDevice( struct tagDC
*dc
, INT xDest
,
146 INT yDest
, DWORD cx
, DWORD cy
,
148 UINT startscan
, UINT lines
,
149 LPCVOID bits
, const BITMAPINFO
*info
,
151 extern INT
X11DRV_DeviceBitmapBits( struct tagDC
*dc
, HBITMAP hbitmap
,
152 WORD fGet
, UINT startscan
,
153 UINT lines
, LPSTR bits
,
154 LPBITMAPINFO info
, UINT coloruse
);
155 extern HANDLE
X11DRV_LoadOEMResource( WORD id
, WORD type
);
157 /* X11 driver internal functions */
159 extern BOOL
X11DRV_BITMAP_Init(void);
160 extern BOOL
X11DRV_BRUSH_Init(void);
161 extern BOOL
X11DRV_DIB_Init(void);
162 extern BOOL
X11DRV_FONT_Init( struct tagDeviceCaps
* );
163 extern BOOL
X11DRV_OBM_Init(void);
166 extern XImage
*X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ
*bmp
);
167 extern int X11DRV_DIB_GetXImageWidthBytes( int width
, int depth
);
168 extern BOOL
X11DRV_DIB_Init(void);
169 extern X11DRV_PHYSBITMAP
*X11DRV_AllocBitmap( struct tagBITMAPOBJ
*bmp
);
171 extern BOOL
X11DRV_SetupGCForPatBlt( struct tagDC
*dc
, GC gc
,
173 extern BOOL
X11DRV_SetupGCForBrush( struct tagDC
*dc
);
174 extern BOOL
X11DRV_SetupGCForPen( struct tagDC
*dc
);
175 extern BOOL
X11DRV_SetupGCForText( struct tagDC
*dc
);
177 extern const int X11DRV_XROPfunction
[];
179 /* Xlib critical section */
181 extern CRITICAL_SECTION X11DRV_CritSection
;
183 extern void _XInitImageFuncPtrs(XImage
*);
185 #define XCREATEIMAGE(image,width,height,bpp) \
187 int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
188 (image) = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()), \
189 (bpp), ZPixmap, 0, xcalloc( (height)*width_bytes ),\
190 (width), (height), 32, width_bytes ); \
193 /* exported dib functions for now */
195 /* Additional info for DIB section objects */
198 /* Windows DIB section */
199 DIBSECTION dibSection
;
202 enum { X11DRV_DIB_NoHandler
, X11DRV_DIB_InSync
, X11DRV_DIB_AppMod
, X11DRV_DIB_GdiMod
} status
;
211 /* Selector for 16-bit access to bits */
215 /* This structure holds the arguments for DIB_SetImageBits() */
236 } X11DRV_DIB_SETIMAGEBITS_DESCR
;
238 extern int X11DRV_DIB_GetImageBits( const X11DRV_DIB_SETIMAGEBITS_DESCR
*descr
);
239 extern int X11DRV_DIB_SetImageBits( const X11DRV_DIB_SETIMAGEBITS_DESCR
*descr
);
240 extern int *X11DRV_DIB_BuildColorMap( struct tagDC
*dc
, WORD coloruse
,
241 WORD depth
, const BITMAPINFO
*info
,
243 extern void X11DRV_DIB_UpdateDIBSection(struct tagDC
*dc
, BOOL toDIB
);
245 extern HBITMAP
X11DRV_DIB_CreateDIBSection(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT usage
,
246 LPVOID
*bits
, HANDLE section
, DWORD offset
);
247 extern HBITMAP16
X11DRV_DIB_CreateDIBSection16(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT16 usage
,
248 SEGPTR
*bits
, HANDLE section
, DWORD offset
);
250 extern struct tagBITMAP_DRIVER X11DRV_BITMAP_Driver
;
252 extern INT
X11DRV_DIB_SetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
253 UINT lines
, LPCVOID bits
, const BITMAPINFO
*info
,
254 UINT coloruse
, HBITMAP hbitmap
);
255 extern INT
X11DRV_DIB_GetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
256 UINT lines
, LPVOID bits
, BITMAPINFO
*info
,
257 UINT coloruse
, HBITMAP hbitmap
);
258 extern void X11DRV_DIB_DeleteDIBSection(struct tagBITMAPOBJ
*bmp
);
260 /**************************************************************************
264 extern struct tagGDI_DRIVER X11DRV_GDI_Driver
;
266 BOOL
X11DRV_GDI_Initialize(void);
267 void X11DRV_GDI_Finalize(void);
269 /* X11 GDI palette driver */
271 #define X11DRV_PALETTE_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
272 #define X11DRV_PALETTE_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
274 #define X11DRV_PALETTE_PRIVATE 0x1000 /* private colormap, identity mapping */
275 #define X11DRV_PALETTE_WHITESET 0x2000
277 extern Colormap X11DRV_PALETTE_PaletteXColormap
;
278 extern UINT16 X11DRV_PALETTE_PaletteFlags
;
280 extern int *X11DRV_PALETTE_PaletteToXPixel
;
281 extern int *X11DRV_PALETTE_XPixelToPalette
;
283 extern int X11DRV_PALETTE_mapEGAPixel
[16];
285 extern BOOL
X11DRV_PALETTE_Init(void);
286 extern void X11DRV_PALETTE_Cleanup(void);
288 extern COLORREF
X11DRV_PALETTE_ToLogical(int pixel
);
289 extern int X11DRV_PALETTE_ToPhysical(struct tagDC
*dc
, COLORREF color
);
291 extern struct tagPALETTE_DRIVER X11DRV_PALETTE_Driver
;
293 extern int X11DRV_PALETTE_SetMapping(struct tagPALETTEOBJ
*palPtr
, UINT uStart
, UINT uNum
, BOOL mapOnly
);
294 extern int X11DRV_PALETTE_UpdateMapping(struct tagPALETTEOBJ
*palPtr
);
295 extern BOOL
X11DRV_PALETTE_IsDark(int pixel
);
297 /**************************************************************************
301 extern struct tagUSER_DRIVER X11DRV_USER_Driver
;
303 extern Display
*display
;
304 extern Screen
*X11DRV_GetXScreen(void);
305 extern Window
X11DRV_GetXRootWindow(void);
307 extern BOOL
X11DRV_USER_Initialize(void);
308 extern void X11DRV_USER_Finalize(void);
309 extern void X11DRV_USER_BeginDebugging(void);
310 extern void X11DRV_USER_EndDebugging(void);
312 /* X11 clipboard driver */
314 extern struct tagCLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver
;
316 extern void X11DRV_CLIPBOARD_Empty(void);
317 extern void X11DRV_CLIPBOARD_SetData(UINT wFormat
);
318 extern BOOL
X11DRV_CLIPBOARD_GetData(UINT wFormat
);
319 extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND
*pWnd
, BOOL bFooBar
);
320 extern void X11DRV_CLIPBOARD_ReleaseSelection(Window w
, HWND hwnd
);
322 /* X11 desktop driver */
324 extern struct tagDESKTOP_DRIVER X11DRV_DESKTOP_Driver
;
326 typedef struct _X11DRV_DESKTOP_DATA
{
328 } X11DRV_DESKTOP_DATA
;
332 extern Screen
*X11DRV_DESKTOP_GetXScreen(struct tagDESKTOP
*pDesktop
);
333 extern Window
X11DRV_DESKTOP_GetXRootWindow(struct tagDESKTOP
*pDesktop
);
335 extern void X11DRV_DESKTOP_Initialize(struct tagDESKTOP
*pDesktop
);
336 extern void X11DRV_DESKTOP_Finalize(struct tagDESKTOP
*pDesktop
);
337 extern int X11DRV_DESKTOP_GetScreenWidth(struct tagDESKTOP
*pDesktop
);
338 extern int X11DRV_DESKTOP_GetScreenHeight(struct tagDESKTOP
*pDesktop
);
339 extern int X11DRV_DESKTOP_GetScreenDepth(struct tagDESKTOP
*pDesktop
);
341 /* X11 event driver */
343 extern struct tagEVENT_DRIVER X11DRV_EVENT_Driver
;
345 extern BOOL
X11DRV_EVENT_Init(void);
346 extern void X11DRV_EVENT_Synchronize( void );
347 extern BOOL
X11DRV_EVENT_CheckFocus( void );
348 extern BOOL
X11DRV_EVENT_QueryPointer(DWORD
*posX
, DWORD
*posY
, DWORD
*state
);
349 extern void X11DRV_EVENT_UserRepaintDisable( BOOL bDisable
);
351 /* X11 keyboard driver */
353 extern struct tagKEYBOARD_DRIVER X11DRV_KEYBOARD_Driver
;
355 extern void X11DRV_KEYBOARD_Init(void);
356 extern WORD
X11DRV_KEYBOARD_VkKeyScan(CHAR cChar
);
357 extern UINT16
X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode
, UINT16 wMapType
);
358 extern INT16
X11DRV_KEYBOARD_GetKeyNameText(LONG lParam
, LPSTR lpBuffer
, INT16 nSize
);
359 extern INT16
X11DRV_KEYBOARD_ToAscii(UINT16 virtKey
, UINT16 scanCode
, LPBYTE lpKeyState
, LPVOID lpChar
, UINT16 flags
);
360 extern BOOL
X11DRV_KEYBOARD_GetBeepActive(void);
361 extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate
);
362 extern void X11DRV_KEYBOARD_Beep(void);
363 extern BOOL
X11DRV_KEYBOARD_GetDIState(DWORD len
, LPVOID ptr
);
364 extern BOOL
X11DRV_KEYBOARD_GetDIData(BYTE
*keystate
, DWORD dodsize
, LPDIDEVICEOBJECTDATA dod
, LPDWORD entries
, DWORD flags
);
366 extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND
*pWnd
, XKeyEvent
*event
);
368 /* X11 monitor driver */
370 extern struct tagMONITOR_DRIVER X11DRV_MONITOR_Driver
;
372 typedef struct _X11DRV_MONITOR_DATA
{
378 } X11DRV_MONITOR_DATA
;
382 extern Screen
*X11DRV_MONITOR_GetXScreen(struct tagMONITOR
*pMonitor
);
383 extern Window
X11DRV_MONITOR_GetXRootWindow(struct tagMONITOR
*pMonitor
);
385 extern void X11DRV_MONITOR_Initialize(struct tagMONITOR
*pMonitor
);
386 extern void X11DRV_MONITOR_Finalize(struct tagMONITOR
*pMonitor
);
387 extern BOOL
X11DRV_MONITOR_IsSingleWindow(struct tagMONITOR
*pMonitor
);
388 extern int X11DRV_MONITOR_GetWidth(struct tagMONITOR
*pMonitor
);
389 extern int X11DRV_MONITOR_GetHeight(struct tagMONITOR
*pMonitor
);
390 extern int X11DRV_MONITOR_GetDepth(struct tagMONITOR
*pMonitor
);
391 extern BOOL
X11DRV_MONITOR_GetScreenSaveActive(struct tagMONITOR
*pMonitor
);
392 extern void X11DRV_MONITOR_SetScreenSaveActive(struct tagMONITOR
*pMonitor
, BOOL bActivate
);
393 extern int X11DRV_MONITOR_GetScreenSaveTimeout(struct tagMONITOR
*pMonitor
);
394 extern void X11DRV_MONITOR_SetScreenSaveTimeout(struct tagMONITOR
*pMonitor
, int nTimeout
);
396 /* X11 mouse driver */
398 extern struct tagMOUSE_DRIVER X11DRV_MOUSE_Driver
;
400 extern BOOL X11DRV_MOUSE_DisableWarpPointer
;
402 extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO
*lpCursor
);
403 extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX
, WORD wAbsY
);
404 extern BOOL
X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable
);
406 /* X11 windows driver */
408 extern struct tagWND_DRIVER X11DRV_WND_Driver
;
410 typedef struct _X11DRV_WND_DATA
{
412 HBITMAP hWMIconBitmap
;
416 extern Window
X11DRV_WND_GetXWindow(struct tagWND
*wndPtr
);
417 extern Window
X11DRV_WND_FindXWindow(struct tagWND
*wndPtr
);
418 extern Screen
*X11DRV_WND_GetXScreen(struct tagWND
*wndPtr
);
419 extern Window
X11DRV_WND_GetXRootWindow(struct tagWND
*wndPtr
);
421 extern void X11DRV_WND_Initialize(struct tagWND
*wndPtr
);
422 extern void X11DRV_WND_Finalize(struct tagWND
*wndPtr
);
423 extern BOOL
X11DRV_WND_CreateDesktopWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, BOOL bUnicode
);
424 extern BOOL
X11DRV_WND_CreateWindow(struct tagWND
*wndPtr
, struct tagCLASS
*classPtr
, struct tagCREATESTRUCTA
*cs
, BOOL bUnicode
);
425 extern BOOL
X11DRV_WND_DestroyWindow(struct tagWND
*pWnd
);
426 extern struct tagWND
*X11DRV_WND_SetParent(struct tagWND
*wndPtr
, struct tagWND
*pWndParent
);
427 extern void X11DRV_WND_ForceWindowRaise(struct tagWND
*pWnd
);
428 extern void X11DRV_WND_SetWindowPos(struct tagWND
*wndPtr
, const struct tagWINDOWPOS
*winpos
, BOOL bSMC_SETXPOS
);
429 extern void X11DRV_WND_SetText(struct tagWND
*wndPtr
, LPCSTR text
);
430 extern void X11DRV_WND_SetFocus(struct tagWND
*wndPtr
);
431 extern void X11DRV_WND_PreSizeMove(struct tagWND
*wndPtr
);
432 extern void X11DRV_WND_PostSizeMove(struct tagWND
*wndPtr
);
433 extern void X11DRV_WND_SurfaceCopy(struct tagWND
*wndPtr
, struct tagDC
*dcPtr
, INT dx
, INT dy
, const RECT
*clipRect
, BOOL bUpdate
);
434 extern void X11DRV_WND_SetDrawable(struct tagWND
*wndPtr
, struct tagDC
*dc
, WORD flags
, BOOL bSetClipOrigin
);
435 extern BOOL
X11DRV_WND_SetHostAttr(struct tagWND
*wndPtr
, INT haKey
, INT value
);
436 extern BOOL
X11DRV_WND_IsSelfClipping(struct tagWND
*wndPtr
);
438 #endif /* __WINE_X11DRV_H */