From 06646784f3ee11cd17d5eb85b91846005dce128a Mon Sep 17 00:00:00 2001
From: Nico Alt <nicoalt@posteo.org>
Date: Tue, 29 Dec 2020 12:00:00 +0000
Subject: [PATCH] Limit input width just like message texts width

Fixes #70
---
 briar-gtk/briar_gtk/views/private_chat.py |  2 +-
 briar-gtk/data/ui/main_window.ui          | 20 ++++++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/briar-gtk/briar_gtk/views/private_chat.py b/briar-gtk/briar_gtk/views/private_chat.py
index 560e0da..fe5b388 100644
--- a/briar-gtk/briar_gtk/views/private_chat.py
+++ b/briar-gtk/briar_gtk/views/private_chat.py
@@ -89,7 +89,7 @@ class PrivateChatView(Gtk.Overlay):
 
     def _setup_clamp(self):
         clamp = Handy.Clamp.new()
-        clamp.set_maximum_size(800)
+        clamp.set_maximum_size(800)  # same as in main_window.ui
         clamp.set_tightening_threshold(600)
         clamp.set_hexpand(True)
         clamp.set_vexpand(True)
diff --git a/briar-gtk/data/ui/main_window.ui b/briar-gtk/data/ui/main_window.ui
index 73f5177..e10eaa8 100644
--- a/briar-gtk/data/ui/main_window.ui
+++ b/briar-gtk/data/ui/main_window.ui
@@ -114,16 +114,20 @@
                           <object class="GtkBox">
                             <property name="visible">True</property>
                             <child>
-                              <object class="GtkEntry" id="chat_entry">
+                              <object class="HdyClamp">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="placeholder_text" translatable="yes" context="Used in input field in main window">Type Message</property>
-                                <property name="show_emoji_icon">True</property>
+                                <property name="maximum_size">800</property> <!-- Same as in PrivateChatView -->
+                                <property name="tightening_threshold">600</property>
+                                <property name="hexpand">True</property>
+                                <child>
+                                  <object class="GtkEntry" id="chat_entry">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="placeholder_text" translatable="yes" context="Used in input field in main window">Type Message</property>
+                                    <property name="show_emoji_icon">True</property>
+                                  </object>
+                                </child>
                               </object>
-                              <packing>
-                                <property name="expand">True</property>
-                                <property name="fill">True</property>
-                              </packing>
                             </child>
                             <style>
                               <class name="message-input-area" />
-- 
GitLab