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): |
35 | 35 | return group |
36 | 36 | |
37 | 37 | |
| 38 | def popdown_all(): |
| 39 | for group in _groups.values(): |
| 40 | group.popdown() |
| 41 | |
| 42 | |
38 | 43 | class Group(gobject.GObject): |
39 | 44 | |
40 | 45 | __gsignals__ = { |
diff --git a/src/sugar/graphics/window.py b/src/sugar/graphics/window.py
index 48adda0..b147831 100644
a
|
b
|
import gtk |
25 | 25 | import warnings |
26 | 26 | |
27 | 27 | from sugar.graphics.icon import Icon |
| 28 | from sugar.graphics import palettegroup |
28 | 29 | |
29 | 30 | |
30 | 31 | _UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT = 2 |
… |
… |
class Window(gtk.Window): |
88 | 89 | gtk.Window.__init__(self, **args) |
89 | 90 | |
90 | 91 | self.connect('realize', self.__window_realize_cb) |
91 | | self.connect('window-state-event', self.__window_state_event_cb) |
92 | 92 | self.connect('key-press-event', self.__key_press_cb) |
93 | 93 | |
94 | 94 | self._toolbar_box = None |
… |
… |
class Window(gtk.Window): |
118 | 118 | self.__unfullscreen_button_pressed) |
119 | 119 | self._unfullscreen_button_timeout_id = None |
120 | 120 | |
| 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 | |
121 | 161 | def set_canvas(self, canvas): |
122 | 162 | if self._canvas: |
123 | 163 | self._event_box.remove(self._canvas) |
… |
… |
class Window(gtk.Window): |
188 | 228 | group.realize() |
189 | 229 | window.window.set_group(group.window) |
190 | 230 | |
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 | | |
228 | 231 | def __key_press_cb(self, widget, event): |
229 | 232 | key = gtk.gdk.keyval_name(event.keyval) |
230 | 233 | if event.state & gtk.gdk.MOD1_MASK: |