[uim-commit] r612 - in trunk: gtk uim xim

ekato at freedesktop.org ekato at freedesktop.org
Tue Feb 8 05:43:39 PST 2005


Author: ekato
Date: 2005-02-08 05:43:36 -0800 (Tue, 08 Feb 2005)
New Revision: 612

Modified:
   trunk/gtk/gtk-im-uim.c
   trunk/uim/uim-helper-client.c
   trunk/xim/ximserver.cpp
Log:
* gtk/gtk-im-uim.c (update_prop_list_cb) : Do not send message
  unless context is focused.
(update_prop_label_cb) : Ditto.
* xim/ximserver.cpp (InputContext::update_prop_list_cb) : Ditto.
(InputContext::update_prop_label_cb) : Ditto.
* uim/uim-helper-client.s (uim_helper_init_client_fd) : Set
  O_NONBLOCK flag after connect() has been succeeded.


Modified: trunk/gtk/gtk-im-uim.c
===================================================================
--- trunk/gtk/gtk-im-uim.c	2005-02-08 10:37:18 UTC (rev 611)
+++ trunk/gtk/gtk-im-uim.c	2005-02-08 13:43:36 UTC (rev 612)
@@ -693,7 +693,13 @@
 static void
 update_prop_list_cb(void *ptr, const char *str)
 {
-  GString *tmp = g_string_new("");
+  IMUIMContext *uic = (IMUIMContext *)ptr;
+  GString *tmp;
+
+  if (uic != focused_context)
+    return;
+
+  tmp = g_string_new("");
   g_string_printf(tmp, "prop_list_update\ncharset=UTF-8\n%s", str);
 
   uim_helper_send_message(im_uim_fd, tmp->str);
@@ -703,7 +709,13 @@
 static void
 update_prop_label_cb(void *ptr, const char *str)
 {
-  GString *tmp = g_string_new("");
+  IMUIMContext *uic = (IMUIMContext *)ptr;
+  GString *tmp;
+
+  if (uic != focused_context)
+    return;
+
+  tmp = g_string_new("");
   g_string_printf(tmp, "prop_label_update\ncharset=UTF-8\n%s", str);
 
   uim_helper_send_message(im_uim_fd, tmp->str);

Modified: trunk/uim/uim-helper-client.c
===================================================================
--- trunk/uim/uim-helper-client.c	2005-02-08 10:37:18 UTC (rev 611)
+++ trunk/uim/uim-helper-client.c	2005-02-08 13:43:36 UTC (rev 612)
@@ -90,16 +90,6 @@
     return -1;
   }
   
-  if ((flag = fcntl(fd, F_GETFL)) == -1) {
-    close(fd);
-    return -1;
-  }
-
-  flag |= O_NONBLOCK;
-  if (fcntl(fd, F_SETFL, flag) == -1) {
-    close(fd);
-    return -1;
-  }
 #ifdef LOCAL_CREDS /* for NetBSD */
   /* Set the socket to receive credentials on the next message */
   {
@@ -135,6 +125,17 @@
     return -1;
   }
 
+  if ((flag = fcntl(fd, F_GETFL)) == -1) {
+    close(fd);
+    return -1;
+  }
+
+  flag |= O_NONBLOCK;
+  if (fcntl(fd, F_SETFL, flag) == -1) {
+    close(fd);
+    return -1;
+  }
+
   uim_read_buf = strdup("");
   uim_disconnect_cb = disconnect_cb;
   uim_fd = fd;

Modified: trunk/xim/ximserver.cpp
===================================================================
--- trunk/xim/ximserver.cpp	2005-02-08 10:37:18 UTC (rev 611)
+++ trunk/xim/ximserver.cpp	2005-02-08 13:43:36 UTC (rev 612)
@@ -159,6 +159,7 @@
 #if 1
     // Updated ximserver's global im with customized one.
     // This is temporal hack.
+    //fprintf(stderr, "custom %s, val %s\n", custom, val);
     if (!strcmp(custom, "custom-activate-default-im-name?")) {
 	if (!strcmp(val, "#t"))
 	    mUsePreservedDefaultIM = true;
@@ -551,13 +552,17 @@
 void InputContext::update_prop_list_cb(void *ptr, const char *str)
 {
     InputContext *ic = (InputContext *)ptr;
-    ic->update_prop_list(str);
+    InputContext *focusedContext = InputContext::focusedContext();
+    if (ic == focusedContext)
+      ic->update_prop_list(str);
 }
 
 void InputContext::update_prop_label_cb(void *ptr, const char *str)
 {
     InputContext *ic = (InputContext *)ptr;
-    ic->update_prop_label(str);
+    InputContext *focusedContext = InputContext::focusedContext();
+    if (ic == focusedContext)
+      ic->update_prop_label(str);
 }
 
 void InputContext::clear_preedit()



More information about the Uim-commit mailing list