[gtk+] win32: Handle size queries for all values
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] win32: Handle size queries for all values
- Date: Sun, 21 Feb 2016 02:08:35 +0000 (UTC)
commit eda348d2b51c89c1fa2729662f4d39b5addc41bc
Author: Benjamin Otte <otte gnome org>
Date: Fri Feb 19 09:01:43 2016 +0100
win32: Handle size queries for all values
Fall back to GetSystemMetrics() whenever GetThemeSysSize() didn't work.
gtk/gtkwin32theme.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkwin32theme.c b/gtk/gtkwin32theme.c
index dadc910..50d4563 100644
--- a/gtk/gtkwin32theme.c
+++ b/gtk/gtkwin32theme.c
@@ -73,7 +73,7 @@ typedef HRESULT (FAR PASCAL *GetThemeBackgroundExtentFunc) (HTHEME hTheme,
static GetThemeSysFontFunc get_theme_sys_font = NULL;
static GetThemeSysColorFunc GetThemeSysColor = NULL;
-static GetThemeSysSizeFunc get_theme_sys_metric = NULL;
+static GetThemeSysSizeFunc GetThemeSysSize = NULL;
static OpenThemeDataFunc OpenThemeData = NULL;
static CloseThemeDataFunc CloseThemeData = NULL;
static DrawThemeBackgroundFunc draw_theme_background = NULL;
@@ -215,7 +215,7 @@ gtk_win32_theme_init (void)
enable_theme_dialog_texture = (EnableThemeDialogTextureFunc) GetProcAddress (uxtheme_dll,
"EnableThemeDialogTexture");
get_theme_sys_font = (GetThemeSysFontFunc) GetProcAddress (uxtheme_dll, "GetThemeSysFont");
GetThemeSysColor = (GetThemeSysColorFunc) GetProcAddress (uxtheme_dll, "GetThemeSysColor");
- get_theme_sys_metric = (GetThemeSysSizeFunc) GetProcAddress (uxtheme_dll, "GetThemeSysSize");
+ GetThemeSysSize = (GetThemeSysSizeFunc) GetProcAddress (uxtheme_dll, "GetThemeSysSize");
is_theme_partially_transparent = (IsThemeBackgroundPartiallyTransparentFunc) GetProcAddress
(uxtheme_dll, "IsThemeBackgroundPartiallyTransparent");
draw_theme_parent_background = (DrawThemeParentBackgroundFunc) GetProcAddress (uxtheme_dll,
"DrawThemeParentBackground");
GetThemePartSize = (GetThemePartSizeFunc) GetProcAddress (uxtheme_dll, "GetThemePartSize");
@@ -480,16 +480,21 @@ int
gtk_win32_theme_get_size (GtkWin32Theme *theme,
int id)
{
+ int size;
+
#ifdef G_OS_WIN32
- if (use_xp_theme && get_theme_sys_metric != NULL)
+ if (use_xp_theme && GetThemeSysSize != NULL)
{
HTHEME htheme = gtk_win32_theme_get_htheme (theme);
/* If htheme is NULL it will just return the GetSystemMetrics value */
- return get_theme_sys_metric (htheme, id);
+ size = GetThemeSysSize (htheme, id);
+ /* fall through on invalid parameter */
+ if (GetLastError () == 0)
+ return size;
}
- else
- return GetSystemMetrics (id);
+
+ return GetSystemMetrics (id);
#else
return -1;
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]