diff -ruN fvwm1-1.24r/configure.h fvwm1-1.24r-i18n/configure.h --- fvwm1-1.24r/configure.h Mon Mar 13 14:45:08 2000 +++ fvwm1-1.24r-i18n/configure.h Mon Mar 13 14:44:19 2000 @@ -60,6 +60,12 @@ #define XPMLIBRARY -L/usr/X11R6/lib -lXpm /*************************************************************************** + *#define I18N + * If you want to use i18n feature, specify #define I18N + ***************************************************************************/ +/* #define I18N */ + +/*************************************************************************** *#define M4 * Causes m4 pre-processor patches to be included. Try man m4 for more info. * Warning: m4 defines macros for some simple things like "include" diff -ruN fvwm1-1.24r/fvwm/add_window.c fvwm1-1.24r-i18n/fvwm/add_window.c --- fvwm1-1.24r/fvwm/add_window.c Tue Dec 6 00:05:56 1994 +++ fvwm1-1.24r-i18n/fvwm/add_window.c Mon Mar 13 14:44:19 2000 @@ -101,6 +101,10 @@ XrmValue rm_value; unsigned long buttons; XTextProperty text_prop; +#ifdef I18N + char **list; + int num; +#endif NeedToResizeToo = False; /* allocate space for the fvwm window */ @@ -121,7 +125,18 @@ return(NULL); } if ( XGetWMName(dpy, tmp_win->w, &text_prop) != 0 ) +#ifdef I18N + { + if (text_prop.value) text_prop.nitems = strlen(text_prop.value); + if (XmbTextPropertyToTextList(dpy, &text_prop, &list, &num) == Success + && num > 0 && *list) + tmp_win->name = *list; + else + tmp_win->name = NoName; + } +#else tmp_win->name = (char *)text_prop.value ; +#endif else tmp_win->name = NoName; @@ -260,9 +275,28 @@ } XSetWindowBorderWidth (dpy, tmp_win->w,0); +#ifdef I18N + if (XGetWindowProperty(dpy, tmp_win->w, XA_WM_ICON_NAME, 0L, 200L, False, + AnyPropertyType, &actual_type, &actual_format, &nitems, + &bytesafter,(unsigned char **)&tmp_win->icon_name) + == Success && actual_type != None) { + text_prop.value = tmp_win->icon_name; + text_prop.encoding = actual_type; + text_prop.format = actual_format; + text_prop.nitems = nitems; + if (XmbTextPropertyToTextList(dpy, &text_prop, &list, &num) == Success + && num > 0 && *list) + tmp_win->icon_name = *list; + else + tmp_win->icon_name = NULL; + } + else + tmp_win->icon_name = NULL; +#else XGetWindowProperty (dpy, tmp_win->w, XA_WM_ICON_NAME, 0L, 200L, False, XA_STRING, &actual_type, &actual_format, &nitems, &bytesafter,(unsigned char **)&tmp_win->icon_name); +#endif if(tmp_win->icon_name==(char *)NULL) tmp_win->icon_name = tmp_win->name; @@ -493,7 +527,18 @@ } XChangeWindowAttributes (dpy, tmp_win->w, valuemask, &attributes); if ( XGetWMName(dpy, tmp_win->w, &text_prop) != 0 ) +#ifdef I18N + { + if (text_prop.value) text_prop.nitems = strlen(text_prop.value); + if (XmbTextPropertyToTextList(dpy, &text_prop, &list, &num) == Success + && num > 0 && *list) + tmp_win->name = *list; + else + tmp_win->name = NoName; + } +#else tmp_win->name = (char *)text_prop.value ; +#endif else tmp_win->name = NoName; diff -ruN fvwm1-1.24r/fvwm/borders.c fvwm1-1.24r-i18n/fvwm/borders.c --- fvwm1-1.24r/fvwm/borders.c Sat Dec 3 04:54:43 1994 +++ fvwm1-1.24r-i18n/fvwm/borders.c Mon Mar 13 14:44:19 2000 @@ -178,6 +178,8 @@ if((t->icon_name != NULL)&&(Scr.PagerFont.height > 0)) { NewFontAndColor(Scr.PagerFont.font->fid,TextColor,BackColor); +#undef FONTSET +#define FONTSET Scr.PagerFont.fontset XDrawImageString(dpy, t->pager_view, Scr.FontGC, 2,Scr.PagerFont.y+2, t->icon_name, strlen(t->icon_name)); } @@ -488,6 +490,8 @@ hor_off = (t->title_width - w)/2; NewFontAndColor(Scr.WindowFont.font->fid,Forecolor, BackColor); +#undef FONTSET +#define FONTSET Scr.WindowFont.fontset if(NewTitle) XClearWindow(dpy,t->title_w); diff -ruN fvwm1-1.24r/fvwm/configure.c fvwm1-1.24r-i18n/fvwm/configure.c --- fvwm1-1.24r/fvwm/configure.c Mon Mar 13 14:45:07 2000 +++ fvwm1-1.24r-i18n/fvwm/configure.c Mon Mar 13 14:44:19 2000 @@ -24,6 +24,9 @@ #include #include #include +#ifdef I18N +#include +#endif #include #include @@ -316,6 +319,9 @@ char line[256],*tline; char *Home; /* the HOME environment variable */ int HomeLen; /* length of Home */ +#ifdef I18N + char *Lang; +#endif #ifdef M4 extern int m4_enable; #endif @@ -363,10 +369,37 @@ } else { +#ifdef I18N + if ((Lang = setlocale(LC_CTYPE, NULL)) != NULL) { + home_file = safemalloc(HomeLen+strlen(Lang)+strlen(config_file)+4); + strcpy(home_file,Home); + strcat(home_file,"/"); + strcat(home_file,Lang); + strcat(home_file,"/"); + strcat(home_file,config_file); + config_fd = fopen(home_file,"r"); + if (config_fd == (FILE *)NULL) { + free(home_file); + home_file = safemalloc(HomeLen+strlen(config_file)+3); + strcpy(home_file,Home); + strcat(home_file,"/"); + strcat(home_file,config_file); + } + else + fclose(config_fd); + } + else { + home_file = safemalloc(HomeLen+strlen(config_file)+3); + strcpy(home_file,Home); + strcat(home_file,"/"); + strcat(home_file,config_file); + } +#else home_file = safemalloc(HomeLen+strlen(config_file)+3); strcpy(home_file,Home); strcat(home_file,"/"); strcat(home_file,config_file); +#endif } fvwm_file = home_file; config_fd = fopen(home_file,"r"); @@ -410,7 +443,7 @@ orig_tline = tline; while(tline != (char *)0) { - while(isspace(*tline))tline++; + while(isspace((unsigned char)*tline))tline++; if((strlen(&tline[0])>1)&&(tline[0]!='#')&&(tline[0]!='*')) match_string(main_config,tline,"error in config:",config_fd); tline = fgets(line,(sizeof line)-1,config_fd); @@ -490,7 +523,7 @@ int *y_coords; int *line_style; - while(isspace(*letter))letter++; + while(isspace((unsigned char)*letter))letter++; if (*letter == ':') /* signal for new data format */ { /* get button number */ @@ -745,6 +778,13 @@ #endif void GetColors(void) { +#ifdef I18N + XFontSetExtents *fset_extents; + XFontStruct **fs_list; + char **ml; + int mc; + char *ds; +#endif extern MyFont *IconFont; if(have_the_colors) return; @@ -812,6 +852,21 @@ } /* load the font */ +#ifdef I18N + if ((Scr.StdFont.fontset = XCreateFontSet(dpy, Scr.StdFont.name, &ml, + &mc, &ds)) == NULL) { + nofont(Scr.StdFont.name); + if ((Scr.StdFont.fontset = XCreateFontSet(dpy, "fixed", + &ml, &mc, &ds)) == NULL) + exit(1); + } + XFontsOfFontSet(Scr.StdFont.fontset, &fs_list, &ml); + Scr.StdFont.font = fs_list[0]; + fset_extents = XExtentsOfFontSet(Scr.StdFont.fontset); + Scr.StdFont.height = fset_extents->max_logical_extent.height; + Scr.StdFont.y = Scr.StdFont.font->ascent; + Scr.EntryHeight = Scr.StdFont.height + HEIGHT_EXTRA; +#else if ((Scr.StdFont.font = XLoadQueryFont(dpy, Scr.StdFont.name)) == NULL) { nofont(Scr.StdFont.name); @@ -821,8 +876,23 @@ Scr.StdFont.height = Scr.StdFont.font->ascent + Scr.StdFont.font->descent; Scr.StdFont.y = Scr.StdFont.font->ascent; Scr.EntryHeight = Scr.StdFont.height + HEIGHT_EXTRA; +#endif /* load the window-title font */ +#ifdef I18N + if ((Scr.WindowFont.fontset = XCreateFontSet(dpy, Scr.WindowFont.name, &ml, + &mc, &ds)) == NULL) { + nofont(Scr.WindowFont.name); + if ((Scr.WindowFont.fontset = XCreateFontSet(dpy, "fixed", + &ml, &mc, &ds)) == NULL) + exit(1); + } + XFontsOfFontSet(Scr.WindowFont.fontset, &fs_list, &ml); + Scr.WindowFont.font = fs_list[0]; + fset_extents = XExtentsOfFontSet(Scr.WindowFont.fontset); + Scr.WindowFont.height = fset_extents->max_logical_extent.height; + Scr.WindowFont.y = Scr.WindowFont.font->ascent; +#else if ((Scr.WindowFont.font = XLoadQueryFont(dpy, Scr.WindowFont.name)) == NULL) { nofont(Scr.WindowFont.name); @@ -833,17 +903,29 @@ Scr.WindowFont.height= Scr.WindowFont.font->ascent+Scr.WindowFont.font->descent; Scr.WindowFont.y = Scr.WindowFont.font->ascent; +#endif /* load the pager-label font */ #ifndef NO_PAGER if(Scr.PagerFont.name != NULL) { +#ifdef I18N + if ((Scr.PagerFont.fontset = XCreateFontSet(dpy, Scr.PagerFont.name, &ml, + &mc, &ds)) != NULL) { + XFontsOfFontSet(Scr.PagerFont.fontset, &fs_list, &ml); + Scr.PagerFont.font = fs_list[0]; + fset_extents = XExtentsOfFontSet(Scr.PagerFont.fontset); + Scr.PagerFont.height = fset_extents->max_logical_extent.height; + Scr.PagerFont.y = Scr.PagerFont.font->ascent; + } +#else if ((Scr.PagerFont.font = XLoadQueryFont(dpy, Scr.PagerFont.name))!=NULL) { Scr.PagerFont.height= Scr.PagerFont.font->ascent+Scr.PagerFont.font->descent; Scr.PagerFont.y = Scr.PagerFont.font->ascent; } +#endif else nofont(Scr.PagerFont.name); } @@ -852,6 +934,17 @@ IconFont = &Scr.StdFont; if(Scr.IconFont.name != NULL) { +#ifdef I18N + if ((Scr.IconFont.fontset = XCreateFontSet(dpy, Scr.IconFont.name, &ml, + &mc, &ds)) != NULL) { + XFontsOfFontSet(Scr.IconFont.fontset, &fs_list, &ml); + Scr.IconFont.font = fs_list[0]; + fset_extents = XExtentsOfFontSet(Scr.IconFont.fontset); + Scr.IconFont.height = fset_extents->max_logical_extent.height; + Scr.IconFont.y = Scr.IconFont.font->ascent; + IconFont = &Scr.IconFont; + } +#else if ((Scr.IconFont.font = XLoadQueryFont(dpy, Scr.IconFont.name))!=NULL) { Scr.IconFont.height= @@ -859,6 +952,7 @@ Scr.IconFont.y = Scr.IconFont.font->ascent; IconFont = &Scr.IconFont; } +#endif else nofont(Scr.IconFont.name); } @@ -900,7 +994,7 @@ mr = NewMenuRoot(name); GetColors(); - while(isspace(*pline))pline++; + while(isspace((unsigned char)*pline))pline++; while((pline != (char *)0) &&(mystrncasecmp("End",pline,3)!=0)) { @@ -933,7 +1027,7 @@ orig_tline = pline; - while(isspace(*pline))pline++; + while(isspace((unsigned char)*pline))pline++; } MakeMenu(mr); @@ -1613,11 +1707,11 @@ char *tmp,*ptr; int len; - while(isspace(*source)) + while(isspace((unsigned char)*source)) source++; len = strlen(source); tmp = source + len -1; - while(((isspace(*tmp))||(*tmp == '\n'))&&(tmp >=source)) + while(((isspace((unsigned char)*tmp))||(*tmp == '\n'))&&(tmp >=source)) { tmp--; len--; @@ -2123,6 +2217,9 @@ #endif #ifdef NO_SAVEUNDERS strcat(options, "NO_SAVEUNDERS "); +#endif +#ifdef I18N + strcat(options, "I18N "); #endif #ifdef NO_WINDOWLIST strcat(options, "NO_WINDOWLIST "); diff -ruN fvwm1-1.24r/fvwm/events.c fvwm1-1.24r-i18n/fvwm/events.c --- fvwm1-1.24r/fvwm/events.c Tue Nov 15 23:02:39 1994 +++ fvwm1-1.24r-i18n/fvwm/events.c Mon Mar 13 14:44:19 2000 @@ -365,6 +365,11 @@ Atom actual = None; int actual_format; unsigned long nitems, bytesafter; +#ifdef I18N + XTextProperty text_prop; + char **list; + int num; +#endif if ((!Tmp_win)||(XGetGeometry(dpy, Tmp_win->w, &JunkRoot, &JunkX, &JunkY, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0)) @@ -373,6 +378,24 @@ switch (Event.xproperty.atom) { case XA_WM_NAME: +#ifdef I18N + if (XGetWindowProperty (dpy, Tmp_win->w, Event.xproperty.atom, 0L, + MAX_NAME_LEN, False, AnyPropertyType, &actual, + &actual_format, &nitems, &bytesafter, + (unsigned char **) &prop) != Success || + actual == None) + return; + text_prop.value = prop; + text_prop.encoding = actual; + text_prop.format = actual_format; + text_prop.nitems = nitems; + if (XmbTextPropertyToTextList(dpy, &text_prop, &list, &num) != Success) + return; + if (!(num > 0 && *list)) + prop = NoName; + else + prop = *list; +#else if (XGetWindowProperty (dpy, Tmp_win->w, Event.xproperty.atom, 0L, MAX_NAME_LEN, False, XA_STRING, &actual, &actual_format, &nitems, &bytesafter, @@ -380,6 +403,7 @@ actual == None) return; if (!prop) prop = NoName; +#endif free_window_names (Tmp_win, True, False); Tmp_win->name = prop; @@ -404,6 +428,24 @@ break; case XA_WM_ICON_NAME: +#ifdef I18N + if (XGetWindowProperty (dpy, Tmp_win->w, Event.xproperty.atom, 0L, + MAX_NAME_LEN, False, AnyPropertyType, &actual, + &actual_format, &nitems, &bytesafter, + (unsigned char **) &prop) != Success || + actual == None) + return; + text_prop.value = prop; + text_prop.encoding = actual; + text_prop.format = actual_format; + text_prop.nitems = nitems; + if (XmbTextPropertyToTextList(dpy, &text_prop, &list, &num) != Success) + return; + if (!(num > 0 && *list)) + prop = NoName; + else + prop = *list; +#else if (XGetWindowProperty (dpy, Tmp_win->w, Event.xproperty.atom, 0, MAX_ICON_NAME_LEN, False, XA_STRING, &actual, &actual_format, &nitems, &bytesafter, @@ -411,6 +453,7 @@ actual == None) return; if (!prop) prop = NoName; +#endif free_window_names (Tmp_win, False, True); Tmp_win->icon_name = prop; BroadcastName(M_ICON_NAME,Tmp_win->w,Tmp_win->frame, diff -ruN fvwm1-1.24r/fvwm/functions.c fvwm1-1.24r-i18n/fvwm/functions.c --- fvwm1-1.24r/fvwm/functions.c Tue Nov 15 23:18:26 1994 +++ fvwm1-1.24r-i18n/fvwm/functions.c Mon Mar 13 14:44:19 2000 @@ -464,6 +464,8 @@ if((tmp_win->icon_name != NULL)&&(Scr.PagerFont.height > 0)) { NewFontAndColor(Scr.PagerFont.font->fid,TextColor,BackColor); +#undef FONTSET +#define FONTSET Scr.PagerFont.fontset XDrawString (dpy, tmp_win->pager_view,Scr.FontGC,2,Scr.PagerFont.y+2, tmp_win->icon_name, strlen(tmp_win->icon_name)); } diff -ruN fvwm1-1.24r/fvwm/fvwm.c fvwm1-1.24r-i18n/fvwm/fvwm.c --- fvwm1-1.24r/fvwm/fvwm.c Mon Mar 13 14:45:08 2000 +++ fvwm1-1.24r-i18n/fvwm/fvwm.c Mon Mar 13 14:44:19 2000 @@ -56,6 +56,10 @@ #include #endif /* SHAPE */ +#ifdef I18N +#include +#endif + #if defined (sparc) && defined (SVR4) /* Solaris has sysinfo instead of gethostname. */ #include @@ -151,6 +155,11 @@ Bool single = False; Bool option_error = FALSE; + +#ifdef I18N + if (setlocale(LC_CTYPE, "") == NULL) + fvwm_err("can't set locale", NULL, NULL, NULL); +#endif #ifdef M4 /* Set the defaults for m4 processing */ diff -ruN fvwm1-1.24r/fvwm/fvwm.h fvwm1-1.24r-i18n/fvwm/fvwm.h --- fvwm1-1.24r/fvwm/fvwm.h Tue Nov 15 23:02:56 1994 +++ fvwm1-1.24r-i18n/fvwm/fvwm.h Mon Mar 13 14:44:19 2000 @@ -109,6 +109,9 @@ { char *name; /* name of the font */ XFontStruct *font; /* font structure */ +#ifdef I18N + XFontSet fontset; /* font set */ +#endif int height; /* height of the font */ int y; /* Y coordinate to draw characters */ } MyFont; @@ -281,7 +284,6 @@ extern Atom _XA_WM_DESKTOP; extern Atom _XA_FVWM_STICKS_TO_GLASS; extern Atom _XA_FVWM_CLIENT; - #endif /* _FVWM_ */ diff -ruN fvwm1-1.24r/fvwm/icons.c fvwm1-1.24r-i18n/fvwm/icons.c --- fvwm1-1.24r/fvwm/icons.c Tue Nov 15 23:03:29 1994 +++ fvwm1-1.24r-i18n/fvwm/icons.c Mon Mar 13 14:44:19 2000 @@ -276,6 +276,8 @@ /* write the icon label */ NewFontAndColor(IconFont->font->fid,TextColor,BackColor); +#undef FONTSET +#define FONTSET IconFont->fontset if(Tmp_win->icon_pixmap_w != None) XMoveWindow(dpy,Tmp_win->icon_pixmap_w,Tmp_win->icon_x_loc, diff -ruN fvwm1-1.24r/fvwm/menus.c fvwm1-1.24r-i18n/fvwm/menus.c --- fvwm1-1.24r/fvwm/menus.c Tue Nov 15 23:03:34 1994 +++ fvwm1-1.24r-i18n/fvwm/menus.c Mon Mar 13 14:44:19 2000 @@ -267,6 +267,8 @@ /* should be a shaded out word, no just re-colored. */ currentGC = Scr.MenuStippleGC; +#undef FONTSET +#define FONTSET Scr.StdFont.fontset if(*mi->item) XDrawString(dpy, mr->w, currentGC,mi->x,text_y, mi->item, mi->strlen); if(mi->strlen2>0) diff -ruN fvwm1-1.24r/fvwm/misc.h fvwm1-1.24r-i18n/fvwm/misc.h --- fvwm1-1.24r/fvwm/misc.h Thu Sep 29 23:46:25 1994 +++ fvwm1-1.24r-i18n/fvwm/misc.h Mon Mar 13 14:44:19 2000 @@ -99,6 +99,15 @@ Globalgcm = GCFont | GCForeground | GCBackground; \ XChangeGC(dpy,Scr.FontGC,Globalgcm,&Globalgcv); \ } +#ifdef I18N +#ifdef __STDC__ +#define XTextWidth(x,y,z) XmbTextEscapement(x ## set,y,z) +#else +#define XTextWidth(x,y,z) XmbTextEscapement(x/**/set,y,z) +#endif +#define XDrawString(t,u,v,w,x,y,z) XmbDrawString(t,u,FONTSET,v,w,x,y,z) +#define XDrawImageString(t,u,v,w,x,y,z) XmbDrawImageString(t,u,FONTSET,v,w,x,y,z) +#endif #ifdef NO_ICONS #define ICON_HEIGHT 1 diff -ruN fvwm1-1.24r/fvwm/module.c fvwm1-1.24r-i18n/fvwm/module.c --- fvwm1-1.24r/fvwm/module.c Thu Dec 1 02:35:43 1994 +++ fvwm1-1.24r-i18n/fvwm/module.c Mon Mar 13 14:44:19 2000 @@ -107,11 +107,11 @@ strcpy(command,action); cptr = command; - while((isspace(*cptr))&&(*cptr != '\n')&&(*cptr != 0)) + while((isspace((unsigned char)*cptr))&&(*cptr != '\n')&&(*cptr != 0)) cptr++; end = cptr; - while((!(isspace(*end))&&(*end != '\n'))&&(*end != 0)&&(end <(command+256))) + while((!(isspace((unsigned char)*end))&&(*end != '\n'))&&(*end != 0)&&(end <(command+256))) end++; if((*end == 0)||(end >= command+256)) @@ -122,7 +122,7 @@ if(aptr) { - while((isspace(*aptr)||(*aptr=='\n'))&&(*aptr!=0)&&(aptr<(command+256))) + while((isspace((unsigned char)*aptr)||(*aptr=='\n'))&&(*aptr!=0)&&(aptr<(command+256))) aptr++; if((*aptr == 0)||(*aptr == '\n')) aptr = NULL; diff -ruN fvwm1-1.24r/fvwm/move.c fvwm1-1.24r-i18n/fvwm/move.c --- fvwm1-1.24r/fvwm/move.c Tue Nov 15 23:03:50 1994 +++ fvwm1-1.24r-i18n/fvwm/move.c Mon Mar 13 14:44:19 2000 @@ -335,6 +335,8 @@ offset = (Scr.SizeStringWidth + SIZE_HINDENT*2 - XTextWidth(Scr.StdFont.font,str,strlen(str)))/2; +#undef FONTSET +#define FONTSET Scr.StdFont.fontset XDrawString (dpy, Scr.SizeWindow, Scr.NormalGC, offset, Scr.StdFont.font->ascent + SIZE_VINDENT, diff -ruN fvwm1-1.24r/fvwm/pager.c fvwm1-1.24r-i18n/fvwm/pager.c --- fvwm1-1.24r/fvwm/pager.c Mon Mar 13 14:45:08 2000 +++ fvwm1-1.24r-i18n/fvwm/pager.c Mon Mar 13 14:44:19 2000 @@ -70,6 +70,8 @@ TextColor = Scr.HiColors.fore; BackColor = Scr.HiColors.back; NewFontAndColor(Scr.PagerFont.font->fid,TextColor,BackColor); +#undef FONTSET +#define FONTSET Scr.PagerFont.fontset flush_expose(Scr.Hilite->pager_view); XDrawImageString (dpy, Scr.Hilite->pager_view, Scr.FontGC, 2,Scr.PagerFont.y+2, diff -ruN fvwm1-1.24r/fvwm/resize.c fvwm1-1.24r-i18n/fvwm/resize.c --- fvwm1-1.24r/fvwm/resize.c Tue Nov 15 23:04:09 1994 +++ fvwm1-1.24r-i18n/fvwm/resize.c Mon Mar 13 14:44:19 2000 @@ -455,6 +455,8 @@ Scr.StdFont.height,False); } +#undef FONTSET +#define FONTSET Scr.StdFont.fontset XDrawString (dpy, Scr.SizeWindow, Scr.NormalGC, offset, Scr.StdFont.font->ascent + SIZE_VINDENT, str, 13); diff -ruN fvwm1-1.24r/fvwm/style.c fvwm1-1.24r-i18n/fvwm/style.c --- fvwm1-1.24r/fvwm/style.c Tue Nov 15 23:04:17 1994 +++ fvwm1-1.24r-i18n/fvwm/style.c Mon Mar 13 14:44:19 2000 @@ -53,11 +53,11 @@ if(restofline == NULL)return; while((*restofline != 0)&&(*restofline != '\n')) { - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; if(mystrncasecmp(restofline,"ICON",4)==0) { restofline +=4; - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; tmp = restofline; len = 0; while((tmp != NULL)&&(*tmp != 0)&&(*tmp != ',')&&(*tmp != '\n')) @@ -80,11 +80,11 @@ if(mystrncasecmp(restofline,"COLOR",5)==0) { restofline +=5; - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; tmp = restofline; len = 0; while((tmp != NULL)&&(*tmp != 0)&&(*tmp != ',')&& - (*tmp != '\n')&&(*tmp != '/')&&(!isspace(*tmp))) + (*tmp != '\n')&&(*tmp != '/')&&(!isspace((unsigned char)*tmp))) { tmp++; len++; @@ -97,15 +97,15 @@ off_flags |= FORE_COLOR_FLAG; } - while(isspace(*tmp))tmp++; + while(isspace((unsigned char)*tmp))tmp++; if(*tmp == '/') { tmp++; - while(isspace(*tmp))tmp++; + while(isspace((unsigned char)*tmp))tmp++; restofline = tmp; len = 0; while((tmp != NULL)&&(*tmp != 0)&&(*tmp != ',')&& - (*tmp != '\n')&&(*tmp != '/')&&(!isspace(*tmp))) + (*tmp != '\n')&&(*tmp != '/')&&(!isspace((unsigned char)*tmp))) { tmp++; len++; @@ -123,11 +123,11 @@ if(mystrncasecmp(restofline,"FORECOLOR",9)==0) { restofline +=9; - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; tmp = restofline; len = 0; while((tmp != NULL)&&(*tmp != 0)&&(*tmp != ',')&& - (*tmp != '\n')&&(*tmp != '/')&&(!isspace(*tmp))) + (*tmp != '\n')&&(*tmp != '/')&&(!isspace((unsigned char)*tmp))) { tmp++; len++; @@ -145,11 +145,11 @@ if(mystrncasecmp(restofline,"BACKCOLOR",9)==0) { restofline +=9; - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; tmp = restofline; len = 0; while((tmp != NULL)&&(*tmp != 0)&&(*tmp != ',')&& - (*tmp != '\n')&&(*tmp != '/')&&(!isspace(*tmp))) + (*tmp != '\n')&&(*tmp != '/')&&(!isspace((unsigned char)*tmp))) { tmp++; len++; @@ -203,11 +203,11 @@ restofline +=8; sscanf(restofline,"%d",&butt); - while(isspace(*restofline))restofline++; - while((!isspace(*restofline))&&(*restofline!= 0)&& + while(isspace((unsigned char)*restofline))restofline++; + while((!isspace((unsigned char)*restofline))&&(*restofline!= 0)&& (*restofline != ',')&&(*restofline != '\n')) restofline++; - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; off_buttons |= (1<<(butt-1)); } @@ -216,11 +216,11 @@ restofline +=6; sscanf(restofline,"%d",&butt); - while(isspace(*restofline))restofline++; - while((!isspace(*restofline))&&(*restofline!= 0)&& + while(isspace((unsigned char)*restofline))restofline++; + while((!isspace((unsigned char)*restofline))&&(*restofline!= 0)&& (*restofline != ',')&&(*restofline != '\n')) restofline++; - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; on_buttons |= (1<<(butt-1)); } @@ -279,40 +279,40 @@ restofline +=11; off_flags |= BW_FLAG; sscanf(restofline,"%d",&bw); - while(isspace(*restofline))restofline++; - while((!isspace(*restofline))&&(*restofline!= 0)&& + while(isspace((unsigned char)*restofline))restofline++; + while((!isspace((unsigned char)*restofline))&&(*restofline!= 0)&& (*restofline != ',')&&(*restofline != '\n')) restofline++; - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; } else if(mystrncasecmp(restofline,"HandleWidth",11)==0) { restofline +=11; off_flags |= NOBW_FLAG; sscanf(restofline,"%d",&nobw); - while(isspace(*restofline))restofline++; - while((!isspace(*restofline))&&(*restofline!= 0)&& + while(isspace((unsigned char)*restofline))restofline++; + while((!isspace((unsigned char)*restofline))&&(*restofline!= 0)&& (*restofline != ',')&&(*restofline != '\n')) restofline++; - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; } else if(mystrncasecmp(restofline,"STARTSONDESK",12)==0) { restofline +=12; off_flags |= STAYSONDESK_FLAG; sscanf(restofline,"%d",&desknumber); - while(isspace(*restofline))restofline++; - while((!isspace(*restofline))&&(*restofline!= 0)&& + while(isspace((unsigned char)*restofline))restofline++; + while((!isspace((unsigned char)*restofline))&&(*restofline!= 0)&& (*restofline != ',')&&(*restofline != '\n')) restofline++; - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; } else if(mystrncasecmp(restofline,"STARTSANYWHERE",14)==0) { restofline +=14; on_flags |= STAYSONDESK_FLAG; } - while(isspace(*restofline))restofline++; + while(isspace((unsigned char)*restofline))restofline++; if(*restofline == ',') restofline++; else if((*restofline != 0)&&(*restofline != '\n')) diff -ruN fvwm1-1.24r/libs/CopyString.c fvwm1-1.24r-i18n/libs/CopyString.c --- fvwm1-1.24r/libs/CopyString.c Thu Sep 15 05:13:45 1994 +++ fvwm1-1.24r-i18n/libs/CopyString.c Mon Mar 13 14:44:19 2000 @@ -12,7 +12,7 @@ int len; char *start; - while(((isspace(*source))&&(*source != '\n'))&&(*source != 0)) + while(((isspace((unsigned char)*source))&&(*source != '\n'))&&(*source != 0)) { source++; } @@ -25,7 +25,7 @@ } source--; - while((isspace(*source))&&(*source != 0)&&(len >0)) + while((isspace((unsigned char)*source))&&(*source != 0)&&(len >0)) { len--; source--; diff -ruN fvwm1-1.24r/modules/FvwmBacker/FvwmBacker.c fvwm1-1.24r-i18n/modules/FvwmBacker/FvwmBacker.c --- fvwm1-1.24r/modules/FvwmBacker/FvwmBacker.c Wed Sep 28 22:37:39 1994 +++ fvwm1-1.24r-i18n/modules/FvwmBacker/FvwmBacker.c Mon Mar 13 14:44:19 2000 @@ -311,7 +311,7 @@ tline = fgets(line,(sizeof line)-1,ptr); while(tline != (char *)0) { - while(isspace(*tline))tline++; + while(isspace((unsigned char)*tline))tline++; if(strlen(tline)>1) { if(mystrncasecmp(tline,line2,strlen(line2))==0) AddCommand(&tline[strlen(line2)]); @@ -329,10 +329,10 @@ char *temp; int num; temp=string; - while(isspace(*temp)) temp++; + while(isspace((unsigned char)*temp)) temp++; num=atoi(temp); - while(!isspace(*temp)) temp++; - while(isspace(*temp)) temp++; + while(!isspace((unsigned char)*temp)) temp++; + while(isspace((unsigned char)*temp)) temp++; if (DeskCount<1) { commands=(Command*)safemalloc((num+1)*sizeof(Command)); while(DeskCount1)&& (mystrncasecmp(tline, MyName,strlen(MyName))==0)) { sscanf(&tline[strlen(MyName)],"%ld",&period[num_commands]); if(period[num_commands]>maxperiod) maxperiod = period[num_commands]; - while(!isspace(*tline))tline++; - while(isspace(*tline))tline++; /* points to "time" field */ - while(!isspace(*tline))tline++; - while(isspace(*tline))tline++; /* points to "command" field */ + while(!isspace((unsigned char)*tline))tline++; + while(isspace((unsigned char)*tline))tline++; /* points to "time" field */ + while(!isspace((unsigned char)*tline))tline++; + while(isspace((unsigned char)*tline))tline++; /* points to "command" field */ strcpy(command[num_commands],tline); num_commands++; } diff -ruN fvwm1-1.24r/modules/FvwmIconBox/FvwmIconBox.c fvwm1-1.24r-i18n/modules/FvwmIconBox/FvwmIconBox.c --- fvwm1-1.24r/modules/FvwmIconBox/FvwmIconBox.c Sat Sep 17 00:54:49 1994 +++ fvwm1-1.24r-i18n/modules/FvwmIconBox/FvwmIconBox.c Mon Mar 13 14:44:20 2000 @@ -59,12 +59,21 @@ #define FALSE 0 #endif +#ifdef I18N +#include +#endif + #include "FvwmIconBox.h" #include "../../version.h" char *MyName; XFontStruct *font; +#ifdef I18N +XFontSet fontset; +#define XTextWidth(x,y,z) XmbTextEscapement(fontset,y,z) +#define XDrawString(t,u,v,w,x,y,z) XmbDrawString(t,u,fontset,v,w,x,y,z) +#endif Display *dpy; /* which display are we talking to */ int x_fd,fd_width; @@ -161,6 +170,10 @@ char *temp, *s; char set_mask_mesg[50]; +#ifdef I18N + setlocale(LC_CTYPE, ""); +#endif + temp = argv[0]; s=strrchr(argv[0], '/'); @@ -899,11 +912,29 @@ XGCValues gcv; unsigned long gcm; unsigned long mask; +#ifdef I18N + char **ml; + int mc; + char *ds; + XFontStruct **fs_list; +#endif wm_del_win = XInternAtom(dpy,"WM_DELETE_WINDOW",False); _XA_WM_PROTOCOLS = XInternAtom (dpy, "WM_PROTOCOLS", False); /* load the font */ +#ifdef I18N + if ((fontset = XCreateFontSet(dpy, font_string, &ml, &mc, &ds)) == NULL) + { + if ((fontset = XCreateFontSet(dpy, "fixed", &ml, &mc, &ds)) == NULL) + { + fprintf(stderr,"%s: No fonts available\n",MyName); + exit(1); + } + } + XFontsOfFontSet(fontset, &fs_list, &ml); + font = fs_list[0]; +#else if ((font = XLoadQueryFont(dpy, font_string)) == NULL) { if ((font = XLoadQueryFont(dpy, "fixed")) == NULL) @@ -912,6 +943,7 @@ exit(1); } }; +#endif if (hidesc == HORIZONTAL) v_margin -= BAR_WIDTH + MARGIN2 + 4; @@ -1450,13 +1482,13 @@ int g_x, g_y, flags; unsigned width,height; - while(isspace(*tline))tline++; + while(isspace((unsigned char)*tline))tline++; if(strlen(&tline[0])>1){ if (mystrncasecmp(tline,CatString3("*", MyName, "Geometry"),Clength+9)==0){ tmp = &tline[Clength+9]; - while(((isspace(*tmp))&&(*tmp != '\n'))&&(*tmp != 0)) + while(((isspace((unsigned char)*tmp))&&(*tmp != '\n'))&&(*tmp != 0)) tmp++; tmp[strlen(tmp)-1] = 0; flags = XParseGeometry(tmp,&g_x,&g_y,&width,&height); @@ -1475,7 +1507,7 @@ } else if (mystrncasecmp(tline,CatString3("*", MyName, "MaxIconSize"),Clength+12)==0){ tmp = &tline[Clength+12]; - while(((isspace(*tmp))&&(*tmp != '\n'))&&(*tmp != 0)) + while(((isspace((unsigned char)*tmp))&&(*tmp != '\n'))&&(*tmp != 0)) tmp++; tmp[strlen(tmp)-1] = 0; @@ -1529,7 +1561,7 @@ else if (mystrncasecmp(tline,CatString3("*",MyName, "HideSC"),Clength+7)==0){ tmp = &tline[Clength+7]; - while(((isspace(*tmp))&&(*tmp != '\n'))&&(*tmp != 0)) + while(((isspace((unsigned char)*tmp))&&(*tmp != '\n'))&&(*tmp != 0)) tmp++; if (mystrncasecmp(tmp, "Horizontal", 10) == 0) hidesc = HORIZONTAL; @@ -1582,11 +1614,11 @@ /* file */ /* skip spaces */ - while(isspace(*tline)&&(*tline != '\n')&&(*tline != 0)) + while(isspace((unsigned char)*tline)&&(*tline != '\n')&&(*tline != 0)) tline++; start = tline; end = tline; - while(!isspace(*end)&&(*end != '\n')&&(*end != 0)) + while(!isspace((unsigned char)*end)&&(*end != '\n')&&(*end != 0)) end++; len = end - start; ptr = safemalloc(len+1); @@ -1643,11 +1675,11 @@ f->mouse = 0; /* skip spaces */ - while(isspace(*tline)&&(*tline != '\n')&&(*tline != 0)) + while(isspace((unsigned char)*tline)&&(*tline != '\n')&&(*tline != 0)) tline++; start = tline; end = tline; - while((!isspace(*end))&&(*end!='\n')&&(*end!=0)) + while((!isspace((unsigned char)*end))&&(*end!='\n')&&(*end!=0)) end++; if (mystrncasecmp(start, "1", 1) == 0) f->mouse = Button1; @@ -1658,11 +1690,11 @@ /* click or doubleclick */ tline = end; /* skip spaces */ - while(isspace(*tline)&&(*tline != '\n')&&(*tline != 0)) + while(isspace((unsigned char)*tline)&&(*tline != '\n')&&(*tline != 0)) tline++; start = tline; end = tline; - while((!isspace(*end))&&(*end!='\n')&&(*end!=0)) + while((!isspace((unsigned char)*end))&&(*end!='\n')&&(*end!=0)) end++; if (mystrncasecmp(start, "Click", 5) == 0) f->type = CLICK; @@ -1672,13 +1704,13 @@ /* actions */ tline = end; /* skip spaces */ - while(isspace(*tline)&&(*tline != '\n')&&(*tline != 0)) + while(isspace((unsigned char)*tline)&&(*tline != '\n')&&(*tline != 0)) tline++; start = tline; end = tline; tmp = tline; while((*tmp!='\n')&&(*tmp!=0)){ - if (!isspace(*tmp)) + if (!isspace((unsigned char)*tmp)) end = tmp; tmp++; } @@ -1708,11 +1740,11 @@ KeySym keysym; /* skip spaces */ - while(isspace(*tline)&&(*tline != '\n')&&(*tline != 0)) + while(isspace((unsigned char)*tline)&&(*tline != '\n')&&(*tline != 0)) tline++; start = tline; end = tline; - while((!isspace(*end))&&(*end!='\n')&&(*end!=0)) + while((!isspace((unsigned char)*end))&&(*end!='\n')&&(*end!=0)) end++; nlen = end - start; nptr = safemalloc(nlen+1); @@ -1722,13 +1754,13 @@ /* actions */ tline = end; /* skip spaces */ - while(isspace(*tline)&&(*tline != '\n')&&(*tline != 0)) + while(isspace((unsigned char)*tline)&&(*tline != '\n')&&(*tline != 0)) tline++; start = tline; end = tline; tmp = tline; while((*tmp!='\n')&&(*tmp!=0)){ - if (!isspace(*tmp)) + if (!isspace((unsigned char)*tmp)) end = tmp; tmp++; } diff -ruN fvwm1-1.24r/modules/FvwmIdent/FvwmIdent.c fvwm1-1.24r-i18n/modules/FvwmIdent/FvwmIdent.c --- fvwm1-1.24r/modules/FvwmIdent/FvwmIdent.c Sat Sep 17 00:07:11 1994 +++ fvwm1-1.24r-i18n/modules/FvwmIdent/FvwmIdent.c Mon Mar 13 14:44:20 2000 @@ -34,6 +34,9 @@ #include #include #include +#ifdef I18N +#include +#endif #include "../../fvwm/module.h" #include "FvwmIdent.h" @@ -59,6 +62,9 @@ Window main_win; Window app_win; XFontStruct *font; +#ifdef I18N +XFontSet fontset; +#endif int Width, Height,win_x,win_y; @@ -87,6 +93,10 @@ char *display_name = NULL; int Clength; +#ifdef I18N + setlocale(LC_CTYPE, ""); +#endif + /* Save the program name for error messages and config parsing */ temp = argv[0]; s=strrchr(argv[0], '/'); @@ -140,7 +150,7 @@ tline = fgets(line,(sizeof line)-1,file); while(tline != (char *)0) { - while(isspace(*tline))tline++; + while(isspace((unsigned char)*tline))tline++; if(strlen(tline)>1) { if(mystrncasecmp(tline, CatString3(MyName,"Font",""),Clength+4)==0) @@ -347,6 +357,12 @@ int JunkX, JunkY; unsigned int JunkMask; int x,y; +#ifdef I18N + char **ml; + int mc; + char *ds; + XFontStruct **fs_list; +#endif if(!found) { @@ -358,11 +374,20 @@ close(fd[1]); /* load the font */ +#ifdef I18N + if ((fontset = XCreateFontSet(dpy, font_string, &ml, &mc, &ds)) == NULL) { + if ((fontset = XCreateFontSet(dpy, "fixed", &ml, &mc, &ds)) == NULL) + exit(1); + } + XFontsOfFontSet(fontset, &fs_list, &ml); + font = fs_list[0]; +#else if ((font = XLoadQueryFont(dpy, font_string)) == NULL) { if ((font = XLoadQueryFont(dpy, "fixed")) == NULL) exit(1); }; +#endif /* make window infomation list */ MakeList(); diff -ruN fvwm1-1.24r/modules/FvwmIdent/FvwmIdent.h fvwm1-1.24r-i18n/modules/FvwmIdent/FvwmIdent.h --- fvwm1-1.24r/modules/FvwmIdent/FvwmIdent.h Wed Sep 14 03:25:16 1994 +++ fvwm1-1.24r-i18n/modules/FvwmIdent/FvwmIdent.h Mon Mar 13 14:44:20 2000 @@ -64,6 +64,11 @@ void list_res_name(unsigned long *body); void list_end(void); +#ifdef I18N +#define XTextWidth(x,y,z) XmbTextEscapement(fontset,y,z) +#define XDrawString(t,u,v,w,x,y,z) XmbDrawString(t,u,fontset,v,w,x,y,z) +#endif + #ifdef BROKEN_SUN_HEADERS #include "../../fvwm/sun_headers.h" #endif diff -ruN fvwm1-1.24r/modules/FvwmPager/FvwmPager.c fvwm1-1.24r-i18n/modules/FvwmPager/FvwmPager.c --- fvwm1-1.24r/modules/FvwmPager/FvwmPager.c Fri Oct 7 21:49:26 1994 +++ fvwm1-1.24r-i18n/modules/FvwmPager/FvwmPager.c Mon Mar 13 14:44:20 2000 @@ -34,6 +34,9 @@ #include #include #include +#ifdef I18N +#include +#endif #include "../../fvwm/module.h" @@ -90,6 +93,9 @@ char line[100]; char mask_mesg[50]; +#ifdef I18N + setlocale(LC_CTYPE, ""); +#endif /* Save our program name - for error messages */ temp = argv[0]; s=strrchr(argv[0], '/'); @@ -122,10 +128,10 @@ fd_width = GetFdWidth(); cptr = argv[6]; - while((isspace(*cptr))&&(*cptr != 0))cptr++; + while((isspace((unsigned char)*cptr & 0xff))&&(*cptr != 0))cptr++; desk1 = atoi(cptr); - while(!(isspace(*cptr))&&(*cptr != 0))cptr++; - while((isspace(*cptr))&&(*cptr != 0))cptr++; + while(!(isspace((unsigned char)*cptr & 0xff))&&(*cptr != 0))cptr++; + while((isspace((unsigned char)*cptr & 0xff))&&(*cptr != 0))cptr++; desk2 = atoi(cptr); if(desk2 < desk1) { @@ -802,13 +808,13 @@ int g_x, g_y, flags; unsigned width,height; - while(isspace(*tline))tline++; + while(isspace((unsigned char)*tline & 0xff))tline++; if((strlen(&tline[0])>1)&& (mystrncasecmp(tline, CatString3("*", MyName, "Geometry"),Clength+9)==0)) { tmp = &tline[Clength+9]; - while(((isspace(*tmp))&&(*tmp != '\n'))&&(*tmp != 0)) + while(((isspace((unsigned char)*tmp & 0xff))&&(*tmp != '\n'))&&(*tmp != 0)) { tmp++; } @@ -835,7 +841,7 @@ Clength+13)==0)) { tmp = &tline[Clength+13]; - while(((isspace(*tmp))&&(*tmp != '\n'))&&(*tmp != 0)) + while(((isspace((unsigned char)*tmp & 0xff))&&(*tmp != '\n'))&&(*tmp != 0)) { tmp++; } @@ -863,8 +869,8 @@ if((desk >= desk1)&&(desk <=desk2)) { n = 0; - while(isspace(tline[Clength+6+n]))n++; - while(!isspace(tline[Clength+6+n]))n++; + while(isspace((unsigned char)tline[Clength+6+n] & 0xff))n++; + while(!isspace((unsigned char)tline[Clength+6+n] & 0xff))n++; free(Desks[desk - desk1].label); CopyString(&Desks[desk - desk1].label,&tline[Clength+6+n]); } diff -ruN fvwm1-1.24r/modules/FvwmPager/x_pager.c fvwm1-1.24r-i18n/modules/FvwmPager/x_pager.c --- fvwm1-1.24r/modules/FvwmPager/x_pager.c Tue Nov 15 23:08:38 1994 +++ fvwm1-1.24r-i18n/modules/FvwmPager/x_pager.c Mon Mar 13 14:44:20 2000 @@ -32,6 +32,16 @@ extern int StartIconic; extern int icon_w, icon_h, icon_x, icon_y; XFontStruct *font, *windowFont; +#ifdef I18N +XFontSet fontset, windowFontset; +#ifdef __STDC__ +#define XTextWidth(x,y,z) XmbTextEscapement(x ## set,y,z) +#else +#define XTextWidth(x,y,z) XmbTextEscapement(x/**/set,y,z) +#endif +#define XDrawString(t,u,v,w,x,y,z) XmbDrawString(t,u,FONTSET,v,w,x,y,z) +#define XDrawImageString(t,u,v,w,x,y,z) XmbDrawImageString(t,u,FONTSET,v,w,x,y,z) +#endif GC NormalGC,HiliteGC,rvGC; GC StdGC, FocusGC; @@ -108,6 +118,12 @@ XGCValues gcv; unsigned long gcm; XClassHint class1; +#ifdef I18N + char **ml; + int mc; + char *ds; + XFontStruct **fs_list; +#endif XSetErrorHandler((XErrorHandler)FvwmErrorHandler); wm_del_win = XInternAtom(dpy,"WM_DELETE_WINDOW",False); @@ -116,6 +132,18 @@ m = Scr.VyMax/Scr.MyDisplayHeight; /* load the font */ +#ifdef I18N + if ((fontset = XCreateFontSet(dpy, font_string, &ml, &mc, &ds)) == NULL) + { + if ((fontset = XCreateFontSet(dpy, "fixed", &ml, &mc, &ds)) == NULL) + { + fprintf(stderr,"%s: No fonts available\n",MyName); + exit(1); + } + } + XFontsOfFontSet(fontset, &fs_list, &ml); + font = fs_list[0]; +#else if ((font = XLoadQueryFont(dpy, font_string)) == NULL) { if ((font = XLoadQueryFont(dpy, "fixed")) == NULL) @@ -124,18 +152,36 @@ exit(1); } }; +#endif + if(uselabel) label_h = font->ascent + font->descent+2; else label_h = 0; - +#ifdef I18N + if(smallFont != NULL) + { + windowFontset = XCreateFontSet(dpy, smallFont, &ml, &mc, &ds); + if (windowFontset != NULL) + { + XFontsOfFontSet(windowFontset, &fs_list, &ml); + windowFont = fs_list[0]; + } + } + else + { + windowFontset = NULL; + windowFont = NULL; + } +#else if(smallFont!= NULL) { windowFont= XLoadQueryFont(dpy, smallFont); } else windowFont= NULL; +#endif /* Load the colors */ fore_pix = GetColor(PagerFore); @@ -622,6 +668,9 @@ { int n1,m1,x,y,n,m,i; XTextProperty name; +#ifdef I18N + int ret; +#endif char str[100],*sptr; static int icon_desk_shown = -1000; @@ -658,11 +707,22 @@ sprintf(str,"Desk %d",Scr.CurrentDesk); sptr = &str[0]; } +#ifdef I18N + if ((ret = XmbTextListToTextProperty(dpy,&sptr,1,XStdICCTextStyle,&name)) + == XNoMemory) + { + fprintf(stderr,"%s: cannot allocate window name",MyName); + return; + } + else if (ret != Success) + return; +#else if (XStringListToTextProperty(&sptr,1,&name) == 0) { fprintf(stderr,"%s: cannot allocate window name",MyName); return; } +#endif XSetWMIconName(dpy,Scr.Pager_w,&name); } } @@ -773,6 +833,8 @@ if((w<= desk_w)&&(uselabel)) { hor_off = (desk_w -w)/2; +#undef FONTSET +#define FONTSET fontset if(i == (Scr.CurrentDesk - desk1)) XDrawString (dpy, Desks[i].title_w,rvGC,hor_off,font->ascent +1 , ptr, strlen(ptr)); @@ -1455,6 +1517,8 @@ Globalgcm = GCForeground|GCBackground; XChangeGC(dpy, StdGC,Globalgcm,&Globalgcv); } +#undef FONTSET +#define FONTSET windowFontset if(t->PagerView != None) { XClearWindow(dpy, t->PagerView); @@ -1493,6 +1557,8 @@ } XClearWindow(dpy, t->IconView); +#undef FONTSET +#define FONTSET windowFontset XDrawImageString (dpy, t->IconView,tgc,2,windowFont->ascent+2 , t->icon_name, strlen(t->icon_name)); diff -ruN fvwm1-1.24r/modules/FvwmSave/FvwmSave.c fvwm1-1.24r-i18n/modules/FvwmSave/FvwmSave.c --- fvwm1-1.24r/modules/FvwmSave/FvwmSave.c Sat Sep 17 00:07:40 1994 +++ fvwm1-1.24r-i18n/modules/FvwmSave/FvwmSave.c Mon Mar 13 14:44:20 2000 @@ -250,7 +250,7 @@ for(i=0;i1) { if(mystrncasecmp(tline,CatString3(MyName,"Fore",""), diff -ruN fvwm1-1.24r/modules/FvwmWinList/ButtonArray.c fvwm1-1.24r-i18n/modules/FvwmWinList/ButtonArray.c --- fvwm1-1.24r/modules/FvwmWinList/ButtonArray.c Tue May 10 02:08:28 1994 +++ fvwm1-1.24r-i18n/modules/FvwmWinList/ButtonArray.c Mon Mar 13 14:44:20 2000 @@ -12,6 +12,8 @@ * Things to do: Convert to C++ (In Progress) */ +#include "../../configure.h" + #include #include #include @@ -23,7 +25,19 @@ #define max(a,b) (((a)>(b)) ? (a) : (b)) #endif +#ifdef I18N +#ifdef __STDC__ +#define XTextWidth(x,y,z) XmbTextEscapement(x ## set,y,z) +#else +#define XTextWidth(x,y,z) XmbTextEscapement(x/**/set,y,z) +#endif +#define XDrawString(t,u,v,w,x,y,z) XmbDrawString(t,u,ButtonFontset,v,w,x,y,z) +#endif + extern XFontStruct *ButtonFont; +#ifdef I18N +extern XFontSet ButtonFontset; +#endif extern Display *dpy; extern Window win; extern GC shadow,hilite,graph; diff -ruN fvwm1-1.24r/modules/FvwmWinList/FvwmWinList.c fvwm1-1.24r-i18n/modules/FvwmWinList/FvwmWinList.c --- fvwm1-1.24r/modules/FvwmWinList/FvwmWinList.c Mon Sep 19 21:40:13 1994 +++ fvwm1-1.24r-i18n/modules/FvwmWinList/FvwmWinList.c Mon Mar 13 14:44:20 2000 @@ -31,6 +31,15 @@ #define YES "Yes" #define NO "No" +#ifdef I18N +#ifdef __STDC__ +#define XTextWidth(x,y,z) XmbTextEscapement(x ## set,y,z) +#else +#define XTextWidth(x,y,z) XmbTextEscapement(x/**/set,y,z) +#endif +#define XDrawString(t,u,v,w,x,y,z) XmbDrawString(t,u,ButtonFontset,v,w,x,y,z) +#endif + #include "../../configure.h" #include @@ -55,6 +64,9 @@ #include #include #include +#ifdef I18N +#include +#endif #include "../../fvwm/module.h" #include "../../version.h" @@ -81,6 +93,9 @@ Pixel back, fore; GC graph,shadow,hilite; XFontStruct *ButtonFont; +#ifdef I18N +XFontSet ButtonFontset; +#endif int fontheight; static Atom wm_del_win; Atom MwmAtom = None; @@ -105,6 +120,9 @@ { char *temp, *s; +#ifdef I18N + setlocale(LC_CTYPE, ""); +#endif /* Open the console for messages */ OpenConsole(); @@ -392,7 +410,7 @@ tline = fgets(line,(sizeof line)-1,ptr); while(tline != (char *)0) { - while(isspace(*tline))tline++; + while(isspace((unsigned char)*tline))tline++; if(strlen(tline)>1) { if(mystrncasecmp(tline, CatString3(Module, "Font",""),Clength+4)==0) CopyString(&font_string,&tline[Clength+4]); @@ -575,7 +593,7 @@ { char *temp; temp=string; - while(isspace(*temp)) temp++; + while(isspace((unsigned char)*temp)) temp++; if(mystrncasecmp(temp, "Click1", 6)==0) CopyString(&ClickAction[0],&temp[6]); else if(mystrncasecmp(temp, "Click2", 6)==0) @@ -711,6 +729,13 @@ ******************************************************************************/ void StartMeUp() { +#ifdef I18N + char **ml; + int mc; + char *ds; + XFontStruct **fs_list; +#endif + if (!(dpy = XOpenDisplay(""))) { fprintf(stderr,"%s: can't open display %s", Module, XDisplayName("")); @@ -724,9 +749,17 @@ ScreenHeight = DisplayHeight(dpy,screen); ScreenWidth = DisplayWidth(dpy,screen); +#ifdef I18N + if ((ButtonFontset=XCreateFontSet(dpy,font_string,&ml,&mc,&ds)) == NULL) { + if ((ButtonFontset=XCreateFontSet(dpy,"fixed",&ml,&mc,&ds)) == NULL) exit(1); + } + XFontsOfFontSet(ButtonFontset,&fs_list,&ml); + ButtonFont = fs_list[0]; +#else if ((ButtonFont=XLoadQueryFont(dpy,font_string))==NULL) { if ((ButtonFont=XLoadQueryFont(dpy,"fixed"))==NULL) exit(1); } +#endif fontheight=ButtonFont->ascent+ButtonFont->descent; diff -ruN fvwm1-1.24r/modules/GoodStuff/GoodStuff.c fvwm1-1.24r-i18n/modules/GoodStuff/GoodStuff.c --- fvwm1-1.24r/modules/GoodStuff/GoodStuff.c Tue Dec 6 02:39:04 1994 +++ fvwm1-1.24r-i18n/modules/GoodStuff/GoodStuff.c Mon Mar 13 14:44:20 2000 @@ -30,6 +30,10 @@ #include #include "../../fvwm/module.h" +#ifdef I18N +#include +#endif + #include #include #include @@ -41,6 +45,30 @@ char *MyName; XFontStruct *font; +#ifdef I18N +XFontSet fontset; +static Status MyXFetchName(dpy, win, winname) +Display *dpy; +Window win; +char **winname; +{ + XTextProperty text; + char **list; + int nitems; + + if (XGetWMName(dpy, win, &text)) { + if (text.value) + text.nitems = strlen(text.value); + if (XmbTextPropertyToTextList(dpy, &text, &list, &nitems) == Success && + *list) { + *winname = *list; + return 0; + } + return 1; + } +} +#define XFetchName(x,y,z) MyXFetchName(x,y,z) +#endif Display *dpy; /* which display are we talking to */ int x_fd,fd_width; @@ -99,6 +127,9 @@ char set_mask_mesg[50]; temp = argv[0]; +#ifdef I18N + setlocale(LC_CTYPE, ""); +#endif s=strrchr(argv[0], '/'); if (s != NULL) temp = s + 1; @@ -555,11 +586,30 @@ XGCValues gcv; unsigned long gcm; int actual_buttons_used,first_avail_button,i,j,k; +#ifdef I18N + char **ml; + int mc; + char *ds; + XFontStruct **fs_list; +#endif + wm_del_win = XInternAtom(dpy,"WM_DELETE_WINDOW",False); _XA_WM_PROTOCOLS = XInternAtom (dpy, "WM_PROTOCOLS", False); /* load the font */ +#ifdef I18N + if ((fontset = XCreateFontSet(dpy, font_string, &ml, &mc, &ds)) == NULL) + { + if ((fontset = XCreateFontSet(dpy, "fixed", &ml, &mc, &ds)) == NULL) + { + fprintf(stderr,"%s: No fonts available\n",MyName); + exit(1); + } + } + XFontsOfFontSet(fontset, &fs_list, &ml); + font = fs_list[0]; +#else if ((font = XLoadQueryFont(dpy, font_string)) == NULL) { if ((font = XLoadQueryFont(dpy, "fixed")) == NULL) @@ -568,6 +618,7 @@ exit(1); } }; +#endif /* Allow for multi-width/height buttons */ actual_buttons_used = 0; @@ -940,13 +991,13 @@ int g_x, g_y, flags; unsigned width,height; - while(isspace(*tline))tline++; + while(isspace((unsigned char)*tline))tline++; if((strlen(&tline[0])>1)&& (mystrncasecmp(tline,CatString3("*", MyName, "Geometry"),Clength+9)==0)) { tmp = &tline[Clength+9]; - while(((isspace(*tmp))&&(*tmp != '\n'))&&(*tmp != 0)) + while(((isspace((unsigned char)*tmp))&&(*tmp != '\n'))&&(*tmp != 0)) { tmp++; } @@ -1024,7 +1075,7 @@ char *ptr,*start,*end,*tmp; /* Get a size argument, if any */ - while(isspace(*tline)&&(*tline != '\n')&&(*tline != 0)) + while(isspace((unsigned char)*tline)&&(*tline != '\n')&&(*tline != 0)) tline++; if( *tline == '(') { @@ -1042,7 +1093,7 @@ } /* skip spaces */ - while(isspace(*tline)&&(*tline != '\n')&&(*tline != 0)) + while(isspace((unsigned char)*tline)&&(*tline != '\n')&&(*tline != 0)) tline++; /* read next word. Its the button label. Users can specify "" @@ -1050,7 +1101,7 @@ /* read to next space */ start = tline; end = tline; - while((!isspace(*end))&&(*end!='\n')&&(*end!=0)) + while((!isspace((unsigned char)*end))&&(*end!='\n')&&(*end!=0)) end++; len = end - start; ptr = safemalloc(len+1); @@ -1063,10 +1114,10 @@ /* read to next space */ start = end; /* skip spaces */ - while(isspace(*start)&&(*start != '\n')&&(*start != 0)) + while(isspace((unsigned char)*start)&&(*start != '\n')&&(*start != 0)) start++; end = start; - while((!isspace(*end))&&(*end!='\n')&&(*end!=0)) + while((!isspace((unsigned char)*end))&&(*end!='\n')&&(*end!=0)) end++; len = end - start; ptr = safemalloc(len+1); @@ -1076,7 +1127,7 @@ tline = end; /* skip spaces */ - while(isspace(*tline)&&(*tline != '\n')&&(*tline != 0)) + while(isspace((unsigned char)*tline)&&(*tline != '\n')&&(*tline != 0)) tline++; if(mystrncasecmp(tline,"swallow",7)==0) @@ -1099,11 +1150,11 @@ Buttons[num_buttons].swallow = 1; } n = 7; - while((isspace(tline[n]))&&(tline[n]!=0)) + while((isspace((unsigned char)tline[n]))&&(tline[n]!=0)) n++; len = strlen(&tline[n]); tmp = tline + n + len -1; - while(((isspace(*tmp))||(*tmp == '\n'))&&(tmp >=(tline + n))) + while(((isspace((unsigned char)*tmp))||(*tmp == '\n'))&&(tmp >=(tline + n))) { tmp--; len--; @@ -1127,7 +1178,7 @@ { len = strlen(tline); tmp = tline + len -1; - while(((isspace(*tmp))||(*tmp == '\n'))&&(tmp >=tline)) + while(((isspace((unsigned char)*tmp))||(*tmp == '\n'))&&(tmp >=tline)) { tmp--; len--; diff -ruN fvwm1-1.24r/modules/GoodStuff/GoodStuff.h fvwm1-1.24r-i18n/modules/GoodStuff/GoodStuff.h --- fvwm1-1.24r/modules/GoodStuff/GoodStuff.h Thu Sep 15 04:58:12 1994 +++ fvwm1-1.24r-i18n/modules/GoodStuff/GoodStuff.h Mon Mar 13 14:44:20 2000 @@ -39,6 +39,11 @@ extern GC ReliefGC; extern int ButtonWidth,ButtonHeight; extern XFontStruct *font; +#ifdef I18N +extern XFontSet fontset; +#define XTextWidth(x,y,z) XmbTextEscapement(fontset,y,z) +#define XDrawString(t,u,v,w,x,y,z) XmbDrawString(t,u,fontset,v,w,x,y,z) +#endif #define MAX_BUTTONS 100 struct button_info