Debian Codegraph @

gdk/win32/gdkdisplay-win32.h

raw
1 /*
2 * gdkdisplay-win32.h
3 *
4 * Copyright 2014 Chun-wei Fan <[email protected]>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
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 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "gdkdisplayprivate.h"
21 #include "gdkglcontext-win32.h"
22
23 #ifndef __GDK_DISPLAY__WIN32_H__
24 #define __GDK_DISPLAY__WIN32_H__
25
26 /* Define values used to set DPI-awareness */
27 typedef enum _GdkWin32ProcessDpiAwareness {
28 PROCESS_DPI_UNAWARE = 0,
29 PROCESS_SYSTEM_DPI_AWARE = 1,
30 PROCESS_PER_MONITOR_DPI_AWARE = 2
31 } GdkWin32ProcessDpiAwareness;
32
33 /* Define values for GL type used */
34 typedef enum _GdkWin32GLContextType
35 {
36 GDK_WIN32_GL_PENDING,
37 GDK_WIN32_GL_NONE,
38 GDK_WIN32_GL_WGL,
39 GDK_WIN32_GL_EGL
40 } GdkWin32GLContextType;
41
42 /* APIs from shcore.dll */
43 typedef HRESULT (WINAPI *funcSetProcessDpiAwareness) (GdkWin32ProcessDpiAwareness value);
44 typedef HRESULT (WINAPI *funcGetProcessDpiAwareness) (HANDLE handle,
45 GdkWin32ProcessDpiAwareness *awareness);
46 typedef HRESULT (WINAPI *funcGetDpiForMonitor) (HMONITOR monitor,
47 GdkWin32MonitorDpiType dpi_type,
48 UINT *dpi_x,
49 UINT *dpi_y);
50
51 typedef struct _GdkWin32ShcoreFuncs
52 {
53 HMODULE hshcore;
54 funcSetProcessDpiAwareness setDpiAwareFunc;
55 funcGetProcessDpiAwareness getDpiAwareFunc;
56 funcGetDpiForMonitor getDpiForMonitorFunc;
57 } GdkWin32ShcoreFuncs;
58
59 /* DPI awareness APIs from user32.dll */
60 typedef BOOL (WINAPI *funcSetProcessDPIAware) (void);
61 typedef BOOL (WINAPI *funcIsProcessDPIAware) (void);
62
63 typedef struct _GdkWin32User32DPIFuncs
64 {
65 funcSetProcessDPIAware setDpiAwareFunc;
66 funcIsProcessDPIAware isDpiAwareFunc;
67 } GdkWin32User32DPIFuncs;
68
69 struct _GdkWin32Display
70 {
71 GdkDisplay display;
72
73 GdkScreen *screen;
74
75 Win32CursorTheme *cursor_theme;
76 gchar *cursor_theme_name;
77 int cursor_theme_size;
78 GHashTable *cursor_cache;
79
80 HWND hwnd;
81 HWND clipboard_hwnd;
82
83 /* OpenGL Items */
84 GdkWin32GLContextType gl_type;
85 guint gl_version;
86
87 /* WGL Items */
88 guint hasWglARBCreateContext : 1;
89 guint hasWglEXTSwapControl : 1;
90 guint hasWglOMLSyncControl : 1;
91 guint hasWglARBPixelFormat : 1;
92 guint hasWglARBmultisample : 1;
93
94 /* compensate around Intel OpenGL driver issues on blitting, see issue #3487 */
95 guint needIntelGLWorkaround : 1;
96
97 /* EGL (Angle) Items */
98 HDC hdc_egl_temp;
99
100 #ifdef GDK_WIN32_ENABLE_EGL
101 EGLDisplay egl_disp;
102 EGLConfig egl_config;
103 guint hasEglKHRCreateContext : 1;
104 guint hasEglSurfacelessContext : 1;
105 EGLint egl_min_swap_interval;
106 #endif
107
108 GPtrArray *monitors;
109
110 /* HiDPI Items */
111 guint have_at_least_win81 : 1;
112 GdkWin32ProcessDpiAwareness dpi_aware_type;
113 guint has_fixed_scale : 1;
114 guint window_scale;
115
116 GdkWin32ShcoreFuncs shcore_funcs;
117 GdkWin32User32DPIFuncs user32_dpi_funcs;
118
119 /* Running CPU items */
120 };
121
122 struct _GdkWin32DisplayClass
123 {
124 GdkDisplayClass display_class;
125 };
126
127 gboolean _gdk_win32_display_init_monitors (GdkWin32Display *display);
128
129 GPtrArray *_gdk_win32_display_get_monitor_list (GdkWin32Display *display);
130
131 guint _gdk_win32_display_get_monitor_scale_factor (GdkWin32Display *win32_display,
132 HMONITOR hmonitor,
133 HWND hwnd,
134 gint *dpi);
135 #endif /* __GDK_DISPLAY__WIN32_H__ */