[gtk+/master.fcw: 316/648] gdkcursor-win32.c: Simplify OS Version Check
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/master.fcw: 316/648] gdkcursor-win32.c: Simplify OS Version Check
- Date: Wed, 4 Feb 2015 05:07:19 +0000 (UTC)
commit 76ed0681572a386c9f8c495e53a180bc5a019a15
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Dec 22 17:14:04 2014 +0800
gdkcursor-win32.c: Simplify OS Version Check
... for _gdk_win32_pixbuf_to_hicon_supports_alpha(), as we just need to
use the utility function added in gdkmain-win32.c to check the OS version.
Also use g_once_init_enter()/g_once_init_leave() to make sure that we cache
results of whether we are using XP or later.
https://bugzilla.gnome.org/show_bug.cgi?id=741849
gdk/win32/gdkcursor-win32.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/gdk/win32/gdkcursor-win32.c b/gdk/win32/gdkcursor-win32.c
index 28b2745..e5e2c3b 100644
--- a/gdk/win32/gdkcursor-win32.c
+++ b/gdk/win32/gdkcursor-win32.c
@@ -821,20 +821,13 @@ _gdk_win32_pixbuf_to_hcursor (GdkPixbuf *pixbuf,
gboolean
_gdk_win32_pixbuf_to_hicon_supports_alpha (void)
{
- static gboolean is_win_xp=FALSE, is_win_xp_checked=FALSE;
+ static gboolean is_win_xp=FALSE;
+ static gsize is_win_xp_checked;
- if (!is_win_xp_checked)
+ if (g_once_init_enter (&is_win_xp_checked))
{
- OSVERSIONINFO version;
-
- is_win_xp_checked = TRUE;
-
- memset (&version, 0, sizeof (version));
- version.dwOSVersionInfoSize = sizeof (version);
- is_win_xp = GetVersionEx (&version)
- && version.dwPlatformId == VER_PLATFORM_WIN32_NT
- && (version.dwMajorVersion > 5
- || (version.dwMajorVersion == 5 && version.dwMinorVersion >= 1));
+ is_win_xp = _gdk_win32_check_os_version (5, 1);
+ g_once_init_leave (&is_win_xp_checked, 1);
}
return is_win_xp;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]