[gnome-themes-standard] gtk2: fix regression in drawing LibreOffice/OOo GtkEntry backgrounds



commit 0d6170da97c4200ac17d029334268a52377335e9
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Feb 19 12:52:06 2013 -0500

    gtk2: fix regression in drawing LibreOffice/OOo GtkEntry backgrounds
    
    The way GTK theming is done in LibreOffice/OOo doesn't work with
    composed transparent images on top of another.
    Add a workaround and draw a solid background for the entry in this case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694191

 .../gtk-2.0/Entry/entry-border-fill-solid.png      |  Bin 0 -> 203 bytes
 themes/Adwaita/gtk-2.0/Makefile.am                 |    1 +
 themes/Adwaita/gtk-2.0/adwaita_engine.c            |   33 ++++++++++++------
 themes/Adwaita/gtk-2.0/gtkrc                       |   37 +++++++++++++++++--
 4 files changed, 56 insertions(+), 15 deletions(-)
---
diff --git a/themes/Adwaita/gtk-2.0/Entry/entry-border-fill-solid.png 
b/themes/Adwaita/gtk-2.0/Entry/entry-border-fill-solid.png
new file mode 100644
index 0000000..a1997b7
Binary files /dev/null and b/themes/Adwaita/gtk-2.0/Entry/entry-border-fill-solid.png differ
diff --git a/themes/Adwaita/gtk-2.0/Makefile.am b/themes/Adwaita/gtk-2.0/Makefile.am
index 91f63ed..8f24473 100644
--- a/themes/Adwaita/gtk-2.0/Makefile.am
+++ b/themes/Adwaita/gtk-2.0/Makefile.am
@@ -72,6 +72,7 @@ asset_data = \
        Entry/combo-entry-button-disabled.png \
        Entry/combo-entry-button-disabled-rtl.png \
        Entry/entry-border-fill.png \
+       Entry/entry-border-fill-solid.png \
        Entry/entry-border-bg.png \
        Entry/entry-border-active-bg.png \
        Entry/entry-border-disabled-bg.png \
diff --git a/themes/Adwaita/gtk-2.0/adwaita_engine.c b/themes/Adwaita/gtk-2.0/adwaita_engine.c
index 3136aa0..61cd650 100644
--- a/themes/Adwaita/gtk-2.0/adwaita_engine.c
+++ b/themes/Adwaita/gtk-2.0/adwaita_engine.c
@@ -49,6 +49,22 @@ typedef struct
 
 G_DEFINE_DYNAMIC_TYPE (AdwaitaStyle, adwaita_style, GTK_TYPE_STYLE)
 
+static void
+do_toplevel_hack (GtkWidget   *widget,
+                  const gchar *widget_name)
+{
+  gboolean tried_hack;
+
+  tried_hack = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "adwaita-toplevel-hack"));
+
+  if (!tried_hack)
+    {
+      g_object_set_data (G_OBJECT (widget),
+                         "adwaita-toplevel-hack", GINT_TO_POINTER (1));
+      gtk_widget_set_name (widget, widget_name);
+    }
+}
+
 static gboolean
 wm_is_fallback (void)
 {
@@ -145,6 +161,7 @@ adwaita_draw_flat_box (GtkStyle      *style,
                        gint          height)
 {
   gboolean tried_ooo_hack;
+  const gchar *app_name;
 
   GTK_STYLE_CLASS (adwaita_style_parent_class)->draw_flat_box (style, window, state_type, shadow_type,
                                                                area, widget, detail,
@@ -155,17 +172,11 @@ adwaita_draw_flat_box (GtkStyle      *style,
       (gtk_window_get_window_type (GTK_WINDOW (widget)) != GTK_WINDOW_TOPLEVEL))
     return;
 
-  if (!g_str_has_prefix (g_get_application_name (), "OpenOffice.org"))
-    return;
-
-  tried_ooo_hack = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "adwaita-ooo-hack"));
-
-  if (!tried_ooo_hack)
-    {
-      g_object_set_data (G_OBJECT (widget),
-                         "adwaita-ooo-hack", GINT_TO_POINTER (1));
-      gtk_widget_set_name (widget, "openoffice-toplevel");
-    }
+  app_name = g_get_application_name ();
+  if (g_str_has_prefix (app_name, "OpenOffice.org"))
+    do_toplevel_hack (widget, "openoffice-toplevel");
+  else if (g_str_has_prefix (app_name, "LibreOffice"))
+    do_toplevel_hack (widget, "libreoffice-toplevel");
 }
 
 static void
diff --git a/themes/Adwaita/gtk-2.0/gtkrc b/themes/Adwaita/gtk-2.0/gtkrc
index b383524..b00d6f8 100755
--- a/themes/Adwaita/gtk-2.0/gtkrc
+++ b/themes/Adwaita/gtk-2.0/gtkrc
@@ -547,7 +547,7 @@ style "default"
         }
 }
 
-style "ooo_toplevel_hack"
+style "toplevel_hack"
 {
         engine "adwaita"
         {
@@ -1656,6 +1656,31 @@ style "gimp_spin_scale"
   }
 }
 
+style "libreoffice_entry"
+{
+        engine "pixmap"
+        {
+        image
+        {
+                function                = FLAT_BOX
+                detail                  = "entry_bg"
+                state                   = NORMAL
+                overlay_file           = "Entry/entry-border-fill-solid.png"
+               overlay_border          = { 0, 0, 0, 0 }
+                overlay_stretch         = TRUE
+        }
+        image
+        {
+                function                = FLAT_BOX
+                detail                  = "entry_bg"
+                state                   = ACTIVE
+                overlay_file           = "Entry/entry-border-fill-solid.png"
+               overlay_border          = { 0, 0, 0, 0 }
+                overlay_stretch         = TRUE
+        }
+        }
+}
+
 style "notebook"
 {
 
@@ -2290,6 +2315,10 @@ widget_class "*<GtkCustomMenu>*<GtkCustomMenuItem>*" style "chrome_menu_item"
 widget "gtk-tooltips*"                         style "eclipse-tooltips"
 widget "*swt-toolbar-flat"             style "null"
 
-# Openoffice
-class "GtkWindow"                  style "ooo_toplevel_hack"
-widget "*openoffice-toplevel*"     style "ooo_stepper_hack"
+# Openoffice, Libreoffice
+class "GtkWindow"                             style "toplevel_hack"
+widget "*openoffice-toplevel*"                style "ooo_stepper_hack"
+widget "*openoffice-toplevel*GtkEntry"        style "libreoffice_entry"
+widget "*openoffice-toplevel*GtkSpinButton"   style "libreoffice_entry"
+widget "*libreoffice-toplevel*GtkEntry"       style "libreoffice_entry"
+widget "*libreoffice-toplevel*GtkSpinButton"  style "libreoffice_entry"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]