aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/chat_input/occupants_tab_completer.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-02-14 14:55:59 +0100
committerfiaxh <git@lightrise.org>2022-07-27 20:34:20 +0200
commit7e7dcedaf31ee35499875491c9f569c575d28435 (patch)
tree0c5fee2b28baf320775fbc92b3c252e97d9d054f /main/src/ui/chat_input/occupants_tab_completer.vala
parentf25bfb00969a7e09996da2d5500e6718f4cc0148 (diff)
downloaddino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz
dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip
Port from GTK3 to GTK4
Diffstat (limited to 'main/src/ui/chat_input/occupants_tab_completer.vala')
-rw-r--r--main/src/ui/chat_input/occupants_tab_completer.vala14
1 files changed, 8 insertions, 6 deletions
diff --git a/main/src/ui/chat_input/occupants_tab_completer.vala b/main/src/ui/chat_input/occupants_tab_completer.vala
index 6d2a7434..e50fe831 100644
--- a/main/src/ui/chat_input/occupants_tab_completer.vala
+++ b/main/src/ui/chat_input/occupants_tab_completer.vala
@@ -27,16 +27,18 @@ public class OccupantsTabCompletor {
this.stream_interactor = stream_interactor;
this.text_input = text_input;
- text_input.key_press_event.connect(on_text_input_key_press);
+ var text_input_key_events = new EventControllerKey();
+ text_input_key_events.key_pressed.connect(on_text_input_key_press);
+ text_input.add_controller(text_input_key_events);
}
public void initialize_for_conversation(Conversation conversation) {
this.conversation = conversation;
}
- public bool on_text_input_key_press(EventKey event) {
+ public bool on_text_input_key_press(uint keyval, uint keycode, Gdk.ModifierType state) {
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
- if (event.keyval == Key.Tab || event.keyval == Key.ISO_Left_Tab) {
+ if (keyval == Key.Tab || keyval == Key.ISO_Left_Tab) {
string text = text_input.buffer.text;
int start_index = int.max(text.last_index_of(" "), text.last_index_of("\n")) + 1;
string word = text.substring(start_index);
@@ -51,11 +53,11 @@ public class OccupantsTabCompletor {
index = -1;
}
}
- if (event.keyval != Key.ISO_Group_Shift && active) {
- text_input.buffer.text = next_completion(event.keyval == Key.ISO_Left_Tab);
+ if (keyval != Key.ISO_Group_Shift && active) {
+ text_input.buffer.text = next_completion(keyval == Key.ISO_Left_Tab);
return true;
}
- } else if (event.keyval != Key.Shift_L && active) {
+ } else if (keyval != Key.Shift_L && active) {
active = false;
}
}