FreeBSD Bugzilla – Attachment 189719 Details for
Bug 225165
x11/gnome-terminal: patch to restore transparency
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to restore transparency
patch-transparency (text/plain), 20.74 KB, created by
Ben
on 2018-01-14 20:01:34 UTC
(
hide
)
Description:
patch to restore transparency
Filename:
MIME Type:
Creator:
Ben
Created:
2018-01-14 20:01:34 UTC
Size:
20.74 KB
patch
obsolete
>From a73d915e0df7d3010494255de251368b631170e8 Mon Sep 17 00:00:00 2001 >From: Debarshi Ray <debarshir@gnome.org> >Date: Mon, 12 May 2014 14:57:18 +0200 >Subject: [PATCH 01/14] 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. > >The transparency checkbox lost its mnemonic accelerator because 't' >is already taken and using any other letter would make it hard to >restore the translations of the string. >--- > src/org.gnome.Terminal.gschema.xml | 10 ++++++++ > src/profile-editor.c | 11 +++++++++ > src/profile-preferences.ui | 47 ++++++++++++++++++++++++++++++++++++++ > src/terminal-schemas.h | 3 +++ > src/terminal-screen.c | 22 +++++++++++++++++- > src/terminal-window.c | 7 ++++++ > 6 files changed, 99 insertions(+), 1 deletion(-) > >diff --git src/org.gnome.Terminal.gschema.xml.orig src/org.gnome.Terminal.gschema.xml >index c68512b3f8f8..1b0121b8b85a 100644 >--- src/org.gnome.Terminal.gschema.xml.orig >+++ src/org.gnome.Terminal.gschema.xml >@@ -370,6 +370,16 @@ > <default>'narrow'</default> > <summary>Whether ambiguous-width characters are narrow or wide when using UTF-8 encoding</summary> > </key> >+ <key name="use-transparent-background" type="b"> >+ <default>false</default> >+ <summary>Whether to use a transparent background</summary> >+ </key> >+ <key name="background-transparency-percent" type="i"> >+ <default>50</default> >+ <range min="0" max="100"/> >+ <summary>Adjust the amount of transparency</summary> >+ <description>A value between 0 and 100, where 0 is opaque and 100 is fully transparent.</description> >+ </key> > </schema> > > <!-- Keybinding settings --> >diff --git src/profile-editor.c.orig src/profile-editor.c >index 002561d77dcb..9b8a35c6b859 100644 >--- src/profile-editor.c.orig >+++ src/profile-editor.c >@@ -1215,7 +1215,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"), >+ "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 src/profile-preferences.ui.orig src/profile-preferences.ui >index 5adcb5317e01..e1cb3470d0ee 100644 >--- src/profile-preferences.ui.orig >+++ src/profile-preferences.ui >@@ -23,6 +23,11 @@ > <property name="step_increment">1</property> > <property name="page_increment">100</property> > </object> >+ <object class="GtkAdjustment" id="background-transparent-adjustment"> >+ <property name="upper">100</property> >+ <property name="step_increment">1</property> >+ <property name="page_increment">10</property> >+ </object> > <object class="GtkListStore" id="cjk-ambiguous-width-model"> > <columns> > <!-- column-name gchararray --> >@@ -1036,6 +1041,48 @@ > <property name="position">1</property> > </packing> > </child> >+ <child> >+ <object class="GtkBox" id="use-transparent-background-box"> >+ <property name="visible">True</property> >+ <property name="can_focus">False</property> >+ <property name="orientation">horizontal</property> >+ <property name="spacing">12</property> >+ <child> >+ <object class="GtkCheckButton" id="use-transparent-background"> >+ <property name="label" translatable="yes">Transparent background</property> >+ <property name="visible">True</property> >+ <property name="can_focus">True</property> >+ <property name="receives_default">False</property> >+ <property name="use_underline">True</property> >+ <property name="xalign">0</property> >+ <property name="draw_indicator">True</property> >+ </object> >+ <packing> >+ <property name="expand">False</property> >+ <property name="fill">False</property> >+ <property name="position">0</property> >+ </packing> >+ </child> >+ <child> >+ <object class="GtkScale" id="background-transparent-scale"> >+ <property name="visible">True</property> >+ <property name="can_focus">True</property> >+ <property name="adjustment">background-transparent-adjustment</property> >+ <property name="draw_value">False</property> >+ </object> >+ <packing> >+ <property name="expand">True</property> >+ <property name="fill">True</property> >+ <property name="position">1</property> >+ </packing> >+ </child> >+ </object> >+ <packing> >+ <property name="expand">True</property> >+ <property name="fill">True</property> >+ <property name="position">2</property> >+ </packing> >+ </child> > </object> > </child> > </object> >diff --git src/terminal-schemas.h.orig src/terminal-schemas.h >index 4b734a3961d1..e434075d86af 100644 >--- src/terminal-schemas.h.orig >+++ src/terminal-schemas.h >@@ -69,6 +69,9 @@ G_BEGIN_DECLS > #define TERMINAL_PROFILE_VISIBLE_NAME_KEY "visible-name" > #define TERMINAL_PROFILE_WORD_CHAR_EXCEPTIONS_KEY "word-char-exceptions" > >+#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_ENABLE_MENU_BAR_ACCEL_KEY "menu-accelerator-enabled" >diff --git src/terminal-screen.c.orig src/terminal-screen.c >index 63f0ca28227c..6209dee51312 100644 >--- src/terminal-screen.c.orig >+++ src/terminal-screen.c >@@ -829,7 +829,9 @@ terminal_screen_profile_changed_cb (GSettings *profile, > prop_name == I_(TERMINAL_PROFILE_HIGHLIGHT_COLORS_SET_KEY) || > prop_name == I_(TERMINAL_PROFILE_HIGHLIGHT_BACKGROUND_COLOR_KEY) || > prop_name == I_(TERMINAL_PROFILE_HIGHLIGHT_FOREGROUND_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)) >@@ -899,6 +901,8 @@ update_color_scheme (TerminalScreen *screen) > GdkRGBA *cursor_bgp = NULL, *cursor_fgp = NULL; > GdkRGBA *highlight_bgp = NULL, *highlight_fgp = NULL; > GtkStyleContext *context; >+ GtkWidget *toplevel; >+ gboolean transparent; > gboolean use_theme_colors; > > context = gtk_widget_get_style_context (widget); >@@ -940,6 +944,18 @@ update_color_scheme (TerminalScreen *screen) > } > > 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); >@@ -947,6 +963,10 @@ update_color_scheme (TerminalScreen *screen) > vte_terminal_set_color_cursor_foreground (VTE_TERMINAL (screen), cursor_fgp); > vte_terminal_set_color_highlight (VTE_TERMINAL (screen), highlight_bgp); > vte_terminal_set_color_highlight_foreground (VTE_TERMINAL (screen), highlight_fgp); >+ >+ 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 src/terminal-window.c.orig src/terminal-window.c >index 2921c025596c..c41a73231bf4 100644 >--- src/terminal-window.c.orig >+++ src/terminal-window.c >@@ -2621,6 +2621,8 @@ terminal_window_init (TerminalWindow *window) > TerminalWindowPrivate *priv; > TerminalApp *app; > TerminalSettingsList *profiles_list; >+ GdkScreen *screen; >+ GdkVisual *visual; > GSettings *gtk_debug_settings; > GtkActionGroup *action_group; > GtkAction *action; >@@ -2637,6 +2639,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); >-- >2.12.2 > > >From a48b1ea301b01a00311718b21ab1fdd51207c6ec Mon Sep 17 00:00:00 2001 >From: Lars Uebernickel <lars.uebernickel@canonical.com> >Date: Wed, 28 May 2014 14:11:02 +0200 >Subject: [PATCH 02/14] 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 src/terminal-window.c.orig src/terminal-window.c >index c41a73231bf4..fb64fa89b3cc 100644 >--- src/terminal-window.c.orig >+++ src/terminal-window.c >@@ -2295,6 +2295,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) > { >@@ -2832,6 +2852,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; >-- >2.12.2 > > >From 45ecb5a45a66ca9ab372eb7b5e638e8b165aa0db Mon Sep 17 00:00:00 2001 >From: "Owen W. Taylor" <otaylor@fishsoup.net> >Date: Fri, 13 Nov 2015 15:16:42 +0100 >Subject: [PATCH 03/14] screen, window: Extra padding around transparent > terminals in Wayland > >https://bugzilla.redhat.com/show_bug.cgi?id=1207943 >--- > src/terminal-screen.c | 40 +++++++++++++++++++++++++++++++++++++--- > src/terminal-window.c | 18 ++++++++++++------ > 2 files changed, 49 insertions(+), 9 deletions(-) > >diff --git src/terminal-screen.c.orig src/terminal-screen.c >index 6209dee51312..043a7ae9c4b2 100644 >--- src/terminal-screen.c.orig >+++ src/terminal-screen.c >@@ -139,6 +139,8 @@ static void terminal_screen_system_font_changed_cb (GSettings *, > 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_do_exec (TerminalScreen *screen, > FDSetupData *data, > GError **error); >@@ -484,6 +486,7 @@ terminal_screen_class_init (TerminalScreenClass *klass) > 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; > >@@ -887,6 +890,32 @@ terminal_screen_profile_changed_cb (GSettings *profile, > } > > 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; >+ >+ 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); >@@ -964,9 +993,7 @@ update_color_scheme (TerminalScreen *screen) > vte_terminal_set_color_highlight (VTE_TERMINAL (screen), highlight_bgp); > vte_terminal_set_color_highlight_foreground (VTE_TERMINAL (screen), highlight_fgp); > >- 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 >@@ -1585,6 +1612,13 @@ terminal_screen_do_popup (TerminalScreen *screen, > terminal_screen_popup_info_unref (info); > } > >+static void >+terminal_screen_hierarchy_changed (GtkWidget *widget, >+ GtkWidget *previous_toplevel) >+{ >+ update_toplevel_transparency (TERMINAL_SCREEN (widget)); >+} >+ > static gboolean > terminal_screen_button_press (GtkWidget *widget, > GdkEventButton *event) >diff --git src/terminal-window.c.orig src/terminal-window.c >index fb64fa89b3cc..f1b1c7d1038d 100644 >--- src/terminal-window.c.orig >+++ src/terminal-window.c >@@ -2300,15 +2300,21 @@ terminal_window_draw (GtkWidget *widget, > { > if (gtk_widget_get_app_paintable (widget)) > { >+ GtkAllocation child_allocation; > GtkStyleContext *context; >- int width; >- int height; >+ GtkWidget *child; >+ >+ /* Get the *child* allocation, so we don't overwrite window borders */ >+ child = gtk_bin_get_child (GTK_BIN (widget)); >+ 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); >-- >2.12.2 > > >From 89d16875f224dccd798eee978b1bc17eef77b281 Mon Sep 17 00:00:00 2001 >From: Debarshi Ray <debarshir@gnome.org> >Date: Mon, 27 Feb 2017 16:53:51 +0100 >Subject: [PATCH 04/14] screen: Silence -Wunused variable > >https://bugzilla.redhat.com/show_bug.cgi?id=1207943 >--- > src/terminal-screen.c | 1 - > 1 file changed, 1 deletion(-) > >diff --git src/terminal-screen.c.orig src/terminal-screen.c >index 043a7ae9c4b2..dac1663a24ec 100644 >--- src/terminal-screen.c.orig >+++ src/terminal-screen.c >@@ -930,7 +930,6 @@ update_color_scheme (TerminalScreen *screen) > GdkRGBA *cursor_bgp = NULL, *cursor_fgp = NULL; > GdkRGBA *highlight_bgp = NULL, *highlight_fgp = NULL; > GtkStyleContext *context; >- GtkWidget *toplevel; > gboolean transparent; > gboolean use_theme_colors; > >-- >2.12.2 > > >+terminal_screen_notification_received (VteTerminal *terminal, >+ const char *summary, >+ const char *body) >+{ >+ TerminalScreen *screen = TERMINAL_SCREEN (terminal); >+ TerminalScreenPrivate *priv = screen->priv; >+ TerminalWindow *window; >+ >+ if (G_UNLIKELY (!priv->shell_prompt_shown)) >+ { >+ priv->shell_prompt_shown = TRUE; >+ return; >+ } >+ >+ window = terminal_screen_get_window (screen); >+ if (window == NULL) >+ return; >+ >+ if (gtk_window_is_active (GTK_WINDOW (window))) >+ { >+ GtkWidget *mdi_container; >+ TerminalScreenContainer *screen_container; >+ >+ if (screen == terminal_window_get_active (window)) >+ return; >+ >+ screen_container = terminal_screen_container_get_from_screen (screen); >+ if (screen_container == NULL) >+ return; >+ >+ mdi_container = terminal_window_get_mdi_container (window); >+ /* FIXME: add interface method to retrieve tab label */ >+ if (GTK_IS_NOTEBOOK (mdi_container)) >+ { >+ GtkWidget *tab_label; >+ >+ tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (mdi_container), GTK_WIDGET (screen_container)); >+ terminal_tab_label_set_bold (TERMINAL_TAB_LABEL (tab_label), TRUE); >+ terminal_tab_label_set_icon (TERMINAL_TAB_LABEL (tab_label), "dialog-information-symbolic", summary); >+ } >+ } >+ else >+ { >+ gs_unref_object GNotification *notification = NULL; >+ TerminalApp *app; >+ gs_free char *detailed_action = NULL; >+ >+ notification = g_notification_new (summary); >+ g_notification_set_body (notification, body); >+ detailed_action = g_strdup_printf ("app.activate-tab::%s", priv->uuid); >+ g_notification_set_default_action (notification, detailed_action); >+ >+ app = terminal_app_get (); >+ g_application_send_notification (G_APPLICATION (app), priv->uuid, notification); >+ } >+} >+ >+static void > terminal_screen_drag_data_received (GtkWidget *widget, > GdkDragContext *context, > gint x, >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 225165
: 189719