-/* vim:set et ts=4: */
+/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2008-2009 Huang Peng <shawn.p.huang@gmail.com>
*
GdkRectangle cursor_area;
gboolean has_focus;
+
+ gint caps;
};
static guint _signal_commit_id = 0;
priv->ic = NULL;
priv->has_focus = FALSE;
+ priv->caps = IBUS_CAP_PREEDIT | IBUS_CAP_FOCUS;
// Create slave im context
if(priv->ic) {
if (use_preedit) {
- ibus_im_client_set_capabilities (_client, priv->ic, IBUS_CAP_FOCUS | IBUS_CAP_PREEDIT);
+ priv->caps |= IBUS_CAP_PREEDIT;
}
else {
- ibus_im_client_set_capabilities (_client, priv->ic, IBUS_CAP_FOCUS);
+ priv->caps &= ~IBUS_CAP_PREEDIT;
}
+ ibus_im_client_set_capabilities (_client, priv->ic, priv->caps);
}
gtk_im_context_set_use_preedit (priv->slave, use_preedit);
}
if (priv->ic == NULL) {
priv->enable = FALSE;
}
- else if (priv->has_focus) {
- ibus_im_context_focus_in (GTK_IM_CONTEXT (context));
+ else {
+ ibus_im_client_set_capabilities (_client, priv->ic, priv->caps);
+ if (priv->has_focus) {
+ ibus_im_context_focus_in (GTK_IM_CONTEXT (context));
+ }
}
}
client (client),
ic (ic),
preedit_visible (false),
- has_focus (false)
+ has_focus (false),
+ caps (IBUS_CAP_PREEDIT | IBUS_CAP_FOCUS)
{
}
else {
/* KateView can not support preedit well. */
if (widget->inherits("KateViewInternal")) {
- client->setCapabilities (this, IBUS_CAP_FOCUS);
+ caps &= ~IBUS_CAP_PREEDIT;
}
else {
- client->setCapabilities (this, IBUS_CAP_FOCUS | IBUS_CAP_PREEDIT);
+ caps |= IBUS_CAP_PREEDIT;
}
+ client->setCapabilities (this, caps);
has_focus = true;
client->focusIn (this);
IBusInputContext::setIC (QString ic)
{
this->ic = ic;
- if (has_focus && !ic.isEmpty ()) {
+ if (ic.isEmpty ())
+ return;
+
+ client->setCapabilities (this, caps);
+ if (has_focus) {
client->focusIn (this);
}
}