[uim-commit] r956 - branches/uim-0.4.7/xim

tkng at freedesktop.org tkng at freedesktop.org
Sun Jul 10 03:11:17 EST 2005


Author: tkng
Date: 2005-07-09 10:11:14 -0700 (Sat, 09 Jul 2005)
New Revision: 956

Modified:
   branches/uim-0.4.7/xim/compose.cpp
   branches/uim-0.4.7/xim/convdisp.cpp
   branches/uim-0.4.7/xim/ximserver.cpp
   branches/uim-0.4.7/xim/ximserver.h
Log:
* xim/compose.cpp, xim/ximserver.cpp, xim/convdisp.cpp, 
  xim/ximserver.h: Ported r953 (bug fix) from trunk.



Modified: branches/uim-0.4.7/xim/compose.cpp
===================================================================
--- branches/uim-0.4.7/xim/compose.cpp	2005-07-09 16:46:29 UTC (rev 955)
+++ branches/uim-0.4.7/xim/compose.cpp	2005-07-09 17:11:14 UTC (rev 956)
@@ -104,7 +104,7 @@
     } else { // Unmatched
 	if (m_context == m_top)
 	    return false;
-	// Error (Sequence Unmatch occured)
+	// Error (Sequence Unmatch occurred)
 	m_context = m_top;
 	return true;
     }

Modified: branches/uim-0.4.7/xim/convdisp.cpp
===================================================================
--- branches/uim-0.4.7/xim/convdisp.cpp	2005-07-09 16:46:29 UTC (rev 955)
+++ branches/uim-0.4.7/xim/convdisp.cpp	2005-07-09 17:11:14 UTC (rev 956)
@@ -97,27 +97,15 @@
     }
 }
 
-static char *
-dequote(const char *str)
-{
-   char *ret = NULL;
-
-   if (str) {
-	int len = strlen(str);
-	if (str[0] == '"' && str[len - 1] == '"') {
-	    ret = strdup(++str);
-	    ret[len - 2] = '\0';
-	} else
-	    ret = strdup(str);
-   }
-
-   return ret;
-}
-
 void
-update_default_xftfont(const char *s) {
-    char *fontname = dequote(s);
+update_default_xftfont() {
+    const char *fontname;
+    
+    if (!uim_scm_symbol_value_bool("uim-xim-use-xft-font?"))
+      return;
 
+    fontname = uim_scm_symbol_value_str("uim-xim-xft-font-name");
+    
     if (fontname) {
 	XftFont *xftfont = XftFontOpen(XimServer::gDpy,
 			DefaultScreen(XimServer::gDpy),
@@ -125,11 +113,12 @@
 			XFT_PIXEL_SIZE, XftTypeDouble, (double)DEFAULT_FONT_SIZE,
 			NULL);
 	if (xftfont) {
-	    XftFontClose(XimServer::gDpy, gXftFont);
+	    if (gXftFont)
+	      XftFontClose(XimServer::gDpy, gXftFont);
 	    free(gXftFontName);
 	    free(gXftFontLocale);
 	    gXftFont = xftfont;
-	    gXftFontName = fontname;
+	    gXftFontName = strdup(fontname);
 	    gXftFontLocale = strdup(setlocale(LC_CTYPE, NULL));
 	}
     }

Modified: branches/uim-0.4.7/xim/ximserver.cpp
===================================================================
--- branches/uim-0.4.7/xim/ximserver.cpp	2005-07-09 16:46:29 UTC (rev 955)
+++ branches/uim-0.4.7/xim/ximserver.cpp	2005-07-09 17:11:14 UTC (rev 956)
@@ -105,7 +105,6 @@
 {
     mIMName = strdup(name);
     mIMLang = lang;
-    mUsePreservedDefaultIM = false;
 }
 
 InputContext *XimServer::createContext(XimIC *xic, const char *engine)
@@ -139,32 +138,21 @@
 }
 
 void XimServer::customContext(const char *custom, const char *val) {
-#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;
-	else
-	    mUsePreservedDefaultIM = false;
+    std::list<InputContext *>::iterator it;
+    for (it = ic_list.begin(); it != ic_list.end(); it++) {
+	(*it)->customContext(custom, val);
+	break;
     }
+
+    // Updated global IM of XimServer
     if (!strcmp(custom, "custom-preserved-default-im-name") &&
-		    mUsePreservedDefaultIM == true) {
-	val++;
-	set_im(val);
-	val--;
-    }
+		    uim_scm_symbol_value_bool("custom-activate-default-im-name?"))
+	set_im(++val);
+
 #if HAVE_XFT_UTF8_STRING
     if (!strcmp(custom, "uim-xim-xft-font-name"))
-	update_default_xftfont(val);
+	update_default_xftfont();
 #endif
-#endif
-
-    std::list<InputContext *>::iterator it;
-    for (it = ic_list.begin(); it != ic_list.end(); it++) {
-	(*it)->customContext(custom, val);
-    }
 }
 
 bool

Modified: branches/uim-0.4.7/xim/ximserver.h
===================================================================
--- branches/uim-0.4.7/xim/ximserver.h	2005-07-09 16:46:29 UTC (rev 955)
+++ branches/uim-0.4.7/xim/ximserver.h	2005-07-09 17:11:14 UTC (rev 956)
@@ -82,7 +82,7 @@
 void init_modifier_keys();
 #if HAVE_XFT_UTF8_STRING
 void init_default_xftfont();
-void update_default_xftfont(const char *s);
+void update_default_xftfont();
 #endif
 
 
@@ -248,7 +248,6 @@
     Atom mServerAtom;
     char *mIMName;
     const char *mIMLang;
-    bool mUsePreservedDefaultIM;
 };
 
 struct UIMInfo {



More information about the uim-commit mailing list