include/mscvpdb.h: Use flexible array members for the rest of structures.
[wine.git] / include / wine / gdi_driver.h
blob774211fea1559ae051ac8b9dd6ea371cfcd9d5db
1 /*
2 * Definitions for Wine GDI drivers
4 * Copyright 2011 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_WINE_GDI_DRIVER_H
22 #define __WINE_WINE_GDI_DRIVER_H
24 #ifndef WINE_UNIX_LIB
25 #error The GDI driver can only be used on the Unix side
26 #endif
28 #include <stdarg.h>
29 #include <stddef.h>
31 #include <pthread.h>
33 #include "windef.h"
34 #include "winbase.h"
35 #include "winternl.h"
36 #include "ntuser.h"
37 #include "immdev.h"
38 #include "shellapi.h"
39 #include "ddk/d3dkmthk.h"
40 #include "kbd.h"
41 #include "wine/list.h"
43 struct gdi_dc_funcs;
44 struct opengl_funcs;
45 struct vulkan_funcs;
47 typedef struct gdi_physdev
49 const struct gdi_dc_funcs *funcs;
50 struct gdi_physdev *next;
51 HDC hdc;
52 } *PHYSDEV;
54 struct bitblt_coords
56 int log_x; /* original position and size, in logical coords */
57 int log_y;
58 int log_width;
59 int log_height;
60 int x; /* mapped position and size, in device coords */
61 int y;
62 int width;
63 int height;
64 RECT visrect; /* rectangle clipped to the visible part, in device coords */
65 DWORD layout; /* DC layout */
68 struct gdi_image_bits
70 void *ptr; /* pointer to the bits */
71 BOOL is_copy; /* whether this is a copy of the bits that can be modified */
72 void (*free)(struct gdi_image_bits *); /* callback for freeing the bits */
73 void *param; /* extra parameter for callback private use */
76 struct brush_pattern
78 BITMAPINFO *info; /* DIB info */
79 struct gdi_image_bits bits; /* DIB bits */
80 UINT usage; /* color usage for DIB info */
83 typedef int (*font_enum_proc)(const LOGFONTW *, const TEXTMETRICW *, DWORD, LPARAM);
85 struct gdi_dc_funcs
87 INT (*pAbortDoc)(PHYSDEV);
88 BOOL (*pAbortPath)(PHYSDEV);
89 BOOL (*pAlphaBlend)(PHYSDEV,struct bitblt_coords*,PHYSDEV,struct bitblt_coords*,BLENDFUNCTION);
90 BOOL (*pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
91 BOOL (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
92 BOOL (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
93 BOOL (*pBeginPath)(PHYSDEV);
94 DWORD (*pBlendImage)(PHYSDEV,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,BLENDFUNCTION);
95 BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
96 BOOL (*pCloseFigure)(PHYSDEV);
97 BOOL (*pCreateCompatibleDC)(PHYSDEV,PHYSDEV*);
98 BOOL (*pCreateDC)(PHYSDEV*,LPCWSTR,LPCWSTR,const DEVMODEW*);
99 BOOL (*pDeleteDC)(PHYSDEV);
100 BOOL (*pDeleteObject)(PHYSDEV,HGDIOBJ);
101 BOOL (*pEllipse)(PHYSDEV,INT,INT,INT,INT);
102 INT (*pEndDoc)(PHYSDEV);
103 INT (*pEndPage)(PHYSDEV);
104 BOOL (*pEndPath)(PHYSDEV);
105 BOOL (*pEnumFonts)(PHYSDEV,LPLOGFONTW,font_enum_proc,LPARAM);
106 INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
107 BOOL (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
108 BOOL (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
109 BOOL (*pFillPath)(PHYSDEV);
110 BOOL (*pFillRgn)(PHYSDEV,HRGN,HBRUSH);
111 BOOL (*pFontIsLinked)(PHYSDEV);
112 BOOL (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
113 UINT (*pGetBoundsRect)(PHYSDEV,RECT*,UINT);
114 BOOL (*pGetCharABCWidths)(PHYSDEV,UINT,UINT,WCHAR*,LPABC);
115 BOOL (*pGetCharABCWidthsI)(PHYSDEV,UINT,UINT,WORD*,LPABC);
116 BOOL (*pGetCharWidth)(PHYSDEV,UINT,UINT,const WCHAR*,LPINT);
117 BOOL (*pGetCharWidthInfo)(PHYSDEV,void*);
118 INT (*pGetDeviceCaps)(PHYSDEV,INT);
119 BOOL (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
120 DWORD (*pGetFontData)(PHYSDEV,DWORD,DWORD,LPVOID,DWORD);
121 BOOL (*pGetFontRealizationInfo)(PHYSDEV,void*);
122 DWORD (*pGetFontUnicodeRanges)(PHYSDEV,LPGLYPHSET);
123 DWORD (*pGetGlyphIndices)(PHYSDEV,LPCWSTR,INT,LPWORD,DWORD);
124 DWORD (*pGetGlyphOutline)(PHYSDEV,UINT,UINT,LPGLYPHMETRICS,DWORD,LPVOID,const MAT2*);
125 BOOL (*pGetICMProfile)(PHYSDEV,BOOL,LPDWORD,LPWSTR);
126 DWORD (*pGetImage)(PHYSDEV,BITMAPINFO*,struct gdi_image_bits*,struct bitblt_coords*);
127 DWORD (*pGetKerningPairs)(PHYSDEV,DWORD,LPKERNINGPAIR);
128 COLORREF (*pGetNearestColor)(PHYSDEV,COLORREF);
129 UINT (*pGetOutlineTextMetrics)(PHYSDEV,UINT,LPOUTLINETEXTMETRICW);
130 COLORREF (*pGetPixel)(PHYSDEV,INT,INT);
131 UINT (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
132 UINT (*pGetTextCharsetInfo)(PHYSDEV,LPFONTSIGNATURE,DWORD);
133 BOOL (*pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,LPINT);
134 BOOL (*pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,LPINT);
135 INT (*pGetTextFace)(PHYSDEV,INT,LPWSTR);
136 BOOL (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
137 BOOL (*pGradientFill)(PHYSDEV,TRIVERTEX*,ULONG,void*,ULONG,ULONG);
138 BOOL (*pInvertRgn)(PHYSDEV,HRGN);
139 BOOL (*pLineTo)(PHYSDEV,INT,INT);
140 BOOL (*pMoveTo)(PHYSDEV,INT,INT);
141 BOOL (*pPaintRgn)(PHYSDEV,HRGN);
142 BOOL (*pPatBlt)(PHYSDEV,struct bitblt_coords*,DWORD);
143 BOOL (*pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
144 BOOL (*pPolyBezier)(PHYSDEV,const POINT*,DWORD);
145 BOOL (*pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
146 BOOL (*pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
147 BOOL (*pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
148 BOOL (*pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
149 BOOL (*pPolylineTo)(PHYSDEV,const POINT*,INT);
150 DWORD (*pPutImage)(PHYSDEV,HRGN,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,DWORD);
151 UINT (*pRealizeDefaultPalette)(PHYSDEV);
152 UINT (*pRealizePalette)(PHYSDEV,HPALETTE,BOOL);
153 BOOL (*pRectangle)(PHYSDEV,INT,INT,INT,INT);
154 BOOL (*pResetDC)(PHYSDEV,const DEVMODEW*);
155 BOOL (*pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
156 HBITMAP (*pSelectBitmap)(PHYSDEV,HBITMAP);
157 HBRUSH (*pSelectBrush)(PHYSDEV,HBRUSH,const struct brush_pattern*);
158 HFONT (*pSelectFont)(PHYSDEV,HFONT,UINT*);
159 HPEN (*pSelectPen)(PHYSDEV,HPEN,const struct brush_pattern*);
160 COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
161 UINT (*pSetBoundsRect)(PHYSDEV,RECT*,UINT);
162 COLORREF (*pSetDCBrushColor)(PHYSDEV, COLORREF);
163 COLORREF (*pSetDCPenColor)(PHYSDEV, COLORREF);
164 INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,BITMAPINFO*,UINT);
165 VOID (*pSetDeviceClipping)(PHYSDEV,HRGN);
166 BOOL (*pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
167 COLORREF (*pSetPixel)(PHYSDEV,INT,INT,COLORREF);
168 COLORREF (*pSetTextColor)(PHYSDEV,COLORREF);
169 INT (*pStartDoc)(PHYSDEV,const DOCINFOW*);
170 INT (*pStartPage)(PHYSDEV);
171 BOOL (*pStretchBlt)(PHYSDEV,struct bitblt_coords*,PHYSDEV,struct bitblt_coords*,DWORD);
172 INT (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void*,BITMAPINFO*,UINT,DWORD);
173 BOOL (*pStrokeAndFillPath)(PHYSDEV);
174 BOOL (*pStrokePath)(PHYSDEV);
175 BOOL (*pUnrealizePalette)(HPALETTE);
177 /* priority order for the driver on the stack */
178 UINT priority;
181 /* increment this when you change the DC function table */
182 #define WINE_GDI_DRIVER_VERSION 87
184 #define GDI_PRIORITY_NULL_DRV 0 /* null driver */
185 #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
186 #define GDI_PRIORITY_GRAPHICS_DRV 200 /* any graphics driver */
187 #define GDI_PRIORITY_DIB_DRV 300 /* the DIB driver */
188 #define GDI_PRIORITY_PATH_DRV 400 /* the path driver */
190 static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
192 while (!((void **)dev->funcs)[offset / sizeof(void *)]) dev = dev->next;
193 return dev;
196 #define GET_NEXT_PHYSDEV(dev,func) \
197 get_physdev_entry_point( (dev)->next, FIELD_OFFSET(struct gdi_dc_funcs,func))
199 static inline void push_dc_driver( PHYSDEV *dev, PHYSDEV physdev, const struct gdi_dc_funcs *funcs )
201 while ((*dev)->funcs->priority > funcs->priority) dev = &(*dev)->next;
202 physdev->funcs = funcs;
203 physdev->next = *dev;
204 physdev->hdc = (*dev)->hdc;
205 *dev = physdev;
208 /* support for window surfaces */
210 struct window_surface;
212 struct window_surface_funcs
214 void (*set_clip)( struct window_surface *surface, const RECT *rects, UINT count );
215 BOOL (*flush)( struct window_surface *surface, const RECT *rect, const RECT *dirty,
216 const BITMAPINFO *color_info, const void *color_bits, BOOL shape_changed,
217 const BITMAPINFO *shape_info, const void *shape_bits );
218 void (*destroy)( struct window_surface *surface );
221 struct window_surface
223 const struct window_surface_funcs *funcs; /* driver-specific implementations */
224 struct list entry; /* entry in global list managed by user32 */
225 LONG ref; /* reference count */
226 HWND hwnd; /* window the surface was created for */
227 RECT rect; /* constant, no locking needed */
229 pthread_mutex_t mutex; /* mutex needed for any field below */
230 RECT bounds; /* dirty area rectangle */
231 HRGN clip_region; /* visible region of the surface, fully visible if 0 */
232 DWORD draw_start_ticks; /* start ticks of fresh draw */
233 COLORREF color_key; /* layered window surface color key, invalid if CLR_INVALID */
234 UINT alpha_bits; /* layered window global alpha bits, invalid if -1 */
235 UINT alpha_mask; /* layered window per-pixel alpha mask, invalid if 0 */
236 HRGN shape_region; /* shape of the window surface, unshaped if 0 */
237 HBITMAP shape_bitmap; /* bitmap for the surface shape (1bpp) */
238 HBITMAP color_bitmap; /* bitmap for the surface colors */
239 /* driver-specific fields here */
242 W32KAPI BOOL window_surface_init( struct window_surface *surface, const struct window_surface_funcs *funcs,
243 HWND hwnd, const RECT *rect, BITMAPINFO *info, HBITMAP bitmap );
244 W32KAPI void window_surface_add_ref( struct window_surface *surface );
245 W32KAPI void window_surface_release( struct window_surface *surface );
246 W32KAPI void window_surface_lock( struct window_surface *surface );
247 W32KAPI void window_surface_unlock( struct window_surface *surface );
248 W32KAPI void window_surface_set_layered( struct window_surface *surface, COLORREF color_key, UINT alpha_bits, UINT alpha_mask );
249 W32KAPI void window_surface_flush( struct window_surface *surface );
250 W32KAPI void window_surface_set_clip( struct window_surface *surface, HRGN clip_region );
251 W32KAPI void window_surface_set_shape( struct window_surface *surface, HRGN shape_region );
252 W32KAPI void window_surface_set_layered( struct window_surface *surface, COLORREF color_key, UINT alpha_bits, UINT alpha_mask );
254 /* display manager interface, used to initialize display device registry data */
256 struct pci_id
258 UINT16 vendor;
259 UINT16 device;
260 UINT16 subsystem;
261 UINT16 revision;
264 struct gdi_monitor
266 RECT rc_monitor; /* RcMonitor in MONITORINFO struct */
267 RECT rc_work; /* RcWork in MONITORINFO struct */
268 unsigned char *edid; /* Extended Device Identification Data */
269 UINT edid_len;
272 struct gdi_device_manager
274 void (*add_gpu)( const char *name, const struct pci_id *pci_id, const GUID *vulkan_uuid, void *param );
275 void (*add_source)( const char *name, UINT state_flags, void *param );
276 void (*add_monitor)( const struct gdi_monitor *monitor, void *param );
277 void (*add_modes)( const DEVMODEW *current, UINT modes_count, const DEVMODEW *modes, void *param );
280 #define WINE_DM_UNSUPPORTED 0x80000000
282 struct vulkan_driver_funcs;
284 struct user_driver_funcs
286 struct gdi_dc_funcs dc_funcs;
288 /* keyboard functions */
289 BOOL (*pActivateKeyboardLayout)(HKL, UINT);
290 void (*pBeep)(void);
291 INT (*pGetKeyNameText)(LONG,LPWSTR,INT);
292 UINT (*pGetKeyboardLayoutList)(INT, HKL *);
293 UINT (*pMapVirtualKeyEx)(UINT,UINT,HKL);
294 BOOL (*pRegisterHotKey)(HWND,UINT,UINT);
295 INT (*pToUnicodeEx)(UINT,UINT,const BYTE *,LPWSTR,int,UINT,HKL);
296 void (*pUnregisterHotKey)(HWND, UINT, UINT);
297 SHORT (*pVkKeyScanEx)(WCHAR, HKL);
298 const KBDTABLES *(*pKbdLayerDescriptor)(HKL);
299 void (*pReleaseKbdTables)(const KBDTABLES *);
300 /* IME functions */
301 UINT (*pImeProcessKey)(HIMC,UINT,UINT,const BYTE*);
302 void (*pNotifyIMEStatus)(HWND,UINT);
303 /* cursor/icon functions */
304 void (*pDestroyCursorIcon)(HCURSOR);
305 void (*pSetCursor)(HWND,HCURSOR);
306 BOOL (*pGetCursorPos)(LPPOINT);
307 BOOL (*pSetCursorPos)(INT,INT);
308 BOOL (*pClipCursor)(const RECT*,BOOL);
309 /* notify icon functions */
310 LRESULT (*pNotifyIcon)(HWND,UINT,NOTIFYICONDATAW *);
311 void (*pCleanupIcons)(HWND);
312 void (*pSystrayDockInit)(HWND);
313 BOOL (*pSystrayDockInsert)(HWND,UINT,UINT,void *);
314 void (*pSystrayDockClear)(HWND);
315 BOOL (*pSystrayDockRemove)(HWND);
316 /* clipboard functions */
317 LRESULT (*pClipboardWindowProc)(HWND,UINT,WPARAM,LPARAM);
318 void (*pUpdateClipboard)(void);
319 /* display modes */
320 LONG (*pChangeDisplaySettings)(LPDEVMODEW,LPCWSTR,HWND,DWORD,LPVOID);
321 BOOL (*pGetCurrentDisplaySettings)(LPCWSTR,BOOL,LPDEVMODEW);
322 INT (*pGetDisplayDepth)(LPCWSTR,BOOL);
323 UINT (*pUpdateDisplayDevices)(const struct gdi_device_manager *,void*);
324 /* windowing functions */
325 BOOL (*pCreateDesktop)(const WCHAR *,UINT,UINT);
326 BOOL (*pCreateWindow)(HWND);
327 LRESULT (*pDesktopWindowProc)(HWND,UINT,WPARAM,LPARAM);
328 void (*pDestroyWindow)(HWND);
329 void (*pFlashWindowEx)(FLASHWINFO*);
330 void (*pGetDC)(HDC,HWND,HWND,const RECT *,const RECT *,DWORD);
331 BOOL (*pProcessEvents)(DWORD);
332 void (*pReleaseDC)(HWND,HDC);
333 BOOL (*pScrollDC)(HDC,INT,INT,HRGN);
334 void (*pSetCapture)(HWND,UINT);
335 void (*pSetDesktopWindow)(HWND);
336 void (*pSetFocus)(HWND);
337 void (*pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
338 void (*pSetParent)(HWND,HWND,HWND);
339 void (*pSetWindowRgn)(HWND,HRGN,BOOL);
340 void (*pSetWindowIcon)(HWND,UINT,HICON);
341 void (*pSetWindowStyle)(HWND,INT,STYLESTRUCT*);
342 void (*pSetWindowText)(HWND,LPCWSTR);
343 UINT (*pShowWindow)(HWND,INT,RECT*,UINT);
344 LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM);
345 BOOL (*pCreateLayeredWindow)(HWND,const RECT *,COLORREF,struct window_surface **);
346 void (*pUpdateLayeredWindow)(HWND,const RECT *,COLORREF,BYTE,UINT);
347 LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
348 BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,const RECT *,const RECT *,RECT *);
349 BOOL (*pCreateWindowSurface)(HWND,const RECT *,struct window_surface**);
350 void (*pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *,
351 const RECT *,struct window_surface*);
352 /* system parameters */
353 BOOL (*pSystemParametersInfo)(UINT,UINT,void*,UINT);
354 /* vulkan support */
355 UINT (*pVulkanInit)(UINT,void *,const struct vulkan_driver_funcs **);
356 /* opengl support */
357 struct opengl_funcs * (*pwine_get_wgl_driver)(UINT);
358 /* thread management */
359 void (*pThreadDetach)(void);
362 W32KAPI void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version );
364 W32KAPI BOOL win32u_set_window_pixel_format( HWND hwnd, int format, BOOL internal );
365 W32KAPI int win32u_get_window_pixel_format( HWND hwnd );
367 #endif /* __WINE_WINE_GDI_DRIVER_H */