diff options
author | fiaxh <git@lightrise.org> | 2019-09-09 19:47:11 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-09-09 19:47:11 +0200 |
commit | 9950742bf1903291c271619aea101b0e2f81d19c (patch) | |
tree | 49550030dd678a52adce9a0de81688cf95b4dfcb /main/src/ui/unified_window.vala | |
parent | ecb3e783b9fde0fc6164a8058531b0be54eb7ef0 (diff) | |
download | dino-9950742bf1903291c271619aea101b0e2f81d19c.tar.gz dino-9950742bf1903291c271619aea101b0e2f81d19c.zip |
Add emoji button to chat input
Diffstat (limited to 'main/src/ui/unified_window.vala')
-rw-r--r-- | main/src/ui/unified_window.vala | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala index e48d4667..fb973a58 100644 --- a/main/src/ui/unified_window.vala +++ b/main/src/ui/unified_window.vala @@ -71,21 +71,9 @@ public class UnifiedWindow : Gtk.Window { paned = (Paned) builder.get_object("paned"); box.add(paned); chat_input = ((ChatInput.View) builder.get_object("chat_input")).init(stream_interactor); + chat_input.key_press_event.connect(forward_key_press_to_chat_input); conversation_frame = ((ConversationSummary.ConversationView) builder.get_object("conversation_frame")).init(stream_interactor); - conversation_frame.key_press_event.connect((event) => { - // Don't forward / change focus on Control / Alt - if (event.keyval == Gdk.Key.Control_L || event.keyval == Gdk.Key.Control_R || - event.keyval == Gdk.Key.Alt_L || event.keyval == Gdk.Key.Alt_R) { - return false; - } - // Don't forward / change focus on Control + ... - if ((event.state & ModifierType.CONTROL_MASK) > 0) { - return false; - } - chat_input.text_input.key_press_event(event); - chat_input.text_input.grab_focus(); - return true; - }); + conversation_frame.key_press_event.connect(forward_key_press_to_chat_input); conversation_selector = ((ConversationSelector) builder.get_object("conversation_list")).init(stream_interactor); goto_end_revealer = (Revealer) builder.get_object("goto_end_revealer"); goto_end_button = (Button) builder.get_object("goto_end_button"); @@ -124,6 +112,7 @@ public class UnifiedWindow : Gtk.Window { box.add(headerbar_paned); } + headerbar_paned.key_press_event.connect(forward_key_press_to_chat_input); } private void setup_stack() { @@ -158,6 +147,21 @@ public class UnifiedWindow : Gtk.Window { } } + private bool forward_key_press_to_chat_input(EventKey event) { + // Don't forward / change focus on Control / Alt + if (event.keyval == Gdk.Key.Control_L || event.keyval == Gdk.Key.Control_R || + event.keyval == Gdk.Key.Alt_L || event.keyval == Gdk.Key.Alt_R) { + return false; + } + // Don't forward / change focus on Control + ... + if ((event.state & ModifierType.CONTROL_MASK) > 0) { + return false; + } + chat_input.text_input.key_press_event(event); + chat_input.text_input.grab_focus(); + return true; + } + public void loop_conversations(bool backwards) { conversation_selector.loop_conversations(backwards); } |