Philipp Hörist pushed to branch master at gajim / gajim

Commits:

6 changed files:

Changes:

  • gajim/dialogs.py
    ... ... @@ -2776,6 +2776,7 @@ class StartChatDialog(Gtk.ApplicationWindow):
    2776 2776
             self.set_show_menubar(False)
    
    2777 2777
             self.set_title(_('Start new Conversation'))
    
    2778 2778
             self.set_default_size(-1, 400)
    
    2779
    +        self.ready_to_destroy = False
    
    2779 2780
     
    
    2780 2781
             self.builder = gtkgui_helpers.get_gtk_builder(
    
    2781 2782
                 'start_chat_dialog.ui')
    
    ... ... @@ -2891,7 +2892,7 @@ class StartChatDialog(Gtk.ApplicationWindow):
    2891 2892
             else:
    
    2892 2893
                 app.interface.new_chat_from_jid(row.account, row.jid)
    
    2893 2894
     
    
    2894
    -        self.destroy()
    
    2895
    +        self.ready_to_destroy = True
    
    2895 2896
     
    
    2896 2897
         def _on_search_changed(self, entry):
    
    2897 2898
             search_text = entry.get_text()
    

  • gajim/gui_interface.py
    ... ... @@ -1767,7 +1767,7 @@ class Interface:
    1767 1767
                 self.roster.draw_contact(jid, account)
    
    1768 1768
             if w:
    
    1769 1769
                 w.set_active_tab(ctrl)
    
    1770
    -            w.window.get_window().focus(Gtk.get_current_event_time())
    
    1770
    +            w.window.present()
    
    1771 1771
                 # Using isinstance here because we want to catch all derived types
    
    1772 1772
                 if isinstance(ctrl, ChatControlBase):
    
    1773 1773
                     tv = ctrl.conv_textview
    
    ... ... @@ -2145,7 +2145,6 @@ class Interface:
    2145 2145
             # For JEP-0172
    
    2146 2146
             if added_to_roster:
    
    2147 2147
                 ctrl.user_nick = app.nicks[account]
    
    2148
    -        GLib.idle_add(mw.window.grab_focus)
    
    2149 2148
     
    
    2150 2149
             return ctrl
    
    2151 2150
     
    

  • gajim/message_window.py
    ... ... @@ -204,6 +204,14 @@ class MessageWindow(object):
    204 204
             gtkgui_helpers.resize_window(self.window, width, height)
    
    205 205
     
    
    206 206
         def _on_window_focus(self, widget, event):
    
    207
    +        # on destroy() the window that was last focused gets the focus
    
    208
    +        # again. if destroy() is called from the StartChat Dialog, this
    
    209
    +        # Window is not yet focused, because present() seems to be asynchron
    
    210
    +        # at least on KDE, and takes time.
    
    211
    +        if 'start_chat' in app.interface.instances:
    
    212
    +            if app.interface.instances['start_chat'].ready_to_destroy:
    
    213
    +                app.interface.instances['start_chat'].destroy()
    
    214
    +
    
    207 215
             # window received focus, so if we had urgency REMOVE IT
    
    208 216
             # NOTE: we do not have to read the message (it maybe in a bg tab)
    
    209 217
             # to remove urgency hint so this functions does that
    

  • gajim/remote_control.py
    ... ... @@ -519,7 +519,7 @@ class SignalObject(dbus.service.Object):
    519 519
                 win = app.interface.msg_win_mgr.get_window(jid,
    
    520 520
                         connected_account).window
    
    521 521
                 if win.get_property('visible'):
    
    522
    -                win.window.focus(Gtk.get_current_event_time())
    
    522
    +                win.window.present()
    
    523 523
                 return DBUS_BOOLEAN(True)
    
    524 524
             return DBUS_BOOLEAN(False)
    
    525 525
     
    
    ... ... @@ -658,9 +658,9 @@ class SignalObject(dbus.service.Object):
    658 658
                 win.present()
    
    659 659
                 # preserve the 'steal focus preservation'
    
    660 660
                 if self._is_first():
    
    661
    -                win.window.focus(Gtk.get_current_event_time())
    
    661
    +                win.window.present()
    
    662 662
                 else:
    
    663
    -                win.window.focus(int(time()))
    
    663
    +                win.window.present_with_time(int(time()))
    
    664 664
     
    
    665 665
         @dbus.service.method(INTERFACE, in_signature='', out_signature='')
    
    666 666
         def show_roster(self):
    
    ... ... @@ -671,9 +671,9 @@ class SignalObject(dbus.service.Object):
    671 671
             win.present()
    
    672 672
             # preserve the 'steal focus preservation'
    
    673 673
             if self._is_first():
    
    674
    -            win.window.focus(Gtk.get_current_event_time())
    
    674
    +            win.window.present()
    
    675 675
             else:
    
    676
    -            win.window.focus(int(time()))
    
    676
    +            win.window.present_with_time(int(time()))
    
    677 677
     
    
    678 678
         @dbus.service.method(INTERFACE, in_signature='', out_signature='')
    
    679 679
         def toggle_ipython(self):
    

  • gajim/roster_window.py
    ... ... @@ -3131,7 +3131,6 @@ class RosterWindow:
    3131 3131
                 if gc_control:
    
    3132 3132
                     mw = app.interface.msg_win_mgr.get_window(jid, account)
    
    3133 3133
                     mw.set_active_tab(gc_control)
    
    3134
    -                mw.window.get_window().focus(Gtk.get_current_event_time())
    
    3135 3134
                 return
    
    3136 3135
             ctrl = app.interface.minimized_controls[account][jid]
    
    3137 3136
             mw = app.interface.msg_win_mgr.get_window(jid, account)
    
    ... ... @@ -3145,7 +3144,6 @@ class RosterWindow:
    3145 3144
             ctrl.on_groupchat_maximize()
    
    3146 3145
             mw.new_tab(ctrl)
    
    3147 3146
             mw.set_active_tab(ctrl)
    
    3148
    -        mw.window.get_window().focus(Gtk.get_current_event_time())
    
    3149 3147
             self.remove_groupchat(jid, account)
    
    3150 3148
     
    
    3151 3149
         def on_edit_account(self, widget, account):
    

  • plugins/dbus_plugin/plugin.py
    ... ... @@ -367,7 +367,7 @@ if dbus_support.supported:
    367 367
                         win = gajim.interface.msg_win_mgr.get_window(jid,
    
    368 368
                                 connected_account).window
    
    369 369
                         if win.get_property('visible'):
    
    370
    -                        win.window.focus()
    
    370
    +                        win.window.present()
    
    371 371
                         return DBUS_BOOLEAN(True)
    
    372 372
                     return DBUS_BOOLEAN(False)
    
    373 373
     
    
    ... ... @@ -455,9 +455,9 @@ if dbus_support.supported:
    455 455
                         win.present()
    
    456 456
                         # preserve the 'steal focus preservation'
    
    457 457
                         if self._is_first():
    
    458
    -                        win.window.focus()
    
    458
    +                        win.window.present()
    
    459 459
                         else:
    
    460
    -                        win.window.focus(long(time()))
    
    460
    +                        win.window.present_with_time(long(time()))
    
    461 461
     
    
    462 462
                 @dbus.service.method(INTERFACE, in_signature='', out_signature='')
    
    463 463
                 def toggle_ipython(self):