[uim-commit] r1050 - trunk/xim

ekato at freedesktop.org ekato at freedesktop.org
Thu Jul 28 06:19:09 EST 2005


Author: ekato
Date: 2005-07-27 13:19:06 -0700 (Wed, 27 Jul 2005)
New Revision: 1050

Modified:
   trunk/xim/canddisp.cpp
   trunk/xim/connection.cpp
   trunk/xim/convdisp.cpp
   trunk/xim/ximtrans.cpp
Log:
* xim/ximtrans.cpp (Connection::xim_error) : Cope with
  XIM_BadSomething for qt's insufficient XIM implementation.
* xim/canddisp.cpp : Cosmetic change.
* xim/convdisp.cpp : Ditto.
* xim/connection.cpp : Ditto.


Modified: trunk/xim/canddisp.cpp
===================================================================
--- trunk/xim/canddisp.cpp	2005-07-27 15:53:54 UTC (rev 1049)
+++ trunk/xim/canddisp.cpp	2005-07-27 20:19:06 UTC (rev 1050)
@@ -52,8 +52,8 @@
 #include "util.h"
 
 
-static FILE *candwin_r = NULL, *candwin_w = NULL;
-static int candwin_pid = 0;
+static FILE *candwin_r, *candwin_w;
+static int candwin_pid;
 static Canddisp *disp;
 static const char *command;
 
@@ -74,10 +74,10 @@
      */
 
     candwin_prog = getenv("UIM_CANDWIN_PROG");
-    if (candwin_prog == NULL) {
+    if (!candwin_prog) {
 #ifdef UIM_COMPAT_SCM
 	candwin_prog = uim_scm_symbol_value_str("uim-candwin-prog");
-	if(candwin_prog != NULL)
+	if (candwin_prog)
 	    return candwin_prog;
 #endif /* UIM_COMPAT_SCM */
 #if defined(USE_QT_CANDWIN)
@@ -93,10 +93,10 @@
 
 Canddisp *canddisp_singleton()
 {
-    if (command == NULL)
-	  command = candwin_command();
+    if (!command)
+	command = candwin_command();
 
-    if (disp == NULL && command) {
+    if (!disp && command) {
 	candwin_pid = uim_ipc_open_command(candwin_pid, &candwin_r, &candwin_w, command);
 	disp = new Canddisp();
 	int fd = fileno(candwin_r);
@@ -117,14 +117,13 @@
 {
     std::vector<const char *>::iterator i;
 
-    if (candwin_w == NULL)
+    if (!candwin_w)
 	return;
 
     fprintf(candwin_w, "activate\ncharset=UTF-8\ndisplay_limit=%d\n",
 		    display_limit);
-    for (i = candidates.begin(); i != candidates.end(); i++) {
+    for (i = candidates.begin(); i != candidates.end(); i++)
 	fprintf(candwin_w, "%s\n", *i);
-    }
     fprintf(candwin_w, "\n");
     fflush(candwin_w);
     check_connection();
@@ -132,7 +131,7 @@
 
 void Canddisp::select(int index)
 {
-    if (candwin_w == NULL)
+    if (!candwin_w)
 	return;
     fprintf(candwin_w, "select\n");
     fprintf(candwin_w, "%d\n\n", index);
@@ -142,7 +141,7 @@
 
 void Canddisp::deactivate()
 {
-    if (candwin_w == NULL)
+    if (!candwin_w)
 	return;
     fprintf(candwin_w, "deactivate\n\n");
     fflush(candwin_w);
@@ -151,7 +150,7 @@
 
 void Canddisp::show()
 {
-    if (candwin_w == NULL)
+    if (!candwin_w)
 	return;
     fprintf(candwin_w, "show\n\n");
     fflush(candwin_w);
@@ -160,7 +159,7 @@
 
 void Canddisp::hide()
 {
-    if (candwin_w == NULL)
+    if (!candwin_w)
 	return;
     fprintf(candwin_w, "hide\n\n");
     fflush(candwin_w);
@@ -169,7 +168,7 @@
 
 void Canddisp::move(int x, int y)
 {
-    if (candwin_w == NULL)
+    if (!candwin_w)
 	return;
     fprintf(candwin_w, "move\n");
     fprintf(candwin_w, "%d\n", x);
@@ -181,7 +180,7 @@
 
 void Canddisp::show_caret_state(const char *str)
 {
-    if (candwin_w == NULL)
+    if (!candwin_w)
 	return;
     fprintf(candwin_w, "show_caret_state\n");
     fprintf(candwin_w, "%s", str);
@@ -266,6 +265,5 @@
     }
 
     disp = NULL;
-
     return;
 }

Modified: trunk/xim/connection.cpp
===================================================================
--- trunk/xim/connection.cpp	2005-07-27 15:53:54 UTC (rev 1049)
+++ trunk/xim/connection.cpp	2005-07-27 20:19:06 UTC (rev 1050)
@@ -101,7 +101,7 @@
 void
 procXClientMessage(XClientMessageEvent *ev)
 {
-    //  check connection request
+    // check connection request
     XimServer *xs = XimServer::findServer(ev->window);
     if (xs && ev->message_type == xim_xconnect) {
 	xs->setupNewConnection(ev);

Modified: trunk/xim/convdisp.cpp
===================================================================
--- trunk/xim/convdisp.cpp	2005-07-27 15:53:54 UTC (rev 1049)
+++ trunk/xim/convdisp.cpp	2005-07-27 20:19:06 UTC (rev 1050)
@@ -114,7 +114,7 @@
 			NULL);
 	if (xftfont) {
 	    if (gXftFont)
-	      XftFontClose(XimServer::gDpy, gXftFont);
+		XftFontClose(XimServer::gDpy, gXftFont);
 	    free(gXftFontName);
 	    free(gXftFontLocale);
 	    gXftFont = xftfont;

Modified: trunk/xim/ximtrans.cpp
===================================================================
--- trunk/xim/ximtrans.cpp	2005-07-27 15:53:54 UTC (rev 1049)
+++ trunk/xim/ximtrans.cpp	2005-07-27 20:19:06 UTC (rev 1050)
@@ -46,6 +46,9 @@
 # include <alloca.h>
 #endif
 
+/* XIM Error Code */
+#define XIM_BadSomething	999
+
 const char *xim_packet_name[] = {
     // 0
     0, "XIM_CONNECT", "XIM_CONNECT_REPLY",
@@ -757,14 +760,23 @@
     buf[len] = 0;
     p->getStr(buf);
   
-    printf("XIM_ERROR received.\n");
+    fprintf(stderr, "XIM_ERROR received.\n");
     if (mask & 1)
-	printf(" imid = %d\n", imid);
+	fprintf(stderr, " imid = %d\n", imid);
     if (mask & 2)
-	printf(" icid = %d\n", icid);
+	fprintf(stderr, " icid = %d\n", icid);
 
-    printf(" error_code = %d\n", ecode);
-    printf(" message=(%s)\n", buf);
+    fprintf(stderr, " error_code = %d\n", ecode);
+    fprintf(stderr, " message=(%s)\n", buf);
+
+    switch (ecode) {
+    case XIM_BadSomething:
+	unsetPreeditStartSyncFlag();
+	unsetPreeditCaretSyncFlag();
+	break;
+    default:
+	break;
+    }
 }
 
 XimIC *Connection::get_ic(RxPacket *p)



More information about the uim-commit mailing list