From 488663da30b89f0ea0641f205fd7160077f5d153 Mon Sep 17 00:00:00 2001 From: wurstsalat Date: Tue, 16 Feb 2021 23:57:46 +0100 Subject: ChatControlBase: Add workaround for hscrollbar As soon as a line break occurs in Gtk.TextView with word-char wrapping enabled, a hyphen character is automatically inserted before the line break. This triggers the hscrollbar to show, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2384 --- gajim/chat_control_base.py | 10 ++++++++++ gajim/data/gui/chat_control.ui | 1 - gajim/data/gui/groupchat_control.ui | 1 - 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gajim/chat_control_base.py b/gajim/chat_control_base.py index b48e8a4fb..a8acec6b3 100644 --- a/gajim/chat_control_base.py +++ b/gajim/chat_control_base.py @@ -178,6 +178,16 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper): self.conv_textview.tv.connect('key-press-event', self._on_conv_textview_key_press_event) + # This is a workaround: as soon as a line break occurs in Gtk.TextView + # with word-char wrapping enabled, a hyphen character is automatically + # inserted before the line break. This triggers the hscrollbar to show, + # see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2384 + # Using set_hscroll_policy(Gtk.Scrollable.Policy.NEVER) would cause bad + # performance during resize, and prevent the window from being shrinked + # horizontally under certain conditions (applies to GroupchatControl) + hscrollbar = self.xml.conversation_scrolledwindow.get_hscrollbar() + hscrollbar.hide() + self.xml.conversation_scrolledwindow.add(self.conv_textview.tv) widget = self.xml.conversation_scrolledwindow.get_vadjustment() widget.connect('changed', self.on_conversation_vadjustment_changed) diff --git a/gajim/data/gui/chat_control.ui b/gajim/data/gui/chat_control.ui index 9932a71ae..f47c14190 100644 --- a/gajim/data/gui/chat_control.ui +++ b/gajim/data/gui/chat_control.ui @@ -621,7 +621,6 @@ 60 True - never in False diff --git a/gajim/data/gui/groupchat_control.ui b/gajim/data/gui/groupchat_control.ui index f222953dd..f42f8d2f7 100644 --- a/gajim/data/gui/groupchat_control.ui +++ b/gajim/data/gui/groupchat_control.ui @@ -261,7 +261,6 @@ 60 True True - never in False -- cgit v1.2.3