diff --git a/gajim/dialogs.py b/gajim/dialogs.py index a0d2a27d7..e89a46628 100644 --- a/gajim/dialogs.py +++ b/gajim/dialogs.py @@ -2776,6 +2776,7 @@ class StartChatDialog(Gtk.ApplicationWindow): self.set_show_menubar(False) self.set_title(_('Start new Conversation')) self.set_default_size(-1, 400) + self.ready_to_destroy = False self.builder = gtkgui_helpers.get_gtk_builder( 'start_chat_dialog.ui') @@ -2891,7 +2892,7 @@ class StartChatDialog(Gtk.ApplicationWindow): else: app.interface.new_chat_from_jid(row.account, row.jid) - self.destroy() + self.ready_to_destroy = True def _on_search_changed(self, entry): search_text = entry.get_text() diff --git a/gajim/message_window.py b/gajim/message_window.py index c043a05c0..6a13b57bf 100644 --- a/gajim/message_window.py +++ b/gajim/message_window.py @@ -204,6 +204,14 @@ class MessageWindow(object): gtkgui_helpers.resize_window(self.window, width, height) def _on_window_focus(self, widget, event): + # on destroy() the window that was last focused gets the focus + # again. if destroy() is called from the StartChat Dialog, this + # Window is not yet focused, because present() seems to be asynchron + # at least on KDE, and takes time. + if 'start_chat' in app.interface.instances: + if app.interface.instances['start_chat'].ready_to_destroy: + app.interface.instances['start_chat'].destroy() + # window received focus, so if we had urgency REMOVE IT # NOTE: we do not have to read the message (it maybe in a bg tab) # to remove urgency hint so this functions does that