From d26f418a3df4a9ad78dd952d997e028ba24c88f9 Mon Sep 17 00:00:00 2001 From: Yusuke Sato Date: Mon, 24 Jan 2011 10:56:05 +0900 Subject: [PATCH] Add to introspection_xml in src/ibusconfigservice.c. I don't think that GDBus library in glib-2.26.[01] uses the information to filter out undefined signals, but just in case. BUG=none TEST=manually Review URL: http://codereview.appspot.com/4015043 --- src/ibusconfigservice.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/ibusconfigservice.c b/src/ibusconfigservice.c index 5374a76..6420730 100644 --- a/src/ibusconfigservice.c +++ b/src/ibusconfigservice.c @@ -103,6 +103,11 @@ static const gchar introspection_xml[] = " " " " " " + " " + " " + " " + " " + " " " " ""; -- 1.7.3.2 From f28d3e30cb04dc0eee5a657469f2c8d49d7056e0 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Mon, 24 Jan 2011 12:25:48 +0900 Subject: [PATCH] Set GdkEventKey time for gdk_event_put with IBUS_FORWARD_MASK. --- client/gtk2/ibusimcontext.c | 35 +++++++++++++++++++++++++++++++++-- 1 files changed, 33 insertions(+), 2 deletions(-) diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index fb6fb2d..009d05d 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -59,8 +59,8 @@ struct _IBusIMContext { GdkRectangle cursor_area; gboolean has_focus; + guint32 time; gint caps; - }; struct _IBusIMContextClass { @@ -307,6 +307,10 @@ _key_snooper_cb (GtkWidget *widget, } while (0); + if (ibusimcontext != NULL) { + ibusimcontext->time = event->time; + } + switch (event->type) { case GDK_KEY_RELEASE: retval = ibus_input_context_process_key_event (ibuscontext, @@ -458,6 +462,7 @@ ibus_im_context_init (GObject *obj) ibusimcontext->ibuscontext = NULL; ibusimcontext->has_focus = FALSE; + ibusimcontext->time = GDK_CURRENT_TIME; ibusimcontext->caps = IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_FOCUS | IBUS_CAP_SURROUNDING_TEXT; @@ -550,6 +555,10 @@ ibus_im_context_filter_keypress (GtkIMContext *context, if (ibusimcontext->client_window == NULL && event->window != NULL) gtk_im_context_set_client_window ((GtkIMContext *)ibusimcontext, event->window); + if (ibusimcontext != NULL) { + ibusimcontext->time = event->time; + } + switch (event->type) { case GDK_KEY_RELEASE: retval = ibus_input_context_process_key_event (ibusimcontext->ibuscontext, @@ -892,7 +901,29 @@ _create_gdk_event (IBusIMContext *ibusimcontext, event->window = g_object_ref (ibusimcontext->client_window); else if (_input_window) event->window = g_object_ref (_input_window); - event->time = GDK_CURRENT_TIME; + + /* The time is copied the latest value from the previous + * GdkKeyEvent in filter_keypress(). + * + * We understand the best way would be to pass the all time value + * to IBus functions process_key_event() and IBus DBus functions + * ProcessKeyEvent() in IM clients and IM engines so that the + * _create_gdk_event() could get the correct time values. + * However it would causes to change many functions and the time value + * would not provide the useful meanings for each IBus engines but just + * pass the original value to ForwardKeyEvent(). + * We use the saved value at the moment. + * + * Another idea might be to have the time implementation in X servers + * but some Xorg uses clock_gettime() and others use gettimeofday() + * and the values would be different in each implementation and + * locale/remote X server. So probably that idea would not work. */ + if (ibusimcontext) { + event->time = ibusimcontext->time; + } else { + event->time = GDK_CURRENT_TIME; + } + event->send_event = FALSE; event->state = state; event->keyval = keyval; -- 1.7.3.2 From 73135d06d2195cee5630918e48003347315eb653 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Wed, 26 Jan 2011 14:01:17 +0900 Subject: [PATCH] Add signals in IBusPanelService for non-C classes. --- src/ibuspanelservice.c | 525 ++++++++++++++++++++++++++++++++++++++++++++---- src/ibuspanelservice.h | 4 +- 2 files changed, 492 insertions(+), 37 deletions(-) diff --git a/src/ibuspanelservice.c b/src/ibuspanelservice.c index df949c5..f027390 100644 --- a/src/ibuspanelservice.c +++ b/src/ibuspanelservice.c @@ -21,8 +21,33 @@ */ #include "ibusshare.h" #include "ibuspanelservice.h" +#include "ibusmarshalers.h" +#include "ibusinternal.h" enum { + UPDATE_PREEDIT_TEXT, + UPDATE_AUXILIARY_TEXT, + UPDATE_LOOKUP_TABLE, + FOCUS_IN, + FOCUS_OUT, + REGISTER_PROPERTIES, + UPDATE_PROPERTY, + SET_CURSOR_LOCATION, + CURSOR_UP_LOOKUP_TABLE, + CURSOR_DOWN_LOOKUP_TABLE, + HIDE_AUXILIARY_TEXT, + HIDE_LANGUAGE_BAR, + HIDE_LOOKUP_TABLE, + HIDE_PREEDIT_TEXT, + PAGE_UP_LOOKUP_TABLE, + PAGE_DOWN_LOOKUP_TABLE, + RESET, + SHOW_AUXILIARY_TEXT, + SHOW_LANGUAGE_BAR, + SHOW_LOOKUP_TABLE, + SHOW_PREEDIT_TEXT, + START_SETUP, + STATE_CHANGED, LAST_SIGNAL, }; @@ -30,6 +55,8 @@ enum { PROP_0, }; +static guint panel_signals[LAST_SIGNAL] = { 0 }; + /* functions prototype */ static void ibus_panel_service_set_property (IBusPanelService *panel, guint prop_id, @@ -167,6 +194,7 @@ static void ibus_panel_service_class_init (IBusPanelServiceClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); + ibus_panel_service_parent_class = IBUS_SERVICE_CLASS (g_type_class_peek_parent (class)); gobject_class->set_property = (GObjectSetPropertyFunc) ibus_panel_service_set_property; gobject_class->get_property = (GObjectGetPropertyFunc) ibus_panel_service_get_property; @@ -203,6 +231,436 @@ ibus_panel_service_class_init (IBusPanelServiceClass *class) class->show_preedit_text = ibus_panel_service_not_implemented; class->start_setup = ibus_panel_service_not_implemented; class->state_changed = ibus_panel_service_not_implemented; + + /* install signals */ + /** + * IBusPanelService::update-preedit-text: + * @text: A preedit text to be updated. + * @cursor_pos: The cursor position of the text. + * @visible: Whether the update is visible. + * + * Emitted when the client application get the update-preedit-text. + * Implement the member function update_preedit_text() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[UPDATE_PREEDIT_TEXT] = + g_signal_new (I_("update-preedit-text"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, update_preedit_text), + NULL, NULL, + _ibus_marshal_VOID__OBJECT_UINT_BOOLEAN, + G_TYPE_NONE, + 3, + IBUS_TYPE_TEXT, + G_TYPE_UINT, + G_TYPE_BOOLEAN); + + /** + * IBusPanelService::update-auxiliary-text: + * @text: A preedit text to be updated. + * @visible: Whether the update is visible. + * + * Emitted when the client application get the update-auxiliary-text. + * Implement the member function update_auxiliary_text() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[UPDATE_AUXILIARY_TEXT] = + g_signal_new (I_("update-auxiliary-text"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, update_auxiliary_text), + NULL, NULL, + _ibus_marshal_VOID__OBJECT_BOOLEAN, + G_TYPE_NONE, + 2, + IBUS_TYPE_TEXT, + G_TYPE_BOOLEAN); + + /** + * IBusPanelService::update-lookup-table: + * @lookup_table: A lookup table to be updated. + * @visible: Whether the update is visible. + * + * Emitted when the client application get the update-lookup-table. + * Implement the member function update_lookup_table() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[UPDATE_LOOKUP_TABLE] = + g_signal_new (I_("update-lookup-table"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, update_lookup_table), + NULL, NULL, + _ibus_marshal_VOID__OBJECT_BOOLEAN, + G_TYPE_NONE, + 2, + IBUS_TYPE_LOOKUP_TABLE, + G_TYPE_BOOLEAN); + + /** + * IBusPanelService::focus-in: + * @input_context_path: Object path of InputContext. + * + * Emitted when the client application get the focus-in. + * Implement the member function focus_in() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[FOCUS_IN] = + g_signal_new (I_("focus-in"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, focus_in), + NULL, NULL, + _ibus_marshal_VOID__STRING, + G_TYPE_NONE, + 1, + G_TYPE_STRING); + + /** + * IBusPanelService::focus-out: + * @input_context_path: Object path of InputContext. + * + * Emitted when the client application get the focus-out. + * Implement the member function focus_out() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[FOCUS_OUT] = + g_signal_new (I_("focus-out"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, focus_out), + NULL, NULL, + _ibus_marshal_VOID__STRING, + G_TYPE_NONE, + 1, + G_TYPE_STRING); + + /** + * IBusPanelService::register-properties: + * @prop_list: An IBusPropList that contains properties. + * + * Emitted when the client application get the register-properties. + * Implement the member function register_properties() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[REGISTER_PROPERTIES] = + g_signal_new (I_("register-properties"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, register_properties), + NULL, NULL, + _ibus_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + IBUS_TYPE_PROP_LIST); + + /** + * IBusPanelService::update-property: + * @prop: The IBusProperty to be updated. + * + * Emitted when the client application get the update-property. + * Implement the member function update_property() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[UPDATE_PROPERTY] = + g_signal_new (I_("update-property"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, update_property), + NULL, NULL, + _ibus_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + IBUS_TYPE_PROPERTY); + + /** + * IBusPanelService::set-cursor-location: + * @x: X coordinate of the cursor. + * @y: Y coordinate of the cursor. + * @w: Width of the cursor. + * @h: Height of the cursor. + * + * Emitted when the client application get the set-cursor-location. + * Implement the member function set_cursor_location() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[SET_CURSOR_LOCATION] = + g_signal_new (I_("set-cursor-location"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, set_cursor_location), + NULL, NULL, + _ibus_marshal_VOID__INT_INT_INT_INT, + G_TYPE_NONE, + 4, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_INT); + + /** + * IBusPanelService::cursor-up-lookup-table: + * + * Emitted when the client application get the cursor-up-lookup-table. + * Implement the member function cursor_up_lookup_table() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[CURSOR_UP_LOOKUP_TABLE] = + g_signal_new (I_("cursor-up-lookup-table"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, cursor_up_lookup_table), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::cursor-down-lookup-table: + * + * Emitted when the client application get the cursor-down-lookup-table. + * Implement the member function cursor_down_lookup_table() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[CURSOR_DOWN_LOOKUP_TABLE] = + g_signal_new (I_("cursor-down-lookup-table"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, cursor_down_lookup_table), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::hide-auxiliary-text: + * + * Emitted when the client application get the hide-auxiliary-text. + * Implement the member function hide_auxiliary_text() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[HIDE_AUXILIARY_TEXT] = + g_signal_new (I_("hide-auxiliary-text"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, hide_auxiliary_text), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::hide-language-bar: + * + * Emitted when the client application get the hide-language-bar. + * Implement the member function hide_language_bar() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[HIDE_LANGUAGE_BAR] = + g_signal_new (I_("hide-language-bar"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, hide_language_bar), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::hide-lookup-table: + * + * Emitted when the client application get the hide-lookup-table. + * Implement the member function hide_lookup_table() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[HIDE_LOOKUP_TABLE] = + g_signal_new (I_("hide-lookup-table"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, hide_lookup_table), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::hide-preedit-text: + * + * Emitted when the client application get the hide-preedit-text. + * Implement the member function hide_preedit_text() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[HIDE_PREEDIT_TEXT] = + g_signal_new (I_("hide-preedit-text"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, hide_preedit_text), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::page-up-lookup-table: + * + * Emitted when the client application get the page-up-lookup-table. + * Implement the member function page_up_lookup_table() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[PAGE_UP_LOOKUP_TABLE] = + g_signal_new (I_("page-up-lookup-table"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, page_up_lookup_table), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::page-down-lookup-table: + * + * Emitted when the client application get the page-down-lookup-table. + * Implement the member function page_down_lookup_table() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[PAGE_DOWN_LOOKUP_TABLE] = + g_signal_new (I_("page-down-lookup-table"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, page_down_lookup_table), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::reset: + * + * Emitted when the client application get the reset. + * Implement the member function reset() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[RESET] = + g_signal_new (I_("reset"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, reset), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::show-auxiliary-text: + * + * Emitted when the client application get the show-auxiliary-text. + * Implement the member function show_auxiliary_text() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[SHOW_AUXILIARY_TEXT] = + g_signal_new (I_("show-auxiliary-text"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, show_auxiliary_text), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::show-language-bar: + * + * Emitted when the client application get the show-language-bar. + * Implement the member function show_language_bar() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[SHOW_LANGUAGE_BAR] = + g_signal_new (I_("show-language-bar"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, show_language_bar), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::show-lookup-table: + * + * Emitted when the client application get the show-lookup-table. + * Implement the member function show_lookup_table() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[SHOW_LOOKUP_TABLE] = + g_signal_new (I_("show-lookup-table"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, show_lookup_table), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::show-preedit-text: + * + * Emitted when the client application get the show-preedit-text. + * Implement the member function show_preedit_text() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[SHOW_PREEDIT_TEXT] = + g_signal_new (I_("show-preedit-text"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, show_preedit_text), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::start-setup: + * + * Emitted when the client application get the start-setup. + * Implement the member function start_setup() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[START_SETUP] = + g_signal_new (I_("start-setup"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, start_setup), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * IBusPanelService::state-changed: + * + * Emitted when the client application get the state-changed. + * Implement the member function state_changed() in extended class to receive this signal. + * + * Argument @user_data is ignored in this function. + */ + panel_signals[STATE_CHANGED] = + g_signal_new (I_("state-changed"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, state_changed), + NULL, NULL, + _ibus_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void @@ -282,7 +740,7 @@ ibus_panel_service_service_method_call (IBusService *service, IBusText *text = IBUS_TEXT (ibus_serializable_deserialize (variant)); g_variant_unref (variant); - IBUS_PANEL_SERVICE_GET_CLASS (panel)->update_preedit_text (panel, text, cursor, visible); + g_signal_emit (panel, panel_signals[UPDATE_PREEDIT_TEXT], 0, text, cursor, visible); _g_object_unref_if_floating (text); g_dbus_method_invocation_return_value (invocation, NULL); return; @@ -296,7 +754,7 @@ ibus_panel_service_service_method_call (IBusService *service, IBusText *text = IBUS_TEXT (ibus_serializable_deserialize (variant)); g_variant_unref (variant); - IBUS_PANEL_SERVICE_GET_CLASS (panel)->update_auxiliary_text (panel, text, visible); + g_signal_emit (panel, panel_signals[UPDATE_AUXILIARY_TEXT], 0, text, visible); _g_object_unref_if_floating (text); g_dbus_method_invocation_return_value (invocation, NULL); return; @@ -310,7 +768,7 @@ ibus_panel_service_service_method_call (IBusService *service, IBusLookupTable *table = IBUS_LOOKUP_TABLE (ibus_serializable_deserialize (variant)); g_variant_unref (variant); - IBUS_PANEL_SERVICE_GET_CLASS (panel)->update_lookup_table (panel, table, visible); + g_signal_emit (panel, panel_signals[UPDATE_LOOKUP_TABLE], 0, table, visible); _g_object_unref_if_floating (table); g_dbus_method_invocation_return_value (invocation, NULL); return; @@ -319,7 +777,7 @@ ibus_panel_service_service_method_call (IBusService *service, if (g_strcmp0 (method_name, "FocusIn") == 0) { const gchar *path; g_variant_get (parameters, "(&o)", &path); - IBUS_PANEL_SERVICE_GET_CLASS (panel)->focus_in (panel, path); + g_signal_emit (panel, panel_signals[FOCUS_IN], 0, path); g_dbus_method_invocation_return_value (invocation, NULL); return; } @@ -327,7 +785,7 @@ ibus_panel_service_service_method_call (IBusService *service, if (g_strcmp0 (method_name, "FocusOut") == 0) { const gchar *path; g_variant_get (parameters, "(&o)", &path); - IBUS_PANEL_SERVICE_GET_CLASS (panel)->focus_out (panel, path); + g_signal_emit (panel, panel_signals[FOCUS_OUT], 0, path); g_dbus_method_invocation_return_value (invocation, NULL); return; } @@ -337,7 +795,7 @@ ibus_panel_service_service_method_call (IBusService *service, IBusPropList *prop_list = IBUS_PROP_LIST (ibus_serializable_deserialize (variant)); g_variant_unref (variant); - IBUS_PANEL_SERVICE_GET_CLASS (panel)->register_properties (panel, prop_list); + g_signal_emit (panel, panel_signals[REGISTER_PROPERTIES], 0, prop_list); _g_object_unref_if_floating (prop_list); g_dbus_method_invocation_return_value (invocation, NULL); return; @@ -348,7 +806,7 @@ ibus_panel_service_service_method_call (IBusService *service, IBusProperty *property = IBUS_PROPERTY (ibus_serializable_deserialize (variant)); g_variant_unref (variant); - IBUS_PANEL_SERVICE_GET_CLASS (panel)->update_property (panel, property); + g_signal_emit (panel, panel_signals[UPDATE_PROPERTY], 0, property); _g_object_unref_if_floating (property); g_dbus_method_invocation_return_value (invocation, NULL); return; @@ -357,41 +815,38 @@ ibus_panel_service_service_method_call (IBusService *service, if (g_strcmp0 (method_name, "SetCursorLocation") == 0) { gint x, y, w, h; g_variant_get (parameters, "(iiii)", &x, &y, &w, &h); - IBUS_PANEL_SERVICE_GET_CLASS (panel)->set_cursor_location (panel, x, y, w, h); + g_signal_emit (panel, panel_signals[SET_CURSOR_LOCATION], 0, x, y, w, h); g_dbus_method_invocation_return_value (invocation, NULL); return; } const static struct { const gchar *name; - const gint offset; + const gint signal_id; } no_arg_methods [] = { - { "CursorUpLookupTable" , G_STRUCT_OFFSET (IBusPanelServiceClass, cursor_down_lookup_table) }, - { "CursorDownLookupTable", G_STRUCT_OFFSET (IBusPanelServiceClass, cursor_up_lookup_table) }, - { "HideAuxiliaryText", G_STRUCT_OFFSET (IBusPanelServiceClass, hide_auxiliary_text) }, - { "HideLanguageBar", G_STRUCT_OFFSET (IBusPanelServiceClass, hide_language_bar) }, - { "HideLookupTable", G_STRUCT_OFFSET (IBusPanelServiceClass, hide_lookup_table) }, - { "HidePreeditText", G_STRUCT_OFFSET (IBusPanelServiceClass, hide_preedit_text) }, - { "PageDownLookupTable", G_STRUCT_OFFSET (IBusPanelServiceClass, page_down_lookup_table) }, - { "PageUpLookupTable", G_STRUCT_OFFSET (IBusPanelServiceClass, page_up_lookup_table) }, - { "Reset", G_STRUCT_OFFSET (IBusPanelServiceClass, reset) }, - { "ShowAuxiliaryText", G_STRUCT_OFFSET (IBusPanelServiceClass, show_auxiliary_text) }, - { "ShowLanguageBar", G_STRUCT_OFFSET (IBusPanelServiceClass, show_language_bar) }, - { "ShowLookupTable", G_STRUCT_OFFSET (IBusPanelServiceClass, show_lookup_table) }, - { "ShowPreeditText", G_STRUCT_OFFSET (IBusPanelServiceClass, show_preedit_text) }, - { "StartSetup", G_STRUCT_OFFSET (IBusPanelServiceClass, start_setup) }, - { "StateChanged", G_STRUCT_OFFSET (IBusPanelServiceClass, state_changed) }, + { "CursorUpLookupTable", CURSOR_UP_LOOKUP_TABLE }, + { "CursorDownLookupTable", CURSOR_DOWN_LOOKUP_TABLE }, + { "HideAuxiliaryText", HIDE_AUXILIARY_TEXT }, + { "HideLanguageBar", HIDE_LANGUAGE_BAR }, + { "HideLookupTable", HIDE_LOOKUP_TABLE }, + { "HidePreeditText", HIDE_PREEDIT_TEXT }, + { "PageUpLookupTable", PAGE_UP_LOOKUP_TABLE }, + { "PageDownLookupTable", PAGE_DOWN_LOOKUP_TABLE }, + { "Reset", RESET }, + { "ShowAuxiliaryText", SHOW_AUXILIARY_TEXT }, + { "ShowLanguageBar", SHOW_LANGUAGE_BAR }, + { "ShowLookupTable", SHOW_LOOKUP_TABLE }, + { "ShowPreeditText", SHOW_PREEDIT_TEXT }, + { "StartSetup", START_SETUP }, + { "StateChanged", STATE_CHANGED }, }; gint i; for (i = 0; i < G_N_ELEMENTS (no_arg_methods); i++) { if (g_strcmp0 (method_name, no_arg_methods[i].name) == 0) { - typedef gboolean (* NoArgFunc) (IBusPanelService *); - NoArgFunc func; - func = G_STRUCT_MEMBER (NoArgFunc, - IBUS_PANEL_SERVICE_GET_CLASS (panel), - no_arg_methods[i].offset); - func (panel); + if (no_arg_methods[i].signal_id >= 0) { + g_signal_emit (panel, panel_signals[no_arg_methods[i].signal_id], 0); + } g_dbus_method_invocation_return_value (invocation, NULL); return; } @@ -490,7 +945,7 @@ ibus_panel_service_update_auxiliary_text (IBusPanelService *panel, static void ibus_panel_service_update_lookup_table (IBusPanelService *panel, IBusLookupTable *lookup_table, - gboolean visibl) + gboolean visible) { ibus_panel_service_not_implemented(panel); } @@ -540,15 +995,15 @@ ibus_panel_service_candidate_clicked (IBusPanelService *panel, } void -ibus_panel_service_property_active (IBusPanelService *panel, - const gchar *prop_name, - guint prop_state) +ibus_panel_service_property_activate (IBusPanelService *panel, + const gchar *prop_name, + guint prop_state) { g_return_if_fail (IBUS_IS_PANEL_SERVICE (panel)); ibus_service_emit_signal ((IBusService *) panel, NULL, IBUS_INTERFACE_PANEL, - "PropertyActive", + "PropertyActivate", g_variant_new ("(su)", prop_name, prop_state), NULL); } diff --git a/src/ibuspanelservice.h b/src/ibuspanelservice.h index 505fb7f..7678922 100644 --- a/src/ibuspanelservice.h +++ b/src/ibuspanelservice.h @@ -182,7 +182,7 @@ void ibus_panel_service_page_down (IBusPanelService *panel); void ibus_panel_service_page_up (IBusPanelService *panel); /** - * ibus_panel_service_property_active + * ibus_panel_service_property_activate * @panel: An IBusPanelService * @prop_name: A property name * @prop_state: State of the property @@ -190,7 +190,7 @@ void ibus_panel_service_page_up (IBusPanelService *panel); * Notify that a property is active * by sending a "PropertyActivate" message to IBus service. */ -void ibus_panel_service_property_active (IBusPanelService *panel, +void ibus_panel_service_property_activate (IBusPanelService *panel, const gchar *prop_name, guint prop_state); /** -- 1.7.3.2 From cc1d776aeb65b481b1bd93e1f7acfbe4fea8e1f2 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Wed, 26 Jan 2011 14:01:25 +0900 Subject: [PATCH] Set QT_IM_MODULE=xim in case of no ibus-qt. --- xinput-ibus.in | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/xinput-ibus.in b/xinput-ibus.in index f10d003..8e5818b 100644 --- a/xinput-ibus.in +++ b/xinput-ibus.in @@ -13,6 +13,8 @@ if test -f /usr/lib64/qt4/plugins/inputmethods/libqtim-ibus.so || \ test -f /usr/lib/qt4/plugins/inputmethods/libqtim-ibus.so; then QT_IM_MODULE=ibus +else + QT_IM_MODULE=xim fi # if [ -z "$IBUS_SESSION_ID" ]; then -- 1.7.3.2 From ea3917659bb7be5ee93ced938d5b522a468f7677 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Wed, 26 Jan 2011 13:15:08 +0900 Subject: [PATCH] Fix introspection definitions. --- src/ibusbus.h | 2 +- src/ibusinputcontext.h | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ibusbus.h b/src/ibusbus.h index a2cd1db..3ea3cde 100644 --- a/src/ibusbus.h +++ b/src/ibusbus.h @@ -101,7 +101,7 @@ gboolean ibus_bus_is_connected (IBusBus *bus); /** * ibus_bus_get_connection: * @bus: An IBusBus. - * @returns: TRUE if @bus is connected, FALSE otherwise. + * @returns: (transfer none): A GDBusConnection of an IBusIBus instance. * * Return GDBusConnection of an IBusIBus instance. */ diff --git a/src/ibusinputcontext.h b/src/ibusinputcontext.h index 4be9160..fa7d976 100644 --- a/src/ibusinputcontext.h +++ b/src/ibusinputcontext.h @@ -107,7 +107,7 @@ IBusInputContext * ibus_input_context_get_input_context: * @path: The path to the object that emitting the signal. * @connection: An GDBusConnection. - * @returns: An existing IBusInputContext. + * @returns: (transfer none): An existing IBusInputContext. * * Gets an existing IBusInputContext. */ @@ -142,7 +142,7 @@ IBusInputContext * * Use ibus_keymap_lookup_keysym() to convert keycode to keysym in given keyboard layout. * - * @see_also: #IBusEngine::process-key-event + * see_also: #IBusEngine::process-key-event */ gboolean ibus_input_context_process_key_event (IBusInputContext *context, @@ -160,7 +160,7 @@ gboolean ibus_input_context_process_key_event * * Set the cursor location of IBus input context. * - * @see_also: #IBusEngine::set-cursor-location + * see_also: #IBusEngine::set-cursor-location */ void ibus_input_context_set_cursor_location (IBusInputContext *context, @@ -177,7 +177,7 @@ void ibus_input_context_set_cursor_location * When IBUS_CAP_FOCUS is not set, IBUS_CAP_PREEDIT_TEXT, IBUS_CAP_AUXILIARY_TEXT, IBUS_CAP_LOOKUP_TABLE, and IBUS_CAP_PROPERTY have to be all set. * The panel component does nothing for an application that doesn't support focus. * - * @see_also: #IBusEngine::set-capabilities + * see_also: #IBusEngine::set-capabilities */ void ibus_input_context_set_capabilities (IBusInputContext *context, @@ -204,7 +204,7 @@ void ibus_input_context_property_activate * * Invoked when the client application get focus. * - * @see_also: #IBusEngine::focus_in. + * see_also: #IBusEngine::focus_in. */ void ibus_input_context_focus_in (IBusInputContext *context); @@ -214,7 +214,7 @@ void ibus_input_context_focus_in (IBusInputContext *context); * * Invoked when the client application get focus. * - * @see_also: #IBusEngine::focus_out. + * see_also: #IBusEngine::focus_out. */ void ibus_input_context_focus_out (IBusInputContext *context); @@ -225,7 +225,7 @@ void ibus_input_context_focus_out (IBusInputContext *context); * * Invoked when the IME is reset. * - * @see_also: #IBusEngine::reset + * see_also: #IBusEngine::reset */ void ibus_input_context_reset (IBusInputContext *context); @@ -235,7 +235,7 @@ void ibus_input_context_reset (IBusInputContext *context); * * Invoked when the IME is enabled, either by IME switch hotkey or select from the menu. * - * @see_also: #IBusEngine::enable + * see_also: #IBusEngine::enable */ void ibus_input_context_enable (IBusInputContext *context); @@ -245,7 +245,7 @@ void ibus_input_context_enable (IBusInputContext *context); * * Invoked when the IME is disabled, either by IME switch hotkey or select from the menu. * - * @see_also: #IBusEngine::disable + * see_also: #IBusEngine::disable */ void ibus_input_context_disable (IBusInputContext *context); @@ -262,7 +262,7 @@ gboolean ibus_input_context_is_enabled (IBusInputContext *context); /** * ibus_input_context_get_engine: * @context: An IBusInputContext. - * @returns: An IME engine description for the context + * @returns: (transfer none): An IME engine description for the context * * Returns an IME engine description for the context. */ -- 1.7.3.2