Ticket #1335: sugar-1335.patch

File sugar-1335.patch, 4.7 KB (added by alsroot, 13 years ago)
  • src/sugar/graphics/palettegroup.py

    From e7127fe74a362318aa8ed80019b04430a3ef3cdb Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Tue, 15 Sep 2009 20:52:13 +0000
    Subject: When in fullscreen mode in an activity, frame doesnt pop-up #1335
    
    ---
     src/sugar/graphics/palettegroup.py |    5 ++
     src/sugar/graphics/window.py       |   79 ++++++++++++++++++-----------------
     2 files changed, 46 insertions(+), 38 deletions(-)
    
    diff --git a/src/sugar/graphics/palettegroup.py b/src/sugar/graphics/palettegroup.py
    index 7e6ce46..05c713c 100644
    a b def get_group(group_id): 
    3535    return group
    3636
    3737
     38def popdown_all():
     39    for group in _groups.values():
     40        group.popdown()
     41
     42
    3843class Group(gobject.GObject):
    3944
    4045    __gsignals__ = {
  • src/sugar/graphics/window.py

    diff --git a/src/sugar/graphics/window.py b/src/sugar/graphics/window.py
    index 48adda0..b147831 100644
    a b import gtk 
    2525import warnings
    2626
    2727from sugar.graphics.icon import Icon
     28from sugar.graphics import palettegroup
    2829
    2930
    3031_UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT = 2
    class Window(gtk.Window): 
    8889        gtk.Window.__init__(self, **args)
    8990
    9091        self.connect('realize', self.__window_realize_cb)
    91         self.connect('window-state-event', self.__window_state_event_cb)
    9292        self.connect('key-press-event', self.__key_press_cb)
    9393
    9494        self._toolbar_box = None
    class Window(gtk.Window): 
    118118            self.__unfullscreen_button_pressed)
    119119        self._unfullscreen_button_timeout_id = None
    120120
     121    def fullscreen(self):
     122        palettegroup.popdown_all()
     123        if self._toolbar_box is not None:
     124            self._toolbar_box.hide()
     125        if self.tray is not None:
     126            self.tray.hide()
     127
     128        self._is_fullscreen = True
     129
     130        if not self.props.enable_fullscreen_mode:
     131            return
     132
     133        self._unfullscreen_button.show()
     134
     135        if self._unfullscreen_button_timeout_id is not None:
     136            gobject.source_remove(self._unfullscreen_button_timeout_id)
     137            self._unfullscreen_button_timeout_id = None
     138
     139        self._unfullscreen_button_timeout_id = \
     140            gobject.timeout_add_seconds( \
     141                _UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT, \
     142                self.__unfullscreen_button_timeout_cb)
     143
     144    def unfullscreen(self):
     145        if self._toolbar_box is not None:
     146            self._toolbar_box.show()
     147        if self.tray is not None:
     148            self.tray.show()
     149
     150        self._is_fullscreen = False
     151
     152        if not self.props.enable_fullscreen_mode:
     153            return
     154
     155        self._unfullscreen_button.hide()
     156
     157        if self._unfullscreen_button_timeout_id:
     158            gobject.source_remove(self._unfullscreen_button_timeout_id)
     159            self._unfullscreen_button_timeout_id = None
     160
    121161    def set_canvas(self, canvas):
    122162        if self._canvas:
    123163            self._event_box.remove(self._canvas)
    class Window(gtk.Window): 
    188228        group.realize()
    189229        window.window.set_group(group.window)
    190230
    191     def __window_state_event_cb(self, window, event):
    192         if not (event.changed_mask & gtk.gdk.WINDOW_STATE_FULLSCREEN):
    193             return False
    194 
    195         if event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN:
    196             if self._toolbar_box is not None:
    197                 self._toolbar_box.hide()
    198             if self.tray is not None:
    199                 self.tray.hide()
    200 
    201             self._is_fullscreen = True
    202             if self.props.enable_fullscreen_mode:
    203                 self._unfullscreen_button.show()
    204 
    205                 if self._unfullscreen_button_timeout_id is not None:
    206                     gobject.source_remove(self._unfullscreen_button_timeout_id)
    207                     self._unfullscreen_button_timeout_id = None
    208 
    209                 self._unfullscreen_button_timeout_id = \
    210                     gobject.timeout_add_seconds( \
    211                         _UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT, \
    212                         self.__unfullscreen_button_timeout_cb)
    213 
    214         else:
    215             if self._toolbar_box is not None:
    216                 self._toolbar_box.show()
    217             if self.tray is not None:
    218                 self.tray.show()
    219 
    220             self._is_fullscreen = False
    221             if self.props.enable_fullscreen_mode:
    222                 self._unfullscreen_button.hide()
    223 
    224                 if self._unfullscreen_button_timeout_id:
    225                     gobject.source_remove(self._unfullscreen_button_timeout_id)
    226                     self._unfullscreen_button_timeout_id = None
    227 
    228231    def __key_press_cb(self, widget, event):
    229232        key = gtk.gdk.keyval_name(event.keyval)
    230233        if event.state & gtk.gdk.MOD1_MASK: