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) */
23 struct tagCREATESTRUCTA;
24 struct tagCURSORICONINFO;
41 int type; /* GEOMETRIC || COSMETIC */
44 /* X physical brush */
54 typedef UINT X_PHYSFONT;
56 /* X physical device */
59 GC gc; /* X Window GC */
73 /* GCs used for B&W and color bitmap operations */
74 extern GC BITMAP_monoGC, BITMAP_colorGC;
76 #define BITMAP_GC(bmp) \
77 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
79 extern DeviceCaps X11DRV_DevCaps;
81 /* Wine driver X11 functions */
83 extern BOOL X11DRV_Init(void);
84 extern BOOL X11DRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst,
85 INT width, INT height, struct tagDC *dcSrc,
86 INT xSrc, INT ySrc, DWORD rop );
87 extern BOOL X11DRV_EnumDeviceFonts( struct tagDC *dc, LPLOGFONT16 plf,
88 DEVICEFONTENUMPROC dfeproc, LPARAM lp );
89 extern BOOL X11DRV_GetCharWidth( struct tagDC *dc, UINT firstChar,
90 UINT lastChar, LPINT buffer );
91 extern BOOL X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCSTR str,
92 INT count, LPSIZE size );
93 extern BOOL X11DRV_GetTextMetrics(struct tagDC *dc, TEXTMETRICA *metrics);
94 extern BOOL X11DRV_PatBlt( struct tagDC *dc, INT left, INT top,
95 INT width, INT height, DWORD rop );
96 extern VOID X11DRV_SetDeviceClipping(struct tagDC *dc);
97 extern BOOL X11DRV_StretchBlt( struct tagDC *dcDst, INT xDst, INT yDst,
98 INT widthDst, INT heightDst,
99 struct tagDC *dcSrc, INT xSrc, INT ySrc,
100 INT widthSrc, INT heightSrc, DWORD rop );
101 extern BOOL X11DRV_MoveToEx( struct tagDC *dc, INT x, INT y,LPPOINT pt);
102 extern BOOL X11DRV_LineTo( struct tagDC *dc, INT x, INT y);
103 extern BOOL X11DRV_Arc( struct tagDC *dc, INT left, INT top, INT right,
104 INT bottom, INT xstart, INT ystart, INT xend,
106 extern BOOL X11DRV_Pie( struct tagDC *dc, INT left, INT top, INT right,
107 INT bottom, INT xstart, INT ystart, INT xend,
109 extern BOOL X11DRV_Chord( struct tagDC *dc, INT left, INT top,
110 INT right, INT bottom, INT xstart,
111 INT ystart, INT xend, INT yend );
112 extern BOOL X11DRV_Ellipse( struct tagDC *dc, INT left, INT top,
113 INT right, INT bottom );
114 extern BOOL X11DRV_Rectangle(struct tagDC *dc, INT left, INT top,
115 INT right, INT bottom);
116 extern BOOL X11DRV_RoundRect( struct tagDC *dc, INT left, INT top,
117 INT right, INT bottom, INT ell_width,
119 extern COLORREF X11DRV_SetPixel( struct tagDC *dc, INT x, INT y,
121 extern COLORREF X11DRV_GetPixel( struct tagDC *dc, INT x, INT y);
122 extern BOOL X11DRV_PaintRgn( struct tagDC *dc, HRGN hrgn );
123 extern BOOL X11DRV_Polyline( struct tagDC *dc,const POINT* pt,INT count);
124 extern BOOL X11DRV_PolyBezier( struct tagDC *dc, const POINT start, const POINT* lppt, DWORD cPoints);
125 extern BOOL X11DRV_Polygon( struct tagDC *dc, const POINT* pt, INT count );
126 extern BOOL X11DRV_PolyPolygon( struct tagDC *dc, const POINT* pt,
127 const INT* counts, UINT polygons);
128 extern BOOL X11DRV_PolyPolyline( struct tagDC *dc, const POINT* pt,
129 const DWORD* counts, DWORD polylines);
131 extern HGDIOBJ X11DRV_SelectObject( struct tagDC *dc, HGDIOBJ handle );
133 extern COLORREF X11DRV_SetBkColor( struct tagDC *dc, COLORREF color );
134 extern COLORREF X11DRV_SetTextColor( struct tagDC *dc, COLORREF color );
135 extern BOOL X11DRV_ExtFloodFill( struct tagDC *dc, INT x, INT y,
136 COLORREF color, UINT fillType );
137 extern BOOL X11DRV_ExtTextOut( struct tagDC *dc, INT x, INT y,
138 UINT flags, const RECT *lprect,
139 LPCSTR str, UINT count, const INT *lpDx );
140 extern BOOL X11DRV_CreateBitmap( HBITMAP hbitmap );
141 extern BOOL X11DRV_DeleteObject( HGDIOBJ handle );
142 extern LONG X11DRV_BitmapBits( HBITMAP hbitmap, void *bits, LONG count,
144 extern INT X11DRV_SetDIBitsToDevice( struct tagDC *dc, INT xDest,
145 INT yDest, DWORD cx, DWORD cy,
147 UINT startscan, UINT lines,
148 LPCVOID bits, const BITMAPINFO *info,
150 extern INT X11DRV_DeviceBitmapBits( struct tagDC *dc, HBITMAP hbitmap,
151 WORD fGet, UINT startscan,
152 UINT lines, LPSTR bits,
153 LPBITMAPINFO info, UINT coloruse );
154 extern HANDLE X11DRV_LoadOEMResource( WORD id, WORD type );
156 /* X11 driver internal functions */
158 extern BOOL X11DRV_BITMAP_Init(void);
159 extern BOOL X11DRV_BRUSH_Init(void);
160 extern BOOL X11DRV_DIB_Init(void);
161 extern BOOL X11DRV_FONT_Init( struct tagDeviceCaps* );
162 extern BOOL X11DRV_OBM_Init(void);
165 extern XImage *X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ *bmp );
166 extern int X11DRV_DIB_GetXImageWidthBytes( int width, int depth );
167 extern BOOL X11DRV_DIB_Init(void);
168 extern X11DRV_PHYSBITMAP *X11DRV_AllocBitmap( struct tagBITMAPOBJ *bmp );
170 extern BOOL X11DRV_SetupGCForPatBlt( struct tagDC *dc, GC gc,
172 extern BOOL X11DRV_SetupGCForBrush( struct tagDC *dc );
173 extern BOOL X11DRV_SetupGCForPen( struct tagDC *dc );
174 extern BOOL X11DRV_SetupGCForText( struct tagDC *dc );
176 extern const int X11DRV_XROPfunction[];
178 /* Xlib critical section */
180 extern CRITICAL_SECTION X11DRV_CritSection;
182 extern void _XInitImageFuncPtrs(XImage *);
184 #define XCREATEIMAGE(image,width,height,bpp) \
186 int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
187 (image) = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()), \
188 (bpp), ZPixmap, 0, xcalloc( (height)*width_bytes ),\
189 (width), (height), 32, width_bytes ); \
192 /* exported dib functions for now */
194 /* Additional info for DIB section objects */
197 /* Windows DIB section */
198 DIBSECTION dibSection;
201 enum { X11DRV_DIB_NoHandler, X11DRV_DIB_InSync, X11DRV_DIB_AppMod, X11DRV_DIB_GdiMod } status;
210 /* Selector for 16-bit access to bits */
214 /* This structure holds the arguments for DIB_SetImageBits() */
235 } X11DRV_DIB_SETIMAGEBITS_DESCR;
237 extern int X11DRV_DIB_GetImageBits( const X11DRV_DIB_SETIMAGEBITS_DESCR *descr );
238 extern int X11DRV_DIB_SetImageBits( const X11DRV_DIB_SETIMAGEBITS_DESCR *descr );
239 extern int *X11DRV_DIB_BuildColorMap( struct tagDC *dc, WORD coloruse,
240 WORD depth, const BITMAPINFO *info,
242 extern void X11DRV_DIB_UpdateDIBSection(struct tagDC *dc, BOOL toDIB);
244 extern HBITMAP X11DRV_DIB_CreateDIBSection(struct tagDC *dc, BITMAPINFO *bmi, UINT usage,
245 LPVOID *bits, HANDLE section, DWORD offset);
246 extern HBITMAP16 X11DRV_DIB_CreateDIBSection16(struct tagDC *dc, BITMAPINFO *bmi, UINT16 usage,
247 SEGPTR *bits, HANDLE section, DWORD offset);
249 extern struct tagBITMAP_DRIVER X11DRV_BITMAP_Driver;
251 extern INT X11DRV_DIB_SetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan,
252 UINT lines, LPCVOID bits, const BITMAPINFO *info,
253 UINT coloruse, HBITMAP hbitmap);
254 extern INT X11DRV_DIB_GetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan,
255 UINT lines, LPVOID bits, BITMAPINFO *info,
256 UINT coloruse, HBITMAP hbitmap);
257 extern void X11DRV_DIB_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
259 /**************************************************************************
263 extern struct tagGDI_DRIVER X11DRV_GDI_Driver;
265 BOOL X11DRV_GDI_Initialize(void);
266 void X11DRV_GDI_Finalize(void);
268 /* X11 GDI palette driver */
270 #define X11DRV_PALETTE_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
271 #define X11DRV_PALETTE_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
273 #define X11DRV_PALETTE_PRIVATE 0x1000 /* private colormap, identity mapping */
274 #define X11DRV_PALETTE_WHITESET 0x2000
276 extern Colormap X11DRV_PALETTE_PaletteXColormap;
277 extern UINT16 X11DRV_PALETTE_PaletteFlags;
279 extern int *X11DRV_PALETTE_PaletteToXPixel;
280 extern int *X11DRV_PALETTE_XPixelToPalette;
282 extern int X11DRV_PALETTE_mapEGAPixel[16];
284 extern BOOL X11DRV_PALETTE_Init(void);
285 extern void X11DRV_PALETTE_Cleanup(void);
287 extern COLORREF X11DRV_PALETTE_ToLogical(int pixel);
288 extern int X11DRV_PALETTE_ToPhysical(struct tagDC *dc, COLORREF color);
289 extern int X11DRV_PALETTE_LookupSystemXPixel(COLORREF col);
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_AddIO(int fd, unsigned flag);
347 extern void X11DRV_EVENT_DeleteIO(int fd, unsigned flag);
348 extern BOOL X11DRV_EVENT_WaitNetEvent(BOOL sleep, BOOL peek);
349 extern void X11DRV_EVENT_Synchronize(void);
350 extern BOOL X11DRV_EVENT_CheckFocus( void );
351 extern BOOL X11DRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state);
352 extern void X11DRV_EVENT_DummyMotionNotify(void);
353 extern BOOL X11DRV_EVENT_Pending(void);
354 extern BOOL16 X11DRV_EVENT_IsUserIdle(void);
355 extern void X11DRV_EVENT_WakeUp(void);
357 /* X11 keyboard driver */
359 extern struct tagKEYBOARD_DRIVER X11DRV_KEYBOARD_Driver;
361 extern void X11DRV_KEYBOARD_Init(void);
362 extern WORD X11DRV_KEYBOARD_VkKeyScan(CHAR cChar);
363 extern UINT16 X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
364 extern INT16 X11DRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
365 extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
366 extern BOOL X11DRV_KEYBOARD_GetBeepActive(void);
367 extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate);
368 extern void X11DRV_KEYBOARD_Beep(void);
370 extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
372 /* X11 monitor driver */
374 extern struct tagMONITOR_DRIVER X11DRV_MONITOR_Driver;
376 typedef struct _X11DRV_MONITOR_DATA {
382 } X11DRV_MONITOR_DATA;
386 extern Screen *X11DRV_MONITOR_GetXScreen(struct tagMONITOR *pMonitor);
387 extern Window X11DRV_MONITOR_GetXRootWindow(struct tagMONITOR *pMonitor);
389 extern void X11DRV_MONITOR_Initialize(struct tagMONITOR *pMonitor);
390 extern void X11DRV_MONITOR_Finalize(struct tagMONITOR *pMonitor);
391 extern BOOL X11DRV_MONITOR_IsSingleWindow(struct tagMONITOR *pMonitor);
392 extern int X11DRV_MONITOR_GetWidth(struct tagMONITOR *pMonitor);
393 extern int X11DRV_MONITOR_GetHeight(struct tagMONITOR *pMonitor);
394 extern int X11DRV_MONITOR_GetDepth(struct tagMONITOR *pMonitor);
395 extern BOOL X11DRV_MONITOR_GetScreenSaveActive(struct tagMONITOR *pMonitor);
396 extern void X11DRV_MONITOR_SetScreenSaveActive(struct tagMONITOR *pMonitor, BOOL bActivate);
397 extern int X11DRV_MONITOR_GetScreenSaveTimeout(struct tagMONITOR *pMonitor);
398 extern void X11DRV_MONITOR_SetScreenSaveTimeout(struct tagMONITOR *pMonitor, int nTimeout);
400 /* X11 mouse driver */
402 extern struct tagMOUSE_DRIVER X11DRV_MOUSE_Driver;
404 extern BOOL X11DRV_MOUSE_DisableWarpPointer;
406 extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor);
407 extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
408 extern BOOL X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable);
410 /* X11 windows driver */
412 extern struct tagWND_DRIVER X11DRV_WND_Driver;
414 typedef struct _X11DRV_WND_DATA {
416 HBITMAP hWMIconBitmap;
420 extern Window X11DRV_WND_GetXWindow(struct tagWND *wndPtr);
421 extern Window X11DRV_WND_FindXWindow(struct tagWND *wndPtr);
422 extern Screen *X11DRV_WND_GetXScreen(struct tagWND *wndPtr);
423 extern Window X11DRV_WND_GetXRootWindow(struct tagWND *wndPtr);
425 extern void X11DRV_WND_Initialize(struct tagWND *wndPtr);
426 extern void X11DRV_WND_Finalize(struct tagWND *wndPtr);
427 extern BOOL X11DRV_WND_CreateDesktopWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, BOOL bUnicode);
428 extern BOOL X11DRV_WND_CreateWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, struct tagCREATESTRUCTA *cs, BOOL bUnicode);
429 extern BOOL X11DRV_WND_DestroyWindow(struct tagWND *pWnd);
430 extern struct tagWND *X11DRV_WND_SetParent(struct tagWND *wndPtr, struct tagWND *pWndParent);
431 extern void X11DRV_WND_ForceWindowRaise(struct tagWND *pWnd);
432 extern void X11DRV_WND_SetWindowPos(struct tagWND *wndPtr, const struct tagWINDOWPOS *winpos, BOOL bSMC_SETXPOS);
433 extern void X11DRV_WND_SetText(struct tagWND *wndPtr, LPCSTR text);
434 extern void X11DRV_WND_SetFocus(struct tagWND *wndPtr);
435 extern void X11DRV_WND_PreSizeMove(struct tagWND *wndPtr);
436 extern void X11DRV_WND_PostSizeMove(struct tagWND *wndPtr);
437 extern void X11DRV_WND_SurfaceCopy(struct tagWND *wndPtr, struct tagDC *dcPtr, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
438 extern void X11DRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD flags, BOOL bSetClipOrigin);
439 extern BOOL X11DRV_WND_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value);
440 extern BOOL X11DRV_WND_IsSelfClipping(struct tagWND *wndPtr);
442 #endif /* __WINE_X11DRV_H */