2 * X11 display 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 "xmalloc.h" /* for XCREATEIMAGE macro */
22 #include "clipboard.h"
37 int type
; /* GEOMETRIC || COSMETIC */
40 /* X physical brush */
50 typedef UINT32 X_PHYSFONT
;
52 /* X physical device */
55 GC gc
; /* X Window GC */
69 /* GCs used for B&W and color bitmap operations */
70 extern GC BITMAP_monoGC
, BITMAP_colorGC
;
72 #define BITMAP_GC(bmp) \
73 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
76 /* Wine driver X11 functions */
81 extern BOOL32
X11DRV_Init(void);
82 extern BOOL32
X11DRV_BitBlt( struct tagDC
*dcDst
, INT32 xDst
, INT32 yDst
,
83 INT32 width
, INT32 height
, struct tagDC
*dcSrc
,
84 INT32 xSrc
, INT32 ySrc
, DWORD rop
);
85 extern BOOL32
X11DRV_EnumDeviceFonts( struct tagDC
*dc
, LPLOGFONT16 plf
,
86 DEVICEFONTENUMPROC dfeproc
, LPARAM lp
);
87 extern BOOL32
X11DRV_GetCharWidth( struct tagDC
*dc
, UINT32 firstChar
,
88 UINT32 lastChar
, LPINT32 buffer
);
89 extern BOOL32
X11DRV_GetTextExtentPoint( struct tagDC
*dc
, LPCSTR str
,
90 INT32 count
, LPSIZE32 size
);
91 extern BOOL32
X11DRV_GetTextMetrics(struct tagDC
*dc
, TEXTMETRIC32A
*metrics
);
92 extern BOOL32
X11DRV_PatBlt( struct tagDC
*dc
, INT32 left
, INT32 top
,
93 INT32 width
, INT32 height
, DWORD rop
);
94 extern VOID
X11DRV_SetDeviceClipping(struct tagDC
*dc
);
95 extern BOOL32
X11DRV_StretchBlt( struct tagDC
*dcDst
, INT32 xDst
, INT32 yDst
,
96 INT32 widthDst
, INT32 heightDst
,
97 struct tagDC
*dcSrc
, INT32 xSrc
, INT32 ySrc
,
98 INT32 widthSrc
, INT32 heightSrc
, DWORD rop
);
99 extern BOOL32
X11DRV_MoveToEx( struct tagDC
*dc
, INT32 x
, INT32 y
,LPPOINT32 pt
);
100 extern BOOL32
X11DRV_LineTo( struct tagDC
*dc
, INT32 x
, INT32 y
);
101 extern BOOL32
X11DRV_Arc( struct tagDC
*dc
, INT32 left
, INT32 top
, INT32 right
,
102 INT32 bottom
, INT32 xstart
, INT32 ystart
, INT32 xend
,
104 extern BOOL32
X11DRV_Pie( struct tagDC
*dc
, INT32 left
, INT32 top
, INT32 right
,
105 INT32 bottom
, INT32 xstart
, INT32 ystart
, INT32 xend
,
107 extern BOOL32
X11DRV_Chord( struct tagDC
*dc
, INT32 left
, INT32 top
,
108 INT32 right
, INT32 bottom
, INT32 xstart
,
109 INT32 ystart
, INT32 xend
, INT32 yend
);
110 extern BOOL32
X11DRV_Ellipse( struct tagDC
*dc
, INT32 left
, INT32 top
,
111 INT32 right
, INT32 bottom
);
112 extern BOOL32
X11DRV_Rectangle(struct tagDC
*dc
, INT32 left
, INT32 top
,
113 INT32 right
, INT32 bottom
);
114 extern BOOL32
X11DRV_RoundRect( struct tagDC
*dc
, INT32 left
, INT32 top
,
115 INT32 right
, INT32 bottom
, INT32 ell_width
,
117 extern COLORREF
X11DRV_SetPixel( struct tagDC
*dc
, INT32 x
, INT32 y
,
119 extern COLORREF
X11DRV_GetPixel( struct tagDC
*dc
, INT32 x
, INT32 y
);
120 extern BOOL32
X11DRV_PaintRgn( struct tagDC
*dc
, HRGN32 hrgn
);
121 extern BOOL32
X11DRV_Polyline( struct tagDC
*dc
,const POINT32
* pt
,INT32 count
);
122 extern BOOL32
X11DRV_PolyBezier( struct tagDC
*dc
, const POINT32 start
, const POINT32
* lppt
, DWORD cPoints
);
123 extern BOOL32
X11DRV_Polygon( struct tagDC
*dc
, const POINT32
* pt
, INT32 count
);
124 extern BOOL32
X11DRV_PolyPolygon( struct tagDC
*dc
, const POINT32
* pt
,
125 const INT32
* counts
, UINT32 polygons
);
126 extern BOOL32
X11DRV_PolyPolyline( struct tagDC
*dc
, const POINT32
* pt
,
127 const DWORD
* counts
, DWORD polylines
);
129 extern HGDIOBJ32
X11DRV_SelectObject( struct tagDC
*dc
, HGDIOBJ32 handle
);
131 extern COLORREF
X11DRV_SetBkColor( struct tagDC
*dc
, COLORREF color
);
132 extern COLORREF
X11DRV_SetTextColor( struct tagDC
*dc
, COLORREF color
);
133 extern BOOL32
X11DRV_ExtFloodFill( struct tagDC
*dc
, INT32 x
, INT32 y
,
134 COLORREF color
, UINT32 fillType
);
135 extern BOOL32
X11DRV_ExtTextOut( struct tagDC
*dc
, INT32 x
, INT32 y
,
136 UINT32 flags
, const RECT32
*lprect
,
137 LPCSTR str
, UINT32 count
, const INT32
*lpDx
);
138 extern BOOL32
X11DRV_CreateBitmap( HBITMAP32 hbitmap
);
139 extern BOOL32
X11DRV_DeleteObject( HGDIOBJ32 handle
);
140 extern LONG
X11DRV_BitmapBits( HBITMAP32 hbitmap
, void *bits
, LONG count
,
142 extern INT32
X11DRV_SetDIBitsToDevice( struct tagDC
*dc
, INT32 xDest
,
143 INT32 yDest
, DWORD cx
, DWORD cy
,
144 INT32 xSrc
, INT32 ySrc
,
145 UINT32 startscan
, UINT32 lines
,
146 LPCVOID bits
, const BITMAPINFO
*info
,
148 extern INT32
X11DRV_DeviceBitmapBits( struct tagDC
*dc
, HBITMAP32 hbitmap
,
149 WORD fGet
, UINT32 startscan
,
150 UINT32 lines
, LPSTR bits
,
151 LPBITMAPINFO info
, UINT32 coloruse
);
152 extern HANDLE32
X11DRV_LoadOEMResource( WORD id
, WORD type
);
154 /* X11 driver internal functions */
156 extern BOOL32
X11DRV_BITMAP_Init(void);
157 extern BOOL32
X11DRV_BRUSH_Init(void);
158 extern BOOL32
X11DRV_DIB_Init(void);
159 extern BOOL32
X11DRV_FONT_Init( struct tagDeviceCaps
* );
160 extern BOOL32
X11DRV_OBM_Init(void);
163 extern XImage
*X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ
*bmp
);
164 extern int X11DRV_DIB_GetXImageWidthBytes( int width
, int depth
);
165 extern BOOL32
X11DRV_DIB_Init(void);
166 extern X11DRV_PHYSBITMAP
*X11DRV_AllocBitmap( struct tagBITMAPOBJ
*bmp
);
168 extern BOOL32
X11DRV_SetupGCForPatBlt( struct tagDC
*dc
, GC gc
,
170 extern BOOL32
X11DRV_SetupGCForBrush( struct tagDC
*dc
);
171 extern BOOL32
X11DRV_SetupGCForPen( struct tagDC
*dc
);
172 extern BOOL32
X11DRV_SetupGCForText( struct tagDC
*dc
);
174 extern const int X11DRV_XROPfunction
[];
176 extern Display
* display
;
177 extern Screen
* screen
;
178 extern Window rootWindow
;
179 extern int screenWidth
, screenHeight
, screenDepth
;
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, DefaultVisualOfScreen(screen), \
192 (bpp), ZPixmap, 0, xcalloc( (height)*width_bytes ),\
193 (width), (height), 32, width_bytes ); \
196 /* exported dib functions for now */
198 /* This structure holds the arguments for DIB_SetImageBits() */
219 } DIB_SETIMAGEBITS_DESCR
;
221 extern int X11DRV_DIB_GetImageBits( const DIB_SETIMAGEBITS_DESCR
*descr
);
222 extern int X11DRV_DIB_SetImageBits( const DIB_SETIMAGEBITS_DESCR
*descr
);
223 extern int *X11DRV_DIB_BuildColorMap( struct tagDC
*dc
, WORD coloruse
,
224 WORD depth
, const BITMAPINFO
*info
,
227 /* X11 windows driver */
229 extern WND_DRIVER X11DRV_WND_Driver
;
231 typedef struct _X11DRV_WND_DATA
{
235 extern Window
X11DRV_WND_GetXWindow(WND
*wndPtr
);
236 extern Window
X11DRV_WND_FindXWindow(WND
*wndPtr
);
238 extern void X11DRV_WND_Initialize(WND
*wndPtr
);
239 extern void X11DRV_WND_Finalize(WND
*wndPtr
);
240 extern BOOL32
X11DRV_WND_CreateDesktopWindow(WND
*wndPtr
, CLASS
*classPtr
, BOOL32 bUnicode
);
241 extern BOOL32
X11DRV_WND_CreateWindow(WND
*wndPtr
, CLASS
*classPtr
, CREATESTRUCT32A
*cs
, BOOL32 bUnicode
);
242 extern BOOL32
X11DRV_WND_DestroyWindow(WND
*pWnd
);
243 extern WND
*X11DRV_WND_SetParent(WND
*wndPtr
, WND
*pWndParent
);
244 extern void X11DRV_WND_ForceWindowRaise(WND
*pWnd
);
245 extern void X11DRV_WND_SetWindowPos(WND
*wndPtr
, const WINDOWPOS32
*winpos
, BOOL32 bSMC_SETXPOS
);
246 extern void X11DRV_WND_SetText(WND
*wndPtr
, LPCSTR text
);
247 extern void X11DRV_WND_SetFocus(WND
*wndPtr
);
248 extern void X11DRV_WND_PreSizeMove(WND
*wndPtr
);
249 extern void X11DRV_WND_PostSizeMove(WND
*wndPtr
);
250 extern void X11DRV_WND_ScrollWindow(WND
*wndPtr
, DC
*dcPtr
, INT32 dx
, INT32 dy
, const RECT32
*clipRect
, BOOL32 bUpdate
);
251 extern void X11DRV_WND_SetDrawable(WND
*wndPtr
, DC
*dc
, WORD flags
, BOOL32 bSetClipOrigin
);
252 extern BOOL32
X11DRV_WND_IsSelfClipping(WND
*wndPtr
);
254 /* X11 clipboard driver */
256 extern CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver
;
258 extern void X11DRV_CLIPBOARD_EmptyClipboard();
259 extern void X11DRV_CLIPBOARD_SetClipboardData(UINT32 wFormat
);
260 extern BOOL32
X11DRV_CLIPBOARD_RequestSelection();
261 extern void X11DRV_CLIPBOARD_ResetOwner(WND
*pWnd
, BOOL32 bFooBar
);
263 void X11DRV_CLIPBOARD_ReadSelection(Window w
, Atom prop
);
264 void X11DRV_CLIPBOARD_ReleaseSelection(Window w
, HWND32 hwnd
);
266 /* X11 keyboard driver */
268 extern KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver
;
270 extern void X11DRV_KEYBOARD_Init(void);
271 extern WORD
X11DRV_KEYBOARD_VkKeyScan(CHAR cChar
);
272 extern UINT16
X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode
, UINT16 wMapType
);
273 extern INT16
X11DRV_KEYBOARD_GetKeyNameText(LONG lParam
, LPSTR lpBuffer
, INT16 nSize
);
274 extern INT16
X11DRV_KEYBOARD_ToAscii(UINT16 virtKey
, UINT16 scanCode
, LPBYTE lpKeyState
, LPVOID lpChar
, UINT16 flags
);
276 /* X11 mouse driver */
278 extern MOUSE_DRIVER X11DRV_MOUSE_Driver
;
280 extern void X11DRV_MOUSE_SetCursor(CURSORICONINFO
*lpCursor
);
281 extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX
, WORD wAbsY
);
283 /* X11 event driver */
285 extern EVENT_DRIVER X11DRV_EVENT_Driver
;
287 extern BOOL32
X11DRV_EVENT_Init(void);
288 extern void X11DRV_EVENT_AddIO(int fd
, unsigned flag
);
289 extern void X11DRV_EVENT_DeleteIO(int fd
, unsigned flag
);
290 extern BOOL32
X11DRV_EVENT_WaitNetEvent(BOOL32 sleep
, BOOL32 peek
);
291 extern void X11DRV_EVENT_Synchronize(void);
292 extern BOOL32
X11DRV_EVENT_CheckFocus( void );
293 extern BOOL32
X11DRV_EVENT_QueryPointer(DWORD
*posX
, DWORD
*posY
, DWORD
*state
);
294 extern void X11DRV_EVENT_DummyMotionNotify(void);
295 extern BOOL32
X11DRV_EVENT_Pending(void);
296 extern BOOL16
X11DRV_EVENT_IsUserIdle(void);
298 #endif /* __WINE_X11DRV_H */