Win32: remove the _is_win8_or_above global variable

This commit is contained in:
Paolo Borelli 2016-02-18 17:33:29 +01:00
parent 09cd17a001
commit 2e7f98a683
4 changed files with 8 additions and 10 deletions

View File

@ -80,5 +80,3 @@ gboolean _ignore_destroy_clipboard = FALSE;
HGLOBAL _delayed_rendering_data = NULL; HGLOBAL _delayed_rendering_data = NULL;
GHashTable *_format_atom_table = NULL; GHashTable *_format_atom_table = NULL;
gboolean _is_win8_or_later = FALSE;

View File

@ -128,7 +128,6 @@ _gdk_win32_windowing_init (void)
_cf_url = RegisterClipboardFormat ("UniformResourceLocatorW"); _cf_url = RegisterClipboardFormat ("UniformResourceLocatorW");
_cf_html_format = RegisterClipboardFormat ("HTML Format"); _cf_html_format = RegisterClipboardFormat ("HTML Format");
_cf_text_html = RegisterClipboardFormat ("text/html"); _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 (); _gdk_win32_selection_init ();
} }

View File

@ -552,6 +552,4 @@ void _gdk_events_init (void);
void _gdk_input_init (GdkDisplay *display); void _gdk_input_init (GdkDisplay *display);
void _gdk_input_wintab_init_check (GdkDeviceManager *device_manager); void _gdk_input_wintab_init_check (GdkDeviceManager *device_manager);
extern gboolean _is_win8_or_later;
#endif /* __GDK_PRIVATE_WIN32_H__ */ #endif /* __GDK_PRIVATE_WIN32_H__ */

View File

@ -30,6 +30,8 @@ struct _GdkWin32Screen
GdkScreen parent_instance; GdkScreen parent_instance;
GdkWindow *root_window; GdkWindow *root_window;
gint always_composited : 1;
}; };
struct _GdkWin32ScreenClass struct _GdkWin32ScreenClass
@ -65,6 +67,9 @@ gdk_win32_screen_init (GdkWin32Screen *win32_screen)
if (logpixelsx > 0) if (logpixelsx > 0)
_gdk_screen_set_resolution (screen, logpixelsx); _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 void
@ -245,14 +250,12 @@ gdk_win32_screen_get_window_stack (GdkScreen *screen)
static gboolean static gboolean
gdk_win32_screen_is_composited (GdkScreen *screen) gdk_win32_screen_is_composited (GdkScreen *screen)
{ {
gboolean is_composited; if (GDK_WIN32_SCREEN (screen)->always_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)
return TRUE; return TRUE;
else else
{ {
gboolean is_composited;
if (DwmIsCompositionEnabled (&is_composited) != S_OK) if (DwmIsCompositionEnabled (&is_composited) != S_OK)
return FALSE; return FALSE;
return is_composited; return is_composited;