Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Quiñones <manuq@laptop.org>2012-04-30 13:10:43 (GMT)
committer Manuel Quiñones <manuq@laptop.org>2012-04-30 13:10:43 (GMT)
commite89981305ed79016558f5897007bf1d280102c84 (patch)
tree32addda274459630f520c6fe24dd988f26bbae19
parentc9e19a4da890cd528e1ff70697f28470aa18217e (diff)
Step scroll with the keypad arrow keys OLPC #11806
This is a regression, it worked in gecko Browse without the explicit key-pressed callback because the web view was a scrolled window, but now we have a scrolled window and the WebKit web view inside. Signed-off-by: Manuel Quiñones <manuq@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--webactivity.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/webactivity.py b/webactivity.py
index 156ea3c..fe01754 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -464,6 +464,23 @@ class WebActivity(activity.Activity):
return True
+ elif key_name in ('KP_Up', 'KP_Down', 'KP_Left', 'KP_Right'):
+ scrolled_window = browser.get_parent()
+
+ if key_name in ('KP_Up', 'KP_Down'):
+ adjustment = scrolled_window.get_vadjustment()
+ elif key_name in ('KP_Left', 'KP_Right'):
+ adjustment = scrolled_window.get_hadjustment()
+ value = adjustment.get_value()
+ step = adjustment.get_step_increment()
+
+ if key_name in ('KP_Up', 'KP_Left'):
+ adjustment.set_value(value - step)
+ elif key_name in ('KP_Down', 'KP_Right'):
+ adjustment.set_value(value + step)
+
+ return True
+
return False
def _add_link(self):