diff --git a/gdk/win32/gdkglobals-win32.c b/gdk/win32/gdkglobals-win32.c index 0c14a1e425..4b325b5946 100644 --- a/gdk/win32/gdkglobals-win32.c +++ b/gdk/win32/gdkglobals-win32.c @@ -80,5 +80,3 @@ gboolean _ignore_destroy_clipboard = FALSE; HGLOBAL _delayed_rendering_data = NULL; GHashTable *_format_atom_table = NULL; - -gboolean _is_win8_or_later = FALSE; diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c index c66b540909..a8a765063a 100644 --- a/gdk/win32/gdkmain-win32.c +++ b/gdk/win32/gdkmain-win32.c @@ -128,7 +128,6 @@ _gdk_win32_windowing_init (void) _cf_url = RegisterClipboardFormat ("UniformResourceLocatorW"); _cf_html_format = RegisterClipboardFormat ("HTML Format"); _cf_text_html = RegisterClipboardFormat ("text/html"); - _is_win8_or_later = g_win32_check_windows_version (6, 2, 0, G_WIN32_OS_ANY); _gdk_win32_selection_init (); } diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index 4d1dc0166b..38d5dc2b42 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -552,6 +552,4 @@ void _gdk_events_init (void); void _gdk_input_init (GdkDisplay *display); void _gdk_input_wintab_init_check (GdkDeviceManager *device_manager); -extern gboolean _is_win8_or_later; - #endif /* __GDK_PRIVATE_WIN32_H__ */ diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c index ad84d417d0..df89182c1d 100644 --- a/gdk/win32/gdkscreen-win32.c +++ b/gdk/win32/gdkscreen-win32.c @@ -30,6 +30,8 @@ struct _GdkWin32Screen GdkScreen parent_instance; GdkWindow *root_window; + + gint always_composited : 1; }; struct _GdkWin32ScreenClass @@ -65,6 +67,9 @@ gdk_win32_screen_init (GdkWin32Screen *win32_screen) if (logpixelsx > 0) _gdk_screen_set_resolution (screen, logpixelsx); + + /* On Windows 8 and later, DWM (composition) is always enabled */ + win32_screen->always_composited = g_win32_check_windows_version (6, 2, 0, G_WIN32_OS_ANY); } void @@ -245,14 +250,12 @@ gdk_win32_screen_get_window_stack (GdkScreen *screen) static gboolean gdk_win32_screen_is_composited (GdkScreen *screen) { - gboolean is_composited; - g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); - - /* On Windows 8 and later, DWM (composition) is always enabled */ - if (_is_win8_or_later) + if (GDK_WIN32_SCREEN (screen)->always_composited) return TRUE; else { + gboolean is_composited; + if (DwmIsCompositionEnabled (&is_composited) != S_OK) return FALSE; return is_composited;