Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjay Garg <ajay@activitycentral.com>2013-03-25 11:14:35 (GMT)
committer Ajay Garg <ajay@activitycentral.com>2013-03-25 11:17:16 (GMT)
commit63656cf068c18ca70c11905cebacec3ca3578627 (patch)
treeadb1e4fcd4500283ea0c2791b69d02920b2cfe05
parent9f68e5e1d2511cf139f05c8c25d31ae264a149a4 (diff)
sdxo#3095: "sugar"-code, that catches the signals from maliit upon
every OSK appearence/disappearence AUTOMATICALLY, and then, calls the corresponding callbacks, as in sdxo#2902. Obviously, this needs the patched maliit-rpms, that emit the signals on every OSK appearence/disappearence.
-rwxr-xr-xbin/sugar-session33
-rw-r--r--src/jarabe/view/keyhandler.py7
2 files changed, 40 insertions, 0 deletions
diff --git a/bin/sugar-session b/bin/sugar-session
index fde61fd..d8078a1 100755
--- a/bin/sugar-session
+++ b/bin/sugar-session
@@ -50,6 +50,9 @@ from gi.repository import Gio
MONITORS = []
MONITOR_ACTION_TAKEN = False
+OSK_APPEARENCE_MONITOR_FILE = '~/.sugar/default/osk_just_appeared'
+OSK_DISAPPEARENCE_MONITOR_FILE = '~/.sugar/default/osk_just_disappeared'
+
_USE_XKL = False
try:
from gi.repository import Xkl
@@ -257,6 +260,35 @@ def arrange_for_setup_frame_cb():
monitor.connect('changed', file_monitor_changed_cb)
MONITORS.append(monitor)
+def osk_appeared_cb(monitor, one_file, other_file, event_type):
+ if event_type != Gio.FileMonitorEvent.CHANGED:
+ return
+
+ if one_file.get_path() == os.path.expanduser(OSK_APPEARENCE_MONITOR_FILE):
+ from jarabe.view.keyhandler import get_handle_accumulate_osk_func
+ get_handle_accumulate_osk_func()(None)
+
+def osk_disappeared_cb(monitor, one_file, other_file, event_type):
+ if event_type != Gio.FileMonitorEvent.CHANGED:
+ return
+
+ if one_file.get_path() == os.path.expanduser(OSK_DISAPPEARENCE_MONITOR_FILE):
+ from jarabe.view.keyhandler import get_handle_unaccumulate_osk_func
+ get_handle_unaccumulate_osk_func()(None)
+
+def arrange_for_osk_appearence_disappearence_hacks():
+ osk_appearence_monitor_file_path = \
+ Gio.File.new_for_path(os.path.expanduser(OSK_APPEARENCE_MONITOR_FILE))
+ appearence_monitor = osk_appearence_monitor_file_path.monitor_file(Gio.FileMonitorFlags.NONE, None)
+ appearence_monitor.connect('changed', osk_appeared_cb)
+ MONITORS.append(appearence_monitor)
+
+ osk_disappearence_monitor_file_path = \
+ Gio.File.new_for_path(os.path.expanduser(OSK_DISAPPEARENCE_MONITOR_FILE))
+ disappearence_monitor = osk_disappearence_monitor_file_path.monitor_file(Gio.FileMonitorFlags.NONE, None)
+ disappearence_monitor.connect('changed', osk_disappeared_cb)
+ MONITORS.append(disappearence_monitor)
+
def bootstrap():
show_hidden_wireless_networks()
setup_window_manager()
@@ -267,6 +299,7 @@ def bootstrap():
GObject.idle_add(setup_keyhandler_cb)
arrange_for_setup_frame_cb()
+ arrange_for_osk_appearence_disappearence_hacks()
GObject.idle_add(setup_gesturehandler_cb)
GObject.idle_add(setup_journal_cb)
diff --git a/src/jarabe/view/keyhandler.py b/src/jarabe/view/keyhandler.py
index 2d59359..ac6f5d5 100644
--- a/src/jarabe/view/keyhandler.py
+++ b/src/jarabe/view/keyhandler.py
@@ -167,6 +167,10 @@ class KeyHandler(object):
journalactivity.get_journal().show_journal()
def handle_accumulate_osk(self, event_time):
+ from jarabe.model.shell import get_model
+ if get_model().get_active_activity().get_bundle_id() == 'org.laptop.AbiWordActivity':
+ return
+
# If we are not in ebook-mode, do not do anything.
is_ebook_mode = False
@@ -272,5 +276,8 @@ def set_key_handlers_active(active):
_instance._key_handlers_active = active
+def get_handle_accumulate_osk_func():
+ return _instance.handle_accumulate_osk
+
def get_handle_unaccumulate_osk_func():
return _instance.handle_unaccumulate_osk