summaryrefslogtreecommitdiff
path: root/ibus
diff options
context:
space:
mode:
authorDaiki Ueno <daiki.ueno@gmail.com>2011-04-05 10:11:49 -0400
committerPeng Huang <shawn.p.huang@gmail.com>2011-04-05 10:11:49 -0400
commit06e6abee9f221bdf7c277538ce136154465619d7 (patch)
tree2d91a9dd312428e2164d19cbbb3dcc8d3fb700bc /ibus
parent6a39a86f84fb59c06a246c1bb3f50abbf6c9f8d1 (diff)
downloadibus-06e6abee9f221bdf7c277538ce136154465619d7.tar.gz
Support surrounding-text retrieval.
Unlike the GtkIMContext API, IBus automatically retrieves surrounding-text when certain events occurred to the client ("before filter_keypress", for example). This makes the engine API simpler but causes periodical emission of D-Bus signals for updating surrounding-text information, which is unwanted for typical engines. For this reason, the surrounding-text support is currently disabled by default. To enable it, pass --enable-surrounding-text to configure. Also, even surrounding-text support is compiled in, IBus does not start polling until an engine requests surrounding-text using ibus_engine_get_surrounding_text(). To make the function work for the first time, clients should retrieve initial surrounding-text when the engine is enabled (see ibus_im_context_focus_in() and _ibus_context_enabled_cb() in client/gtk2/ibusimcontext.c). BUG=Issue#778 TEST=manual Review URL: http://codereview.appspot.com/4276082 Patch from Daiki Ueno <daiki.ueno@gmail.com>.
Diffstat (limited to 'ibus')
-rw-r--r--ibus/engine.py6
-rw-r--r--ibus/interface/iengine.py3
-rw-r--r--ibus/interface/iinputcontext.py3
3 files changed, 12 insertions, 0 deletions
diff --git a/ibus/engine.py b/ibus/engine.py
index b1df2fe5..ec42fa43 100644
--- a/ibus/engine.py
+++ b/ibus/engine.py
@@ -46,6 +46,9 @@ class EngineBase(object.Object):
def set_cursor_location(self, x, y, w, h):
pass
+ def set_surrounding_text(self, text, cursor_index):
+ pass
+
def set_capabilities(self, cap):
pass
@@ -163,6 +166,9 @@ class EngineProxy(interface.IEngine):
def SetCursorLocation(self, x, y, w, h):
return self.__engine.set_cursor_location(x, y, w, h)
+ def SetSurroundingText(self, text, cursor_index):
+ return self.__engine.set_surrounding_text(text, cursor_index)
+
def SetCapabilities(self, caps):
return self.__engine.set_capabilities(caps)
diff --git a/ibus/interface/iengine.py b/ibus/interface/iengine.py
index 2386c0f6..5db20121 100644
--- a/ibus/interface/iengine.py
+++ b/ibus/interface/iengine.py
@@ -50,6 +50,9 @@ class IEngine(dbus.service.Object):
@method(in_signature="iiii")
def SetCursorLocation(self, x, y, w, h): pass
+ @method(in_signature="vu")
+ def SetSurroundingText(self, text, cursor_index): pass
+
@method(in_signature="u")
def SetCapabilities(self, cap): pass
diff --git a/ibus/interface/iinputcontext.py b/ibus/interface/iinputcontext.py
index 89f6dbdb..2db1c9b5 100644
--- a/ibus/interface/iinputcontext.py
+++ b/ibus/interface/iinputcontext.py
@@ -49,6 +49,9 @@ class IInputContext(dbus.service.Object):
@method(in_signature="iiii")
def SetCursorLocation(self, x, y, w, h): pass
+ @method(in_signature="vu")
+ def SetSurroundingText(self, text, cursor_index): pass
+
@method()
def FocusIn(self): pass