aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/unified_window.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-04-15 17:29:18 +0200
committerfiaxh <git@lightrise.org>2019-04-15 17:29:18 +0200
commitca9b00d5e8e494ec46bc28259a104ade3adaa40c (patch)
tree4a215ea997b0454866c5390801ede9d902009b34 /main/src/ui/unified_window.vala
parent76c7dec75f052cfaf9c3b469ba9d658a71075b6b (diff)
downloaddino-ca9b00d5e8e494ec46bc28259a104ade3adaa40c.tar.gz
dino-ca9b00d5e8e494ec46bc28259a104ade3adaa40c.zip
Forward KeyEvent (and change focus) on key press in conversation view (not chat input)
fixes #28 fixes #513
Diffstat (limited to 'main/src/ui/unified_window.vala')
-rw-r--r--main/src/ui/unified_window.vala14
1 files changed, 14 insertions, 0 deletions
diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala
index 3e8c75e9..e48d4667 100644
--- a/main/src/ui/unified_window.vala
+++ b/main/src/ui/unified_window.vala
@@ -72,6 +72,20 @@ public class UnifiedWindow : Gtk.Window {
box.add(paned);
chat_input = ((ChatInput.View) builder.get_object("chat_input")).init(stream_interactor);
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_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");