[uim-commit] r3148 - in trunk: doc gtk

yamaken at freedesktop.org yamaken at freedesktop.org
Tue Feb 28 16:26:42 PST 2006


Author: yamaken
Date: 2006-02-28 16:26:36 -0800 (Tue, 28 Feb 2006)
New Revision: 3148

Modified:
   trunk/doc/COMPATIBILITY
   trunk/gtk/gtk-im-uim.c
Log:
* gtk/gtk-im-uim.c
  - (switch_app_global_im_cb, switch_system_global_im_cb): New static
    function
  - (im_module_create): Register the new callbacks appeared in r3147
* doc/COMPATIBILITY
  - Update "Context-originated IM switching of other contexts"


Modified: trunk/doc/COMPATIBILITY
===================================================================
--- trunk/doc/COMPATIBILITY	2006-03-01 00:23:56 UTC (rev 3147)
+++ trunk/doc/COMPATIBILITY	2006-03-01 00:26:36 UTC (rev 3148)
@@ -61,7 +61,7 @@
 Affects: Bridge developers
 Updates: C API
 Version: 1.1.0
-Revision: ac3147
+Revision: ac3147, ac3148
 Date: 2006-02-24
 Modifier: YamaKen
 Related: action-based IM switcher

Modified: trunk/gtk/gtk-im-uim.c
===================================================================
--- trunk/gtk/gtk-im-uim.c	2006-03-01 00:23:56 UTC (rev 3147)
+++ trunk/gtk/gtk-im-uim.c	2006-03-01 00:26:36 UTC (rev 3148)
@@ -139,6 +139,8 @@
 static void im_uim_class_init(GtkIMContextClass *class);
 static void im_uim_class_finalize(GtkIMContextClass *class);
 static void im_uim_init(IMUIMContext *uic);
+static void switch_app_global_im_cb(void *ptr, const char *name);
+static void switch_system_global_im_cb(void *ptr, const char *name);
 
 #if IM_UIM_USE_SNOOPER
 static gboolean key_snoop(GtkWidget *grab_widget, GdkEventKey *key, gpointer data);
@@ -786,8 +788,44 @@
     send_im_list();
 }
 
+static void
+switch_app_global_im_cb(void *ptr, const char *name)
+{
+  IMUIMContext *uic, *cc;
+  GString *im_name_sym;
 
+  uic = (IMUIMContext *)ptr;
+  im_name_sym = g_string_new(name);
+  g_string_prepend_c(im_name_sym, '\'');
 
+  for (cc = context_list.next; cc != &context_list; cc = cc->next) {
+    if (cc != uic)
+      uim_switch_im(cc->uc, name);
+  }
+  uim_prop_update_custom(uic->uc,
+			 "custom-preserved-default-im-name", im_name_sym->str);
+  g_string_free(im_name_sym, TRUE);
+}
+
+static void
+switch_system_global_im_cb(void *ptr, const char *name)
+{
+  GString *msg;
+
+  /* switch contexts of this process */
+  switch_app_global_im_cb(ptr, name);
+
+  /* Switch contexts of other processes. Bridges should not expect
+   * that the helper-server reflect back the messaage to the
+   * originating process.  -- YamaKen 2006-03-01 */
+  msg = g_string_new("");
+  g_string_printf(msg, "im_change_whole_desktop\n%s\n", name);
+  uim_helper_send_message(im_uim_fd, msg->str);
+  g_string_free(msg, TRUE);
+}
+
+
+
 /* uim helper related */
 
 static void
@@ -1330,6 +1368,9 @@
   uim_set_candidate_selector_cb(uic->uc, cand_activate_cb, cand_select_cb,
 				cand_shift_page_cb, cand_deactivate_cb);
   uim_set_configuration_changed_cb(uic->uc, configuration_changed_cb);
+  uim_set_im_switch_request_cb(uic->uc,
+			       switch_app_global_im_cb,
+			       switch_system_global_im_cb);
 
   uim_prop_list_update(uic->uc);
 



More information about the uim-commit mailing list