Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
e585ce4c by wurstsalat at 2025-01-29T22:38:24+01:00
cfix: MessageInputTextView: Add workaround for grabbing focus on chat switch
Calling GLib.idle_add() for grab_focus creates a loop raising CPU load, so we
simply call it with GLib.timeout_add() as a workaround.
- - - - -
2 changed files:
- gajim/gtk/chat_stack.py
- gajim/gtk/message_input.py
Changes:
=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -239,8 +239,7 @@ def show_chat(self, account: str, jid: JID) -> None:
app.plugin_manager.extension_point("switch_contact",
self._current_contact)
- # TODO GTK4: This creates a loop raising CPU load
- # GLib.idle_add(self._message_action_box.msg_textview.grab_focus)
+ self._message_action_box.msg_textview.grab_focus_delayed()
def _on_primary_clipboard_read_text_finished(
self,
=====================================
gajim/gtk/message_input.py
=====================================
@@ -109,6 +109,10 @@ 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 start_correction(self, message: mod.Message | None = None) -> None:
if message is None:
return
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/e585ce4c036cbd935e23a7ea74fbbd033fecc6f0
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/e585ce4c036cbd935e23a7ea74fbbd033fecc6f0
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]