106 lines
4.6 KiB
Diff
106 lines
4.6 KiB
Diff
diff -up gnome-terminal-3.18.1/src/terminal-screen.c.wayland-transparency gnome-terminal-3.18.1/src/terminal-screen.c
|
|
--- gnome-terminal-3.18.1/src/terminal-screen.c.wayland-transparency 2015-10-20 16:36:08.388459536 -0400
|
|
+++ gnome-terminal-3.18.1/src/terminal-screen.c 2015-10-20 16:40:49.236462437 -0400
|
|
@@ -137,6 +137,8 @@ static void terminal_screen_system_font_
|
|
static gboolean terminal_screen_popup_menu (GtkWidget *widget);
|
|
static gboolean terminal_screen_button_press (GtkWidget *widget,
|
|
GdkEventButton *event);
|
|
+static void terminal_screen_hierarchy_changed (GtkWidget *widget,
|
|
+ GtkWidget *previous_toplevel);
|
|
static gboolean terminal_screen_focus_in (GtkWidget *widget,
|
|
GdkEventFocus *event);
|
|
static gboolean terminal_screen_do_exec (TerminalScreen *screen,
|
|
@@ -461,6 +463,7 @@ terminal_screen_class_init (TerminalScre
|
|
widget_class->drag_data_received = terminal_screen_drag_data_received;
|
|
widget_class->button_press_event = terminal_screen_button_press;
|
|
widget_class->popup_menu = terminal_screen_popup_menu;
|
|
+ widget_class->hierarchy_changed = terminal_screen_hierarchy_changed;
|
|
|
|
terminal_class->child_exited = terminal_screen_child_exited;
|
|
terminal_class->notification_received = terminal_screen_notification_received;
|
|
@@ -836,6 +839,30 @@ terminal_screen_profile_changed_cb (GSet
|
|
}
|
|
|
|
static void
|
|
+update_toplevel_transparency (TerminalScreen *screen)
|
|
+{
|
|
+ GtkWidget *widget = GTK_WIDGET (screen);
|
|
+ TerminalScreenPrivate *priv = screen->priv;
|
|
+ GSettings *profile = priv->profile;
|
|
+ GtkWidget *toplevel;
|
|
+
|
|
+ toplevel = gtk_widget_get_toplevel (widget);
|
|
+ if (toplevel != NULL && gtk_widget_is_toplevel (toplevel))
|
|
+ {
|
|
+ gboolean transparent = g_settings_get_boolean (profile, TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND);
|
|
+ if (gtk_widget_get_app_paintable (toplevel) != transparent)
|
|
+ {
|
|
+ gtk_widget_set_app_paintable (toplevel, transparent);
|
|
+
|
|
+ /* The opaque region of the toplevel isn't updated until the toplevel is allocated;
|
|
+ * set_app_paintable() doesn't force an allocation, so do that manually.
|
|
+ */
|
|
+ gtk_widget_queue_resize (toplevel);
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
+static void
|
|
update_color_scheme (TerminalScreen *screen)
|
|
{
|
|
GtkWidget *widget = GTK_WIDGET (screen);
|
|
@@ -884,9 +911,7 @@ update_color_scheme (TerminalScreen *scr
|
|
colors, n_colors);
|
|
vte_terminal_set_color_bold (VTE_TERMINAL (screen), boldp);
|
|
|
|
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (screen));
|
|
- if (toplevel != NULL && gtk_widget_is_toplevel (toplevel))
|
|
- gtk_widget_set_app_paintable (toplevel, transparent);
|
|
+ update_toplevel_transparency (screen);
|
|
}
|
|
|
|
static void
|
|
@@ -1545,6 +1570,13 @@ terminal_screen_button_press (GtkWidget
|
|
return FALSE;
|
|
}
|
|
|
|
+static void
|
|
+terminal_screen_hierarchy_changed (GtkWidget *widget,
|
|
+ GtkWidget *previous_toplevel)
|
|
+{
|
|
+ update_toplevel_transparency (TERMINAL_SCREEN (widget));
|
|
+}
|
|
+
|
|
static gboolean
|
|
terminal_screen_focus_in (GtkWidget *widget,
|
|
GdkEventFocus *event)
|
|
diff -up gnome-terminal-3.18.1/src/terminal-window.c.wayland-transparency gnome-terminal-3.18.1/src/terminal-window.c
|
|
--- gnome-terminal-3.18.1/src/terminal-window.c.wayland-transparency 2015-10-20 16:36:08.334460484 -0400
|
|
+++ gnome-terminal-3.18.1/src/terminal-window.c 2015-10-20 16:36:08.392459466 -0400
|
|
@@ -2235,14 +2235,19 @@ terminal_window_draw (GtkWidget *widget,
|
|
if (gtk_widget_get_app_paintable (widget))
|
|
{
|
|
GtkStyleContext *context;
|
|
- int width;
|
|
- int height;
|
|
+
|
|
+ /* Get the *child* allocation, so we don't overwrite window borders */
|
|
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
|
+ GtkAllocation child_allocation;
|
|
+ gtk_widget_get_allocation (child, &child_allocation);
|
|
|
|
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);
|
|
+ gtk_render_background (context, cr,
|
|
+ child_allocation.x, child_allocation.y,
|
|
+ child_allocation.width, child_allocation.height);
|
|
+ gtk_render_frame (context, cr,
|
|
+ child_allocation.x, child_allocation.y,
|
|
+ child_allocation.width, child_allocation.height);
|
|
}
|
|
|
|
return GTK_WIDGET_CLASS (terminal_window_parent_class)->draw (widget, cr);
|