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


Commits:
2f096eb8 by wurstsalat at 2025-01-30T20:37:20+01:00
cfix: ChatStack: Fix workaround for focusing message input

- - - - -


2 changed files:

- gajim/gtk/chat_stack.py
- gajim/gtk/message_input.py


Changes:

=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -239,7 +239,7 @@ def show_chat(self, account: str, jid: JID) -> None:
 
         app.plugin_manager.extension_point("switch_contact", 
self._current_contact)
 
-        self._message_action_box.msg_textview.grab_focus_delayed()
+        GLib.idle_add(self._message_action_box.msg_textview.grab_focus_delayed)
 
     def _on_primary_clipboard_read_text_finished(
         self,


=====================================
gajim/gtk/message_input.py
=====================================
@@ -109,9 +109,11 @@ def __init__(self, parent: Gtk.Widget) -> None:
     def get_completion_popover(self) -> CompletionPopover:
         return self._completion_popover
 
-    def grab_focus_delayed(self) -> None:
-        # This is a workaround; GLib.idle_add creates a loop raising CPU load
-        GLib.timeout_add(500, self.grab_focus)
+    def grab_focus_delayed(self) -> bool:
+        # Use this function if calling via GLib.idle_add to avoid
+        # creating a loop raising CPU load
+        self.grab_focus()
+        return False
 
     def start_correction(self, message: mod.Message | None = None) -> None:
         if message is None:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/2f096eb83dac394b916aa9e3660d07f0d3c078f1

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


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to