Use Callout table instead of direct GetProcAddress.
[wine/multimedia.git] / include / x11drv.h
blob61f43b2826049c3a652df80d5f746637190b7bc3
1 /*
2 * X11 display driver definitions
3 */
5 #ifndef __WINE_X11DRV_H
6 #define __WINE_X11DRV_H
8 #include "config.h"
9 #include "ts_xlib.h"
10 #include "ts_xutil.h"
12 #include "winbase.h"
13 #include "windows.h"
14 #include "gdi.h"
15 #include "xmalloc.h" /* for XCREATEIMAGE macro */
16 #include "clipboard.h"
17 #include "keyboard.h"
18 #include "message.h"
19 #include "win.h"
21 /* X physical pen */
22 typedef struct
24 int style;
25 int endcap;
26 int linejoin;
27 int pixel;
28 int width;
29 char * dashes;
30 int dash_len;
31 int type; /* GEOMETRIC || COSMETIC */
32 } X_PHYSPEN;
34 /* X physical brush */
35 typedef struct
37 int style;
38 int fillStyle;
39 int pixel;
40 Pixmap pixmap;
41 } X_PHYSBRUSH;
43 /* X physical font */
44 typedef UINT32 X_PHYSFONT;
46 /* X physical device */
47 typedef struct
49 GC gc; /* X Window GC */
50 Drawable drawable;
51 X_PHYSFONT font;
52 X_PHYSPEN pen;
53 X_PHYSBRUSH brush;
54 int backgroundPixel;
55 int textPixel;
56 } X11DRV_PDEVICE;
59 typedef struct {
60 Pixmap pixmap;
61 } X11DRV_PHYSBITMAP;
63 /* GCs used for B&W and color bitmap operations */
64 extern GC BITMAP_monoGC, BITMAP_colorGC;
66 #define BITMAP_GC(bmp) \
67 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
70 /* Wine driver X11 functions */
72 struct tagDC;
73 struct tagDeviceCaps;
75 extern BOOL32 X11DRV_Init(void);
76 extern BOOL32 X11DRV_BitBlt( struct tagDC *dcDst, INT32 xDst, INT32 yDst,
77 INT32 width, INT32 height, struct tagDC *dcSrc,
78 INT32 xSrc, INT32 ySrc, DWORD rop );
79 extern BOOL32 X11DRV_EnumDeviceFonts( struct tagDC *dc, LPLOGFONT16 plf,
80 DEVICEFONTENUMPROC dfeproc, LPARAM lp );
81 extern BOOL32 X11DRV_GetCharWidth( struct tagDC *dc, UINT32 firstChar,
82 UINT32 lastChar, LPINT32 buffer );
83 extern BOOL32 X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCSTR str,
84 INT32 count, LPSIZE32 size );
85 extern BOOL32 X11DRV_GetTextMetrics(struct tagDC *dc, TEXTMETRIC32A *metrics);
86 extern BOOL32 X11DRV_PatBlt( struct tagDC *dc, INT32 left, INT32 top,
87 INT32 width, INT32 height, DWORD rop );
88 extern VOID X11DRV_SetDeviceClipping(struct tagDC *dc);
89 extern BOOL32 X11DRV_StretchBlt( struct tagDC *dcDst, INT32 xDst, INT32 yDst,
90 INT32 widthDst, INT32 heightDst,
91 struct tagDC *dcSrc, INT32 xSrc, INT32 ySrc,
92 INT32 widthSrc, INT32 heightSrc, DWORD rop );
93 extern BOOL32 X11DRV_MoveToEx( struct tagDC *dc, INT32 x, INT32 y,LPPOINT32 pt);
94 extern BOOL32 X11DRV_LineTo( struct tagDC *dc, INT32 x, INT32 y);
95 extern BOOL32 X11DRV_Arc( struct tagDC *dc, INT32 left, INT32 top, INT32 right,
96 INT32 bottom, INT32 xstart, INT32 ystart, INT32 xend,
97 INT32 yend );
98 extern BOOL32 X11DRV_Pie( struct tagDC *dc, INT32 left, INT32 top, INT32 right,
99 INT32 bottom, INT32 xstart, INT32 ystart, INT32 xend,
100 INT32 yend );
101 extern BOOL32 X11DRV_Chord( struct tagDC *dc, INT32 left, INT32 top,
102 INT32 right, INT32 bottom, INT32 xstart,
103 INT32 ystart, INT32 xend, INT32 yend );
104 extern BOOL32 X11DRV_Ellipse( struct tagDC *dc, INT32 left, INT32 top,
105 INT32 right, INT32 bottom );
106 extern BOOL32 X11DRV_Rectangle(struct tagDC *dc, INT32 left, INT32 top,
107 INT32 right, INT32 bottom);
108 extern BOOL32 X11DRV_RoundRect( struct tagDC *dc, INT32 left, INT32 top,
109 INT32 right, INT32 bottom, INT32 ell_width,
110 INT32 ell_height );
111 extern COLORREF X11DRV_SetPixel( struct tagDC *dc, INT32 x, INT32 y,
112 COLORREF color );
113 extern COLORREF X11DRV_GetPixel( struct tagDC *dc, INT32 x, INT32 y);
114 extern BOOL32 X11DRV_PaintRgn( struct tagDC *dc, HRGN32 hrgn );
115 extern BOOL32 X11DRV_Polyline( struct tagDC *dc,const POINT32* pt,INT32 count);
116 extern BOOL32 X11DRV_PolyBezier( struct tagDC *dc, const POINT32 start, const POINT32* lppt, DWORD cPoints);
117 extern BOOL32 X11DRV_Polygon( struct tagDC *dc, const POINT32* pt, INT32 count );
118 extern BOOL32 X11DRV_PolyPolygon( struct tagDC *dc, const POINT32* pt,
119 const INT32* counts, UINT32 polygons);
120 extern BOOL32 X11DRV_PolyPolyline( struct tagDC *dc, const POINT32* pt,
121 const DWORD* counts, DWORD polylines);
123 extern HGDIOBJ32 X11DRV_SelectObject( struct tagDC *dc, HGDIOBJ32 handle );
125 extern COLORREF X11DRV_SetBkColor( struct tagDC *dc, COLORREF color );
126 extern COLORREF X11DRV_SetTextColor( struct tagDC *dc, COLORREF color );
127 extern BOOL32 X11DRV_ExtFloodFill( struct tagDC *dc, INT32 x, INT32 y,
128 COLORREF color, UINT32 fillType );
129 extern BOOL32 X11DRV_ExtTextOut( struct tagDC *dc, INT32 x, INT32 y,
130 UINT32 flags, const RECT32 *lprect,
131 LPCSTR str, UINT32 count, const INT32 *lpDx );
132 extern BOOL32 X11DRV_CreateBitmap( HBITMAP32 hbitmap );
133 extern BOOL32 X11DRV_DeleteObject( HGDIOBJ32 handle );
134 extern LONG X11DRV_BitmapBits( HBITMAP32 hbitmap, void *bits, LONG count,
135 WORD flags );
136 extern INT32 X11DRV_SetDIBitsToDevice( struct tagDC *dc, INT32 xDest,
137 INT32 yDest, DWORD cx, DWORD cy,
138 INT32 xSrc, INT32 ySrc,
139 UINT32 startscan, UINT32 lines,
140 LPCVOID bits, const BITMAPINFO *info,
141 UINT32 coloruse );
142 extern INT32 X11DRV_DeviceBitmapBits( struct tagDC *dc, HBITMAP32 hbitmap,
143 WORD fGet, UINT32 startscan,
144 UINT32 lines, LPSTR bits,
145 LPBITMAPINFO info, UINT32 coloruse );
146 extern HANDLE32 X11DRV_LoadOEMResource( WORD id, WORD type );
148 /* X11 driver internal functions */
150 extern BOOL32 X11DRV_BITMAP_Init(void);
151 extern BOOL32 X11DRV_BRUSH_Init(void);
152 extern BOOL32 X11DRV_DIB_Init(void);
153 extern BOOL32 X11DRV_FONT_Init( struct tagDeviceCaps* );
154 extern BOOL32 X11DRV_OBM_Init(void);
156 struct tagBITMAPOBJ;
157 extern XImage *X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ *bmp );
158 extern int X11DRV_DIB_GetXImageWidthBytes( int width, int depth );
159 extern BOOL32 X11DRV_DIB_Init(void);
160 extern X11DRV_PHYSBITMAP *X11DRV_AllocBitmap( struct tagBITMAPOBJ *bmp );
162 extern BOOL32 X11DRV_SetupGCForPatBlt( struct tagDC *dc, GC gc,
163 BOOL32 fMapColors );
164 extern BOOL32 X11DRV_SetupGCForBrush( struct tagDC *dc );
165 extern BOOL32 X11DRV_SetupGCForPen( struct tagDC *dc );
166 extern BOOL32 X11DRV_SetupGCForText( struct tagDC *dc );
168 extern const int X11DRV_XROPfunction[];
170 extern Display * display;
171 extern Screen * screen;
172 extern Window rootWindow;
173 extern int screenWidth, screenHeight, screenDepth;
176 /* Xlib critical section */
178 extern CRITICAL_SECTION X11DRV_CritSection;
180 extern void _XInitImageFuncPtrs(XImage *);
182 #define XCREATEIMAGE(image,width,height,bpp) \
184 int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
185 (image) = TSXCreateImage(display, DefaultVisualOfScreen(screen), \
186 (bpp), ZPixmap, 0, xcalloc( (height)*width_bytes ),\
187 (width), (height), 32, width_bytes ); \
190 /* exported dib functions for now */
192 /* This structure holds the arguments for DIB_SetImageBits() */
193 typedef struct
195 struct tagDC *dc;
196 LPCVOID bits;
197 XImage *image;
198 int lines;
199 DWORD infoWidth;
200 WORD depth;
201 WORD infoBpp;
202 WORD compression;
203 int *colorMap;
204 int nColorMap;
205 Drawable drawable;
206 GC gc;
207 int xSrc;
208 int ySrc;
209 int xDest;
210 int yDest;
211 int width;
212 int height;
213 } DIB_SETIMAGEBITS_DESCR;
215 extern int X11DRV_DIB_GetImageBits( const DIB_SETIMAGEBITS_DESCR *descr );
216 extern int X11DRV_DIB_SetImageBits( const DIB_SETIMAGEBITS_DESCR *descr );
217 extern int *X11DRV_DIB_BuildColorMap( struct tagDC *dc, WORD coloruse,
218 WORD depth, const BITMAPINFO *info,
219 int *nColors );
221 /* X11 windows driver */
222 extern WND_DRIVER X11DRV_WND_Driver;
224 extern Window X11DRV_WND_GetXWindow(HWND32 hwnd);
226 extern BOOL32 X11DRV_WND_CreateDesktopWindow(WND *wndPtr, CLASS *classPtr, BOOL32 bUnicode);
227 extern BOOL32 X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCT32A *cs, BOOL32 bUnicode);
228 extern BOOL32 X11DRV_WND_DestroyWindow(WND *pWnd);
229 extern WND *X11DRV_WND_SetParent(WND *wndPtr, WND *pWndParent);
230 extern void X11DRV_WND_ForceWindowRaise(WND *pWnd);
231 extern void X11DRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS32 *winpos, BOOL32 bSMC_SETXPOS);
232 extern void X11DRV_WND_SetText(WND *wndPtr, LPCSTR text);
233 extern void X11DRV_WND_SetFocus(WND *wndPtr);
234 extern void X11DRV_WND_PreSizeMove(WND *wndPtr);
235 extern void X11DRV_WND_PostSizeMove(WND *wndPtr);
237 /* X11 clipboard driver */
239 extern CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver;
241 extern void X11DRV_CLIPBOARD_EmptyClipboard();
242 extern void X11DRV_CLIPBOARD_SetClipboardData(UINT32 wFormat);
243 extern BOOL32 X11DRV_CLIPBOARD_RequestSelection();
244 extern void X11DRV_CLIPBOARD_ResetOwner(WND *pWnd);
246 void X11DRV_CLIPBOARD_ReadSelection(Window w, Atom prop);
247 void X11DRV_CLIPBOARD_ReleaseSelection(Window w, HWND32 hwnd);
249 /* X11 keyboard driver */
251 extern KEYBOARD_DRIVER X11DRV_KEYBOARD_Driver;
253 extern void X11DRV_KEYBOARD_Init(void);
254 extern WORD X11DRV_KEYBOARD_VkKeyScan(CHAR cChar);
255 extern UINT16 X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
256 extern INT16 X11DRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
257 extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
259 /* X11 mouse driver */
261 #if 0
262 extern MOUSE_DRIVER X11DRV_MOUSE_Driver;
263 #endif
265 /* X11 event driver */
267 extern EVENT_DRIVER X11DRV_EVENT_Driver;
269 extern BOOL32 X11DRV_EVENT_Init(void);
270 extern void X11DRV_EVENT_AddIO(int fd, unsigned flag);
271 extern void X11DRV_EVENT_DeleteIO(int fd, unsigned flag);
272 extern BOOL32 X11DRV_EVENT_WaitNetEvent(BOOL32 sleep, BOOL32 peek);
273 extern void X11DRV_EVENT_Synchronize(void);
274 extern BOOL32 X11DRV_EVENT_CheckFocus( void );
275 extern BOOL32 X11DRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state);
276 extern void X11DRV_EVENT_DummyMotionNotify(void);
277 extern BOOL32 X11DRV_EVENT_Pending(void);
278 extern BOOL16 X11DRV_EVENT_IsUserIdle(void);
280 #endif /* __WINE_X11DRV_H */