diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ibusinputcontext.c | 20 | ||||
-rw-r--r-- | src/ibusinputcontext.h | 16 | ||||
-rw-r--r-- | src/ibuspanelservice.c | 62 | ||||
-rw-r--r-- | src/ibuspanelservice.h | 8 |
4 files changed, 105 insertions, 1 deletions
diff --git a/src/ibusinputcontext.c b/src/ibusinputcontext.c index 908011fa..9a50acc0 100644 --- a/src/ibusinputcontext.c +++ b/src/ibusinputcontext.c @@ -944,6 +944,26 @@ ibus_input_context_set_cursor_location (IBusInputContext *context, } void +ibus_input_context_set_cursor_location_relative (IBusInputContext *context, + gint32 x, + gint32 y, + gint32 w, + gint32 h) +{ + g_assert (IBUS_IS_INPUT_CONTEXT (context)); + + g_dbus_proxy_call ((GDBusProxy *) context, + "SetCursorLocationRelative", /* method_name */ + g_variant_new ("(iiii)", x, y, w, h),/* parameters */ + G_DBUS_CALL_FLAGS_NONE, /* flags */ + -1, /* timeout */ + NULL, /* cancellable */ + NULL, /* callback */ + NULL /* user_data */ + ); +} + +void ibus_input_context_set_capabilities (IBusInputContext *context, guint32 capabilites) { diff --git a/src/ibusinputcontext.h b/src/ibusinputcontext.h index 5c6372f6..a77cf92f 100644 --- a/src/ibusinputcontext.h +++ b/src/ibusinputcontext.h @@ -317,6 +317,22 @@ void ibus_input_context_set_cursor_location gint32 w, gint32 h); /** + * ibus_input_context_set_cursor_location_relative: + * @context: An IBusInputContext. + * @x: X coordinate of the cursor. + * @y: Y coordinate of the cursor. + * @w: Width of the cursor. + * @h: Height of the cursor. + * + * Set the relative cursor location of IBus input context asynchronously. + */ +void ibus_input_context_set_cursor_location_relative + (IBusInputContext *context, + gint32 x, + gint32 y, + gint32 w, + gint32 h); +/** * ibus_input_context_set_capabilities: * @context: An IBusInputContext. * @capabilities: Capabilities flags of IBusEngine, see #IBusCapabilite diff --git a/src/ibuspanelservice.c b/src/ibuspanelservice.c index 27b76558..b95f54a9 100644 --- a/src/ibuspanelservice.c +++ b/src/ibuspanelservice.c @@ -33,6 +33,7 @@ enum { REGISTER_PROPERTIES, UPDATE_PROPERTY, SET_CURSOR_LOCATION, + SET_CURSOR_LOCATION_RELATIVE, CURSOR_UP_LOOKUP_TABLE, CURSOR_DOWN_LOOKUP_TABLE, HIDE_AUXILIARY_TEXT, @@ -118,6 +119,12 @@ static void ibus_panel_service_set_cursor_location gint y, gint w, gint h); +static void ibus_panel_service_set_cursor_location_relative + (IBusPanelService *panel, + gint x, + gint y, + gint w, + gint h); static void ibus_panel_service_update_auxiliary_text (IBusPanelService *panel, IBusText *text, @@ -189,6 +196,12 @@ static const gchar introspection_xml[] = " <arg direction='in' type='i' name='w' />" " <arg direction='in' type='i' name='h' />" " </method>" + " <method name='SetCursorLocationRelative'>" + " <arg direction='in' type='i' name='x' />" + " <arg direction='in' type='i' name='y' />" + " <arg direction='in' type='i' name='w' />" + " <arg direction='in' type='i' name='h' />" + " </method>" " <method name='Reset' />" " <method name='StartSetup' />" " <method name='StateChanged' />" @@ -251,6 +264,7 @@ ibus_panel_service_class_init (IBusPanelServiceClass *class) class->destroy_context = ibus_panel_service_destroy_context; class->register_properties = ibus_panel_service_register_properties; class->set_cursor_location = ibus_panel_service_set_cursor_location; + class->set_cursor_location_relative = ibus_panel_service_set_cursor_location_relative; class->update_lookup_table = ibus_panel_service_update_lookup_table; class->update_auxiliary_text = ibus_panel_service_update_auxiliary_text; class->update_preedit_text = ibus_panel_service_update_preedit_text; @@ -481,6 +495,35 @@ ibus_panel_service_class_init (IBusPanelServiceClass *class) G_TYPE_INT); /** + * IBusPanelService::set-cursor-location-relative: + * @panel: An #IBusPanelService + * @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-relative. + * Implement the member function set_cursor_location_relative() in + * extended class to receive this signal. + * + * <note><para>Argument @user_data is ignored in this function.</para> + * </note> + */ + panel_signals[SET_CURSOR_LOCATION_RELATIVE] = + g_signal_new (I_("set-cursor-location-relative"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IBusPanelServiceClass, set_cursor_location_relative), + 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: * @panel: An #IBusPanelService * @@ -1011,6 +1054,15 @@ ibus_panel_service_service_method_call (IBusService *service, return; } + if (g_strcmp0 (method_name, "SetCursorLocationRelative") == 0) { + gint x, y, w, h; + g_variant_get (parameters, "(iiii)", &x, &y, &w, &h); + g_signal_emit (panel, panel_signals[SET_CURSOR_LOCATION_RELATIVE], + 0, x, y, w, h); + g_dbus_method_invocation_return_value (invocation, NULL); + return; + } + if (g_strcmp0 (method_name, "ContentType") == 0) { guint purpose, hints; g_variant_get (parameters, "(uu)", &purpose, &hints); @@ -1142,6 +1194,16 @@ ibus_panel_service_set_cursor_location (IBusPanelService *panel, } static void +ibus_panel_service_set_cursor_location_relative (IBusPanelService *panel, + gint x, + gint y, + gint w, + gint h) +{ + ibus_panel_service_not_implemented(panel); +} + +static void ibus_panel_service_update_auxiliary_text (IBusPanelService *panel, IBusText *text, gboolean visible) diff --git a/src/ibuspanelservice.h b/src/ibuspanelservice.h index c3f1833c..07b56296 100644 --- a/src/ibuspanelservice.h +++ b/src/ibuspanelservice.h @@ -121,10 +121,16 @@ struct _IBusPanelServiceClass { void (* set_content_type) (IBusPanelService *panel, guint purpose, guint hints); + void (* set_cursor_location_relative) + (IBusPanelService *panel, + gint x, + gint y, + gint w, + gint h); /*< private >*/ /* padding */ - gpointer pdummy[6]; // We can add 8 pointers without breaking the ABI. + gpointer pdummy[5]; // We can add 8 pointers without breaking the ABI. }; GType ibus_panel_service_get_type (void); |