summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDom Lachowicz <cinamod@hotmail.com>2006-03-11 18:04:36 +0000
committerDom Lachowicz <doml@src.gnome.org>2006-03-11 18:04:36 +0000
commita579bc5a5471315ac111889fb0cd11dd62e7009a (patch)
tree00f15492b487b1eecdee7375b6965c544aa77c4e
parent3f08ebacd73c9871e04630ca927012b4a1ee35d8 (diff)
downloadgtk+-a579bc5a5471315ac111889fb0cd11dd62e7009a.tar.gz
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)
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.pre-2-106
-rwxr-xr-xmodules/engines/ms-windows/msw_style.c8
-rwxr-xr-xmodules/engines/ms-windows/msw_theme_main.c29
-rwxr-xr-xmodules/engines/ms-windows/xp_theme.c30
5 files changed, 61 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 058e653301..eab550ed8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 058e653301..eab550ed8c 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -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
diff --git a/modules/engines/ms-windows/msw_style.c b/modules/engines/ms-windows/msw_style.c
index 10a9f18e12..93d7e998c9 100755
--- a/modules/engines/ms-windows/msw_style.c
+++ b/modules/engines/ms-windows/msw_style.c
@@ -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;
diff --git a/modules/engines/ms-windows/msw_theme_main.c b/modules/engines/ms-windows/msw_theme_main.c
index 9301f4f8e2..4cabf54dcb 100755
--- a/modules/engines/ms-windows/msw_theme_main.c
+++ b/modules/engines/ms-windows/msw_theme_main.c
@@ -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)
{
diff --git a/modules/engines/ms-windows/xp_theme.c b/modules/engines/ms-windows/xp_theme.c
index 43d59c477f..b96467b6af 100755
--- a/modules/engines/ms-windows/xp_theme.c
+++ b/modules/engines/ms-windows/xp_theme.c
@@ -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