Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@laptop.org>2012-10-23 07:24:56 (GMT)
committer Simon Schampijer <simon@laptop.org>2012-10-23 14:14:13 (GMT)
commit20ef297526933144b981ec81245829acc016c1d5 (patch)
tree32bd4228323262e9da4b3d5b2d3fd2af3c4c0ee4
parent1224ab145169430dc39b54188840c09a1561bf95 (diff)
Window: show unfullscreen button on button and touch events
We did track mouse motion events so far to show the unfullscreen button. This adds the tracking of button events (left, middle, right click) and touch tap. Signed-off-by: Simon Schampijer <simon@laptop.org> Acked-by: Manuel QuiƱones <manuq@laptop.org>
-rw-r--r--src/sugar3/graphics/window.py36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/sugar3/graphics/window.py b/src/sugar3/graphics/window.py
index 1d45210..d754795 100644
--- a/src/sugar3/graphics/window.py
+++ b/src/sugar3/graphics/window.py
@@ -112,9 +112,12 @@ class Window(Gtk.Window):
self.__vbox.pack_start(self.__hbox, True, True, 0)
self.__hbox.show()
- self.add_events(Gdk.EventMask.POINTER_MOTION_HINT_MASK
- | Gdk.EventMask.POINTER_MOTION_MASK)
+ self.add_events(Gdk.EventMask.POINTER_MOTION_HINT_MASK |
+ Gdk.EventMask.POINTER_MOTION_MASK |
+ Gdk.EventMask.BUTTON_RELEASE_MASK |
+ Gdk.EventMask.TOUCH_MASK)
self.connect('motion-notify-event', self.__motion_notify_cb)
+ self.connect('button-release-event', self.__button_press_event_cb)
self.add(self.__vbox)
self.__vbox.show()
@@ -264,21 +267,28 @@ class Window(Gtk.Window):
def __unfullscreen_button_clicked(self, button):
self.unfullscreen()
+ def __button_press_event_cb(self, widget, event):
+ self._show_unfullscreen_button()
+ return False
+
def __motion_notify_cb(self, widget, event):
+ self._show_unfullscreen_button()
+ return False
+
+ def _show_unfullscreen_button(self):
if self._is_fullscreen and self.props.enable_fullscreen_mode:
if not self._unfullscreen_button.props.visible:
self._unfullscreen_button.show()
- else:
- # Reset the timer
- if self._unfullscreen_button_timeout_id is not None:
- GObject.source_remove(self._unfullscreen_button_timeout_id)
- self._unfullscreen_button_timeout_id = None
-
- self._unfullscreen_button_timeout_id = \
- GObject.timeout_add_seconds( \
- _UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT, \
- self.__unfullscreen_button_timeout_cb)
- return False
+
+ # Reset the timer
+ if self._unfullscreen_button_timeout_id is not None:
+ GObject.source_remove(self._unfullscreen_button_timeout_id)
+ self._unfullscreen_button_timeout_id = None
+
+ self._unfullscreen_button_timeout_id = \
+ GObject.timeout_add_seconds( \
+ _UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT, \
+ self.__unfullscreen_button_timeout_cb)
def __unfullscreen_button_timeout_cb(self):
self._unfullscreen_button.hide()