Better implementation of GetShortPathNameA/W.
[wine/multimedia.git] / include / x11drv.h
blob9b70a81078a427f285832e2eeb516652e8294b4c
1 /*
2 * X11 display driver definitions
3 */
5 #ifndef __WINE_X11DRV_H
6 #define __WINE_X11DRV_H
8 #include "config.h"
10 #ifndef X_DISPLAY_MISSING
11 #include <X11/Xlib.h>
12 #include <X11/Xresource.h>
13 #include <X11/Xutil.h>
14 #include <X11/Xatom.h>
15 #endif /* !defined(X_DISPLAY_MISSING) */
17 #include "gdi.h"
18 #include "wintypes.h"
19 #include "wine/winuser16.h"
21 struct tagCLASS;
22 struct tagDC;
23 struct tagDeviceCaps;
24 struct tagWND;
26 /* X physical pen */
27 typedef struct
29 int style;
30 int endcap;
31 int linejoin;
32 int pixel;
33 int width;
34 char * dashes;
35 int dash_len;
36 int type; /* GEOMETRIC || COSMETIC */
37 } X_PHYSPEN;
39 /* X physical brush */
40 typedef struct
42 int style;
43 int fillStyle;
44 int pixel;
45 Pixmap pixmap;
46 } X_PHYSBRUSH;
48 /* X physical font */
49 typedef UINT X_PHYSFONT;
51 /* X physical device */
52 typedef struct
54 GC gc; /* X Window GC */
55 Drawable drawable;
56 X_PHYSFONT font;
57 X_PHYSPEN pen;
58 X_PHYSBRUSH brush;
59 int backgroundPixel;
60 int textPixel;
61 } X11DRV_PDEVICE;
64 typedef struct {
65 Pixmap pixmap;
66 } X11DRV_PHYSBITMAP;
68 /* GCs used for B&W and color bitmap operations */
69 extern GC BITMAP_monoGC, BITMAP_colorGC;
71 #define BITMAP_GC(bmp) \
72 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
75 /* Wine driver X11 functions */
77 extern BOOL X11DRV_Init(void);
78 extern BOOL X11DRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst,
79 INT width, INT height, struct tagDC *dcSrc,
80 INT xSrc, INT ySrc, DWORD rop );
81 extern BOOL X11DRV_EnumDeviceFonts( struct tagDC *dc, LPLOGFONT16 plf,
82 DEVICEFONTENUMPROC dfeproc, LPARAM lp );
83 extern BOOL X11DRV_GetCharWidth( struct tagDC *dc, UINT firstChar,
84 UINT lastChar, LPINT buffer );
85 extern BOOL X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCSTR str,
86 INT count, LPSIZE size );
87 extern BOOL X11DRV_GetTextMetrics(struct tagDC *dc, TEXTMETRICA *metrics);
88 extern BOOL X11DRV_PatBlt( struct tagDC *dc, INT left, INT top,
89 INT width, INT height, DWORD rop );
90 extern VOID X11DRV_SetDeviceClipping(struct tagDC *dc);
91 extern BOOL X11DRV_StretchBlt( struct tagDC *dcDst, INT xDst, INT yDst,
92 INT widthDst, INT heightDst,
93 struct tagDC *dcSrc, INT xSrc, INT ySrc,
94 INT widthSrc, INT heightSrc, DWORD rop );
95 extern BOOL X11DRV_MoveToEx( struct tagDC *dc, INT x, INT y,LPPOINT pt);
96 extern BOOL X11DRV_LineTo( struct tagDC *dc, INT x, INT y);
97 extern BOOL X11DRV_Arc( struct tagDC *dc, INT left, INT top, INT right,
98 INT bottom, INT xstart, INT ystart, INT xend,
99 INT yend );
100 extern BOOL X11DRV_Pie( struct tagDC *dc, INT left, INT top, INT right,
101 INT bottom, INT xstart, INT ystart, INT xend,
102 INT yend );
103 extern BOOL X11DRV_Chord( struct tagDC *dc, INT left, INT top,
104 INT right, INT bottom, INT xstart,
105 INT ystart, INT xend, INT yend );
106 extern BOOL X11DRV_Ellipse( struct tagDC *dc, INT left, INT top,
107 INT right, INT bottom );
108 extern BOOL X11DRV_Rectangle(struct tagDC *dc, INT left, INT top,
109 INT right, INT bottom);
110 extern BOOL X11DRV_RoundRect( struct tagDC *dc, INT left, INT top,
111 INT right, INT bottom, INT ell_width,
112 INT ell_height );
113 extern COLORREF X11DRV_SetPixel( struct tagDC *dc, INT x, INT y,
114 COLORREF color );
115 extern COLORREF X11DRV_GetPixel( struct tagDC *dc, INT x, INT y);
116 extern BOOL X11DRV_PaintRgn( struct tagDC *dc, HRGN hrgn );
117 extern BOOL X11DRV_Polyline( struct tagDC *dc,const POINT* pt,INT count);
118 extern BOOL X11DRV_PolyBezier( struct tagDC *dc, const POINT start, const POINT* lppt, DWORD cPoints);
119 extern BOOL X11DRV_Polygon( struct tagDC *dc, const POINT* pt, INT count );
120 extern BOOL X11DRV_PolyPolygon( struct tagDC *dc, const POINT* pt,
121 const INT* counts, UINT polygons);
122 extern BOOL X11DRV_PolyPolyline( struct tagDC *dc, const POINT* pt,
123 const DWORD* counts, DWORD polylines);
125 extern HGDIOBJ X11DRV_SelectObject( struct tagDC *dc, HGDIOBJ handle );
127 extern COLORREF X11DRV_SetBkColor( struct tagDC *dc, COLORREF color );
128 extern COLORREF X11DRV_SetTextColor( struct tagDC *dc, COLORREF color );
129 extern BOOL X11DRV_ExtFloodFill( struct tagDC *dc, INT x, INT y,
130 COLORREF color, UINT fillType );
131 extern BOOL X11DRV_ExtTextOut( struct tagDC *dc, INT x, INT y,
132 UINT flags, const RECT *lprect,
133 LPCSTR str, UINT count, const INT *lpDx );
134 extern BOOL X11DRV_CreateBitmap( HBITMAP hbitmap );
135 extern BOOL X11DRV_DeleteObject( HGDIOBJ handle );
136 extern LONG X11DRV_BitmapBits( HBITMAP hbitmap, void *bits, LONG count,
137 WORD flags );
138 extern INT X11DRV_SetDIBitsToDevice( struct tagDC *dc, INT xDest,
139 INT yDest, DWORD cx, DWORD cy,
140 INT xSrc, INT ySrc,
141 UINT startscan, UINT lines,
142 LPCVOID bits, const BITMAPINFO *info,
143 UINT coloruse );
144 extern INT X11DRV_DeviceBitmapBits( struct tagDC *dc, HBITMAP hbitmap,
145 WORD fGet, UINT startscan,
146 UINT lines, LPSTR bits,
147 LPBITMAPINFO info, UINT coloruse );
148 extern HANDLE X11DRV_LoadOEMResource( WORD id, WORD type );
150 /* X11 driver internal functions */
152 extern BOOL X11DRV_BITMAP_Init(void);
153 extern BOOL X11DRV_BRUSH_Init(void);
154 extern BOOL X11DRV_DIB_Init(void);
155 extern BOOL X11DRV_FONT_Init( struct tagDeviceCaps* );
156 extern BOOL X11DRV_OBM_Init(void);
158 struct tagBITMAPOBJ;
159 extern XImage *X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ *bmp );
160 extern int X11DRV_DIB_GetXImageWidthBytes( int width, int depth );
161 extern BOOL X11DRV_DIB_Init(void);
162 extern X11DRV_PHYSBITMAP *X11DRV_AllocBitmap( struct tagBITMAPOBJ *bmp );
164 extern BOOL X11DRV_SetupGCForPatBlt( struct tagDC *dc, GC gc,
165 BOOL fMapColors );
166 extern BOOL X11DRV_SetupGCForBrush( struct tagDC *dc );
167 extern BOOL X11DRV_SetupGCForPen( struct tagDC *dc );
168 extern BOOL X11DRV_SetupGCForText( struct tagDC *dc );
170 extern const int X11DRV_XROPfunction[];
172 /* Xlib critical section */
174 extern CRITICAL_SECTION X11DRV_CritSection;
176 extern void _XInitImageFuncPtrs(XImage *);
178 #define XCREATEIMAGE(image,width,height,bpp) \
180 int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
181 (image) = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()), \
182 (bpp), ZPixmap, 0, xcalloc( (height)*width_bytes ),\
183 (width), (height), 32, width_bytes ); \
186 /* exported dib functions for now */
188 /* This structure holds the arguments for DIB_SetImageBits() */
189 typedef struct
191 struct tagDC *dc;
192 LPCVOID bits;
193 XImage *image;
194 int lines;
195 DWORD infoWidth;
196 WORD depth;
197 WORD infoBpp;
198 WORD compression;
199 int *colorMap;
200 int nColorMap;
201 Drawable drawable;
202 GC gc;
203 int xSrc;
204 int ySrc;
205 int xDest;
206 int yDest;
207 int width;
208 int height;
209 } DIB_SETIMAGEBITS_DESCR;
211 extern int X11DRV_DIB_GetImageBits( const DIB_SETIMAGEBITS_DESCR *descr );
212 extern int X11DRV_DIB_SetImageBits( const DIB_SETIMAGEBITS_DESCR *descr );
213 extern int *X11DRV_DIB_BuildColorMap( struct tagDC *dc, WORD coloruse,
214 WORD depth, const BITMAPINFO *info,
215 int *nColors );
217 /* X11 clipboard driver */
219 extern struct _CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver;
221 extern void X11DRV_CLIPBOARD_EmptyClipboard(void);
222 extern void X11DRV_CLIPBOARD_SetClipboardData(UINT wFormat);
223 extern BOOL X11DRV_CLIPBOARD_RequestSelection(void);
224 extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL bFooBar);
226 void X11DRV_CLIPBOARD_ReadSelection(Window w, Atom prop);
227 void X11DRV_CLIPBOARD_ReleaseSelection(Window w, HWND hwnd);
229 /* X11 color driver */
231 extern Colormap X11DRV_COLOR_GetColormap(void);
233 /* X11 desktop driver */
235 extern struct _DESKTOP_DRIVER X11DRV_DESKTOP_Driver;
237 typedef struct _X11DRV_DESKTOP_DATA {
238 } X11DRV_DESKTOP_DATA;
240 struct tagDESKTOP;
242 extern Screen *X11DRV_DESKTOP_GetXScreen(struct tagDESKTOP *pDesktop);
243 extern Window X11DRV_DESKTOP_GetXRootWindow(struct tagDESKTOP *pDesktop);
245 extern void X11DRV_DESKTOP_Initialize(struct tagDESKTOP *pDesktop);
246 extern void X11DRV_DESKTOP_Finalize(struct tagDESKTOP *pDesktop);
247 extern int X11DRV_DESKTOP_GetScreenWidth(struct tagDESKTOP *pDesktop);
248 extern int X11DRV_DESKTOP_GetScreenHeight(struct tagDESKTOP *pDesktop);
249 extern int X11DRV_DESKTOP_GetScreenDepth(struct tagDESKTOP *pDesktop);
251 /* X11 event driver */
253 extern struct _EVENT_DRIVER X11DRV_EVENT_Driver;
255 extern BOOL X11DRV_EVENT_Init(void);
256 extern void X11DRV_EVENT_AddIO(int fd, unsigned flag);
257 extern void X11DRV_EVENT_DeleteIO(int fd, unsigned flag);
258 extern BOOL X11DRV_EVENT_WaitNetEvent(BOOL sleep, BOOL peek);
259 extern void X11DRV_EVENT_Synchronize(void);
260 extern BOOL X11DRV_EVENT_CheckFocus( void );
261 extern BOOL X11DRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state);
262 extern void X11DRV_EVENT_DummyMotionNotify(void);
263 extern BOOL X11DRV_EVENT_Pending(void);
264 extern BOOL16 X11DRV_EVENT_IsUserIdle(void);
265 extern void X11DRV_EVENT_WakeUp(void);
267 /* X11 keyboard driver */
269 extern struct _KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver;
271 extern void X11DRV_KEYBOARD_Init(void);
272 extern WORD X11DRV_KEYBOARD_VkKeyScan(CHAR cChar);
273 extern UINT16 X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
274 extern INT16 X11DRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
275 extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
276 extern void KEYBOARD_HandleEvent( struct tagWND *pWnd, XKeyEvent *event );
277 extern void KEYBOARD_UpdateState ( void );
279 /* X11 main driver */
281 extern Display *display;
282 extern Screen *X11DRV_GetXScreen(void);
283 extern Window X11DRV_GetXRootWindow(void);
285 extern void X11DRV_MAIN_Finalize(void);
286 extern void X11DRV_MAIN_Initialize(void);
287 extern void X11DRV_MAIN_ParseOptions(int *argc, char *argv[]);
288 extern void X11DRV_MAIN_Create(void);
289 extern void X11DRV_MAIN_SaveSetup(void);
290 extern void X11DRV_MAIN_RestoreSetup(void);
292 /* X11 monitor driver */
294 extern struct tagMONITOR_DRIVER X11DRV_MONITOR_Driver;
296 typedef struct _X11DRV_MONITOR_DATA {
297 Screen *screen;
298 Window rootWindow;
299 int width;
300 int height;
301 int depth;
302 } X11DRV_MONITOR_DATA;
304 struct tagMONITOR;
306 extern Screen *X11DRV_MONITOR_GetXScreen(struct tagMONITOR *pMonitor);
307 extern Window X11DRV_MONITOR_GetXRootWindow(struct tagMONITOR *pMonitor);
309 extern void X11DRV_MONITOR_Initialize(struct tagMONITOR *pMonitor);
310 extern void X11DRV_MONITOR_Finalize(struct tagMONITOR *pMonitor);
311 extern int X11DRV_MONITOR_GetWidth(struct tagMONITOR *pMonitor);
312 extern int X11DRV_MONITOR_GetHeight(struct tagMONITOR *pMonitor);
313 extern int X11DRV_MONITOR_GetDepth(struct tagMONITOR *pMonitor);
315 /* X11 mouse driver */
317 extern struct _MOUSE_DRIVER X11DRV_MOUSE_Driver;
319 extern void X11DRV_MOUSE_SetCursor(CURSORICONINFO *lpCursor);
320 extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
322 /* X11 windows driver */
324 extern struct _WND_DRIVER X11DRV_WND_Driver;
326 typedef struct _X11DRV_WND_DATA {
327 Window window;
328 } X11DRV_WND_DATA;
330 extern Window X11DRV_WND_GetXWindow(struct tagWND *wndPtr);
331 extern Window X11DRV_WND_FindXWindow(struct tagWND *wndPtr);
332 extern Screen *X11DRV_WND_GetXScreen(struct tagWND *wndPtr);
333 extern Window X11DRV_WND_GetXRootWindow(struct tagWND *wndPtr);
335 extern void X11DRV_WND_Initialize(struct tagWND *wndPtr);
336 extern void X11DRV_WND_Finalize(struct tagWND *wndPtr);
337 extern BOOL X11DRV_WND_CreateDesktopWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, BOOL bUnicode);
338 extern BOOL X11DRV_WND_CreateWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, CREATESTRUCTA *cs, BOOL bUnicode);
339 extern BOOL X11DRV_WND_DestroyWindow(struct tagWND *pWnd);
340 extern struct tagWND *X11DRV_WND_SetParent(struct tagWND *wndPtr, struct tagWND *pWndParent);
341 extern void X11DRV_WND_ForceWindowRaise(struct tagWND *pWnd);
342 extern void X11DRV_WND_SetWindowPos(struct tagWND *wndPtr, const WINDOWPOS *winpos, BOOL bSMC_SETXPOS);
343 extern void X11DRV_WND_SetText(struct tagWND *wndPtr, LPCSTR text);
344 extern void X11DRV_WND_SetFocus(struct tagWND *wndPtr);
345 extern void X11DRV_WND_PreSizeMove(struct tagWND *wndPtr);
346 extern void X11DRV_WND_PostSizeMove(struct tagWND *wndPtr);
347 extern void X11DRV_WND_ScrollWindow(struct tagWND *wndPtr, struct tagDC *dcPtr, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
348 extern void X11DRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD flags, BOOL bSetClipOrigin);
349 extern BOOL X11DRV_WND_IsSelfClipping(struct tagWND *wndPtr);
351 #endif /* __WINE_X11DRV_H */