From 746b01cf540e759493660827e575a64414b69cd8 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Tue, 20 Oct 2015 14:54:44 -0400 Subject: [PATCH] Add patch fixing transparent mode under Wayland https://bugzilla.redhat.com/show_bug.cgi?id=1207943 --- gnome-terminal-wayland-transparency.patch | 105 ++++++++++++++++++++++ gnome-terminal.spec | 5 ++ 2 files changed, 110 insertions(+) create mode 100644 gnome-terminal-wayland-transparency.patch diff --git a/gnome-terminal-wayland-transparency.patch b/gnome-terminal-wayland-transparency.patch new file mode 100644 index 0000000..18ca359 --- /dev/null +++ b/gnome-terminal-wayland-transparency.patch @@ -0,0 +1,105 @@ +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); diff --git a/gnome-terminal.spec b/gnome-terminal.spec index ba8c6c6..4b15d5a 100644 --- a/gnome-terminal.spec +++ b/gnome-terminal.spec @@ -22,6 +22,7 @@ Patch1: gnome-terminal-symbolic-new-tab-icon.patch Patch100: gnome-terminal-restore-dark-transparency.patch Patch101: gnome-terminal-command-notify.patch +Patch102: gnome-terminal-wayland-transparency.patch BuildRequires: dbus-x11 BuildRequires: glib2-devel >= %{glib2_version} @@ -65,6 +66,7 @@ option to the right-click context menu in Nautilus. %patch1 -p1 -b .new-tab-icon %patch100 -p1 -b .dark-transparency %patch101 -p1 -b .command-notify +%patch102 -p1 -b .wayland-transparency %build autoreconf -f -i @@ -109,6 +111,9 @@ fi %{_libdir}/nautilus/extensions-3.0/libterminal-nautilus.so %changelog +* Thu Nov 12 2015 Owen Taylor +- Add patch fixing transparent mode under Wayland + * Sat Oct 31 2015 Kalev Lember - 3.18.1-2 - Drop GConf migrator for F24 (#1276525)