From a19f4b8c80d37f0940a6d7a0ba127ec9740cd6db Mon Sep 17 00:00:00 2001
From: Wolfgang Müller
Date: Fri, 18 Jun 2021 16:15:04 +0200
Subject: Use GtkBox and GtkScrollbar instead of GtkScrolledWindow
Upstream indicates that VTE is incompatible with GtkScrolledWindow.
See [1] and [2] for more information.
This commit contains a proof-of-concept implementation of an alternative
solution using a GtkBox as the toplevel element.
[1] https://gitlab.gnome.org/GNOME/vte/issues/11#note_264921
[2] https://bugzilla.gnome.org/show_bug.cgi?id=733210#c2
---
terminal.ui | 248 +++++++++++++++++++++++++++++++---------------------------
terminal.vala | 16 +---
2 files changed, 135 insertions(+), 129 deletions(-)
diff --git a/terminal.ui b/terminal.ui
index c22fbec..bf3d8de 100644
--- a/terminal.ui
+++ b/terminal.ui
@@ -116,15 +116,13 @@
False
go-up-symbolic
-
+
True
False
-
-
-
- True
- False
- end
- end
- slide-up
-
-
+
+
True
False
- 5
- 5
- 5
- 5
- 2
+ end
+ end
+ slide-up
-
+
True
- True
- edit-find-symbolic
- False
- False
- Search...
-
-
-
-
-
-
+ False
+ 5
+ 5
+ 5
+ 5
+ 2
+
+
+ True
+ True
+ edit-find-symbolic
+ False
+ False
+ Search...
+
+
+
+
+
+
+
+
+ True
+ True
+ 0
+
+
+
+
+ True
+ True
+ True
+ Go to next result
+ search_image_down
+ True
+
+
+
+ False
+ True
+ 1
+
+
+
+
+ True
+ True
+ True
+ Go to previous result
+ search_image_up
+ True
+
+
+
+ False
+ True
+ end
+ 2
+
+
-
- True
- True
- 0
-
-
-
- True
- True
- True
- Go to next result
- search_image_down
- True
-
+
+
+ 1
+
+
+
+
+ True
+ False
+ end
+ True
+ False
+
+
+
+
+ False
+ 6
+ end
+
+
+
False
- True
- 1
+ False
+ 0
-
-
- True
- True
- True
- Go to previous result
- search_image_up
- True
-
+
+
+ False
+ 16
+
+
+ True
+ False
+ Sample Error Message
+ True
+ True
+
+
+ False
+ True
+ 0
+
+
False
- True
+ False
end
- 2
+ 0
+
+
+
+
+ 2
+
- 1
+ True
+ True
+ 0
-
-
+
+
True
False
- end
- True
- False
-
-
-
-
- False
- 6
- end
-
-
-
-
-
- False
- False
- 0
-
-
-
-
- False
- 16
-
-
- True
- False
- Sample Error Message
- True
- True
-
-
- False
- True
- 0
-
-
-
-
- False
- False
- end
- 0
-
-
-
-
-
+ True
+ vertical
- 2
+ False
+ True
+ 1
diff --git a/terminal.vala b/terminal.vala
index d66fc51..69ae02e 100644
--- a/terminal.vala
+++ b/terminal.vala
@@ -1,5 +1,5 @@
[GtkTemplate (ui = "/weltschmerz/ui/terminal.ui")]
-class Terminal : Gtk.Overlay {
+class Terminal : Gtk.Box {
const string URL_REGEX = """(?>https?|ftp):\/\/[^\s\$.?#].(?>[^\s()"]*|\([^\s]*\)|"[^\s"]*")""";
const uint PCRE2_CASELESS = 0x00000008u;
const uint PCRE2_MULTILINE = 0x00000400u;
@@ -30,8 +30,8 @@ class Terminal : Gtk.Overlay {
[GtkChild] unowned Gtk.MenuItem copy_item_html;
[GtkChild] unowned Gtk.MenuItem open_directory_item;
[GtkChild] unowned Gtk.Revealer search_revealer;
- [GtkChild] unowned Gtk.ScrolledWindow scrolled_window;
[GtkChild] unowned Gtk.SearchEntry search_entry;
+ [GtkChild] unowned Gtk.Scrollbar scroll;
[GtkChild] unowned Vte.Terminal vte;
Gtk.Clipboard clipboard;
Gtk.Settings settings;
@@ -82,20 +82,10 @@ class Terminal : Gtk.Overlay {
}
}
- Gtk.PolicyType get_scrollbar_policy(bool want_scrollbar) {
- if (!want_scrollbar)
- return Gtk.PolicyType.NEVER;
-
- if (!settings.gtk_overlay_scrolling || overlay_scrolling_env_override)
- return Gtk.PolicyType.ALWAYS;
-
- return Gtk.PolicyType.AUTOMATIC;
- }
-
public void load_config(bool reload) {
var conf = new Config();
- scrolled_window.set_policy(Gtk.PolicyType.NEVER, get_scrollbar_policy(conf.scrollbar));
+ scroll.set_adjustment(vte.get_vadjustment());
vte.set_font(conf.font);
var char_width = (int)vte.get_char_width();
--
cgit v1.2.3-2-gb3c3