[uim-commit] r954 - in trunk: uim xim

ekato at freedesktop.org ekato at freedesktop.org
Sat Jul 9 20:21:25 EST 2005


Author: ekato
Date: 2005-07-09 03:21:21 -0700 (Sat, 09 Jul 2005)
New Revision: 954

Modified:
   trunk/uim/skk.c
   trunk/xim/compose.cpp
   trunk/xim/convdisp.cpp
   trunk/xim/ximserver.cpp
   trunk/xim/ximserver.h
Log:
* xim/ximserver.cpp (XimServer::customContext) : Update default
  xftfont and IM after customContext().
* xim/convdisp.cpp (dequote) : Removed.
(update_default_xftfont) : Don't use argument.  Add sanity check
  for gXftFont.
* xim/ximserver.h (class XimServer) : Remove
  mUsePreservedDefaultIM member.
* xim/compose.cpp : Fix typo in comment.
* uim/skk.c : Ditto.  Cosmetic changes about parentheses.


Modified: trunk/uim/skk.c
===================================================================
--- trunk/uim/skk.c	2005-07-08 17:41:34 UTC (rev 953)
+++ trunk/uim/skk.c	2005-07-09 10:21:21 UTC (rev 954)
@@ -113,7 +113,7 @@
   int size;
   /* head of cached skk dictionary line list. LRU ordered */
   struct skk_line head;
-  /* timestamp of personal dictonary */
+  /* timestamp of personal dictionary */
   time_t personal_dic_timestamp;
   /* whether cached lines are modified or not */
   int cache_modified;
@@ -311,7 +311,7 @@
   return -1;
 }
 
-/* This funciton name is temporary. I want a better name. */
+/* This function name is temporary. I want a better name. */
 static char *
 first_space(char *str)
 {
@@ -409,14 +409,14 @@
 free_skk_line(struct skk_line *sl)
 {
   int i, j;
-  if (!sl) {
+
+  if (!sl)
     return ;
-  }
+
   for (i = 0; i < sl->nr_cand_array; i++) {
     struct skk_cand_array *ca = &sl->cands[i];
-    for (j = 0; j < ca->nr_cands; j++) {
+    for (j = 0; j < ca->nr_cands; j++)
       free(ca->cands[j]);
-    }
     free(ca->okuri);
     free(ca->cands);
   }
@@ -986,10 +986,9 @@
 {
   struct skk_cand_array *ca;
   ca = find_cand_array_lisp(head_, okuri_head_, okuri_, 0);
-  if (ca) {
-    if (!is_purged_only(ca))
+  if (ca && ca->nr_cands > 0 && !is_purged_only(ca))
       return uim_scm_t();
-  }
+
   return uim_scm_f();
 }
 

Modified: trunk/xim/compose.cpp
===================================================================
--- trunk/xim/compose.cpp	2005-07-08 17:41:34 UTC (rev 953)
+++ trunk/xim/compose.cpp	2005-07-09 10:21:21 UTC (rev 954)
@@ -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: trunk/xim/convdisp.cpp
===================================================================
--- trunk/xim/convdisp.cpp	2005-07-08 17:41:34 UTC (rev 953)
+++ trunk/xim/convdisp.cpp	2005-07-09 10:21:21 UTC (rev 954)
@@ -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: trunk/xim/ximserver.cpp
===================================================================
--- trunk/xim/ximserver.cpp	2005-07-08 17:41:34 UTC (rev 953)
+++ trunk/xim/ximserver.cpp	2005-07-09 10:21:21 UTC (rev 954)
@@ -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: trunk/xim/ximserver.h
===================================================================
--- trunk/xim/ximserver.h	2005-07-08 17:41:34 UTC (rev 953)
+++ trunk/xim/ximserver.h	2005-07-09 10:21:21 UTC (rev 954)
@@ -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