[uim-commit] r1162 - in trunk: doc gtk uim xim
yamaken at freedesktop.org
yamaken at freedesktop.org
Tue Aug 9 06:56:18 EST 2005
Author: yamaken
Date: 2005-08-08 13:56:11 -0700 (Mon, 08 Aug 2005)
New Revision: 1162
Modified:
trunk/doc/COMPATIBILITY
trunk/gtk/gtk-im-uim.c
trunk/uim/uim-custom.c
trunk/uim/uim-custom.h
trunk/xim/helper.cpp
Log:
* This commit reverts the removal of the prop_update_custom message
functionality committed in r1160 and r1161 because:
- The new message custom_reload_notify cannot replace some
functionality of the prop_update_custom listed in below:
* alter custom variables without saving files
* alter a single custom variable
- It's broken since the Scheme procedure custom-reload-configs is
still lacking
Please be conservertive when removing or alter an
API functionality. Suggestion before such change at the mailinglist
makes us happy.
* uim/uim-custom.h
- (uim_custom_broadcast_reload_request): New API function
* uim/uim-custom.c
- (uim_custom_broadcast_reload_request): New function
- (uim_custom_broadcast): Revert the prop_update_custom
functionality
* gtk/gtk-im-uim.c
- (im_uim_parse_helper_str): Ditto
* xim/helper.cpp
- (helper_str_parse): Ditto
* doc/COMPATIBILITY
- Add a new section "An experimental custom variable reloading API"
Modified: trunk/doc/COMPATIBILITY
===================================================================
--- trunk/doc/COMPATIBILITY 2005-08-08 19:50:42 UTC (rev 1161)
+++ trunk/doc/COMPATIBILITY 2005-08-08 20:56:11 UTC (rev 1162)
@@ -58,6 +58,19 @@
The changes are described below in most recently updated order.
------------------------------------------------------------------------------
+Summary: An experimental custom variable reloading API
+Affects: Helper program developers, Bridge developers
+Updates: C API, Helper protocol
+Version: 0.5
+Revision: ac1160, ac1161, ac1162
+Date: 2005-08-09
+Modifier: TOKUNAGA Hiroyuki, YamaKen
+Related: bug #3620
+URL:
+Changes:
+ (new) uim_custom_broadcast_reload_request()
+Description:
+------------------------------------------------------------------------------
Summary: default IM switching responsibility separation from uim_switch_im()
Affects: Bridge developers
Updates: C API
Modified: trunk/gtk/gtk-im-uim.c
===================================================================
--- trunk/gtk/gtk-im-uim.c 2005-08-08 19:50:42 UTC (rev 1161)
+++ trunk/gtk/gtk-im-uim.c 2005-08-08 20:56:11 UTC (rev 1162)
@@ -986,7 +986,15 @@
if (g_str_has_prefix(str, "im_change") == TRUE) {
im_uim_parse_helper_str_im_change(str);
} else if (g_str_has_prefix(str, "prop_update_custom") == TRUE) {
- uim_prop_reload_configs();
+ IMUIMContext *cc;
+ lines = g_strsplit(str, "\n", 0);
+ if (lines && lines[0] && lines[1] && lines[2]) {
+ for (cc = context_list.next; cc != &context_list; cc = cc->next) {
+ uim_prop_update_custom(cc->uc, lines[1], lines[2]);
+ break; /* all custom variables are global */
+ }
+ g_strfreev(lines);
+ }
} else if (g_str_has_prefix(str, "custom_reload_notify") == TRUE) {
uim_prop_reload_configs();
} else if (focused_context && !disable_focused_context) {
Modified: trunk/uim/uim-custom.c
===================================================================
--- trunk/uim/uim-custom.c 2005-08-08 19:50:42 UTC (rev 1161)
+++ trunk/uim/uim-custom.c 2005-08-08 20:56:11 UTC (rev 1162)
@@ -916,6 +916,44 @@
helper_fd = uim_helper_init_client_fd(helper_disconnect_cb);
}
+ custom_syms = uim_custom_collect_by_group(NULL);
+ for (sym = custom_syms; *sym; sym++) {
+ value = uim_custom_value_as_literal(*sym);
+ if (value) {
+ msg_size = sizeof(custom_msg_tmpl) + strlen(*sym) + strlen(value);
+ msg = (char *)malloc(msg_size);
+ if (!msg) {
+ free(value);
+ uim_custom_symbol_list_free(custom_syms);
+ return UIM_FALSE;
+ }
+ sprintf(msg, custom_msg_tmpl, *sym, value);
+ uim_helper_send_message(helper_fd, msg);
+ free(msg);
+ free(value);
+ }
+ }
+ uim_custom_symbol_list_free(custom_syms);
+
+ if (helper_fd != -1) {
+ uim_helper_close_client_fd(helper_fd);
+ }
+
+ return UIM_TRUE;
+}
+
+/**
+ *
+ * @retval UIM_TRUE succeeded
+ * @retval UIM_FALSE failed
+ */
+uim_bool
+uim_custom_broadcast_reload_request(void)
+{
+ if (helper_fd < 0) {
+ helper_fd = uim_helper_init_client_fd(helper_disconnect_cb);
+ }
+
uim_helper_send_message(helper_fd, "custom_reload_notify\n");
if (helper_fd != -1) {
Modified: trunk/uim/uim-custom.h
===================================================================
--- trunk/uim/uim-custom.h 2005-08-08 19:50:42 UTC (rev 1161)
+++ trunk/uim/uim-custom.h 2005-08-08 20:56:11 UTC (rev 1162)
@@ -127,6 +127,7 @@
uim_bool uim_custom_load(void);
uim_bool uim_custom_save(void);
uim_bool uim_custom_broadcast(void);
+uim_bool uim_custom_broadcast_reload_request(void);
/* custom variable */
struct uim_custom *uim_custom_get(const char *custom_sym);
Modified: trunk/xim/helper.cpp
===================================================================
--- trunk/xim/helper.cpp 2005-08-08 19:50:42 UTC (rev 1161)
+++ trunk/xim/helper.cpp 2005-08-08 20:56:11 UTC (rev 1162)
@@ -204,7 +204,26 @@
parse_helper_str_im_change(line, engine);
return;
} else if (strcmp("prop_update_custom", line) == 0) {
- uim_prop_reload_configs();
+ line = eol + 1;
+ eol = strchr(line, '\n');
+ if (eol != NULL)
+ *eol = '\0';
+ else
+ return;
+
+ char *custom = line;
+ char *val = eol + 1;
+ eol = strchr(val, '\n');
+ if (eol != NULL)
+ *eol = '\0';
+ else
+ return;
+
+ std::map<Window, XimServer *>::iterator it;
+ for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); it++) {
+ (*it).second->customContext(custom, val);
+ }
+ return;
} else if (strcmp("custom_reload_notify", line) == 0) {
uim_prop_reload_configs();
}
More information about the uim-commit
mailing list