Ticket #4013: 0001-Touch-Get-out-of-activity-fullscreen-mode-SL-4013.patch

File 0001-Touch-Get-out-of-activity-fullscreen-mode-SL-4013.patch, 2.2 KB (added by humitos, 12 years ago)

Maybe the code used in this patch can be modularized on the sugar3.graphics.window.Window class so it's not repeated

  • webactivity.py

    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 
    5454from sugar3 import mime
    5555
    5656from sugar3.graphics.toolbarbox import ToolbarButton
     57from sugar3.graphics.window import _UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT
    5758
    5859PROFILE_VERSION = 2
    5960
    class WebActivity(activity.Activity): 
    207208        self.model = Model()
    208209        self.model.connect('add_link', self._add_link_model_cb)
    209210
     211        self.set_events(Gdk.EventMask.TOUCH_MASK)
     212        self.connect('event', self.__event_cb)
     213
    210214        # HACK to allow Escape key stop loading on fullscreen mode
    211215        # http://bugs.sugarlabs.org/ticket/1434
    212216        self.disconnect_by_func(self._Window__key_press_cb)
    class WebActivity(activity.Activity): 
    431435    def _go_home_button_cb(self, button):
    432436        self._tabbed_view.load_homepage()
    433437
     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
    434453    def _key_press_cb(self, widget, event):
    435454        # HACK: this is the hacked version of
    436455        # sugar3.graphics.Window.__key_press_cb function to allow stop