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