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
26 #include "ddk/d3dkmthk.h"
27 #include "wine/list.h"
33 typedef struct gdi_physdev
35 const struct gdi_dc_funcs
*funcs
;
36 struct gdi_physdev
*next
;
42 int log_x
; /* original position and size, in logical coords */
46 int x
; /* mapped position and size, in device coords */
50 RECT visrect
; /* rectangle clipped to the visible part, in device coords */
51 DWORD layout
; /* DC layout */
56 void *ptr
; /* pointer to the bits */
57 BOOL is_copy
; /* whether this is a copy of the bits that can be modified */
58 void (CDECL
*free
)(struct gdi_image_bits
*); /* callback for freeing the bits */
59 void *param
; /* extra parameter for callback private use */
64 BITMAPINFO
*info
; /* DIB info */
65 struct gdi_image_bits bits
; /* DIB bits */
66 UINT usage
; /* color usage for DIB info */
71 INT (CDECL
*pAbortDoc
)(PHYSDEV
);
72 BOOL (CDECL
*pAbortPath
)(PHYSDEV
);
73 BOOL (CDECL
*pAlphaBlend
)(PHYSDEV
,struct bitblt_coords
*,PHYSDEV
,struct bitblt_coords
*,BLENDFUNCTION
);
74 BOOL (CDECL
*pAngleArc
)(PHYSDEV
,INT
,INT
,DWORD
,FLOAT
,FLOAT
);
75 BOOL (CDECL
*pArc
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
76 BOOL (CDECL
*pArcTo
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
77 BOOL (CDECL
*pBeginPath
)(PHYSDEV
);
78 DWORD (CDECL
*pBlendImage
)(PHYSDEV
,BITMAPINFO
*,const struct gdi_image_bits
*,struct bitblt_coords
*,struct bitblt_coords
*,BLENDFUNCTION
);
79 BOOL (CDECL
*pChord
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
80 BOOL (CDECL
*pCloseFigure
)(PHYSDEV
);
81 BOOL (CDECL
*pCreateCompatibleDC
)(PHYSDEV
,PHYSDEV
*);
82 BOOL (CDECL
*pCreateDC
)(PHYSDEV
*,LPCWSTR
,LPCWSTR
,const DEVMODEW
*);
83 BOOL (CDECL
*pDeleteDC
)(PHYSDEV
);
84 BOOL (CDECL
*pDeleteObject
)(PHYSDEV
,HGDIOBJ
);
85 BOOL (CDECL
*pEllipse
)(PHYSDEV
,INT
,INT
,INT
,INT
);
86 INT (CDECL
*pEndDoc
)(PHYSDEV
);
87 INT (CDECL
*pEndPage
)(PHYSDEV
);
88 BOOL (CDECL
*pEndPath
)(PHYSDEV
);
89 BOOL (CDECL
*pEnumFonts
)(PHYSDEV
,LPLOGFONTW
,FONTENUMPROCW
,LPARAM
);
90 INT (CDECL
*pExtEscape
)(PHYSDEV
,INT
,INT
,LPCVOID
,INT
,LPVOID
);
91 BOOL (CDECL
*pExtFloodFill
)(PHYSDEV
,INT
,INT
,COLORREF
,UINT
);
92 BOOL (CDECL
*pExtTextOut
)(PHYSDEV
,INT
,INT
,UINT
,const RECT
*,LPCWSTR
,UINT
,const INT
*);
93 BOOL (CDECL
*pFillPath
)(PHYSDEV
);
94 BOOL (CDECL
*pFillRgn
)(PHYSDEV
,HRGN
,HBRUSH
);
95 BOOL (CDECL
*pFontIsLinked
)(PHYSDEV
);
96 BOOL (CDECL
*pFrameRgn
)(PHYSDEV
,HRGN
,HBRUSH
,INT
,INT
);
97 UINT (CDECL
*pGetBoundsRect
)(PHYSDEV
,RECT
*,UINT
);
98 BOOL (CDECL
*pGetCharABCWidths
)(PHYSDEV
,UINT
,UINT
,WCHAR
*,LPABC
);
99 BOOL (CDECL
*pGetCharABCWidthsI
)(PHYSDEV
,UINT
,UINT
,WORD
*,LPABC
);
100 BOOL (CDECL
*pGetCharWidth
)(PHYSDEV
,UINT
,UINT
,const WCHAR
*,LPINT
);
101 BOOL (CDECL
*pGetCharWidthInfo
)(PHYSDEV
,void*);
102 INT (CDECL
*pGetDeviceCaps
)(PHYSDEV
,INT
);
103 BOOL (CDECL
*pGetDeviceGammaRamp
)(PHYSDEV
,LPVOID
);
104 DWORD (CDECL
*pGetFontData
)(PHYSDEV
,DWORD
,DWORD
,LPVOID
,DWORD
);
105 BOOL (CDECL
*pGetFontRealizationInfo
)(PHYSDEV
,void*);
106 DWORD (CDECL
*pGetFontUnicodeRanges
)(PHYSDEV
,LPGLYPHSET
);
107 DWORD (CDECL
*pGetGlyphIndices
)(PHYSDEV
,LPCWSTR
,INT
,LPWORD
,DWORD
);
108 DWORD (CDECL
*pGetGlyphOutline
)(PHYSDEV
,UINT
,UINT
,LPGLYPHMETRICS
,DWORD
,LPVOID
,const MAT2
*);
109 BOOL (CDECL
*pGetICMProfile
)(PHYSDEV
,BOOL
,LPDWORD
,LPWSTR
);
110 DWORD (CDECL
*pGetImage
)(PHYSDEV
,BITMAPINFO
*,struct gdi_image_bits
*,struct bitblt_coords
*);
111 DWORD (CDECL
*pGetKerningPairs
)(PHYSDEV
,DWORD
,LPKERNINGPAIR
);
112 COLORREF (CDECL
*pGetNearestColor
)(PHYSDEV
,COLORREF
);
113 UINT (CDECL
*pGetOutlineTextMetrics
)(PHYSDEV
,UINT
,LPOUTLINETEXTMETRICW
);
114 COLORREF (CDECL
*pGetPixel
)(PHYSDEV
,INT
,INT
);
115 UINT (CDECL
*pGetSystemPaletteEntries
)(PHYSDEV
,UINT
,UINT
,LPPALETTEENTRY
);
116 UINT (CDECL
*pGetTextCharsetInfo
)(PHYSDEV
,LPFONTSIGNATURE
,DWORD
);
117 BOOL (CDECL
*pGetTextExtentExPoint
)(PHYSDEV
,LPCWSTR
,INT
,LPINT
);
118 BOOL (CDECL
*pGetTextExtentExPointI
)(PHYSDEV
,const WORD
*,INT
,LPINT
);
119 INT (CDECL
*pGetTextFace
)(PHYSDEV
,INT
,LPWSTR
);
120 BOOL (CDECL
*pGetTextMetrics
)(PHYSDEV
,TEXTMETRICW
*);
121 BOOL (CDECL
*pGradientFill
)(PHYSDEV
,TRIVERTEX
*,ULONG
,void*,ULONG
,ULONG
);
122 BOOL (CDECL
*pInvertRgn
)(PHYSDEV
,HRGN
);
123 BOOL (CDECL
*pLineTo
)(PHYSDEV
,INT
,INT
);
124 BOOL (CDECL
*pMoveTo
)(PHYSDEV
,INT
,INT
);
125 BOOL (CDECL
*pPaintRgn
)(PHYSDEV
,HRGN
);
126 BOOL (CDECL
*pPatBlt
)(PHYSDEV
,struct bitblt_coords
*,DWORD
);
127 BOOL (CDECL
*pPie
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
128 BOOL (CDECL
*pPolyBezier
)(PHYSDEV
,const POINT
*,DWORD
);
129 BOOL (CDECL
*pPolyBezierTo
)(PHYSDEV
,const POINT
*,DWORD
);
130 BOOL (CDECL
*pPolyDraw
)(PHYSDEV
,const POINT
*,const BYTE
*,DWORD
);
131 BOOL (CDECL
*pPolyPolygon
)(PHYSDEV
,const POINT
*,const INT
*,UINT
);
132 BOOL (CDECL
*pPolyPolyline
)(PHYSDEV
,const POINT
*,const DWORD
*,DWORD
);
133 BOOL (CDECL
*pPolylineTo
)(PHYSDEV
,const POINT
*,INT
);
134 DWORD (CDECL
*pPutImage
)(PHYSDEV
,HRGN
,BITMAPINFO
*,const struct gdi_image_bits
*,struct bitblt_coords
*,struct bitblt_coords
*,DWORD
);
135 UINT (CDECL
*pRealizeDefaultPalette
)(PHYSDEV
);
136 UINT (CDECL
*pRealizePalette
)(PHYSDEV
,HPALETTE
,BOOL
);
137 BOOL (CDECL
*pRectangle
)(PHYSDEV
,INT
,INT
,INT
,INT
);
138 BOOL (CDECL
*pResetDC
)(PHYSDEV
,const DEVMODEW
*);
139 BOOL (CDECL
*pRoundRect
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
);
140 HBITMAP (CDECL
*pSelectBitmap
)(PHYSDEV
,HBITMAP
);
141 HBRUSH (CDECL
*pSelectBrush
)(PHYSDEV
,HBRUSH
,const struct brush_pattern
*);
142 HFONT (CDECL
*pSelectFont
)(PHYSDEV
,HFONT
,UINT
*);
143 HPEN (CDECL
*pSelectPen
)(PHYSDEV
,HPEN
,const struct brush_pattern
*);
144 COLORREF (CDECL
*pSetBkColor
)(PHYSDEV
,COLORREF
);
145 UINT (CDECL
*pSetBoundsRect
)(PHYSDEV
,RECT
*,UINT
);
146 COLORREF (CDECL
*pSetDCBrushColor
)(PHYSDEV
, COLORREF
);
147 COLORREF (CDECL
*pSetDCPenColor
)(PHYSDEV
, COLORREF
);
148 INT (CDECL
*pSetDIBitsToDevice
)(PHYSDEV
,INT
,INT
,DWORD
,DWORD
,INT
,INT
,UINT
,UINT
,LPCVOID
,BITMAPINFO
*,UINT
);
149 VOID (CDECL
*pSetDeviceClipping
)(PHYSDEV
,HRGN
);
150 BOOL (CDECL
*pSetDeviceGammaRamp
)(PHYSDEV
,LPVOID
);
151 COLORREF (CDECL
*pSetPixel
)(PHYSDEV
,INT
,INT
,COLORREF
);
152 COLORREF (CDECL
*pSetTextColor
)(PHYSDEV
,COLORREF
);
153 INT (CDECL
*pStartDoc
)(PHYSDEV
,const DOCINFOW
*);
154 INT (CDECL
*pStartPage
)(PHYSDEV
);
155 BOOL (CDECL
*pStretchBlt
)(PHYSDEV
,struct bitblt_coords
*,PHYSDEV
,struct bitblt_coords
*,DWORD
);
156 INT (CDECL
*pStretchDIBits
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,const void*,BITMAPINFO
*,UINT
,DWORD
);
157 BOOL (CDECL
*pStrokeAndFillPath
)(PHYSDEV
);
158 BOOL (CDECL
*pStrokePath
)(PHYSDEV
);
159 BOOL (CDECL
*pUnrealizePalette
)(HPALETTE
);
160 NTSTATUS (CDECL
*pD3DKMTCheckVidPnExclusiveOwnership
)(const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP
*);
161 NTSTATUS (CDECL
*pD3DKMTCloseAdapter
)(const D3DKMT_CLOSEADAPTER
*);
162 NTSTATUS (CDECL
*pD3DKMTOpenAdapterFromLuid
)(D3DKMT_OPENADAPTERFROMLUID
*);
163 NTSTATUS (CDECL
*pD3DKMTQueryVideoMemoryInfo
)(D3DKMT_QUERYVIDEOMEMORYINFO
*);
164 NTSTATUS (CDECL
*pD3DKMTSetVidPnSourceOwner
)(const D3DKMT_SETVIDPNSOURCEOWNER
*);
166 /* priority order for the driver on the stack */
170 /* increment this when you change the DC function table */
171 #define WINE_GDI_DRIVER_VERSION 81
173 #define GDI_PRIORITY_NULL_DRV 0 /* null driver */
174 #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
175 #define GDI_PRIORITY_GRAPHICS_DRV 200 /* any graphics driver */
176 #define GDI_PRIORITY_DIB_DRV 300 /* the DIB driver */
177 #define GDI_PRIORITY_PATH_DRV 400 /* the path driver */
179 static inline PHYSDEV
get_physdev_entry_point( PHYSDEV dev
, size_t offset
)
181 while (!((void **)dev
->funcs
)[offset
/ sizeof(void *)]) dev
= dev
->next
;
185 #define GET_NEXT_PHYSDEV(dev,func) \
186 get_physdev_entry_point( (dev)->next, FIELD_OFFSET(struct gdi_dc_funcs,func))
188 static inline void push_dc_driver( PHYSDEV
*dev
, PHYSDEV physdev
, const struct gdi_dc_funcs
*funcs
)
190 while ((*dev
)->funcs
->priority
> funcs
->priority
) dev
= &(*dev
)->next
;
191 physdev
->funcs
= funcs
;
192 physdev
->next
= *dev
;
193 physdev
->hdc
= (*dev
)->hdc
;
197 /* support for window surfaces */
201 struct window_surface
;
203 struct window_surface_funcs
205 void (*lock
)( struct window_surface
*surface
);
206 void (*unlock
)( struct window_surface
*surface
);
207 void* (*get_info
)( struct window_surface
*surface
, BITMAPINFO
*info
);
208 RECT
* (*get_bounds
)( struct window_surface
*surface
);
209 void (*set_region
)( struct window_surface
*surface
, HRGN region
);
210 void (*flush
)( struct window_surface
*surface
);
211 void (*destroy
)( struct window_surface
*surface
);
214 struct window_surface
216 const struct window_surface_funcs
*funcs
; /* driver-specific implementations */
217 struct list entry
; /* entry in global list managed by user32 */
218 LONG ref
; /* reference count */
219 RECT rect
; /* constant, no locking needed */
220 /* driver-specific fields here */
223 static inline ULONG
window_surface_add_ref( struct window_surface
*surface
)
225 return InterlockedIncrement( &surface
->ref
);
228 static inline ULONG
window_surface_release( struct window_surface
*surface
)
230 ULONG ret
= InterlockedDecrement( &surface
->ref
);
231 if (!ret
) surface
->funcs
->destroy( surface
);
235 /* display manager interface, used to initialize display device registry data */
240 WCHAR name
[128]; /* name */
241 UINT vendor_id
; /* PCI ID */
245 GUID vulkan_uuid
; /* Vulkan device UUID */
256 WCHAR name
[128]; /* name */
257 RECT rc_monitor
; /* RcMonitor in MONITORINFO struct */
258 RECT rc_work
; /* RcWork in MONITORINFO struct */
259 DWORD state_flags
; /* StateFlags in DISPLAY_DEVICE struct */
260 unsigned char *edid
; /* Extended Device Identification Data */
264 struct gdi_device_manager
266 void (*add_gpu
)( const struct gdi_gpu
*gpu
, void *param
);
267 void (*add_adapter
)( const struct gdi_adapter
*adapter
, void *param
);
268 void (*add_monitor
)( const struct gdi_monitor
*monitor
, void *param
);
269 void (*add_mode
)( const DEVMODEW
*mode
, void *param
);
272 #define WINE_DM_UNSUPPORTED 0x80000000
274 struct tagUPDATELAYEREDWINDOWINFO
;
276 struct user_driver_funcs
278 struct gdi_dc_funcs dc_funcs
;
280 /* keyboard functions */
281 BOOL (*pActivateKeyboardLayout
)(HKL
, UINT
);
283 INT (*pGetKeyNameText
)(LONG
,LPWSTR
,INT
);
284 UINT (*pGetKeyboardLayoutList
)(INT
, HKL
*);
285 UINT (*pMapVirtualKeyEx
)(UINT
,UINT
,HKL
);
286 BOOL (*pRegisterHotKey
)(HWND
,UINT
,UINT
);
287 INT (*pToUnicodeEx
)(UINT
,UINT
,const BYTE
*,LPWSTR
,int,UINT
,HKL
);
288 void (*pUnregisterHotKey
)(HWND
, UINT
, UINT
);
289 SHORT (*pVkKeyScanEx
)(WCHAR
, HKL
);
290 /* cursor/icon functions */
291 void (*pDestroyCursorIcon
)(HCURSOR
);
292 void (*pSetCursor
)(HCURSOR
);
293 BOOL (*pGetCursorPos
)(LPPOINT
);
294 BOOL (*pSetCursorPos
)(INT
,INT
);
295 BOOL (*pClipCursor
)(LPCRECT
);
296 /* clipboard functions */
297 LRESULT (*pClipboardWindowProc
)(HWND
,UINT
,WPARAM
,LPARAM
);
298 void (*pUpdateClipboard
)(void);
300 LONG (*pChangeDisplaySettings
)(LPDEVMODEW
,LPCWSTR
,HWND
,DWORD
,LPVOID
);
301 BOOL (*pGetCurrentDisplaySettings
)(LPCWSTR
,BOOL
,LPDEVMODEW
);
302 BOOL (*pUpdateDisplayDevices
)(const struct gdi_device_manager
*,BOOL
,void*);
303 /* windowing functions */
304 BOOL (*pCreateDesktopWindow
)(HWND
);
305 BOOL (*pCreateWindow
)(HWND
);
306 LRESULT (*pDesktopWindowProc
)(HWND
,UINT
,WPARAM
,LPARAM
);
307 void (*pDestroyWindow
)(HWND
);
308 void (*pFlashWindowEx
)(FLASHWINFO
*);
309 void (*pGetDC
)(HDC
,HWND
,HWND
,const RECT
*,const RECT
*,DWORD
);
310 NTSTATUS (*pMsgWaitForMultipleObjectsEx
)(DWORD
,const HANDLE
*,const LARGE_INTEGER
*,DWORD
,DWORD
);
311 void (*pReleaseDC
)(HWND
,HDC
);
312 BOOL (*pScrollDC
)(HDC
,INT
,INT
,HRGN
);
313 void (*pSetCapture
)(HWND
,UINT
);
314 void (*pSetFocus
)(HWND
);
315 void (*pSetLayeredWindowAttributes
)(HWND
,COLORREF
,BYTE
,DWORD
);
316 void (*pSetParent
)(HWND
,HWND
,HWND
);
317 void (*pSetWindowRgn
)(HWND
,HRGN
,BOOL
);
318 void (*pSetWindowIcon
)(HWND
,UINT
,HICON
);
319 void (*pSetWindowStyle
)(HWND
,INT
,STYLESTRUCT
*);
320 void (*pSetWindowText
)(HWND
,LPCWSTR
);
321 UINT (*pShowWindow
)(HWND
,INT
,RECT
*,UINT
);
322 LRESULT (*pSysCommand
)(HWND
,WPARAM
,LPARAM
);
323 BOOL (*pUpdateLayeredWindow
)(HWND
,const struct tagUPDATELAYEREDWINDOWINFO
*,const RECT
*);
324 LRESULT (*pWindowMessage
)(HWND
,UINT
,WPARAM
,LPARAM
);
325 BOOL (*pWindowPosChanging
)(HWND
,HWND
,UINT
,const RECT
*,const RECT
*,RECT
*,
326 struct window_surface
**);
327 void (*pWindowPosChanged
)(HWND
,HWND
,UINT
,const RECT
*,const RECT
*,const RECT
*,
328 const RECT
*,struct window_surface
*);
329 /* system parameters */
330 BOOL (*pSystemParametersInfo
)(UINT
,UINT
,void*,UINT
);
332 const struct vulkan_funcs
* (*pwine_get_vulkan_driver
)(UINT
);
334 struct opengl_funcs
* (*pwine_get_wgl_driver
)(UINT
);
335 /* thread management */
336 void (*pThreadDetach
)(void);
339 extern void __wine_set_user_driver( const struct user_driver_funcs
*funcs
, UINT version
);
341 #endif /* WINE_UNIX_LIB */
343 extern struct opengl_funcs
* CDECL
__wine_get_wgl_driver( HDC hdc
, UINT version
);
345 #endif /* __WINE_WINE_GDI_DRIVER_H */