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-09-18 07:37:35 (GMT)
committer Simon Schampijer <simon@laptop.org>2012-09-20 13:26:19 (GMT)
commitb44a235d9fca562522ea02832424c37bf30185e7 (patch)
tree0c1214dc0cf468052194ecc01f41d7424d7e4f55
parent1f9684c7bf7118dd3ca41b9615a65fa42131c0e1 (diff)
OSK support: canvas auto panning based on input focus
Listen to the 'request-clear-area' and 'unset-clear-area' of the widget and adjust allocation accordingly. Signed-off-by: Carlos Garnacho <carlos@lanedo.com> Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--src/sugar3/graphics/window.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sugar3/graphics/window.py b/src/sugar3/graphics/window.py
index 23a8d4f..1d45210 100644
--- a/src/sugar3/graphics/window.py
+++ b/src/sugar3/graphics/window.py
@@ -94,6 +94,14 @@ class Window(Gtk.Window):
self.connect('realize', self.__window_realize_cb)
self.connect('key-press-event', self.__key_press_cb)
+ # OSK support: canvas auto panning based on input focus
+ if GObject.signal_lookup('request-clear-area', Window) != 0 and \
+ GObject.signal_lookup('unset-clear-area', Window) != 0:
+ self.connect('size-allocate', self.__size_allocate_cb)
+ self.connect('request-clear-area', self.__request_clear_area_cb)
+ self.connect('unset-clear-area', self.__unset_clear_area_cb)
+ self._clear_area_dy = 0
+
self._toolbar_box = None
self._alerts = []
self._canvas = None
@@ -277,6 +285,19 @@ class Window(Gtk.Window):
self._unfullscreen_button_timeout_id = None
return False
+ def __request_clear_area_cb(self, activity, osk_rect, cursor_rect):
+ self._clear_area_dy = cursor_rect.y + cursor_rect.height - osk_rect.y
+ self.queue_resize()
+
+ def __unset_clear_area_cb(self, activity, snap_back):
+ self._clear_area_dy = 0
+ self.queue_resize()
+
+ def __size_allocate_cb(self, widget, allocation):
+ self.set_allocation(allocation)
+ allocation.y -= self._clear_area_dy
+ self.__vbox.size_allocate(allocation)
+
def set_enable_fullscreen_mode(self, enable_fullscreen_mode):
self._enable_fullscreen_mode = enable_fullscreen_mode