From a30d5e9c88c409cf58bec4d62dc7e3d299ad3421 Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Tue, 16 Oct 2012 12:21:59 +0000
Subject: [PATCH Browse] Touch: Get out of activity fullscreen mode SL #4013
Show the Unfullscreen button (with a timeout to hide it) when
the user clicks over the canvas.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
webactivity.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/webactivity.py b/webactivity.py
index 0fbf858..71ecdf2 100644
a
|
b
|
from sugar3.graphics.icon import Icon |
54 | 54 | from sugar3 import mime |
55 | 55 | |
56 | 56 | from sugar3.graphics.toolbarbox import ToolbarButton |
| 57 | from sugar3.graphics.window import _UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT |
57 | 58 | |
58 | 59 | PROFILE_VERSION = 2 |
59 | 60 | |
… |
… |
class WebActivity(activity.Activity): |
207 | 208 | self.model = Model() |
208 | 209 | self.model.connect('add_link', self._add_link_model_cb) |
209 | 210 | |
| 211 | self.set_events(Gdk.EventMask.TOUCH_MASK) |
| 212 | self.connect('event', self.__event_cb) |
| 213 | |
210 | 214 | # HACK to allow Escape key stop loading on fullscreen mode |
211 | 215 | # http://bugs.sugarlabs.org/ticket/1434 |
212 | 216 | self.disconnect_by_func(self._Window__key_press_cb) |
… |
… |
class WebActivity(activity.Activity): |
431 | 435 | def _go_home_button_cb(self, button): |
432 | 436 | self._tabbed_view.load_homepage() |
433 | 437 | |
| 438 | def __event_cb(self, widget, event): |
| 439 | if event.type == Gdk.EventType.TOUCH_END: |
| 440 | # Show Unfullscreen button when the user clicks over the canvas |
| 441 | if self._is_fullscreen: |
| 442 | self._unfullscreen_button.show() |
| 443 | |
| 444 | if self._unfullscreen_button_timeout_id is not None: |
| 445 | GObject.source_remove(self._unfullscreen_button_timeout_id) |
| 446 | self._unfullscreen_button_timeout_id = None |
| 447 | |
| 448 | self._unfullscreen_button_timeout_id = \ |
| 449 | GObject.timeout_add_seconds( \ |
| 450 | _UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT, \ |
| 451 | self._Window__unfullscreen_button_timeout_cb) |
| 452 | |
434 | 453 | def _key_press_cb(self, widget, event): |
435 | 454 | # HACK: this is the hacked version of |
436 | 455 | # sugar3.graphics.Window.__key_press_cb function to allow stop |