Commit 5881529e authored by Cosimo Cecchi's avatar Cosimo Cecchi

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
parent 99efc845
......@@ -74,6 +74,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 \
......
......@@ -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
......
......@@ -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"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment