[gnome-terminal/gnome-3-34-ntfy-opn-ttl-ts: 2/16] window: Make the drawing robust across all themes



commit 9dbba1eefd691c0e81e64df465e3f92176b3bf16
Author: Lars Uebernickel <lars uebernickel canonical com>
Date:   Wed May 28 14:11:02 2014 +0200

    window: Make the drawing robust across all themes
    
    There are lots of themes out there in the wild that do not specify a
    background-color for all widgets and the default is transparent. This
    is usually not a problem because GTK+ sets an opaque region on the
    whole window and things without a background-color get drawn with the
    theme's default background colour. However, to achieve transparency
    we disable the opaque region by making the window app-paintable. This
    can lead to transparent menubars or notebook tabs in some themes. We
    can avoid this by ensuring that the window always renders a background.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730016

 src/terminal-window.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 5ba767c5..cdd69f9f 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1979,6 +1979,26 @@ terminal_window_realize (GtkWidget *widget)
   terminal_window_update_size (window);
 }
 
+static gboolean
+terminal_window_draw (GtkWidget *widget,
+                      cairo_t   *cr)
+{
+  if (gtk_widget_get_app_paintable (widget))
+    {
+      GtkStyleContext *context;
+      int width;
+      int height;
+
+      context = gtk_widget_get_style_context (widget);
+      width = gtk_widget_get_allocated_width (widget);
+      height = gtk_widget_get_allocated_height (widget);
+      gtk_render_background (context, cr, 0, 0, width, height);
+      gtk_render_frame (context, cr, 0, 0, width, height);
+    }
+
+  return GTK_WIDGET_CLASS (terminal_window_parent_class)->draw (widget, cr);
+}
+
 static gboolean
 terminal_window_state_event (GtkWidget            *widget,
                              GdkEventWindowState  *event)
@@ -2301,6 +2321,7 @@ terminal_window_class_init (TerminalWindowClass *klass)
 
   widget_class->show = terminal_window_show;
   widget_class->realize = terminal_window_realize;
+  widget_class->draw = terminal_window_draw;
   widget_class->window_state_event = terminal_window_state_event;
   widget_class->screen_changed = terminal_window_screen_changed;
   widget_class->style_updated = terminal_window_style_updated;


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