diff options
author | Daiki Ueno <ueno@unixuser.org> | 2014-04-07 18:06:10 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@unixuser.org> | 2014-04-07 18:06:10 +0900 |
commit | ca128d1eee6599263b5e43b087781a00ada2732c (patch) | |
tree | 3ef623f3a9f85ca7cfee7a181dc67fb0cc6dbf90 | |
parent | 6ca5ddb302c98e52c78326ed0dfaaf90481d4d8c (diff) |
Keep track of content-type change after focus-in
This is an amendment to 6ca5ddb3. As content-type (input-purpose and hints)
can change after focus-in, we should monitor the changes.
BUG=
R=takao.fujiwara1@gmail.com
Review URL: https://codereview.appspot.com/83920043
-rw-r--r-- | bus/inputcontext.c | 21 | ||||
-rw-r--r-- | bus/marshalers.list | 1 | ||||
-rw-r--r-- | bus/panelproxy.c | 16 |
3 files changed, 38 insertions, 0 deletions
diff --git a/bus/inputcontext.c b/bus/inputcontext.c index 512a0ec3..9cbd2eca 100644 --- a/bus/inputcontext.c +++ b/bus/inputcontext.c @@ -124,6 +124,7 @@ enum { UPDATE_PROPERTY, ENGINE_CHANGED, REQUEST_ENGINE, + SET_CONTENT_TYPE, LAST_SIGNAL, }; @@ -566,6 +567,18 @@ bus_input_context_class_init (BusInputContextClass *class) 1, G_TYPE_STRING); + context_signals[SET_CONTENT_TYPE] = + g_signal_new (I_("set-content-type"), + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + bus_marshal_VOID__UINT_UINT, + G_TYPE_NONE, + 2, + G_TYPE_UINT, + G_TYPE_UINT); + text_empty = ibus_text_new_from_string (""); g_object_ref_sink (text_empty); lookup_table_empty = ibus_lookup_table_new (9 /* page size */, 0, FALSE, FALSE); @@ -1149,6 +1162,14 @@ bus_input_context_service_set_property (IBusService *service, purpose, hints); + if (context->has_focus) { + g_signal_emit (context, + context_signals[SET_CONTENT_TYPE], + 0, + context->purpose, + context->hints); + } + error = NULL; retval = bus_input_context_property_changed (context, "ContentType", diff --git a/bus/marshalers.list b/bus/marshalers.list index 7bc5dc3a..c032cdaa 100644 --- a/bus/marshalers.list +++ b/bus/marshalers.list @@ -10,5 +10,6 @@ VOID:OBJECT,UINT,BOOLEAN,UINT VOID:OBJECT,STRING,STRING,STRING VOID:STRING VOID:STRING,INT +VOID:UINT,UINT VOID:UINT,UINT,UINT VOID:VOID diff --git a/bus/panelproxy.c b/bus/panelproxy.c index cdb3d20c..9d47b136 100644 --- a/bus/panelproxy.c +++ b/bus/panelproxy.c @@ -589,6 +589,20 @@ _context_destroy_cb (BusInputContext *context, bus_panel_proxy_focus_out (panel, context); } +static void +_context_set_content_type_cb (BusInputContext *context, + guint purpose, + guint hints, + BusPanelProxy *panel) +{ + g_assert (BUS_IS_INPUT_CONTEXT (context)); + g_assert (BUS_IS_PANEL_PROXY (panel)); + + g_return_if_fail (panel->focused_context == context); + + bus_panel_proxy_set_content_type (panel, purpose, hints); +} + #define DEFINE_FUNCTION(name) \ static void _context_##name##_cb (BusInputContext *context, \ BusPanelProxy *panel) \ @@ -643,6 +657,8 @@ static const struct { { "engine-changed", G_CALLBACK (_context_state_changed_cb) }, { "destroy", G_CALLBACK (_context_destroy_cb) }, + + { "set-content-type", G_CALLBACK (_context_set_content_type_cb) }, }; void |