[uim-commit] r845 - trunk/xim

ekato at freedesktop.org ekato at freedesktop.org
Tue May 24 01:03:25 PDT 2005


Author: ekato
Date: 2005-05-24 01:03:21 -0700 (Tue, 24 May 2005)
New Revision: 845

Modified:
   trunk/xim/compose.cpp
   trunk/xim/convdisp.cpp
   trunk/xim/convdisp.h
   trunk/xim/locale.cpp
   trunk/xim/main.cpp
   trunk/xim/xim.h
   trunk/xim/ximic.cpp
   trunk/xim/ximim.cpp
   trunk/xim/ximserver.cpp
   trunk/xim/ximserver.h
   trunk/xim/ximtrans.cpp
Log:
* xim/*.[cpp,h]
  Change parent of Locale class to XimIM from XimServer, and
  cache iconv cd in each XimIM context to prevent frequent
  call of uim_iconv_open().


Modified: trunk/xim/compose.cpp
===================================================================
--- trunk/xim/compose.cpp	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/compose.cpp	2005-05-24 08:03:21 UTC (rev 845)
@@ -419,7 +419,7 @@
     ucs = KeySymToUcs4(ks);
     len = utf8_wctomb((unsigned char *)local_buf, ucs);
     local_buf[len] = '\0';
-    mb = utf8_to_native_str(local_buf, encoding);
+    mb = utf8_to_native_str(local_buf);
     if (!mb)
 	return 0;
     len = strlen(mb);

Modified: trunk/xim/convdisp.cpp
===================================================================
--- trunk/xim/convdisp.cpp	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/convdisp.cpp	2005-05-24 08:03:21 UTC (rev 845)
@@ -114,7 +114,7 @@
 // Preedit Window
 class PeWin : public WindowIf {
 public:
-    PeWin(Window pw, const char *im_lang, const char *encoding, const char *locale);
+    PeWin(Window pw, const char *im_lang, const char *encoding, const char *locale, Convdisp *cd);
     virtual ~PeWin();
 
     virtual void release();
@@ -146,12 +146,13 @@
     const char *mEncoding;
     int mWidth, mHeight;
     bool mIsMapped;
+    Convdisp *mConvdisp;
 };
 
 // one line preedit window for RootWindowStyle
 class PeLineWin : public PeWin {
 public:
-    PeLineWin(Window w, const char *im_lang, const char *encoding, const char *locale);
+    PeLineWin(Window w, const char *im_lang, const char *encoding, const char *locale, Convdisp *cd);
     virtual ~PeLineWin();
 
     void draw_pe(pe_stat *p);
@@ -167,7 +168,7 @@
 // window for over the spot style
 class PeOvWin : public PeWin {
 public:
-    PeOvWin(Window w, const char *im_lang, const char *encoding, const char *locale);
+    PeOvWin(Window w, const char *im_lang, const char *encoding, const char *locale, Convdisp *cd);
     
     void draw_ce(char_ent *ce, int len);
     virtual void set_size(int w, int h);
@@ -261,9 +262,10 @@
 //
 // PeWin(PreEdit Window)
 //
-PeWin::PeWin(Window pw, const char *im_lang, const char *encoding, const char *locale)
+PeWin::PeWin(Window pw, const char *im_lang, const char *encoding, const char *locale, Convdisp *cd)
 {
     mParentWin = pw;
+    mConvdisp = cd;
     int scr_num = DefaultScreen(XimServer::gDpy);
     // tentative
     mWidth = 1;
@@ -352,8 +354,9 @@
 			gc, x, y, &ch, 1);
     else {
 	char *native_str;
+	XimIM *im = get_im_by_id(mConvdisp->get_context()->get_ic()->get_imid());
 	
-	native_str = utf8_to_native_str(utf8, mEncoding);
+	native_str = im->utf8_to_native_str(utf8);
 	if (!native_str)
 	    return;
 	int len = strlen(native_str);
@@ -439,7 +442,7 @@
 //
 // PeLineWin
 //
-PeLineWin::PeLineWin(Window w, const char *im_lang, const char *encoding, const char *locale) : PeWin(w, im_lang, encoding, locale)
+PeLineWin::PeLineWin(Window w, const char *im_lang, const char *encoding, const char *locale, Convdisp *cd) : PeWin(w, im_lang, encoding, locale, cd)
 {
     set_size(400, 28); // set window height wider than its font height 16
     clear();
@@ -487,7 +490,7 @@
 //
 // PeOvWin
 //
-PeOvWin::PeOvWin(Window w, const char *im_lang, const char *encoding, const char *locale) : PeWin(w, im_lang, encoding, locale)
+PeOvWin::PeOvWin(Window w, const char *im_lang, const char *encoding, const char *locale, Convdisp *cd) : PeWin(w, im_lang, encoding, locale, cd)
 {
     m_mask_pix = 0;
     m_mask_pix_gc = 0;
@@ -606,6 +609,10 @@
     disp->hide();
 }
 
+InputContext *Convdisp::get_context()
+{
+    return mKkContext;
+}
 
 // Root window style
 ConvdispRw::ConvdispRw(InputContext *k, icxatr *a) : Convdisp(k, a)
@@ -631,7 +638,7 @@
 
     // preedit string exists
     if (!mPeWin)
-	mPeWin = new PeLineWin(DefaultRootWindow(XimServer::gDpy), mIMLang, mEncoding, mLocaleName);
+	mPeWin = new PeLineWin(DefaultRootWindow(XimServer::gDpy), mIMLang, mEncoding, mLocaleName, this);
     
     if (m_atr->has_atr(ICA_ClientWindow)) {
     	int x, y;
@@ -960,7 +967,7 @@
     else
 	w = m_atr->client_window;
 
-    m_ov_win = new PeOvWin(w, mIMLang, mEncoding, mLocaleName);
+    m_ov_win = new PeOvWin(w, mIMLang, mEncoding, mLocaleName, this);
     m_ov_win->set_size(m_atr->area.width, m_atr->area.height);
     m_ov_win->set_fore(m_atr->foreground_pixel);
     m_ov_win->set_back(m_atr->background_pixel);
@@ -1042,8 +1049,8 @@
 	    char utf8[6];
 	    int len = utf8_wctomb((unsigned char *)utf8, ch);
 	    utf8[len] = '\0';
-	    char *str;
-	    str = utf8_to_native_str(utf8, mEncoding);
+	    XimIM *im = get_im_by_id(mKkContext->get_ic()->get_imid());
+	    char *str = im->utf8_to_native_str(utf8);
 	    if (!str) {
 		logical.width = 0;
 		logical.height = (i > 0) ? m_ce[i - 1].height : 0;
@@ -1226,7 +1233,8 @@
 	append_ustring(&s, &(*it).s);
     }
 
-    char *c = mKkContext->getServer()->uStringToCtext(&s, mEncoding);
+    XimIM *im = get_im_by_id(mKkContext->get_ic()->get_imid());
+    char *c = im->uStringToCtext(&s);
     int i, len = 0;
     if (c)
 	len = strlen(c);

Modified: trunk/xim/convdisp.h
===================================================================
--- trunk/xim/convdisp.h	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/convdisp.h	2005-05-24 08:03:21 UTC (rev 845)
@@ -53,6 +53,7 @@
     virtual void move_candwin() = 0;
     virtual void set_im_lang(const char *im_lang);
     virtual void set_locale_name(const char *locale);
+    virtual InputContext *get_context();
 
 protected:
     // Owner of mKkContext is XimIC. This is set at the time of

Modified: trunk/xim/locale.cpp
===================================================================
--- trunk/xim/locale.cpp	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/locale.cpp	2005-05-24 08:03:21 UTC (rev 845)
@@ -198,71 +198,23 @@
     return false;
 }
 
-char *utf8_to_native_str(char *utf8, const char *enc) {
-    iconv_t cd;
-    size_t outbufsize = BUFSIZ;
-    char *inbuf, *outbuf, *convstr = NULL;
-    char *inchar;
-    char *outchar;
-    size_t inbytesleft, outbytesleft;
-    size_t ret_val;
-    
-    cd = (iconv_t)uim_iconv_open(enc, "UTF-8");
-    if (cd == (iconv_t)-1) {
-	perror("error in iconv_open");
-	return NULL;
-    }
-
-    inbuf = utf8;
-    if (!inbuf) {
-	iconv_close(cd);
-	return NULL;
-    }
-    outbuf = (char *)malloc(outbufsize);
-    if (!outbuf) {
-	iconv_close(cd);
-	return NULL;
-    }
-    inchar = inbuf;
-    outchar = outbuf;
-    inbytesleft = strlen(inbuf);
-    outbytesleft = outbufsize;
-    ret_val = iconv(cd, (ICONV_CONST char **)&inchar, &inbytesleft, &outchar, &outbytesleft);
-
-    if (ret_val == (size_t)-1 && errno != E2BIG) {
-	//perror("error in iconv");
-	iconv_close(cd);
-	free(outbuf);
-	return NULL;
-    }
-    iconv_close(cd);
-    convstr = (char *)malloc(outbufsize - outbytesleft + 1);
-    if (!convstr) {
-	free(outbuf);
-	return NULL;
-    }
-    strncpy(convstr, outbuf, outbufsize - outbytesleft);
-    convstr[outbufsize - outbytesleft] = '\0';
-    free(outbuf);
-    return convstr;
-}
-
 class UTF8_Locale : public Locale {
 public:
-    UTF8_Locale(const char *lang);
+    UTF8_Locale(const char *encoding);
     virtual ~UTF8_Locale();
-    virtual char *uStringToCtext(uString *us, const char *encoding) {
+    virtual char *utf8_to_native_str(char *str);
+    virtual char *uStringToCtext(uString *us) {
 	char *str = ustring_to_utf8_str(us);
 	XTextProperty prop;
 
-	if (!strcmp(encoding, "UTF-8")) {
+	if (!strcmp(mEncoding, "UTF-8")) {
 	    XmbTextListToTextProperty(XimServer::gDpy, &str, 1,
 			    XCompoundTextStyle, &prop);
 	    free(str);
 	} else {
 	    char *native_str;
 	    
-	    native_str = utf8_to_native_str(str, encoding);
+	    native_str = utf8_to_native_str(str);
 	    free(str);
 	    if (!native_str)
 		return NULL;
@@ -278,21 +230,68 @@
     virtual bool supportOverTheSpot() {
 	return true;
     }
-    virtual void set_localename_from_im_lang(const char *im_lang);
 private:
-    char *mLocaleName;
+    char *mEncoding;
+    iconv_t m_iconv_cd;
 };
 
-UTF8_Locale::UTF8_Locale(const char *im_lang)
+UTF8_Locale::UTF8_Locale(const char *encoding)
 {
-    mLocaleName = strdup(compose_localenames_from_im_lang(im_lang));
+    mEncoding = strdup(encoding);
+    m_iconv_cd = (iconv_t)uim_iconv_open(encoding, "UTF-8");
 }
 
 UTF8_Locale::~UTF8_Locale()
 {
-    free(mLocaleName);
+    free(mEncoding);
+    if (m_iconv_cd != (iconv_t)-1)
+        iconv_close(m_iconv_cd);
 }
 
+char *UTF8_Locale::utf8_to_native_str(char *utf8) {
+    size_t outbufsize = BUFSIZ;
+    char *inbuf, *outbuf, *convstr = NULL;
+    char *inchar;
+    char *outchar;
+    size_t inbytesleft, outbytesleft;
+    size_t ret_val;
+    
+    if (m_iconv_cd == (iconv_t)-1)
+	return NULL;
+
+    inbuf = utf8;
+    if (!inbuf)
+	return NULL;
+
+    outbuf = (char *)malloc(outbufsize);
+    if (!outbuf)
+	return NULL;
+
+    inchar = inbuf;
+    outchar = outbuf;
+    inbytesleft = strlen(inbuf);
+    outbytesleft = outbufsize;
+    ret_val = iconv(m_iconv_cd, (ICONV_CONST char **)&inchar, &inbytesleft, &outchar, &outbytesleft);
+
+    if (ret_val == (size_t)-1 && errno != E2BIG) {
+	//perror("error in iconv");
+	free(outbuf);
+	return NULL;
+    }
+
+    convstr = (char *)malloc(outbufsize - outbytesleft + 1);
+    if (!convstr) {
+	free(outbuf);
+	return NULL;
+    }
+
+    strncpy(convstr, outbuf, outbufsize - outbytesleft);
+    convstr[outbufsize - outbytesleft] = '\0';
+    free(outbuf);
+    return convstr;
+}
+
+
 static const char *
 get_valid_locales(const char *locales)
 {
@@ -488,22 +487,11 @@
     return locale;
 }
 
-void
-UTF8_Locale::set_localename_from_im_lang(const char *im_lang)
+Locale *createLocale(const char *encoding)
 {
-    const char *name;
-    name = compose_localenames_from_im_lang(im_lang);
-    
-    if (mLocaleName)
-	free(mLocaleName);
-    mLocaleName = strdup(name);
+    return new UTF8_Locale(encoding);
 }
 
-Locale *createLocale(const char *im_lang)
-{
-    return new UTF8_Locale(im_lang);
-}
-
 int
 utf8_mbtowc(uchar *wc, const unsigned char *src, int src_len)
 {

Modified: trunk/xim/main.cpp
===================================================================
--- trunk/xim/main.cpp	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/main.cpp	2005-05-24 08:03:21 UTC (rev 845)
@@ -365,10 +365,7 @@
     for (int i = 0; i < nr; i++) {
 	ui.name = strdup(uim_get_im_name(uc, i));
 	ui.lang = strdup(uim_get_im_language(uc, i));
-	ui.locale = createLocale(ui.lang);
 	ui.desc = strdup(uim_get_im_short_desc(uc, i));
-	if (!ui.locale)
-	    continue;
 	uim_info.push_back(ui);
     }
     uim_release_context(uc);
@@ -526,7 +523,7 @@
     // "default-im-name" on ~/.uim.
     for (it = uim_info.begin(); it != uim_info.end(); it++) {
 	if (strcmp(it->name, default_engine) == 0) {
-	    XimServer *xs = new XimServer(it->locale, it->name, it->lang);
+	    XimServer *xs = new XimServer(it->name, it->lang);
 	    res = xs->setupConnection(true);
 	    if (res)
 		printf("XMODIFIERS=@im=uim registered, selecting %s (%s) as default conversion engine\n", it->name, it->lang);

Modified: trunk/xim/xim.h
===================================================================
--- trunk/xim/xim.h	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/xim.h	2005-05-24 08:03:21 UTC (rev 845)
@@ -188,12 +188,16 @@
     const char *get_encoding();
     void set_lang_region(const char *name);
     const char *get_lang_region();
+    char *uStringToCtext(uString *us);
+    char *utf8_to_native_str(char *str);
+    struct input_style *getInputStyles();
     // for Compose
     void create_compose_tree();
     DefTree *get_compose_tree();
 
 protected:
     Connection *mConn;
+    Locale *mLocale;
     int mID;
     char *mEncoding;
     char *mLangRegion;

Modified: trunk/xim/ximic.cpp
===================================================================
--- trunk/xim/ximic.cpp	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/ximic.cpp	2005-05-24 08:03:21 UTC (rev 845)
@@ -538,7 +538,7 @@
 int XimIC::lookup_style(unsigned long s)
 {
     int i;
-    struct input_style *is = mConn->getXimServer()->getInputStyles();
+    struct input_style *is = get_im_by_id(mIMid)->getInputStyles();
     for (i = 0; is[i].x_style; i++) {
 	if (is[i].x_style == (int)s)
 	    return is[i].style;
@@ -575,7 +575,6 @@
     t->pushC16(mICid);
 
     uString s;
-    const char *encoding = get_encoding();
 
     // m_kkContext->get_preedit_string() returns uncommitted preedit
     // strings, which will be committed in client applications.
@@ -583,7 +582,7 @@
     if (s.size()) {
 	char *p;
 	int i, len = 0;
-	p = mConn->getXimServer()->uStringToCtext(&s, encoding);
+	p = get_im_by_id(mIMid)->uStringToCtext(&s);
 	if (p) {
 	    len = strlen(p);
 	    t->pushC16(len); // length of committed strings
@@ -625,8 +624,7 @@
 	return;
 
     char *p;
-    const char *encoding = get_encoding();
-    p = mConn->getXimServer()->uStringToCtext(&mPending, encoding);
+    p = get_im_by_id(mIMid)->uStringToCtext(&mPending);
 
     if (!p) {
 	erase_ustring(&mPending);

Modified: trunk/xim/ximim.cpp
===================================================================
--- trunk/xim/ximim.cpp	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/ximim.cpp	2005-05-24 08:03:21 UTC (rev 845)
@@ -51,6 +51,31 @@
 
 static std::map<int, XimIM *> g_ims;
 
+// tables
+static input_style input_style_tab_with_over_the_spot[] = {
+    {XIMPreeditNothing|XIMStatusNothing, IS_ROOT_WINDOW},
+    //{XIMPreeditPosition|XIMStatusArea, IS_OVER_THE_SPOT},// emacs
+    {XIMPreeditPosition|XIMStatusNothing, IS_OVER_THE_SPOT},
+    //{XIMPreeditCallbacks|XIMStatusCallbacks, IS_ON_THE_SPOT},// OOo
+    //{XIMPreeditArea|XIMStatusArea, IS_ROOT_WINDOW},
+    {XIMPreeditCallbacks|XIMStatusNothing, IS_ON_THE_SPOT},
+    {0, 0},
+};
+static input_style input_style_tab_without_over_the_spot[] = {
+    {XIMPreeditNothing|XIMStatusNothing, IS_ROOT_WINDOW},
+    //{XIMPreeditPosition|XIMStatusArea, IS_OVER_THE_SPOT},// emacs
+    //{XIMPreeditPosition|XIMStatusNothing, IS_OVER_THE_SPOT},
+    //{XIMPreeditCallbacks|XIMStatusCallbacks, IS_ON_THE_SPOT},// OOo
+    //{XIMPreeditArea|XIMStatusArea, IS_ROOT_WINDOW},
+    {XIMPreeditCallbacks|XIMStatusNothing, IS_ON_THE_SPOT},
+    {0, 0},
+};
+// XIMPreeditArea,XIMPreeditCallbacks,XIMPreeditPosition
+// XIMPreeditNothing,XIMPreeditNone
+// XIMStatusArea,XIMStatusCallbacks
+// XIMStatusNothing,XIMStatusNone
+
+
 class XimIM_impl : public XimIM {
 public:
     XimIM_impl(Connection *c, int id);
@@ -353,6 +378,7 @@
     mEncoding = NULL;
     mLangRegion = NULL;
     mTreeTop = NULL;
+    mLocale = NULL;
 }
 
 XimIM::~XimIM()
@@ -360,6 +386,7 @@
     free(mEncoding);
     free(mLangRegion);
     FreeComposeTree(mTreeTop);
+    delete mLocale;
 }
 
 void XimIM::FreeComposeTree(DefTree *top)
@@ -379,6 +406,11 @@
     if (mEncoding)
 	free(mEncoding);
     mEncoding = strdup(encoding);
+
+    // set iconv environment
+    if (mLocale)
+      delete mLocale;
+    mLocale = createLocale(mEncoding);
 }
 
 const char *XimIM::get_encoding()
@@ -398,6 +430,32 @@
     return mLangRegion;
 }
 
+struct input_style *XimIM::getInputStyles()
+{
+    if (mLocale && mLocale->supportOverTheSpot())
+	return input_style_tab_with_over_the_spot;
+
+    return input_style_tab_without_over_the_spot;
+}
+
+char *XimIM::uStringToCtext(uString *us)
+{
+    char *ret = NULL;
+    if (mLocale)
+	ret = mLocale->uStringToCtext(us);
+
+    return ret;
+}
+
+char *XimIM::utf8_to_native_str(char *str)
+{
+    char *ret = NULL;
+    if (mLocale)
+	ret = mLocale->utf8_to_native_str(str);
+
+    return ret;
+}
+
 int unused_im_id()
 {
     int max_id;

Modified: trunk/xim/ximserver.cpp
===================================================================
--- trunk/xim/ximserver.cpp	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/ximserver.cpp	2005-05-24 08:03:21 UTC (rev 845)
@@ -72,30 +72,6 @@
 static int gXNumLockMask;
 
 
-// tables
-static input_style input_style_tab_with_over_the_spot[] = {
-    {XIMPreeditNothing|XIMStatusNothing, IS_ROOT_WINDOW},
-    //{XIMPreeditPosition|XIMStatusArea, IS_OVER_THE_SPOT},// emacs
-    {XIMPreeditPosition|XIMStatusNothing, IS_OVER_THE_SPOT},
-    //{XIMPreeditCallbacks|XIMStatusCallbacks, IS_ON_THE_SPOT},// OOo
-    //{XIMPreeditArea|XIMStatusArea, IS_ROOT_WINDOW},
-    {XIMPreeditCallbacks|XIMStatusNothing, IS_ON_THE_SPOT},
-    {0, 0},
-};
-static input_style input_style_tab_without_over_the_spot[] = {
-    {XIMPreeditNothing|XIMStatusNothing, IS_ROOT_WINDOW},
-    //{XIMPreeditPosition|XIMStatusArea, IS_OVER_THE_SPOT},// emacs
-    //{XIMPreeditPosition|XIMStatusNothing, IS_OVER_THE_SPOT},
-    //{XIMPreeditCallbacks|XIMStatusCallbacks, IS_ON_THE_SPOT},// OOo
-    //{XIMPreeditArea|XIMStatusArea, IS_ROOT_WINDOW},
-    {XIMPreeditCallbacks|XIMStatusNothing, IS_ON_THE_SPOT},
-    {0, 0},
-};
-// XIMPreeditArea,XIMPreeditCallbacks,XIMPreeditPosition
-// XIMPreeditNothing,XIMPreeditNone
-// XIMStatusArea,XIMStatusCallbacks
-// XIMStatusNothing,XIMStatusNone
-
 void print_ustring(uString *s)
 {
     uString::iterator i;
@@ -125,11 +101,10 @@
     }
 }
 
-XimServer::XimServer(Locale *lc, const char *name, const char *lang)
+XimServer::XimServer(const char *name, const char *lang)
 {
     mIMName = strdup(name);
     mIMLang = lang;
-    mLocale = lc;
     mUsePreservedDefaultIM = false;
 }
 
@@ -187,15 +162,6 @@
     }
 }
 
-struct input_style *
-XimServer::getInputStyles()
-{
-    if (mLocale->supportOverTheSpot())
-	return input_style_tab_with_over_the_spot;
-
-    return input_style_tab_without_over_the_spot;
-}
-
 bool
 XimServer::setupConnection(bool useDefaultIM)
 {
@@ -258,12 +224,6 @@
     return true;
 }
 
-char *
-XimServer::uStringToCtext(uString *us, const char *encoding)
-{
-    return mLocale->uStringToCtext(us, encoding);
-}
-
 void
 XimServer::strToUstring(uString *d, const char *s)
 {
@@ -300,11 +260,6 @@
     return mIMLang;
 }
 
-Locale *XimServer::getLocale()
-{
-    return mLocale;
-}
-
 void XimServer::set_im(const char *engine)
 {
     if (mIMName)
@@ -312,7 +267,6 @@
 
     mIMName = strdup(engine);
     mIMLang = get_im_lang_from_engine(engine);
-    mLocale->set_localename_from_im_lang(mIMLang);
 }
 
 const char *get_im_lang_from_engine(const char *engine)

Modified: trunk/xim/ximserver.h
===================================================================
--- trunk/xim/ximserver.h	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/ximserver.h	2005-05-24 08:03:21 UTC (rev 845)
@@ -204,26 +204,23 @@
 class Locale {
 public:
     virtual ~Locale();
-    virtual char *uStringToCtext(uString *us, const char *encoding) = 0;
+    virtual char *uStringToCtext(uString *us) = 0;
+    virtual char *utf8_to_native_str(char *str) = 0;
     virtual bool supportOverTheSpot();
-    virtual void set_localename_from_im_lang(const char *im_lang) = 0;
-private:
-    char *mLocaleName;
 };
 
-Locale *createLocale(const char *im_lang);
+Locale *createLocale(const char *encoding);
 const char *compose_localenames_from_im_lang(const char *im_lang);
 bool is_locale_included(const char *locales, const char *locale);
 // Sring returned by get_first_locale() is allocated with strdup().
 char *get_prefered_locale(const char *locales);
 const char *find_localename_from_encoding(const char *encoding);
-char *utf8_to_native_str(char *utf8, const char *encoding);
 int utf8_mbtowc(uchar *wc, const unsigned char *src, int src_len);
 int utf8_wctomb(unsigned char *dest, uchar wc); // dest must have size 6
 
 class XimServer {
 public:
-    XimServer(Locale *lc, const char *name, const char *lang);
+    XimServer(const char *name, const char *lang);
     ~XimServer() {};
     InputContext *createContext(XimIC *, const char *engine);
     void deleteContext(InputContext *);
@@ -232,19 +229,16 @@
     void setupNewConnection(XClientMessageEvent *ev);
     char *uStringToCtext(uString *js, const char *encoding);
     void strToUstring(uString *d, const char *s);
-    struct input_style *getInputStyles();
     const char *getIMName();
     const char *getIMLang();
     void set_im(const char *name);
     void changeContext(const char *engine);
     void customContext(const char *custom, const char *val);
-    Locale *getLocale();
 public:
     static XimServer *findServer(Window w);
     static Display *gDpy;
     static std::map<Window, XimServer *> gServerMap;
 private:
-    Locale *mLocale;
     Window mSelectionWin;
     Atom mServerAtom;
     char *mIMName;
@@ -256,7 +250,6 @@
 struct UIMInfo {
     const char *lang;
     const char *name;
-    Locale *locale;
     const char *desc;
 };
 extern std::list<UIMInfo> uim_info;

Modified: trunk/xim/ximtrans.cpp
===================================================================
--- trunk/xim/ximtrans.cpp	2005-05-23 14:07:38 UTC (rev 844)
+++ trunk/xim/ximtrans.cpp	2005-05-24 08:03:21 UTC (rev 845)
@@ -613,7 +613,7 @@
 
     // XIMATTRIBUTE
     int nr_style;
-    struct input_style *is = mServer->getInputStyles();
+    struct input_style *is = get_im_by_id(imid)->getInputStyles();
     for (nr_style = 0; is[nr_style].style; nr_style++);
 
     t->pushC16(0); // attribute id



More information about the uim-commit mailing list