Speed up the Windows theme considerably (#163724, John Ehresman) Be more

2006-03-11  Dom Lachowicz <cinamod@hotmail.com>

	* modules/engines/ms-windows: Speed up the Windows theme
	considerably (#163724, John Ehresman)
	Be more careful about setting Pango font descriptions (#333372)
This commit is contained in:
Dom Lachowicz 2006-03-11 18:04:36 +00:00 committed by Dom Lachowicz
parent 3f08ebacd7
commit a579bc5a54
5 changed files with 61 additions and 18 deletions

View File

@ -1,3 +1,9 @@
2006-03-11 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows: Speed up the Windows theme
considerably (#163724, John Ehresman)
Be more careful about setting Pango font descriptions (#333372)
2006-03-11 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_key_press): Allow to cancel

View File

@ -1,3 +1,9 @@
2006-03-11 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows: Speed up the Windows theme
considerably (#163724, John Ehresman)
Be more careful about setting Pango font descriptions (#333372)
2006-03-11 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_key_press): Allow to cancel

View File

@ -39,8 +39,8 @@
#include "gtk/gtk.h"
#include "gtk/gtk.h"
/* #include <gdk/gdkwin32.h> */
/* #include <gdk/gdkwin32.h> */
#include "gdk/win32/gdkwin32.h"
@ -464,8 +464,10 @@ sys_font_to_pango_font (XpThemeClass klazz, XpThemeFont type, char *buf,
pt_size = 10;
font = get_family_name (&lf, hDC);
g_snprintf (buf, bufsiz, "%s %s %s %d", font, style, weight,
pt_size);
if(!(font && *font))
return NULL;
g_snprintf (buf, bufsiz, "%s %s %s %d", font, style, weight, pt_size);
g_free (font);
return buf;

View File

@ -36,6 +36,28 @@
static GModule *this_module = NULL;
static void (*msw_rc_reset_styles) (GtkSettings * settings) = NULL;
static GdkWindow* hidden_msg_window = NULL;
static GdkWindow*
create_hidden_msg_window (void)
{
GdkWindowAttr attributes;
gint attributes_mask;
attributes.x = -100;
attributes.y = -100;
attributes.width = 10;
attributes.height = 10;
attributes.window_type = GDK_WINDOW_TEMP;
attributes.wclass = GDK_INPUT_ONLY;
attributes.override_redirect = TRUE;
attributes.event_mask = 0;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_NOREDIR;
return gdk_window_new (gdk_get_default_root_window (),
&attributes, attributes_mask);
}
static GdkFilterReturn
global_filter_func (void *xevent, GdkEvent * event, gpointer data)
@ -88,13 +110,16 @@ theme_init (GTypeModule * module)
}
msw_style_init ();
gdk_window_add_filter (NULL, global_filter_func, NULL);
hidden_msg_window = create_hidden_msg_window ();
gdk_window_add_filter (hidden_msg_window, global_filter_func, NULL);
}
G_MODULE_EXPORT void
theme_exit (void)
{
gdk_window_remove_filter (NULL, global_filter_func, NULL);
gdk_window_remove_filter (hidden_msg_window, global_filter_func, NULL);
gdk_window_destroy (hidden_msg_window);
hidden_msg_window = NULL;
if (this_module)
{

View File

@ -153,6 +153,7 @@ static const short element_part_map[] = {
static HINSTANCE uxtheme_dll = NULL;
static HTHEME open_themes[XP_THEME_CLASS__SIZEOF];
static gboolean use_xp_theme = FALSE;
typedef HRESULT (FAR PASCAL * GetThemeSysFontFunc)
(HTHEME hTheme, int iFontID, OUT LOGFONT * plf);
@ -254,12 +255,26 @@ xp_theme_init (void)
(DrawThemeParentBackgroundFunc) GetProcAddress (uxtheme_dll,
"DrawThemeParentBackground");
}
if (is_app_themed_func && is_theme_active_func) {
use_xp_theme = (is_app_themed_func () && is_theme_active_func ());
}
else {
use_xp_theme = FALSE;
}
}
void
xp_theme_reset (void)
{
xp_theme_close_open_handles ();
if (is_app_themed_func && is_theme_active_func) {
use_xp_theme = (is_app_themed_func () && is_theme_active_func ());
}
else {
use_xp_theme = FALSE;
}
}
void
@ -272,6 +287,7 @@ xp_theme_exit (void)
FreeLibrary (uxtheme_dll);
uxtheme_dll = NULL;
use_xp_theme = FALSE;
is_app_themed_func = NULL;
is_theme_active_func = NULL;
@ -838,19 +854,7 @@ xp_theme_draw (GdkWindow * win, XpThemeElement element, GtkStyle * style,
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;
return use_xp_theme;
}
gboolean