fix inkscape's toolbar buttons, disable application theming if asked nicely, downgrade gtk+ requirements

This commit is contained in:
cinamod 2004-06-02 19:53:55 +00:00
parent aff289b83a
commit 02039ad7e0
5 changed files with 50 additions and 58 deletions

View File

@ -1,3 +1,12 @@
2004-06-02 Dom Lachowicz <cinamod@hotmail.com>
* configure.in: Bump version number (0.6.1)
* src/msw_theme_main.c: Lower GTK+ requirements. We'll work fine on 2.0.x or better
* src/xp_theme_defs.h: Remove HAVE_LINES junk
* src/xp_theme.c: Disable application theming if XP asks us to
* src/msw_style.c: Return true for 'is_toolbar()' check if our parent
is a GtkHandleBox. This fixes Inkscape's toolbar icons.
2004-05-21 Raymond Penners <raymond@dotsphinx.com>
* === Released 0.6.0 ===

View File

@ -1335,7 +1335,7 @@ static gboolean is_toolbar_child(GtkWidget * wid)
{
while(wid)
{
if(GTK_IS_TOOLBAR(wid))
if(GTK_IS_TOOLBAR(wid) || GTK_IS_HANDLE_BOX(wid))
return TRUE;
else
wid = wid->parent;

View File

@ -46,15 +46,15 @@ global_filter_func (void *xevent,
/* catch theme changes */
case WM_THEMECHANGED:
case WM_SYSCOLORCHANGE:
if(msw_reset_rc_styles != NULL) {
xp_theme_reset ();
msw_style_init ();
/* force all gtkwidgets to redraw */
(*msw_reset_rc_styles) (gtk_settings_get_default());
}
return GDK_FILTER_REMOVE;
case WM_SETTINGCHANGE:
@ -78,12 +78,12 @@ theme_init (GTypeModule *module)
on any GTK 2.x.x platform. */
if(gtk_check_version(2,4,0) == NULL) {
this_module = g_module_open(NULL, 0);
if(this_module)
g_module_symbol (this_module, "gtk_rc_reset_styles",
(gpointer *)(&msw_reset_rc_styles));
}
msw_style_init ();
gdk_window_add_filter (NULL, global_filter_func, NULL);
}
@ -113,7 +113,5 @@ G_MODULE_EXPORT const gchar* g_module_check_init (GModule *module);
const gchar*
g_module_check_init (GModule *module)
{
return gtk_check_version (GTK_MAJOR_VERSION,
GTK_MINOR_VERSION,
GTK_MICRO_VERSION - GTK_INTERFACE_AGE);
return gtk_check_version (2,0,0);
}

View File

@ -115,6 +115,7 @@ typedef HRESULT (FAR PASCAL *DrawThemeBackgroundFunc)
const RECT *pRect, const RECT *pClipRect);
typedef HRESULT (FAR PASCAL *EnableThemeDialogTextureFunc)(HWND hwnd, DWORD dwFlags);
typedef BOOL (FAR PASCAL *IsThemeActiveFunc)(VOID);
typedef BOOL (FAR PASCAL *IsAppThemedFunc)(VOID);
static GetThemeSysFontFunc get_theme_sys_font_func = NULL;
static GetThemeSysColorFunc get_theme_sys_color_func = NULL;
@ -124,8 +125,7 @@ static CloseThemeDataFunc close_theme_data_func = NULL;
static DrawThemeBackgroundFunc draw_theme_background_func = NULL;
static EnableThemeDialogTextureFunc enable_theme_dialog_texture_func = NULL;
static IsThemeActiveFunc is_theme_active_func = NULL;
static gboolean was_theming_active = FALSE;
static IsAppThemedFunc is_app_themed_func = NULL;
static void
xp_theme_close_open_handles (void)
@ -152,31 +152,27 @@ xp_theme_init (void)
uxtheme_dll = LoadLibrary("uxtheme.dll");
if (!uxtheme_dll) {
was_theming_active = FALSE;
return;
}
is_theme_active_func = (IsThemeActiveFunc) GetProcAddress(uxtheme_dll, "IsThemeActive");
open_theme_data_func = (OpenThemeDataFunc) GetProcAddress(uxtheme_dll, "OpenThemeData");
close_theme_data_func = (CloseThemeDataFunc) GetProcAddress(uxtheme_dll, "CloseThemeData");
draw_theme_background_func = (DrawThemeBackgroundFunc) GetProcAddress(uxtheme_dll, "DrawThemeBackground");
enable_theme_dialog_texture_func = (EnableThemeDialogTextureFunc) GetProcAddress(uxtheme_dll, "EnableThemeDialogTexture");
get_theme_sys_font_func = (GetThemeSysFontFunc) GetProcAddress(uxtheme_dll, "GetThemeSysFont");
get_theme_sys_color_func = (GetThemeSysColorFunc) GetProcAddress(uxtheme_dll, "GetThemeSysColor");
get_theme_sys_metric_func = (GetThemeSysSizeFunc) GetProcAddress(uxtheme_dll, "GetThemeSysSize");
is_app_themed_func = (IsAppThemedFunc) GetProcAddress(uxtheme_dll, "IsAppThemed");
if (is_theme_active_func)
{
was_theming_active = (*is_theme_active_func) ();
}
if(is_app_themed_func) {
is_theme_active_func = (IsThemeActiveFunc) GetProcAddress(uxtheme_dll, "IsThemeActive");
open_theme_data_func = (OpenThemeDataFunc) GetProcAddress(uxtheme_dll, "OpenThemeData");
close_theme_data_func = (CloseThemeDataFunc) GetProcAddress(uxtheme_dll, "CloseThemeData");
draw_theme_background_func = (DrawThemeBackgroundFunc) GetProcAddress(uxtheme_dll, "DrawThemeBackground");
enable_theme_dialog_texture_func = (EnableThemeDialogTextureFunc) GetProcAddress(uxtheme_dll, "EnableThemeDialogTexture");
get_theme_sys_font_func = (GetThemeSysFontFunc) GetProcAddress(uxtheme_dll, "GetThemeSysFont");
get_theme_sys_color_func = (GetThemeSysColorFunc) GetProcAddress(uxtheme_dll, "GetThemeSysColor");
get_theme_sys_metric_func = (GetThemeSysSizeFunc) GetProcAddress(uxtheme_dll, "GetThemeSysSize");
}
}
void
xp_theme_reset (void)
{
xp_theme_close_open_handles ();
was_theming_active = is_theme_active_func
? (*is_theme_active_func) () : FALSE;
}
void
@ -190,6 +186,7 @@ xp_theme_exit (void)
FreeLibrary (uxtheme_dll);
uxtheme_dll = NULL;
is_app_themed_func = NULL;
is_theme_active_func = NULL;
open_theme_data_func = NULL;
close_theme_data_func = NULL;
@ -705,26 +702,29 @@ xp_theme_draw (GdkWindow *win, XpThemeElement element, GtkStyle *style,
return TRUE;
}
static gboolean
xp_theme_is_active (void)
{
gboolean active = FALSE;
if (is_app_themed_func)
{
active = (*is_app_themed_func) ();
if (active && is_theme_active_func)
{
active = (*is_theme_active_func) ();
}
}
return active;
}
gboolean
xp_theme_is_drawable (XpThemeElement element)
{
if (is_theme_active_func)
{
gboolean active = (*is_theme_active_func) ();
/* A bit of a hack, but it at least detects theme
switches between XP and classic looks on systems
using older GTK+ version (2.2.0-?) that do not
support theme switch detection (gdk_window_add_filter). */
if (active != was_theming_active)
{
xp_theme_reset ();
}
if (active)
{
return (xp_theme_get_handle_by_element (element) != NULL);
}
}
if (xp_theme_is_active ())
return (xp_theme_get_handle_by_element (element) != NULL);
return FALSE;
}

View File

@ -159,19 +159,4 @@ typedef HANDLE HTHEME;
#define TMT_STATUSFONT 804
#define TMT_MSGBOXFONT 805
#if UXTHEME_HAS_LINES
#error unknown/undocumented uxtheme values
/* #define GP_LINEHORZ */
/* #define GP_LINEVERT */
/* #define LHS_RAISED */
/* #define LHS_SUNKEN */
/* #define LHS_FLAT */
/* #define LVS_RAISED */
/* #define LVS_SUNKEN */
/* #define LHS_FLAT */
#endif /* UXTHEME_HAS_LINES */
#endif /* XP_THEME_DFNS_H */