Use higher level API to focus windows

set_active_tab() already calls present(), no need to call it afterwards
again
This commit is contained in:
Philipp Hörist 2017-12-26 21:43:33 +01:00
parent fd7f302044
commit 23de7d5331
4 changed files with 9 additions and 12 deletions

View File

@ -1767,7 +1767,7 @@ class Interface:
self.roster.draw_contact(jid, account)
if w:
w.set_active_tab(ctrl)
w.window.get_window().focus(Gtk.get_current_event_time())
w.window.present()
# Using isinstance here because we want to catch all derived types
if isinstance(ctrl, ChatControlBase):
tv = ctrl.conv_textview
@ -2145,7 +2145,6 @@ class Interface:
# For JEP-0172
if added_to_roster:
ctrl.user_nick = app.nicks[account]
GLib.idle_add(mw.window.grab_focus)
return ctrl

View File

@ -519,7 +519,7 @@ class SignalObject(dbus.service.Object):
win = app.interface.msg_win_mgr.get_window(jid,
connected_account).window
if win.get_property('visible'):
win.window.focus(Gtk.get_current_event_time())
win.window.present()
return DBUS_BOOLEAN(True)
return DBUS_BOOLEAN(False)
@ -658,9 +658,9 @@ class SignalObject(dbus.service.Object):
win.present()
# preserve the 'steal focus preservation'
if self._is_first():
win.window.focus(Gtk.get_current_event_time())
win.window.present()
else:
win.window.focus(int(time()))
win.window.present_with_time(int(time()))
@dbus.service.method(INTERFACE, in_signature='', out_signature='')
def show_roster(self):
@ -671,9 +671,9 @@ class SignalObject(dbus.service.Object):
win.present()
# preserve the 'steal focus preservation'
if self._is_first():
win.window.focus(Gtk.get_current_event_time())
win.window.present()
else:
win.window.focus(int(time()))
win.window.present_with_time(int(time()))
@dbus.service.method(INTERFACE, in_signature='', out_signature='')
def toggle_ipython(self):

View File

@ -3131,7 +3131,6 @@ class RosterWindow:
if gc_control:
mw = app.interface.msg_win_mgr.get_window(jid, account)
mw.set_active_tab(gc_control)
mw.window.get_window().focus(Gtk.get_current_event_time())
return
ctrl = app.interface.minimized_controls[account][jid]
mw = app.interface.msg_win_mgr.get_window(jid, account)
@ -3145,7 +3144,6 @@ class RosterWindow:
ctrl.on_groupchat_maximize()
mw.new_tab(ctrl)
mw.set_active_tab(ctrl)
mw.window.get_window().focus(Gtk.get_current_event_time())
self.remove_groupchat(jid, account)
def on_edit_account(self, widget, account):

View File

@ -367,7 +367,7 @@ if dbus_support.supported:
win = gajim.interface.msg_win_mgr.get_window(jid,
connected_account).window
if win.get_property('visible'):
win.window.focus()
win.window.present()
return DBUS_BOOLEAN(True)
return DBUS_BOOLEAN(False)
@ -455,9 +455,9 @@ if dbus_support.supported:
win.present()
# preserve the 'steal focus preservation'
if self._is_first():
win.window.focus()
win.window.present()
else:
win.window.focus(long(time()))
win.window.present_with_time(long(time()))
@dbus.service.method(INTERFACE, in_signature='', out_signature='')
def toggle_ipython(self):