Present windows in non-active process #1423

This commit is contained in:
Aleksey Lim 2009-09-29 18:33:13 +00:00
parent 95f065cb9f
commit 8f52b0a8f4
2 changed files with 23 additions and 6 deletions

View File

@ -420,9 +420,7 @@ class Activity(Window, gtk.Container):
def __session_quit_requested_cb(self, session): def __session_quit_requested_cb(self, session):
self._quit_requested = True self._quit_requested = True
if not self._prepare_close(): if self._prepare_close() and not self._updating_jobject:
session.will_quit(self, False)
elif not self._updating_jobject:
session.will_quit(self, True) session.will_quit(self, True)
def __session_quit_cb(self, client): def __session_quit_cb(self, client):
@ -649,7 +647,7 @@ class Activity(Window, gtk.Container):
logging.debug('Failed to join activity: %s', err) logging.debug('Failed to join activity: %s', err)
return return
self.present() self.reveal()
self.emit('joined') self.emit('joined')
self.__privacy_changed_cb(self.shared_activity, None) self.__privacy_changed_cb(self.shared_activity, None)
@ -749,12 +747,16 @@ class Activity(Window, gtk.Container):
self.add_alert(alert) self.add_alert(alert)
alert.connect('response', self._keep_failed_dialog_response_cb) alert.connect('response', self._keep_failed_dialog_response_cb)
self.present() self.reveal()
def _keep_failed_dialog_response_cb(self, alert, response_id): def _keep_failed_dialog_response_cb(self, alert, response_id):
self.remove_alert(alert) self.remove_alert(alert)
if response_id == gtk.RESPONSE_OK: if response_id == gtk.RESPONSE_OK:
self.close(skip_save=True) self.close(skip_save=True)
if self._quit_requested:
self._session.will_quit(self, True)
elif self._quit_requested:
self._session.will_quit(self, False)
def can_close(self): def can_close(self):
"""Activities should override this function if they want to perform """Activities should override this function if they want to perform
@ -809,7 +811,7 @@ class Activity(Window, gtk.Container):
title_alert = NamingAlert(self, get_bundle_path()) title_alert = NamingAlert(self, get_bundle_path())
title_alert.set_transient_for(self.get_toplevel()) title_alert.set_transient_for(self.get_toplevel())
title_alert.show() title_alert.show()
self.present() self.reveal()
def __realize_cb(self, window): def __realize_cb(self, window):
wm.set_bundle_id(window.window, self.get_bundle_id()) wm.set_bundle_id(window.window, self.get_bundle_id())

View File

@ -118,6 +118,21 @@ class Window(gtk.Window):
self.__unfullscreen_button_pressed) self.__unfullscreen_button_pressed)
self._unfullscreen_button_timeout_id = None self._unfullscreen_button_timeout_id = None
def reveal(self):
""" Make window active
In contrast with present(), brings window to the top
even after invoking on response on non-gtk events.
See #1423.
"""
if self.window is None:
self.show()
return
timestamp = gtk.get_current_event_time()
if not timestamp:
timestamp = gtk.gdk.x11_get_server_time(self.window)
self.window.focus(timestamp)
def fullscreen(self): def fullscreen(self):
palettegroup.popdown_all() palettegroup.popdown_all()
if self._toolbar_box is not None: if self._toolbar_box is not None: