From 6171ffd0d6df77fe24a2f2f5246829f48233af572d1c5087ca7aca510aa8a8b7 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Thu, 12 Feb 2015 14:25:25 +0000 Subject: [PATCH] Accepting request 285785 from home:dimstar:branches:GNOME:Factory - Add gnome-terminal-fix-crash.patch: Fix crash with empty child process command line (bgo#742560). - Add gnome-terminal-transparency.patch: Allow gnome-terminal to be set to transparent. - Add gnome-terminal-transparency-fix-for-broken-themes.patch: Ensure that the window itself always has a background. Some themes don't specify a widget background color. OBS-URL: https://build.opensuse.org/request/show/285785 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-terminal?expand=0&rev=130 --- gnome-terminal-fix-crash.patch | 27 ++ ...l-transparency-fix-for-broken-themes.patch | 62 ++++ gnome-terminal-transparency.patch | 267 ++++++++++++++++++ gnome-terminal.changes | 11 + gnome-terminal.spec | 11 +- 5 files changed, 377 insertions(+), 1 deletion(-) create mode 100644 gnome-terminal-fix-crash.patch create mode 100644 gnome-terminal-transparency-fix-for-broken-themes.patch create mode 100644 gnome-terminal-transparency.patch diff --git a/gnome-terminal-fix-crash.patch b/gnome-terminal-fix-crash.patch new file mode 100644 index 0000000..6e6f57f --- /dev/null +++ b/gnome-terminal-fix-crash.patch @@ -0,0 +1,27 @@ +From 664f1e9e8b224658c3f01a062517ad386129d953 Mon Sep 17 00:00:00 2001 +From: Egmont Koblinger +Date: Thu, 8 Jan 2015 14:33:13 +0100 +Subject: screen: Fix crash with empty child process command line + +https://bugzilla.gnome.org/show_bug.cgi?id=742560 +(cherry picked from commit 1c7ed77b003f14bb94527c8fe548c6c414c0da9e) + +diff --git a/src/terminal-screen.c b/src/terminal-screen.c +index ad78388..9f63239 100644 +--- a/src/terminal-screen.c ++++ b/src/terminal-screen.c +@@ -1904,7 +1904,9 @@ terminal_screen_has_foreground_process (TerminalScreen *screen, + if (process_name) + gs_transfer_out_value (process_name, &name); + +- for (i = 0; i < len - 1; i++) ++ if (len > 0 && data[len - 1] == '\0') ++ len--; ++ for (i = 0; i < len; i++) + { + if (data[i] == '\0') + data[i] = ' '; +-- +cgit v0.10.1 + + diff --git a/gnome-terminal-transparency-fix-for-broken-themes.patch b/gnome-terminal-transparency-fix-for-broken-themes.patch new file mode 100644 index 0000000..26787a8 --- /dev/null +++ b/gnome-terminal-transparency-fix-for-broken-themes.patch @@ -0,0 +1,62 @@ +From df5793813d19dccfb6dfa75c1be766df562adb48 Mon Sep 17 00:00:00 2001 +From: Lars Uebernickel +Date: Wed, 28 May 2014 14:11:02 +0200 +Subject: [PATCH] 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 files changed, 21 insertions(+), 0 deletions(-) + +diff --git a/src/terminal-window.c b/src/terminal-window.c +index 98acab4..b838424 100644 +--- a/src/terminal-window.c ++++ b/src/terminal-window.c +@@ -2189,6 +2189,26 @@ terminal_window_realize (GtkWidget *widget) + } + + 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) + { +@@ -2748,6 +2768,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; +-- +1.7.1 + + diff --git a/gnome-terminal-transparency.patch b/gnome-terminal-transparency.patch new file mode 100644 index 0000000..9d5198e --- /dev/null +++ b/gnome-terminal-transparency.patch @@ -0,0 +1,267 @@ +From 1cb63cd1c90cb5bfc8ed2e6d161a7b96c51d8a29 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Mon, 12 May 2014 14:57:18 +0200 +Subject: [PATCH] Restore transparency + +The transparency settings were removed as a side effect of +2bff4b63ed3ceef6055e35563e9b0b33ad57349d + +This restores them and you will need a compositing window manager to +use it. The background image setting, also known as faux transparency, +was not restored. +--- + src/org.gnome.Terminal.gschema.xml | 10 ++++ + src/profile-editor.c | 11 ++++ + src/profile-preferences.ui | 92 ++++++++++++++++++++++++++++++++++++ + src/terminal-schemas.h | 3 + + src/terminal-screen.c | 22 ++++++++- + src/terminal-window.c | 7 +++ + 6 files changed, 144 insertions(+), 1 deletions(-) + +diff --git a/src/org.gnome.Terminal.gschema.xml b/src/org.gnome.Terminal.gschema.xml +index c7d0edb..8910ddd 100644 +--- a/src/org.gnome.Terminal.gschema.xml ++++ b/src/org.gnome.Terminal.gschema.xml +@@ -318,6 +318,16 @@ + 'narrow' + Whether ambiguous-width characters are narrow or wide when using UTF-8 encoding + ++ ++ false ++ Whether to use a transparent background ++ ++ ++ 50 ++ ++ Adjust the amount of transparency ++ A value between 0 and 100, where 0 is opaque and 100 is fully transparent. ++ + + + +diff --git a/src/profile-editor.c b/src/profile-editor.c +index 8e5732d..dac5341 100644 +--- a/src/profile-editor.c ++++ b/src/profile-editor.c +@@ -1099,7 +1099,18 @@ terminal_profile_edit (GSettings *profile, + "active-id", + G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); + ++ g_settings_bind (profile, TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND, ++ gtk_builder_get_object (builder, "use-transparent-background"), ++ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); ++ g_settings_bind (profile, TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND, ++ gtk_builder_get_object (builder, "background-transparent-scale-box"), ++ "sensitive", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY); ++ g_settings_bind (profile, TERMINAL_PROFILE_BACKGROUND_TRANSPARENCY_PERCENT, ++ gtk_builder_get_object (builder, "background-transparent-adjustment"), ++ "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); ++ + /* Finished! */ ++ + terminal_util_bind_mnemonic_label_sensitivity (editor); + + terminal_util_dialog_focus_widget (editor, widget_name); +diff --git a/src/profile-preferences.ui b/src/profile-preferences.ui +index de901ee..25a284e 100644 +--- a/src/profile-preferences.ui ++++ b/src/profile-preferences.ui +@@ -23,6 +23,11 @@ + 1 + 100 + ++ ++ 100 ++ 1 ++ 10 ++ + + + +@@ -1073,6 +1078,93 @@ + 1 + + ++ ++ ++ True ++ False ++ horizontal ++ 12 ++ ++ ++ Use t_ransparent background ++ True ++ True ++ False ++ True ++ 0 ++ True ++ ++ ++ False ++ False ++ 0 ++ ++ ++ ++ ++ True ++ False ++ horizontal ++ 6 ++ ++ ++ True ++ False ++ 0.5 ++ none ++ ++ ++ ++ False ++ False ++ 0 ++ ++ ++ ++ ++ True ++ True ++ background-transparent-adjustment ++ False ++ ++ ++ True ++ True ++ 1 ++ ++ ++ ++ ++ True ++ False ++ 0.5 ++ full ++ ++ ++ ++ False ++ False ++ 2 ++ ++ ++ ++ ++ True ++ True ++ 1 ++ ++ ++ ++ ++ True ++ True ++ 2 ++ ++ + + + +diff --git a/src/terminal-schemas.h b/src/terminal-schemas.h +index 90cc5a0..a3849eb 100644 +--- a/src/terminal-schemas.h ++++ b/src/terminal-schemas.h +@@ -63,6 +63,9 @@ G_BEGIN_DECLS + #define TERMINAL_PROFILE_USE_THEME_COLORS_KEY "use-theme-colors" + #define TERMINAL_PROFILE_VISIBLE_NAME_KEY "visible-name" + ++#define TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND "use-transparent-background" ++#define TERMINAL_PROFILE_BACKGROUND_TRANSPARENCY_PERCENT "background-transparency-percent" ++ + #define TERMINAL_SETTING_CONFIRM_CLOSE_KEY "confirm-close" + #define TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR_KEY "default-show-menubar" + #define TERMINAL_SETTING_DARK_THEME_KEY "dark-theme" +diff --git a/src/terminal-screen.c b/src/terminal-screen.c +index ad78388..d09d812 100644 +--- a/src/terminal-screen.c ++++ b/src/terminal-screen.c +@@ -750,7 +750,9 @@ terminal_screen_profile_changed_cb (GSettings *profile, + prop_name == I_(TERMINAL_PROFILE_BACKGROUND_COLOR_KEY) || + prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY) || + prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_KEY) || +- prop_name == I_(TERMINAL_PROFILE_PALETTE_KEY)) ++ prop_name == I_(TERMINAL_PROFILE_PALETTE_KEY) || ++ prop_name == I_(TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND) || ++ prop_name == I_(TERMINAL_PROFILE_BACKGROUND_TRANSPARENCY_PERCENT)) + update_color_scheme (screen); + + if (!prop_name || prop_name == I_(TERMINAL_PROFILE_AUDIBLE_BELL_KEY)) +@@ -809,6 +811,8 @@ update_color_scheme (TerminalScreen *screen) + GdkRGBA fg, bg, bold, theme_fg, theme_bg; + GdkRGBA *boldp; + GtkStyleContext *context; ++ GtkWidget *toplevel; ++ gboolean transparent; + + context = gtk_widget_get_style_context (widget); + gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &theme_fg); +@@ -829,9 +833,25 @@ update_color_scheme (TerminalScreen *screen) + boldp = NULL; + + colors = terminal_g_settings_get_rgba_palette (priv->profile, TERMINAL_PROFILE_PALETTE_KEY, &n_colors); ++ ++ transparent = g_settings_get_boolean (profile, TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND); ++ if (transparent) ++ { ++ gint transparency_percent; ++ ++ transparency_percent = g_settings_get_int (profile, TERMINAL_PROFILE_BACKGROUND_TRANSPARENCY_PERCENT); ++ bg.alpha = (100 - transparency_percent) / 100.0; ++ } ++ else ++ bg.alpha = 1.0; ++ + vte_terminal_set_colors (VTE_TERMINAL (screen), &fg, &bg, + 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); + } + + static void +diff --git a/src/terminal-window.c b/src/terminal-window.c +index ce85744..98acab4 100644 +--- a/src/terminal-window.c ++++ b/src/terminal-window.c +@@ -2549,6 +2549,8 @@ terminal_window_init (TerminalWindow *window) + TerminalWindowPrivate *priv; + TerminalApp *app; + TerminalSettingsList *profiles_list; ++ GdkScreen *screen; ++ GdkVisual *visual; + GtkActionGroup *action_group; + GtkAction *action; + GtkUIManager *manager; +@@ -2564,6 +2566,11 @@ terminal_window_init (TerminalWindow *window) + + gtk_widget_init_template (GTK_WIDGET (window)); + ++ screen = gtk_widget_get_screen (GTK_WIDGET (window)); ++ visual = gdk_screen_get_rgba_visual (screen); ++ if (visual != NULL) ++ gtk_widget_set_visual (GTK_WIDGET (window), visual); ++ + uuid_generate (u); + uuid_unparse (u, uuidstr); + priv->uuid = g_strdup (uuidstr); +-- +1.7.1 + + diff --git a/gnome-terminal.changes b/gnome-terminal.changes index b682d05..5e63f9e 100644 --- a/gnome-terminal.changes +++ b/gnome-terminal.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Thu Feb 12 10:19:26 UTC 2015 - dimstar@opensuse.org + +- Add gnome-terminal-fix-crash.patch: Fix crash with empty child + process command line (bgo#742560). +- Add gnome-terminal-transparency.patch: Allow gnome-terminal to be + set to transparent. +- Add gnome-terminal-transparency-fix-for-broken-themes.patch: + Ensure that the window itself always has a background. Some + themes don't specify a widget background color. + ------------------------------------------------------------------- Thu Nov 13 18:40:24 UTC 2014 - zaitor@opensuse.org diff --git a/gnome-terminal.spec b/gnome-terminal.spec index f4f215e..3c255ed 100644 --- a/gnome-terminal.spec +++ b/gnome-terminal.spec @@ -1,7 +1,7 @@ # # spec file for package gnome-terminal # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,6 +26,12 @@ Url: http://www.gnome.org Source: http://download.gnome.org/sources/gnome-terminal/3.14/%{name}-%{version}.tar.xz BuildRequires: appdata-tools BuildRequires: fdupes +# PATCH-FIX-UPSTREAM gnome-terminal-fix-crash.patch bgo#742560 dimstar@opensuse.org -- Fix crash with empty child process command line +Patch0: gnome-terminal-fix-crash.patch +# PATCH-FEATURE-OPENSUSE gnome-terminal-transparency.patch dimmstar@opensuse.org -- Allow gnome-terminal to have transparent windows +Patch100: gnome-terminal-transparency.patch +# PATCH-FEATURE-OPENSSUE gnome-terminal-transparency-fix-for-broken-themes.patch dimstar@opensuse.org -- Ensure the window is always painted +Patch101: gnome-terminal-transparency-fix-for-broken-themes.patch # Needed for search provider. It should not be needed in my opionion, we have to take this up with upstream, or just provide search provider interface definition file as source. BuildRequires: gnome-shell BuildRequires: intltool >= 0.50.0 @@ -79,6 +85,9 @@ arbitrary folders. %lang_package %prep %setup -q +%patch0 -p1 +%patch100 -p1 +%patch101 -p1 translation-update-upstream %build