[gnome-themes-standard] gtk2: add an ugly wokaround to an OpenOffice.org scrollbar rendering bug



commit cac3ca75c90b7a67c7661909d3bf9ef4c49c7942
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Jan 15 19:38:44 2013 -0500

    gtk2: add an ugly wokaround to an OpenOffice.org scrollbar rendering bug
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691434

 themes/Adwaita/gtk-2.0/adwaita_engine.c |   38 +++++++++++++++++++++++++++++++
 themes/Adwaita/gtk-2.0/gtkrc            |   18 ++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/themes/Adwaita/gtk-2.0/adwaita_engine.c b/themes/Adwaita/gtk-2.0/adwaita_engine.c
index e1c9425..3136aa0 100644
--- a/themes/Adwaita/gtk-2.0/adwaita_engine.c
+++ b/themes/Adwaita/gtk-2.0/adwaita_engine.c
@@ -131,6 +131,43 @@ adwaita_draw_box (GtkStyle * style,
     }
 }
 
+void
+adwaita_draw_flat_box (GtkStyle      *style,
+                       GdkWindow     *window,
+                       GtkStateType   state_type,
+                       GtkShadowType  shadow_type,
+                       GdkRectangle  *area,
+                       GtkWidget     *widget,
+                       const gchar   *detail,
+                       gint           x,
+                       gint	      y,
+                       gint	      width,
+                       gint	      height)
+{
+  gboolean tried_ooo_hack;
+
+  GTK_STYLE_CLASS (adwaita_style_parent_class)->draw_flat_box (style, window, state_type, shadow_type,
+                                                               area, widget, detail,
+                                                               x, y, width, height);
+
+  /* HACK: this is totally awful, but I don't see a better way to "tag" the OO.o hierarchy */
+  if (!GTK_IS_WINDOW (widget) ||
+      (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");
+    }
+}
+
 static void
 adwaita_style_init (AdwaitaStyle *style)
 {
@@ -142,6 +179,7 @@ adwaita_style_class_init (AdwaitaStyleClass * klass)
   GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
  
   style_class->draw_box = adwaita_draw_box;
+  style_class->draw_flat_box = adwaita_draw_flat_box;
 }
 
 static void
diff --git a/themes/Adwaita/gtk-2.0/gtkrc b/themes/Adwaita/gtk-2.0/gtkrc
index 232b1d5..51e17c8 100755
--- a/themes/Adwaita/gtk-2.0/gtkrc
+++ b/themes/Adwaita/gtk-2.0/gtkrc
@@ -513,6 +513,20 @@ style "default"
         }
 }
 
+style "ooo_toplevel_hack"
+{
+        engine "adwaita"
+        {
+        }
+}
+
+style "ooo_stepper_hack"
+{
+	GtkScrollbar::stepper-size	        = 13
+	GtkScrollbar::has-backward-stepper	= 1
+	GtkScrollbar::has-forward-stepper	= 1
+}
+
 style "scrollbar"
 {
   engine "pixmap" 
@@ -2082,3 +2096,7 @@ widget_class "*<GtkCustomMenu>*<GtkCustomMenuItem>*" style "chrome_menu_item"
 # Eclipse/SWT
 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"



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