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) */
23 #define MAX_PIXELFORMATS 8
27 struct tagCREATESTRUCTA
;
28 struct tagCURSORICONINFO
;
34 struct tagKEYBOARD_CONFIG
;
35 struct DIDEVICEOBJECTDATA
;
47 int type
; /* GEOMETRIC || COSMETIC */
50 /* X physical brush */
60 typedef UINT X_PHYSFONT
;
62 /* X physical device */
65 GC gc
; /* X Window GC */
72 XVisualInfo
*visuals
[MAX_PIXELFORMATS
];
78 /* GCs used for B&W and color bitmap operations */
79 extern GC BITMAP_monoGC
, BITMAP_colorGC
;
81 #define BITMAP_GC(bmp) \
82 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
84 extern DeviceCaps X11DRV_DevCaps
;
86 extern unsigned int X11DRV_server_startticks
;
88 /* Wine driver X11 functions */
90 extern const DC_FUNCTIONS X11DRV_DC_Funcs
;
92 extern BOOL
X11DRV_BitBlt( struct tagDC
*dcDst
, INT xDst
, INT yDst
,
93 INT width
, INT height
, struct tagDC
*dcSrc
,
94 INT xSrc
, INT ySrc
, DWORD rop
);
95 extern BOOL
X11DRV_EnumDeviceFonts( HDC hdc
, LPLOGFONT16 plf
,
96 DEVICEFONTENUMPROC dfeproc
, LPARAM lp
);
97 extern BOOL
X11DRV_GetCharWidth( struct tagDC
*dc
, UINT firstChar
,
98 UINT lastChar
, LPINT buffer
);
99 extern BOOL
X11DRV_GetDCOrgEx( struct tagDC
*dc
, LPPOINT lpp
);
100 extern BOOL
X11DRV_GetTextExtentPoint( struct tagDC
*dc
, LPCWSTR str
,
101 INT count
, LPSIZE size
);
102 extern BOOL
X11DRV_GetTextMetrics(struct tagDC
*dc
, TEXTMETRICA
*metrics
);
103 extern BOOL
X11DRV_PatBlt( struct tagDC
*dc
, INT left
, INT top
,
104 INT width
, INT height
, DWORD rop
);
105 extern VOID
X11DRV_SetDeviceClipping(struct tagDC
*dc
);
106 extern BOOL
X11DRV_StretchBlt( struct tagDC
*dcDst
, INT xDst
, INT yDst
,
107 INT widthDst
, INT heightDst
,
108 struct tagDC
*dcSrc
, INT xSrc
, INT ySrc
,
109 INT widthSrc
, INT heightSrc
, DWORD rop
);
110 extern BOOL
X11DRV_LineTo( struct tagDC
*dc
, INT x
, INT y
);
111 extern BOOL
X11DRV_Arc( struct tagDC
*dc
, INT left
, INT top
, INT right
,
112 INT bottom
, INT xstart
, INT ystart
, INT xend
,
114 extern BOOL
X11DRV_Pie( struct tagDC
*dc
, INT left
, INT top
, INT right
,
115 INT bottom
, INT xstart
, INT ystart
, INT xend
,
117 extern BOOL
X11DRV_Chord( struct tagDC
*dc
, INT left
, INT top
,
118 INT right
, INT bottom
, INT xstart
,
119 INT ystart
, INT xend
, INT yend
);
120 extern BOOL
X11DRV_Ellipse( struct tagDC
*dc
, INT left
, INT top
,
121 INT right
, INT bottom
);
122 extern BOOL
X11DRV_Rectangle(struct tagDC
*dc
, INT left
, INT top
,
123 INT right
, INT bottom
);
124 extern BOOL
X11DRV_RoundRect( struct tagDC
*dc
, INT left
, INT top
,
125 INT right
, INT bottom
, INT ell_width
,
127 extern COLORREF
X11DRV_SetPixel( struct tagDC
*dc
, INT x
, INT y
,
129 extern COLORREF
X11DRV_GetPixel( struct tagDC
*dc
, INT x
, INT y
);
130 extern BOOL
X11DRV_PaintRgn( struct tagDC
*dc
, HRGN hrgn
);
131 extern BOOL
X11DRV_Polyline( struct tagDC
*dc
,const POINT
* pt
,INT count
);
132 extern BOOL
X11DRV_Polygon( struct tagDC
*dc
, const POINT
* pt
, INT count
);
133 extern BOOL
X11DRV_PolyPolygon( struct tagDC
*dc
, const POINT
* pt
,
134 const INT
* counts
, UINT polygons
);
135 extern BOOL
X11DRV_PolyPolyline( struct tagDC
*dc
, const POINT
* pt
,
136 const DWORD
* counts
, DWORD polylines
);
138 extern HGDIOBJ
X11DRV_SelectObject( struct tagDC
*dc
, HGDIOBJ handle
);
140 extern COLORREF
X11DRV_SetBkColor( struct tagDC
*dc
, COLORREF color
);
141 extern COLORREF
X11DRV_SetTextColor( struct tagDC
*dc
, COLORREF color
);
142 extern BOOL
X11DRV_ExtFloodFill( struct tagDC
*dc
, INT x
, INT y
,
143 COLORREF color
, UINT fillType
);
144 extern BOOL
X11DRV_ExtTextOut( struct tagDC
*dc
, INT x
, INT y
,
145 UINT flags
, const RECT
*lprect
,
146 LPCWSTR str
, UINT count
, const INT
*lpDx
);
147 extern BOOL
X11DRV_CreateBitmap( HBITMAP hbitmap
);
148 extern BOOL
X11DRV_DeleteObject( HGDIOBJ handle
);
149 extern LONG
X11DRV_BitmapBits( HBITMAP hbitmap
, void *bits
, LONG count
,
151 extern INT
X11DRV_SetDIBitsToDevice( struct tagDC
*dc
, INT xDest
,
152 INT yDest
, DWORD cx
, DWORD cy
,
154 UINT startscan
, UINT lines
,
155 LPCVOID bits
, const BITMAPINFO
*info
,
157 extern INT
X11DRV_DeviceBitmapBits( struct tagDC
*dc
, HBITMAP hbitmap
,
158 WORD fGet
, UINT startscan
,
159 UINT lines
, LPSTR bits
,
160 LPBITMAPINFO info
, UINT coloruse
);
162 /* OpenGL / X11 driver functions */
163 extern int X11DRV_ChoosePixelFormat(DC
*dc
, const PIXELFORMATDESCRIPTOR
*pppfd
) ;
164 extern int X11DRV_DescribePixelFormat(DC
*dc
, int iPixelFormat
, UINT nBytes
, PIXELFORMATDESCRIPTOR
*ppfd
) ;
165 extern int X11DRV_GetPixelFormat(DC
*dc
) ;
166 extern BOOL
X11DRV_SetPixelFormat(DC
*dc
, int iPixelFormat
, const PIXELFORMATDESCRIPTOR
*ppfd
) ;
167 extern BOOL
X11DRV_SwapBuffers(DC
*dc
) ;
169 /* X11 driver internal functions */
171 extern BOOL
X11DRV_BITMAP_Init(void);
172 extern BOOL
X11DRV_BRUSH_Init(void);
173 extern BOOL
X11DRV_DIB_Init(void);
174 extern BOOL
X11DRV_FONT_Init( struct tagDeviceCaps
* );
175 extern BOOL
X11DRV_OBM_Init(void);
178 extern XImage
*X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ
*bmp
);
179 extern int X11DRV_DIB_GetXImageWidthBytes( int width
, int depth
);
180 extern HBITMAP
X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap
);
181 extern HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap
, HDC hdc
, BOOL bDeletePixmap
);
182 extern HBITMAP
X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap
, BOOL bDeletePixmap
);
183 extern Pixmap
X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB
, HDC hdc
);
184 extern Pixmap
X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp
, HDC hdc
);
186 extern BOOL
X11DRV_SetupGCForPatBlt( struct tagDC
*dc
, GC gc
,
188 extern BOOL
X11DRV_SetupGCForBrush( struct tagDC
*dc
);
189 extern BOOL
X11DRV_SetupGCForPen( struct tagDC
*dc
);
190 extern BOOL
X11DRV_SetupGCForText( struct tagDC
*dc
);
192 extern const int X11DRV_XROPfunction
[];
194 extern void _XInitImageFuncPtrs(XImage
*);
196 #define XCREATEIMAGE(image,width,height,bpp) \
198 int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
199 (image) = TSXCreateImage(display, X11DRV_GetVisual(), \
200 (bpp), ZPixmap, 0, calloc( (height), width_bytes ),\
201 (width), (height), 32, width_bytes ); \
204 /* exported dib functions for now */
206 /* Additional info for DIB section objects */
209 /* Windows DIB section */
210 DIBSECTION dibSection
;
213 int status
, p_status
;
222 /* Selector for 16-bit access to bits */
226 /* Shared memory segment info */
227 XShmSegmentInfo shminfo
;
230 /* Aux buffer access function */
231 void (*copy_aux
)(void*ctx
, int req
);
234 /* GDI access lock */
235 CRITICAL_SECTION lock
;
239 extern int *X11DRV_DIB_BuildColorMap( struct tagDC
*dc
, WORD coloruse
,
240 WORD depth
, const BITMAPINFO
*info
,
242 extern INT
X11DRV_CoerceDIBSection(struct tagDC
*dc
,INT
,BOOL
);
243 extern INT
X11DRV_LockDIBSection(struct tagDC
*dc
,INT
,BOOL
);
244 extern void X11DRV_UnlockDIBSection(struct tagDC
*dc
,BOOL
);
245 extern INT
X11DRV_LockDIBSection2(HBITMAP bmp
,INT
,BOOL
);
246 extern void X11DRV_UnlockDIBSection2(HBITMAP bmp
,BOOL
);
248 extern HBITMAP
X11DRV_DIB_CreateDIBSection(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT usage
,
249 LPVOID
*bits
, HANDLE section
, DWORD offset
, DWORD ovr_pitch
);
250 extern HBITMAP16
X11DRV_DIB_CreateDIBSection16(struct tagDC
*dc
, BITMAPINFO
*bmi
, UINT16 usage
,
251 SEGPTR
*bits
, HANDLE section
, DWORD offset
, DWORD ovr_pitch
);
253 extern struct tagBITMAP_DRIVER X11DRV_BITMAP_Driver
;
255 extern INT
X11DRV_DIB_SetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
256 UINT lines
, LPCVOID bits
, const BITMAPINFO
*info
,
257 UINT coloruse
, HBITMAP hbitmap
);
258 extern INT
X11DRV_DIB_GetDIBits(struct tagBITMAPOBJ
*bmp
, struct tagDC
*dc
, UINT startscan
,
259 UINT lines
, LPVOID bits
, BITMAPINFO
*info
,
260 UINT coloruse
, HBITMAP hbitmap
);
261 extern void X11DRV_DIB_DeleteDIBSection(struct tagBITMAPOBJ
*bmp
);
262 extern UINT
X11DRV_DIB_SetDIBColorTable(struct tagBITMAPOBJ
*,struct tagDC
*,UINT
,UINT
,const RGBQUAD
*);
263 extern UINT
X11DRV_DIB_GetDIBColorTable(struct tagBITMAPOBJ
*,struct tagDC
*,UINT
,UINT
,RGBQUAD
*);
264 extern INT
X11DRV_DIB_Coerce(struct tagBITMAPOBJ
*,INT
,BOOL
);
265 extern INT
X11DRV_DIB_Lock(struct tagBITMAPOBJ
*,INT
,BOOL
);
266 extern void X11DRV_DIB_Unlock(struct tagBITMAPOBJ
*,BOOL
);
267 void X11DRV_DIB_CopyDIBSection(DC
*dcSrc
, DC
*dcDst
,
268 DWORD xSrc
, DWORD ySrc
,
269 DWORD xDest
, DWORD yDest
,
270 DWORD width
, DWORD height
);
272 /**************************************************************************
276 BOOL
X11DRV_GDI_Initialize(void);
277 void X11DRV_GDI_Finalize(void);
279 /* X11 GDI palette driver */
281 #define X11DRV_PALETTE_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual) */
282 #define X11DRV_PALETTE_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
284 #define X11DRV_PALETTE_PRIVATE 0x1000 /* private colormap, identity mapping */
285 #define X11DRV_PALETTE_WHITESET 0x2000
287 extern Colormap X11DRV_PALETTE_PaletteXColormap
;
288 extern UINT16 X11DRV_PALETTE_PaletteFlags
;
290 extern int *X11DRV_PALETTE_PaletteToXPixel
;
291 extern int *X11DRV_PALETTE_XPixelToPalette
;
293 extern int X11DRV_PALETTE_mapEGAPixel
[16];
295 extern BOOL
X11DRV_PALETTE_Init(void);
296 extern void X11DRV_PALETTE_Cleanup(void);
298 extern COLORREF
X11DRV_PALETTE_ToLogical(int pixel
);
299 extern int X11DRV_PALETTE_ToPhysical(struct tagDC
*dc
, COLORREF color
);
301 extern struct tagPALETTE_DRIVER X11DRV_PALETTE_Driver
;
303 extern int X11DRV_PALETTE_SetMapping(struct tagPALETTEOBJ
*palPtr
, UINT uStart
, UINT uNum
, BOOL mapOnly
);
304 extern int X11DRV_PALETTE_UpdateMapping(struct tagPALETTEOBJ
*palPtr
);
305 extern BOOL
X11DRV_PALETTE_IsDark(int pixel
);
307 /**************************************************************************
311 extern Display
*display
;
312 extern Screen
*screen
;
313 extern Visual
*visual
;
314 extern Window root_window
;
315 extern unsigned int screen_width
;
316 extern unsigned int screen_height
;
317 extern unsigned 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 unsigned int X11DRV_GetDepth(void) { return screen_depth
; }
324 /* X11 clipboard driver */
326 extern void X11DRV_CLIPBOARD_FreeResources( Atom property
);
327 extern BOOL
X11DRV_CLIPBOARD_RegisterPixmapResource( Atom property
, Pixmap pixmap
);
328 extern BOOL
X11DRV_CLIPBOARD_IsNativeProperty(Atom prop
);
329 extern UINT
X11DRV_CLIPBOARD_MapPropertyToFormat(char *itemFmtName
);
330 extern Atom
X11DRV_CLIPBOARD_MapFormatToProperty(UINT id
);
331 extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType
, Window w
, HWND hwnd
);
332 extern BOOL
X11DRV_IsSelectionOwner(void);
333 extern BOOL
X11DRV_GetClipboardData(UINT wFormat
);
335 /* X11 event driver */
337 extern WORD
X11DRV_EVENT_XStateToKeyState( int state
) ;
339 extern void X11DRV_EVENT_Init(void);
340 extern void X11DRV_Synchronize( void );
343 X11DRV_INPUT_RELATIVE
,
344 X11DRV_INPUT_ABSOLUTE
346 extern INPUT_TYPE
X11DRV_EVENT_SetInputMethod(INPUT_TYPE type
);
348 #ifdef HAVE_LIBXXF86DGA2
349 void X11DRV_EVENT_SetDGAStatus(HWND hwnd
, int event_base
) ;
353 /* X11 keyboard driver */
355 extern void X11DRV_InitKeyboard(void);
356 extern WORD
X11DRV_VkKeyScan(CHAR cChar
);
357 extern UINT16
X11DRV_MapVirtualKey(UINT16 wCode
, UINT16 wMapType
);
358 extern INT16
X11DRV_GetKeyNameText(LONG lParam
, LPSTR lpBuffer
, INT16 nSize
);
359 extern BOOL
X11DRV_GetDIState(DWORD len
, LPVOID ptr
);
360 extern BOOL
X11DRV_GetDIData(BYTE
*keystate
, DWORD dodsize
, struct DIDEVICEOBJECTDATA
*dod
, LPDWORD entries
, DWORD flags
);
361 extern void X11DRV_GetKeyboardConfig(struct tagKEYBOARD_CONFIG
*cfg
);
362 extern void X11DRV_SetKeyboardConfig(struct tagKEYBOARD_CONFIG
*cfg
, DWORD mask
);
364 extern void X11DRV_HandleEvent(struct tagWND
*pWnd
, XKeyEvent
*event
);
366 /* X11 mouse driver */
368 extern void X11DRV_InitMouse(LPMOUSE_EVENT_PROC
);
369 extern void X11DRV_SetCursor(struct tagCURSORICONINFO
*lpCursor
);
370 extern void X11DRV_MoveCursor(WORD wAbsX
, WORD wAbsY
);
371 extern void X11DRV_SendEvent( DWORD mouseStatus
, DWORD posX
, DWORD posY
,
372 DWORD keyState
, DWORD time
, HWND hWnd
);
374 /* X11 windows driver */
376 extern struct tagWND_DRIVER X11DRV_WND_Driver
;
378 typedef struct _X11DRV_WND_DATA
{
380 HBITMAP hWMIconBitmap
;
385 extern Window
X11DRV_WND_GetXWindow(struct tagWND
*wndPtr
);
386 extern Window
X11DRV_WND_FindXWindow(struct tagWND
*wndPtr
);
388 extern void X11DRV_WND_Initialize(struct tagWND
*wndPtr
);
389 extern void X11DRV_WND_Finalize(struct tagWND
*wndPtr
);
390 extern BOOL
X11DRV_WND_CreateDesktopWindow(struct tagWND
*wndPtr
);
391 extern BOOL
X11DRV_WND_CreateWindow(struct tagWND
*wndPtr
, struct tagCREATESTRUCTA
*cs
, BOOL bUnicode
);
392 extern BOOL
X11DRV_WND_DestroyWindow(struct tagWND
*pWnd
);
393 extern struct tagWND
*X11DRV_WND_SetParent(struct tagWND
*wndPtr
, struct tagWND
*pWndParent
);
394 extern void X11DRV_WND_ForceWindowRaise(struct tagWND
*pWnd
);
395 extern void X11DRV_WND_SetWindowPos(struct tagWND
*wndPtr
, const struct tagWINDOWPOS
*winpos
, BOOL bSMC_SETXPOS
);
396 extern void X11DRV_WND_SetText(struct tagWND
*wndPtr
, LPCWSTR text
);
397 extern void X11DRV_WND_SetFocus(struct tagWND
*wndPtr
);
398 extern void X11DRV_WND_PreSizeMove(struct tagWND
*wndPtr
);
399 extern void X11DRV_WND_PostSizeMove(struct tagWND
*wndPtr
);
400 extern void X11DRV_WND_SurfaceCopy(struct tagWND
*wndPtr
, HDC hdc
, INT dx
, INT dy
, const RECT
*clipRect
, BOOL bUpdate
);
401 extern void X11DRV_WND_SetDrawable(struct tagWND
*wndPtr
, HDC hdc
, WORD flags
, BOOL bSetClipOrigin
);
402 extern BOOL
X11DRV_WND_SetHostAttr(struct tagWND
*wndPtr
, INT haKey
, INT value
);
403 extern BOOL
X11DRV_WND_IsSelfClipping(struct tagWND
*wndPtr
);
404 extern void X11DRV_WND_DockWindow(struct tagWND
*wndPtr
);
405 extern void X11DRV_WND_SetWindowRgn(struct tagWND
*wndPtr
, HRGN hrgnWnd
);
407 extern int X11DRV_EVENT_PrepareShmCompletion( Drawable dw
);
408 extern void X11DRV_EVENT_WaitShmCompletion( int compl );
409 extern void X11DRV_EVENT_WaitShmCompletions( Drawable dw
);
410 extern void X11DRV_EVENT_WaitReplaceShmCompletion( int *compl, Drawable dw
);
412 #endif /* __WINE_X11DRV_H */