Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
8031e049 by wurstsalat at 2021-02-16T23:58:00+01:00
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

- - - - -


3 changed files:

- gajim/chat_control_base.py
- gajim/data/gui/chat_control.ui
- gajim/data/gui/groupchat_control.ui


Changes:

=====================================
gajim/chat_control_base.py
=====================================
@@ -178,6 +178,16 @@ def __init__(self, parent_win, widget_name, contact, acct,
         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)


=====================================
gajim/data/gui/chat_control.ui
=====================================
@@ -621,7 +621,6 @@
                   <object class="GtkScrolledWindow" 
id="conversation_scrolledwindow">
                     <property name="height_request">60</property>
                     <property name="can_focus">True</property>
-                    <property name="hscrollbar_policy">never</property>
                     <property name="shadow_type">in</property>
                     <property name="overlay_scrolling">False</property>
                     <signal name="edge-reached" handler="_on_edge_reached" 
swapped="no"/>


=====================================
gajim/data/gui/groupchat_control.ui
=====================================
@@ -261,7 +261,6 @@
                         <property name="height_request">60</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">never</property>
                         <property name="shadow_type">in</property>
                         <property name="overlay_scrolling">False</property>
                         <signal name="edge-reached" handler="_on_edge_reached" 
swapped="no"/>



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/8031e049a943219a69b7db906046a9c9e3e522fe

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/8031e049a943219a69b7db906046a9c9e3e522fe
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to