static void bus_ibus_impl_set_use_sys_layout
(BusIBusImpl *ibus,
GValue *value);
+static void bus_ibus_impl_set_embed_preedit_text
+ (BusIBusImpl *ibus,
+ GValue *value);
+
static void bus_ibus_impl_set_use_global_engine
(BusIBusImpl *ibus,
GValue *value);
}
static void
+bus_ibus_impl_set_embed_preedit_text (BusIBusImpl *ibus,
+ GValue *value){
+ if (value != NULL && G_VALUE_TYPE (value) == G_TYPE_BOOLEAN) {
+ ibus->embed_preedit_text = g_value_get_boolean (value);
+ }
+
+}
+
+static void
bus_ibus_impl_set_use_global_engine (BusIBusImpl *ibus,
GValue *value)
{
{ "general", "preload_engines", bus_ibus_impl_set_preload_engines },
{ "general", "use_system_keyboard_layout", bus_ibus_impl_set_use_sys_layout },
{ "general", "use_global_engine", bus_ibus_impl_set_use_global_engine },
+ { "general", "embed_preedit_text", bus_ibus_impl_set_embed_preedit_text },
{ NULL, NULL, NULL },
};
{ "general", "preload_engines", bus_ibus_impl_set_preload_engines },
{ "general", "use_system_keyboard_layout", bus_ibus_impl_set_use_sys_layout },
{ "general", "use_global_engine", bus_ibus_impl_set_use_global_engine },
+ { "general", "embed_preedit_text", bus_ibus_impl_set_embed_preedit_text },
{ NULL, NULL, NULL },
};
ibus->keymap = ibus_keymap_get ("us");
ibus->use_sys_layout = FALSE;
+ ibus->embed_preedit_text = TRUE;
ibus->use_global_engine = TRUE;
ibus->global_engine_enabled = FALSE;
ibus->global_engine = NULL;
GList *component_list;
gboolean use_sys_layout;
+ gboolean embed_preedit_text;
BusRegistry *registry;
G_DEFINE_TYPE (BusInputContext, bus_input_context, IBUS_TYPE_SERVICE)
+static inline gboolean is_embed_preedit_text(){
+ BusIBusImpl * ibusimpl = BUS_DEFAULT_IBUS;
+ return ibusimpl->embed_preedit_text;
+}
+
+#define IS_CLIENT_CAPABLE_PREEDIT(context) \
+ ((context->capabilities & IBUS_CAP_PREEDIT_TEXT) == IBUS_CAP_PREEDIT_TEXT)
+
+#define IS_CLIENT_FORCE_PREEDIT(context) \
+ (IS_CLIENT_CAPABLE_PREEDIT(context) && (context->capabilities & IBUS_CAP_FOCUS) == 0)
+
static void
_connection_destroy_cb (BusConnection *connection,
BusInputContext *context)
if (context->capabilities & IBUS_CAP_FOCUS) {
g_signal_emit (context, context_signals[FOCUS_IN], 0);
if (context->engine && context->enabled) {
- if (context->preedit_visible && (context->capabilities & IBUS_CAP_PREEDIT_TEXT) == 0) {
+ if (context->preedit_visible && !(is_embed_preedit_text() && IS_CLIENT_CAPABLE_PREEDIT(context)) && !IS_CLIENT_FORCE_PREEDIT(context)) {
g_signal_emit (context,
context_signals[UPDATE_PREEDIT_TEXT],
0,
context->has_focus = FALSE;
if (context->capabilities & IBUS_CAP_FOCUS) {
- if (context->preedit_visible && (context->capabilities & IBUS_CAP_PREEDIT_TEXT) == 0) {
+ if (context->preedit_visible && !(is_embed_preedit_text() && IS_CLIENT_CAPABLE_PREEDIT(context)) && !IS_CLIENT_FORCE_PREEDIT(context) ) {
g_signal_emit (context, context_signals[HIDE_PREEDIT_TEXT], 0);
}
if (context->auxiliary_visible && (context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
context->preedit_cursor_pos = cursor_pos;
context->preedit_visible = visible;
- if (context->capabilities & IBUS_CAP_PREEDIT_TEXT) {
+ if ((is_embed_preedit_text() && IS_CLIENT_CAPABLE_PREEDIT(context)) || IS_CLIENT_FORCE_PREEDIT(context)) {
bus_input_context_send_signal (context,
"UpdatePreeditText",
IBUS_TYPE_TEXT, &(context->preedit_text),
context->preedit_visible = TRUE;
- if ((context->capabilities & IBUS_CAP_PREEDIT_TEXT) == IBUS_CAP_PREEDIT_TEXT) {
+ if ((is_embed_preedit_text() && IS_CLIENT_CAPABLE_PREEDIT(context)) || IS_CLIENT_FORCE_PREEDIT(context)) {
bus_input_context_send_signal (context,
"ShowPreeditText",
G_TYPE_INVALID);
context->preedit_visible = FALSE;
- if ((context->capabilities & IBUS_CAP_PREEDIT_TEXT) == IBUS_CAP_PREEDIT_TEXT) {
+ if (is_embed_preedit_text() && (context->capabilities & IBUS_CAP_PREEDIT_TEXT) == IBUS_CAP_PREEDIT_TEXT) {
bus_input_context_send_signal (context,
"HidePreeditText",
G_TYPE_INVALID);
</locale>
</schema>
<schema>
+ <key>/schemas/desktop/ibus/general/embed_preedit_text</key>
+ <applyto>/desktop/ibus/general/embed_preedit_text</applyto>
+ <owner>ibus</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Embed Preedit Text</short>
+ <long>Embed Preedit Text in Application Window</long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/desktop/ibus/general/use_global_engine</key>
<applyto>/desktop/ibus/general/use_global_engine</applyto>
<owner>ibus</owner>
self.__config.get_value("panel", "show_im_name", False))
self.__checkbutton_show_im_name.connect("toggled", self.__checkbutton_show_im_name_toggled_cb)
+ # embed preedit text
+ self.__checkbutton_embed_preedit_text = self.__builder.get_object("checkbutton_embed_preedit_text")
+ self.__checkbutton_embed_preedit_text.set_active(
+ self.__config.get_value("general", "embed_preedit_text", True))
+ self.__checkbutton_embed_preedit_text.connect("toggled", self.__checkbutton_embed_preedit_text_toggled_cb)
+
# use system keyboard layout setting
self.__checkbutton_use_sys_layout = self.__builder.get_object("checkbutton_use_sys_layout")
self.__checkbutton_use_sys_layout.set_active(
value = self.__checkbutton_show_im_name.get_active()
self.__config.set_value("panel", "show_im_name", value)
+ def __checkbutton_embed_preedit_text_toggled_cb(self, button):
+ value = self.__checkbutton_embed_preedit_text.get_active()
+ self.__config.set_value("general", "embed_preedit_text", value)
+
def __checkbutton_use_sys_layout_toggled_cb(self, button):
value = self.__checkbutton_use_sys_layout.get_active()
self.__config.set_value("general", "use_system_keyboard_layout", value)
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="checkbutton_embed_preedit_text">
+ <property name="label" translatable="yes">Embed preedit text in application window</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Embed the preedit text of input method in the application window</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkHBox" id="hbox9">
<property name="visible">True</property>
<property name="homogeneous">True</property>
</child>
</object>
<packing>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
</object>