]> Pileus Git - ~andy/gtk/commitdiff
Speed up the Windows theme considerably (#163724, John Ehresman) Be more
authorDom Lachowicz <cinamod@hotmail.com>
Sat, 11 Mar 2006 18:04:36 +0000 (18:04 +0000)
committerDom Lachowicz <doml@src.gnome.org>
Sat, 11 Mar 2006 18:04:36 +0000 (18:04 +0000)
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)

ChangeLog
ChangeLog.pre-2-10
modules/engines/ms-windows/msw_style.c
modules/engines/ms-windows/msw_theme_main.c
modules/engines/ms-windows/xp_theme.c

index 058e6533018ffaf266085f9158ff2ea7b5733468..eab550ed8c5491d480cc4342b620dd9b2a9d3ac1 100644 (file)
--- 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 
index 058e6533018ffaf266085f9158ff2ea7b5733468..eab550ed8c5491d480cc4342b620dd9b2a9d3ac1 100644 (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 
index 10a9f18e12cfb1b82df1085ef3e9066174c856ca..93d7e998c9e2da3c3ed211a5d4621cb60f6e6dcd 100755 (executable)
@@ -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;
index 9301f4f8e21001f46d5ff7eb67172951d3a66683..4cabf54dcb563970109c80e9d6456fbcb3c98157 100755 (executable)
 
 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)
        {
index 43d59c477f8539f965276dfa6b701f4f53de9d1b..b96467b6af86bf5ae142c0765daf7da8536cdf74 100755 (executable)
@@ -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