[uim-commit] r1866 - trunk/uim
ekato at freedesktop.org
ekato at freedesktop.org
Sat Oct 22 07:17:25 PDT 2005
Author: ekato
Date: 2005-10-22 07:17:10 -0700 (Sat, 22 Oct 2005)
New Revision: 1866
Modified:
trunk/uim/uim-func.c
trunk/uim/uim-internal.h
trunk/uim/uim.c
trunk/uim/uim.h
Log:
* uim/uim.h (uim_set_configuration_changed_cb) : New API. Set
a callback function which is called when configuration of the
input context is changed.
* uim/uim-internal.h (uim_context_) : Add void
(*configuration_changed_cb)
* uim/uim-func.c (switch_im) : Call configuration_changed_cb if
exists.
* uim/uim.c (uim_create_context) : Initialize
uc->configuration_changed_cb.
(uim_set_configuration_changed_cb) : New.
Modified: trunk/uim/uim-func.c
===================================================================
--- trunk/uim/uim-func.c 2005-10-22 01:50:08 UTC (rev 1865)
+++ trunk/uim/uim-func.c 2005-10-22 14:17:10 UTC (rev 1866)
@@ -729,6 +729,9 @@
const char *name= uim_scm_refer_c_str(name_);
uim_context uc = uim_find_context(uim_scm_c_int(id_));
uim_switch_im(uc, name);
+ if (uc->configuration_changed_cb)
+ uc->configuration_changed_cb(uc->ptr);
+
return uim_scm_t();
}
Modified: trunk/uim/uim-internal.h
===================================================================
--- trunk/uim/uim-internal.h 2005-10-22 01:50:08 UTC (rev 1865)
+++ trunk/uim/uim-internal.h 2005-10-22 14:17:10 UTC (rev 1866)
@@ -114,6 +114,8 @@
/* surrounding text */
void (*request_surrounding_text_cb)(void *ptr);
int (*delete_surrounding_text_cb)(void *ptr, int offset, int len);
+ /* configuration changed */
+ void (*configuration_changed_cb)(void *ptr);
/* preedit segments array */
struct preedit_segment *psegs;
int nr_psegs;
Modified: trunk/uim/uim.c
===================================================================
--- trunk/uim/uim.c 2005-10-22 01:50:08 UTC (rev 1865)
+++ trunk/uim/uim.c 2005-10-22 14:17:10 UTC (rev 1866)
@@ -170,6 +170,8 @@
uc->request_surrounding_text_cb = NULL;
uc->delete_surrounding_text_cb = NULL;
/**/
+ uc->configuration_changed_cb = NULL;
+ /**/
uc->nr_candidates = 0;
uc->candidate_index = 0;
/**/
@@ -213,6 +215,13 @@
}
void
+uim_set_configuration_changed_cb(uim_context uc,
+ void (*changed_cb)(void *ptr))
+{
+ uc->configuration_changed_cb = changed_cb;
+}
+
+void
uim_switch_im(uim_context uc, const char *engine)
{
/* related to the commit log of r1400:
Modified: trunk/uim/uim.h
===================================================================
--- trunk/uim/uim.h 2005-10-22 01:50:08 UTC (rev 1865)
+++ trunk/uim/uim.h 2005-10-22 14:17:10 UTC (rev 1866)
@@ -567,6 +567,17 @@
uim_set_surrounding_text(uim_context uc, const char *text,
int cursor_pos, int len);
+/*
+ * Set callback function to be called when configuration of input
+ * context is changed.
+ *
+ * @param uc input context
+ * @param changed_cb called when configuration of the input context is changed.
+ * 1st argument "ptr" corresponds to the 1st argument of uim_create_context.
+ */
+void
+uim_set_configuration_changed_cb(uim_context uc,
+ void (*changed_cb)(void *ptr));
/* Utility functions */
int
More information about the uim-commit
mailing list