Ticket #1423: sugar-1423.patch

File sugar-1423.patch, 2.4 KB (added by alsroot, 12 years ago)
  • src/sugar/activity/activity.py

    From 02bcfa6c675347ef5e26fe3a219c3c868a95924f Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Thu, 24 Sep 2009 14:18:03 +0000
    Subject: Present windows in non-active process #1423
    
    ---
     src/sugar/activity/activity.py |    6 +++---
     src/sugar/graphics/window.py   |   15 +++++++++++++++
     2 files changed, 18 insertions(+), 3 deletions(-)
    
    diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
    index f483774..d4892d0 100644
    a b class Activity(Window, gtk.Container): 
    647647            logging.debug('Failed to join activity: %s', err)
    648648            return
    649649
    650         self.present()
     650        self.reveal()
    651651        self.emit('joined')
    652652        self.__privacy_changed_cb(self.shared_activity, None)
    653653
    class Activity(Window, gtk.Container): 
    747747        self.add_alert(alert)
    748748        alert.connect('response', self._keep_failed_dialog_response_cb)
    749749
    750         self.present()
     750        self.reveal()
    751751
    752752    def _keep_failed_dialog_response_cb(self, alert, response_id):
    753753        self.remove_alert(alert)
    class Activity(Window, gtk.Container): 
    811811            title_alert = NamingAlert(self, get_bundle_path())
    812812            title_alert.set_transient_for(self.get_toplevel())
    813813            title_alert.show()
    814             self.present()
     814            self.reveal()
    815815
    816816    def __realize_cb(self, window):
    817817        wm.set_bundle_id(window.window, self.get_bundle_id())
  • src/sugar/graphics/window.py

    diff --git a/src/sugar/graphics/window.py b/src/sugar/graphics/window.py
    index 967217a..c04902f 100644
    a b class Window(gtk.Window): 
    118118            self.__unfullscreen_button_pressed)
    119119        self._unfullscreen_button_timeout_id = None
    120120
     121    def reveal(self):
     122        """ Make window active
     123
     124        In contrast with present(), brings window to the top
     125        even after invoking on respoce on non-gtk events.
     126        See #1423.
     127        """
     128        if self.window is None:
     129            self.show()
     130            return
     131        timestamp = gtk.get_current_event_time()
     132        if not timestamp:
     133            timestamp = gtk.gdk.x11_get_server_time(self.window)
     134        self.window.focus(timestamp)
     135
    121136    def fullscreen(self):
    122137        palettegroup.popdown_all()
    123138        if self._toolbar_box is not None: