context = self._lookup_context(ic, conn)
return context.is_enabled()
+ def set_capabilities(self, ic, caps, conn):
+ context = self._lookup_context(ic, conn)
+ return context.set_capabilities(caps)
+
def process_key_event(self, ic, keyval, is_press, state,
conn, reply_cb, error_cb):
context = self._lookup_context(ic, conn)
def IsEnabled(self, ic, dbusconn):
return self._ibus.is_enabled(ic, self._conn)
+ def SetCapabilities(self, ic, caps, dbusconn):
+ return self._ibus.set_capabilities(ic, caps, self._conn)
+
def GetFactories(self, dbusconn):
return self._ibus.get_factories()
self._aux_attrs = None
self._aux_visible = False
- self._use_preedit = False
+ self._use_preedit = True
self._preedit_string = None
self._preedit_attrs = None
self._cursor_pos = 0
def is_enabled(self):
return self._enable
+ def set_capabilities(self, caps):
+ if caps == 0:
+ self._use_preedit = False
+ else:
+ self._use_preedit = True
+
def set_enable(self, enable):
if self._enable != enable:
self._enable = enable
DBUS_TYPE_INVALID);
}
+void
+ibus_im_client_set_use_preedit (IBusIMClient *client, IBusIMContext *context, gboolean use_preedit)
+{
+ IBusIMClientPrivate *priv = client->priv;
+ gchar *ic = ibus_im_context_get_ic (context);
+
+ if (ic == NULL)
+ return;
+
+ _ibus_call_with_reply_and_block (client->priv->ibus,
+ "SetCapabilities",
+ DBUS_TYPE_STRING, &ic,
+ DBUS_TYPE_INT32, &use_preedit,
+ DBUS_TYPE_INVALID,
+ DBUS_TYPE_INVALID);
+}
void
ibus_im_client_release_im_context (IBusIMClient *client, IBusIMContext *context)
(IBusIMClient *client,
IBusIMContext *context,
GdkRectangle *area);
+void ibus_im_client_set_use_preedit (IBusIMClient *client,
+ IBusIMContext *context,
+ gboolean use_preedit);
gboolean ibus_im_client_is_enabled (IBusIMClient *client);
void ibus_im_client_release_im_context(IBusIMClient *client,
IBusIMContext *context);
static void ibus_im_context_set_cursor_location
(GtkIMContext *context,
GdkRectangle *area);
+static void ibus_im_context_set_use_preedit
+ (GtkIMContext *context,
+ gboolean use_preedit);
/* callback functions for slave context */
static void _slave_commit_cb (GtkIMContext *slave,
im_context_class->get_preedit_string = ibus_im_context_get_preedit_string;
im_context_class->set_client_window = ibus_im_context_set_client_window;
im_context_class->set_cursor_location = ibus_im_context_set_cursor_location;
+ im_context_class->set_use_preedit = ibus_im_context_set_use_preedit;
gobject_class->finalize = ibus_im_context_finalize;
}
gtk_im_context_set_cursor_location (priv->slave, area);
}
+static void
+ibus_im_context_set_use_preedit (GtkIMContext *context, gboolean use_preedit)
+{
+ DEBUG_FUNCTION_IN;
+
+ IBusIMContext *ibus = IBUS_IM_CONTEXT (context);
+ IBusIMContextPrivate *priv = ibus->priv;
+
+ ibus_im_client_set_use_preedit (_client, ibus, use_preedit);
+ gtk_im_context_set_use_preedit (priv->slave, use_preedit);
+}
+
+
/* Callback functions for slave context */
static void
_slave_commit_cb (GtkIMContext *slave, gchar *string, IBusIMContext *context)
@method (in_signature = "s", out_signature = "b")
def IsEnabled (self, ic, dbusconn): pass
+ @method(in_signature = "si")
+ def SetCapabilities(self, ic, caps, dbusconn): pass
+
# methods for ibus engine provide
@method (in_signature = "ao")
def RegisterFactories (self, object_paths, dbusconn): pass