Index: ChangeLog =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/ChangeLog,v retrieving revision 1.2 diff -u -r1.2 ChangeLog --- ChangeLog 2 Feb 2004 01:36:29 -0000 1.2 +++ ChangeLog 1 Mar 2004 01:29:18 -0000 @@ -1,3 +1,29 @@ +2004-03-01 Xiao Huo + + * src/xim.c: Make this XIM server serve clients using zh_CN and + en_US.UTF-8 locales. It is simply done by setting the line + IMLocale, "zh_CN,en_US.UTF-8", + with locales to be served. + +2004-03-01 Xiao Huo + + * src/SetLocale.[ch] main.c: Remove SetLocale(), GetLocale() and + strDefaultLocale. Use setlocale() and nl_langinfo() instead. + +2004-03-01 Xiao Huo + + * src/Makefile.am: Define PKGDATADIR. It is used as a prefix + to all the data files. + * src/erbi.c punc.c py.c wbx.c: Data files are installed under + PKGDATADIR/data directory. Remove DATA_DIR and bRunLocal which + are no longer needed. + * src/ime.h main.c xim.c: Remove DATA_DIR and bRunLocal which + are no longer needed. + +2004-03-01 Xiao Huo + + * configure.in: Define _USE_XFT if Xft is enabled. + 2004-02-02 Xie Yanbo * configure.in created(based on fcitx2.0.1). Index: configure.in =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/configure.in,v retrieving revision 1.2 diff -u -r1.2 configure.in --- configure.in 12 Feb 2004 11:41:29 -0000 1.2 +++ configure.in 1 Mar 2004 01:07:04 -0000 @@ -58,7 +58,7 @@ if test "x$have_xft" = "xtrue"; then LIBS="$LIBS $X_LIBS $XFT_LIBS" - CFLAGS="$CFLAGS $X_CFLAGS $XFT_CFLAGS" + CFLAGS="$CFLAGS $X_CFLAGS $XFT_CFLAGS -D_USE_XFT" else LIBS="$LIBS $X_LIBS -lX11" CFLAGS="$CFLAGS $X_CFLAGS" Index: src/Makefile.am =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/Makefile.am,v retrieving revision 1.2 diff -u -r1.2 Makefile.am --- src/Makefile.am 12 Feb 2004 11:40:22 -0000 1.2 +++ src/Makefile.am 1 Mar 2004 01:07:05 -0000 @@ -1,11 +1,30 @@ -bin_PROGRAMS = fcitx -AM_CFLAGS = -O2 -fno-strength-reduce +DEFS = -DPKGDATADIR=\"$(pkgdatadir)\" + INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/xpm -fcitx_SOURCES = \ - IC.c IC.h ime.c ime.h InputWindow.c InputWindow.h KeyList.c \ - KeyList.h main.c main.h MainWindow.c MainWindow.h \ - MyErrorsHandlers.c MyErrorsHandlers.h punc.c punc.h py.c PYFA.c \ - PYFA.h py.h pyMapTable.c pyMapTable.h pyParser.c pyParser.h \ - SetLocale.c SetLocale.h sp.c sp.h tools.c tools.h ui.c ui.h \ - version.h wbx.c wbx.h xim.c xim.h erbi.c erbi.h + +AM_CFLAGS = -O2 -fno-strength-reduce + + +bin_PROGRAMS = fcitx + +fcitx_SOURCES = erbi.c erbi.h \ + IC.c IC.h \ + ime.c ime.h \ + InputWindow.c InputWindow.h \ + KeyList.c KeyList.h \ + main.c main.h \ + MainWindow.c MainWindow.h \ + MyErrorsHandlers.c MyErrorsHandlers.h \ + punc.c punc.h \ + py.c py.h \ + PYFA.c PYFA.h \ + pyMapTable.c pyMapTable.h \ + pyParser.c pyParser.h \ + SetLocale.c SetLocale.h \ + sp.c sp.h \ + tools.c tools.h \ + ui.c ui.h \ + version.h \ + wbx.c wbx.h \ + xim.c xim.h fcitx_LDADD = ../lib/libXimd.a Index: src/SetLocale.c =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/SetLocale.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 SetLocale.c --- src/SetLocale.c 31 Jan 2004 04:43:26 -0000 1.1.1.1 +++ src/SetLocale.c 1 Mar 2004 01:07:06 -0000 @@ -6,30 +6,8 @@ char strUserLocale[20]; -extern Bool bIsUtf8; -extern char *strDefaultLocale; extern Bool bUseGBK; -void GetLocale (void) -{ - if (strUserLocale[0] != '\0') - strDefaultLocale = strUserLocale; - else { - strDefaultLocale = (char *) getenv ("LC_CTYPE"); - if (!strDefaultLocale) - strDefaultLocale = (char *) getenv ("LANG"); - } - - if (!strcasecmp (strDefaultLocale, "zh_CN.UTF8") || !strcasecmp (strDefaultLocale, "zh_CN.UTF-8")) - bIsUtf8 = True; -} - -void SetLocale (void) -{ -// GetLocale (); - setlocale (LC_CTYPE, strDefaultLocale); -} - Bool CheckLocale (char *strHZ) { if (!bUseGBK) { Index: src/SetLocale.h =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/SetLocale.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 SetLocale.h --- src/SetLocale.h 31 Jan 2004 04:43:26 -0000 1.1.1.1 +++ src/SetLocale.h 1 Mar 2004 01:07:06 -0000 @@ -3,8 +3,6 @@ #include "xim.h" -void GetLocale (void); -void SetLocale (void); Bool CheckLocale (char *strHZ); #endif Index: src/erbi.c =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/erbi.c,v retrieving revision 1.1 diff -u -r1.1 erbi.c --- src/erbi.c 12 Feb 2004 11:39:45 -0000 1.1 +++ src/erbi.c 1 Mar 2004 01:07:08 -0000 @@ -47,7 +47,6 @@ extern SINGLE_HZ legendCandWords[]; extern char strCodeInput[]; -extern Bool bRunLocal; extern Bool bIsDoInputOnly; extern int iCandPageCount; extern int iCurrentCandPage; @@ -94,12 +93,7 @@ //读入五笔码表 if (access (strPath, 0)) { - if (bRunLocal) { - strcpy (strPath, (char *) getenv ("HOME")); - strcat (strPath, "/fcitx/"); - } - else - strcpy (strPath, DATA_DIR); + strcpy (strPath, PKGDATADIR "/data/"); strcat (strPath, ERBI_DICT_FILENAME); fpDict = fopen (strPath, "rt"); } @@ -135,12 +129,7 @@ strcat (strPath, ERBI_FH_FILENAME); if (access (strPath, 0)) { - if (bRunLocal) { - strcpy (strPath, (char *) getenv ("HOME")); - strcat (strPath, "/fcitx/"); - } - else - strcpy (strPath, DATA_DIR); + strcpy (strPath, PKGDATADIR "/data/"); strcat (strPath, ERBI_FH_FILENAME); fpDict = fopen (strPath, "rt"); } Index: src/ime.h =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/ime.h,v retrieving revision 1.3 diff -u -r1.3 ime.h --- src/ime.h 12 Feb 2004 11:40:22 -0000 1.3 +++ src/ime.h 1 Mar 2004 01:07:08 -0000 @@ -8,7 +8,6 @@ #define MAX_CAND_WORD 10 #define MAX_USER_INPUT 300 // #define MAX_PHRASE_LENGTH 10 //最大词组长度----与拼音词组长度相同 -#define DATA_DIR "/usr/share/fcitx/data/" #define HOT_KEY_COUNT 2 #define MAX_HZ_SAVED 10 Index: src/main.c =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/main.c,v retrieving revision 1.2 diff -u -r1.2 main.c --- src/main.c 12 Feb 2004 11:41:00 -0000 1.2 +++ src/main.c 1 Mar 2004 01:07:08 -0000 @@ -3,6 +3,8 @@ /*Program closes with a mouse click or keypress */ +#include + #ifdef HAVE_CONFIG_H # include #endif @@ -33,8 +35,8 @@ extern IME imeIndex; extern Bool bBackground; +extern Bool bIsUtf8; extern HIDE_MAINWINDOW hideMainWindow; -extern Bool bRunLocal; int main (int argc, char *argv[]) { @@ -47,21 +49,20 @@ imname = argv[++i]; /* else if (!strcmp (argv[i], "-kl")) filter_mask = (KeyPressMask | KeyReleaseMask);*/ - else if (!strcmp (argv[i], "-local")) - bRunLocal = True; else if (!strcmp (argv[i], "-nb")) bBackground = False; } SetMyExceptionHandler (); + setlocale (LC_ALL, ""); + bIsUtf8 = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0); + InitX (); LoadProfile (); LoadConfig (True); - GetLocale (); CreateFont (); - SetLocale (); if (!LoadPuncDict ()) fprintf (stderr, "无法打开中文标点文件,将无法输入中文标点!\n"); Index: src/punc.c =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/punc.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 punc.c --- src/punc.c 31 Jan 2004 04:43:26 -0000 1.1.1.1 +++ src/punc.c 1 Mar 2004 01:07:08 -0000 @@ -11,7 +11,6 @@ ChnPunc *chnPunc = NULL; extern int iCodeInputCount; -extern Bool bRunLocal; int LoadPuncDict (void) { @@ -22,12 +21,7 @@ char *pstr; int i; - if (bRunLocal) { - strcpy (strPath, (char *) getenv ("HOME")); - strcat (strPath, "/fcitx/"); - } - else - strcpy (strPath, DATA_DIR); + strcpy (strPath, PKGDATADIR "/data/"); strcat (strPath, PUNC_DICT_FILENAME); fpDict = fopen (strPath, "rt"); Index: src/py.c =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/py.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 py.c --- src/py.c 31 Jan 2004 04:43:26 -0000 1.1.1.1 +++ src/py.c 1 Mar 2004 01:07:13 -0000 @@ -65,7 +65,6 @@ extern Bool bUseLegend; extern Bool bSP_UseSemicolon; extern Bool bSP; -extern Bool bRunLocal; extern int iCandWordCount; extern int iCandPageCount; extern int iCodeInputCount; @@ -95,12 +94,7 @@ char strPath[PATH_MAX]; int i, j, iLen; - if (bRunLocal) { - strcpy (strPath, (char *) getenv ("HOME")); - strcat (strPath, "/fcitx/"); - } - else - strcpy (strPath, DATA_DIR); + strcpy (strPath, PKGDATADIR "/data/"); strcat (strPath, PY_BASE_FILE); fp = fopen (strPath, "rb"); if (!fp) @@ -155,12 +149,7 @@ bPYOtherDictLoaded = True; - if (bRunLocal) { - strcpy (strPath, (char *) getenv ("HOME")); - strcat (strPath, "/fcitx/"); - } - else - strcpy (strPath, DATA_DIR); + strcpy (strPath, PKGDATADIR "/data/"); strcat (strPath, PY_PHRASE_FILE); fp = fopen (strPath, "rb"); if (!fp) Index: src/ui.c =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/ui.c,v retrieving revision 1.2 diff -u -r1.2 ui.c --- src/ui.c 12 Feb 2004 11:41:00 -0000 1.2 +++ src/ui.c 1 Mar 2004 01:07:14 -0000 @@ -54,7 +54,6 @@ extern Bool bIsResizingInputWindow; extern HIDE_MAINWINDOW hideMainWindow; extern IC *CurrentIC; -extern char *strDefaultLocale; Bool InitX (void) { Index: src/wbx.c =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/wbx.c,v retrieving revision 1.2 diff -u -r1.2 wbx.c --- src/wbx.c 12 Feb 2004 11:41:00 -0000 1.2 +++ src/wbx.c 1 Mar 2004 01:07:16 -0000 @@ -47,7 +47,6 @@ extern SINGLE_HZ legendCandWords[]; extern char strCodeInput[]; -extern Bool bRunLocal; extern Bool bIsDoInputOnly; extern int iCandPageCount; extern int iCurrentCandPage; @@ -95,12 +94,7 @@ //读入五笔码表 if (access (strPath, 0)) { - if (bRunLocal) { - strcpy (strPath, (char *) getenv ("HOME")); - strcat (strPath, "/fcitx/"); - } - else - strcpy (strPath, DATA_DIR); + strcpy (strPath, PKGDATADIR "/data/"); strcat (strPath, WUBI_DICT_FILENAME); fpDict = fopen (strPath, "rt"); } @@ -136,12 +130,7 @@ strcat (strPath, WUBI_FH_FILENAME); if (access (strPath, 0)) { - if (bRunLocal) { - strcpy (strPath, (char *) getenv ("HOME")); - strcat (strPath, "/fcitx/"); - } - else - strcpy (strPath, DATA_DIR); + strcpy (strPath, PKGDATADIR "/data/"); strcat (strPath, WUBI_FH_FILENAME); fpDict = fopen (strPath, "rt"); } Index: src/xim.c =================================================================== RCS file: /sfroot/cvs/fcitx/fcitx/src/xim.c,v retrieving revision 1.2 diff -u -r1.2 xim.c --- src/xim.c 12 Feb 2004 11:41:00 -0000 1.2 +++ src/xim.c 1 Mar 2004 01:07:17 -0000 @@ -12,8 +12,6 @@ long filter_mask = KeyPressMask | KeyReleaseMask; IC *CurrentIC; -Bool bRunLocal = False; -char *strDefaultLocale; Bool bUseCtrlShift = False; Bool bBackground = True; @@ -363,7 +361,6 @@ XIMStyles *input_styles; //, *styles2; XIMTriggerKeys *on_keys; XIMEncodings *encodings; //, *encoding2; - char transport[80]; /* enough */ if (!imname) { imname = getenv ("XMODIFIERS"); @@ -388,9 +385,15 @@ encodings = (XIMEncodings *) malloc (sizeof (XIMEncodings)); encodings->count_encodings = sizeof (zhEncodings) / sizeof (XIMEncoding) - 1; encodings->supported_encodings = zhEncodings; - strcpy (transport, "X/"); - ims = IMOpenIM (dpy, IMModifiers, "Xi18n", IMServerWindow, im_window, IMServerName, imname, IMLocale, (strcasecmp (strDefaultLocale, "zh_CN.gb2312")) ? strDefaultLocale : "zh_CN", IMServerTransport, transport, IMInputStyles, input_styles, NULL); + ims = IMOpenIM (dpy, + IMModifiers, "Xi18n", + IMServerWindow, im_window, + IMServerName, imname, + IMLocale, "zh_CN,en_US.UTF-8", + IMServerTransport, "X/", + IMInputStyles, input_styles, + NULL); if (ims == (XIMS) NULL) { fprintf (stderr, "已经存在另一个同名服务程序 %s\n", imname); return False;