GDK-Win32: Enable HiDPI support for Windows

This enables HiDPI support for GTK+ on Windows, so that the
fonts and window look better on HiDPI displays.  Notes for the current
work:

-The DPI awareness enabling can be disabled if and only if an application
 manifest is not embedded in the app to enable DPI awareness AND a user
 compatibility setting is not set to limit DPI awareness for the app, via
 the envvar GDK_WIN32_DISABLE_HIDPI.  The app manifest/user setting for
 DPI awareness will always win against the envvar, and so the HiDPI items
 will be always setup in such scenarios, unless DPI awareness is disabled.

-Both automatic detection for the scaling factor and setting the scale
 factor using the GDK_SCALE envvar are supported, where the envvar takes
 precedence, which will therefore disable automatic scaling when
 resolution changes.

-I am unable to test the wintab items because I don't have such devices
 around.

https://bugzilla.gnome.org/show_bug.cgi?id=768081
This commit is contained in:
Chun-wei Fan
2016-06-27 13:16:43 +08:00
parent a64a0bc617
commit 4add92a431
13 changed files with 953 additions and 322 deletions

View File

@ -96,6 +96,14 @@ enum _GdkW32WindowDragOp
typedef enum _GdkW32WindowDragOp GdkW32WindowDragOp;
typedef enum _GdkWin32MonitorDpiType
{
MDT_EFFECTIVE_DPI = 0,
MDT_ANGULAR_DPI = 1,
MDT_RAW_DPI = 2,
MDT_DEFAULT = MDT_EFFECTIVE_DPI
} GdkWin32MonitorDpiType;
struct _GdkW32DragMoveResizeContext
{
/* The window that is being moved/resized */
@ -333,6 +341,11 @@ struct _GdkWindowImplWin32
* They are removed at the first opportunity (usually WM_INITMENU).
*/
LONG_PTR temp_styles;
/* scale of window on HiDPI */
gint window_scale;
gint unscaled_width;
gint unscaled_height;
};
struct _GdkWindowImplWin32Class
@ -352,6 +365,8 @@ void _gdk_win32_window_tmp_reset_parent_bg (GdkWindow *window);
void _gdk_win32_window_update_style_bits (GdkWindow *window);
gint _gdk_win32_window_get_scale_factor (GdkWindow *window);
G_END_DECLS
#endif /* __GDK_WINDOW_WIN32_H__ */