diff -urN AfterStep-1.0/afterstep/add_window.c AfterStep-1.0-I18N/afterstep/add_window.c --- AfterStep-1.0/afterstep/add_window.c Wed Mar 19 10:26:41 1997 +++ AfterStep-1.0-I18N/afterstep/add_window.c Fri Feb 27 15:23:29 1998 @@ -107,6 +107,10 @@ XrmValue rm_value; unsigned long buttons; XTextProperty text_prop; +#ifdef I18N + char **list; + int num; +#endif NeedToResizeToo = False; /* allocate space for the afterstep window */ @@ -127,9 +131,27 @@ 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 (text_prop.encoding == XA_STRING) + tmp_win->name = (char *)text_prop.value; + else { + if (XmbTextPropertyToTextList(dpy,&text_prop,&list,&num) >= Success + && num > 0 && *list) + tmp_win->name = *list; + else + tmp_win->name = (char *)text_prop.value; + } + } else + tmp_win->name = NoName; + } +#else tmp_win->name = (char *)text_prop.value ; - else - tmp_win->name = NoName; +#endif + else + tmp_win->name = NoName; tmp_win->focus_sequence = 1; SetCirculateSequence(tmp_win, -1); @@ -268,9 +290,35 @@ return(NULL); } 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 (text_prop.value) { + text_prop.nitems = strlen(text_prop.value); + if (text_prop.encoding == XA_STRING) + tmp_win->icon_name = (char *)text_prop.value; + else { + if (XmbTextPropertyToTextList(dpy,&text_prop,&list,&num) >= Success + && num > 0 && *list) + tmp_win->icon_name = *list; + else + tmp_win->icon_name = (char *)text_prop.value; + } + } 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); + 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; @@ -487,7 +535,25 @@ } XChangeWindowAttributes (dpy, tmp_win->w, valuemask, &attributes); if ( XGetWMName(dpy, tmp_win->w, &text_prop) != 0 ) - tmp_win->name = (char *)text_prop.value ; +#ifdef I18N + { + if (text_prop.value) { + text_prop.nitems = strlen(text_prop.value); + if (text_prop.encoding == XA_STRING) + tmp_win->name = (char *)text_prop.value; + else { + if (XmbTextPropertyToTextList(dpy,&text_prop,&list,&num) >= Success + && num > 0 && *list) + tmp_win->name = *list; + else + tmp_win->name = (char *)text_prop.value; + } + } else + tmp_win->name = NoName; + } +#else + tmp_win->name = (char *)text_prop.value ; +#endif else tmp_win->name = NoName; diff -urN AfterStep-1.0/afterstep/afterstep.c AfterStep-1.0-I18N/afterstep/afterstep.c --- AfterStep-1.0/afterstep/afterstep.c Mon May 5 00:19:57 1997 +++ AfterStep-1.0-I18N/afterstep/afterstep.c Fri Feb 27 15:21:52 1998 @@ -66,6 +66,10 @@ #include #endif /* SHAPE */ +#ifdef I18N +#include +#endif + #if defined (sparc) && defined (SVR4) /* Solaris has sysinfo instead of gethostname. */ #include @@ -163,6 +167,11 @@ Bool single = False; Bool option_error = FALSE; + +#ifdef I18N + if (setlocale(LC_CTYPE, "") == NULL) + afterstep_err("can't set locale", NULL, NULL, NULL); +#endif #ifdef M4 /* Set the defaults for m4 processing */ diff -urN AfterStep-1.0/afterstep/afterstep.h AfterStep-1.0-I18N/afterstep/afterstep.h --- AfterStep-1.0/afterstep/afterstep.h Tue Mar 11 09:49:26 1997 +++ AfterStep-1.0-I18N/afterstep/afterstep.h Fri Feb 27 15:21:53 1998 @@ -119,6 +119,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; diff -urN AfterStep-1.0/afterstep/borders.c AfterStep-1.0-I18N/afterstep/borders.c --- AfterStep-1.0/afterstep/borders.c Fri Mar 21 09:09:21 1997 +++ AfterStep-1.0-I18N/afterstep/borders.c Fri Feb 27 15:21:53 1998 @@ -295,6 +295,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)); } @@ -589,8 +591,10 @@ } NewFontAndColor(Scr.WindowFont.font->fid,Forecolor, BackColor); + - +#undef FONTSET +#define FONTSET Scr.WindowFont.fontset if(NewTitle) XClearWindow(dpy,t->title_w); @@ -630,8 +634,13 @@ if(t->name != (char *)NULL) { if (onoroff && (Textures.flags & GradientText)) { - DrawTexturedText(dpy,t->title_w,Scr.WindowFont.font,hor_off, +#ifdef I18N + DrawTexturedText(dpy,t->title_w,Scr.WindowFont.font,Scr.WindowFont.fontset,hor_off, 4,Scr.TitleGradient, t->name, strlen(t->name)); +#else + DrawTexturedText(dpy,t->title_w,Scr.WindowFont.font,hor_off, + 4,Scr.TitleGradient, t->name, strlen(t->name)); +#endif } else { XDrawString (dpy, t->title_w,Scr.FontGC,hor_off, Scr.WindowFont.y+ 4, diff -urN AfterStep-1.0/afterstep/configure.c AfterStep-1.0-I18N/afterstep/configure.c --- AfterStep-1.0/afterstep/configure.c Sun Mar 9 09:43:54 1997 +++ AfterStep-1.0-I18N/afterstep/configure.c Fri Feb 27 15:21:53 1998 @@ -27,7 +27,9 @@ #include #include #include - +#ifdef I18N +#include +#endif #include #include #ifdef M4 @@ -412,6 +414,11 @@ char line[256],*tline; char *Home; /* the HOME environment variable */ int HomeLen; /* length of Home */ + +#ifdef I18N + char *Lang; +#endif + #ifdef ENABLE_TEXTURE int icol, mcol, ucol, tcol, scol; /* texture colors */ int defcol; @@ -463,10 +470,37 @@ } else { - home_file = safemalloc(HomeLen+strlen(config_file)+3); - strcpy(home_file,Home); - strcat(home_file,"/"); - strcat(home_file,config_file); +#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 } afterstep_file = home_file; config_fd = fopen(home_file,"r"); @@ -508,7 +542,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); @@ -1286,6 +1320,15 @@ #endif void GetColors(void) { +#ifdef I18N + XFontSetExtents *fset_extents; + XFontStruct **fs_list; + char **ml; + int mc; + char *ds; + char *fn_tmp; + int fn_tmp_length; +#endif extern MyFont *IconFont; if(have_the_colors) return; @@ -1353,6 +1396,33 @@ } /* load the font */ +#ifdef I18N + if ((Scr.StdFont.fontset = XCreateFontSet(dpy, Scr.StdFont.name, &ml, + &mc, &ds)) == NULL) { + nofont(Scr.StdFont.name); + fn_tmp_length = strlen(Scr.StdFont.name) + strlen(",-*--14-*"); + fn_tmp = malloc(fn_tmp_length + 1); + strcpy(fn_tmp,Scr.StdFont.name); + strcat(fn_tmp,",-*--14-*"); + fprintf(stderr,"Trying... %s\n",fn_tmp); + if ((Scr.StdFont.fontset = XCreateFontSet(dpy, fn_tmp, + &ml, &mc, &ds)) == NULL) { + nofont(fn_tmp); + fprintf(stderr,"Trying... fixed,-*--14-*\n"); + if ((Scr.StdFont.fontset = XCreateFontSet(dpy, "fixed,-*--14-*", + &ml, &mc, &ds)) == NULL) { + fprintf(stderr,"ERROR: no fontset available\n"); + 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 +2; +#else if ((Scr.StdFont.font = XLoadQueryFont(dpy, Scr.StdFont.name)) == NULL) { nofont(Scr.StdFont.name); @@ -1362,7 +1432,35 @@ 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 +2; +#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); + + fn_tmp_length = strlen(Scr.WindowFont.name) + strlen(",-*--14-*"); + fn_tmp = malloc(fn_tmp_length + 1); + strcpy(fn_tmp,Scr.WindowFont.name); + strcat(fn_tmp,",-*--14-*"); + fprintf(stderr,"Trying... %s\n",fn_tmp); + if ((Scr.WindowFont.fontset = XCreateFontSet(dpy, fn_tmp, + &ml, &mc, &ds)) == NULL) { + nofont(fn_tmp); + fprintf(stderr,"Trying... fixed,-*--14-*\n"); + if ((Scr.WindowFont.fontset = XCreateFontSet(dpy, "fixed,-*--14-*", + &ml, &mc, &ds)) == NULL) { + fprintf(stderr,"ERROR: no fontset available\n"); + 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); @@ -1373,17 +1471,30 @@ 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); } @@ -1391,13 +1502,42 @@ IconFont = &Scr.StdFont; if(Scr.IconFont.name != NULL) { - if ((Scr.IconFont.font = XLoadQueryFont(dpy, Scr.IconFont.name))!=NULL) { - Scr.IconFont.height= - Scr.IconFont.font->ascent+Scr.IconFont.font->descent; - Scr.IconFont.y = Scr.IconFont.font->ascent; - IconFont = &Scr.IconFont; - } else - nofont(Scr.IconFont.name); +#ifdef I18N + if ((Scr.IconFont.fontset = XCreateFontSet(dpy, Scr.IconFont.name, &ml, + &mc, &ds)) == NULL) { + nofont(Scr.IconFont.name); + fn_tmp_length = strlen(Scr.IconFont.name) + strlen(",-*--14-*"); + fn_tmp = malloc(fn_tmp_length + 1); + strcpy(fn_tmp,Scr.IconFont.name); + strcat(fn_tmp,",-*--14-*"); + fprintf(stderr,"Trying... %s\n",fn_tmp); + if ((Scr.IconFont.fontset = XCreateFontSet(dpy, fn_tmp, + &ml, &mc, &ds)) == NULL) { + nofont(fn_tmp); + fprintf(stderr,"Trying... fixed,-*--14-*\n"); + if ((Scr.IconFont.fontset = XCreateFontSet(dpy, "fixed,-*--14-*", + &ml, &mc, &ds)) == NULL) { + fprintf(stderr,"ERROR: no fontset available\n"); + exit(1); + } + } + } + + 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= + Scr.IconFont.font->ascent+Scr.IconFont.font->descent; + Scr.IconFont.y = Scr.IconFont.font->ascent; + IconFont = &Scr.IconFont; + } else + nofont(Scr.IconFont.name); +#endif } else { if ((Scr.IconFont.font = XLoadQueryFont(dpy, "fixed"))!=NULL) { Scr.IconFont.height= @@ -1448,7 +1588,7 @@ mr = NewMenuRoot(name); GetColors(); - while(isspace(*pline))pline++; + while(isspace((unsigned char)*pline))pline++; while((pline != (char *)0) &&(mystrncasecmp("End",pline,3)!=0)) { @@ -1482,7 +1622,7 @@ orig_tline = pline; - while(isspace(*pline))pline++; + while(isspace((unsigned char)*pline))pline++; } MakeMenu(mr); @@ -1834,7 +1974,7 @@ cur->x = 5; if(cur->func==F_TITLE) /* Title */ - cur->y_height = NS_TITLE_HEIGHT+1; + cur->y_height = Scr.EntryHeight; else if(cur->func==F_NOP && *cur->item==0) /* Separator */ cur->y_height = HEIGHT_SEPARATOR; @@ -2156,7 +2296,7 @@ char *tmp,*ptr; int len; - while(isspace(*source)) + while(isspace((unsigned char)*source)) source++; len = strlen(source); tmp = source + len -1; @@ -2681,6 +2821,9 @@ #endif #ifdef NO_SAVEUNDERS strcat(options, "NO_SAVEUNDERS "); +#endif +#ifdef I18N + strcat(options, "I18N "); #endif #ifdef NO_WINDOWLIST strcat(options, "NO_WINDOWLIST "); diff -urN AfterStep-1.0/afterstep/events.c AfterStep-1.0-I18N/afterstep/events.c --- AfterStep-1.0/afterstep/events.c Sat Apr 26 21:21:36 1997 +++ AfterStep-1.0-I18N/afterstep/events.c Fri Feb 27 15:24:30 1998 @@ -363,7 +363,12 @@ 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)) return; @@ -371,6 +376,31 @@ 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 (text_prop.value) { + text_prop.nitems = strlen(text_prop.value); + if (text_prop.encoding == XA_STRING) + prop = (char *)text_prop.value; + else { + if (XmbTextPropertyToTextList(dpy,&text_prop,&list,&num) >= Success + && num > 0 && *list) + prop = *list; + else + prop = (char *)text_prop.value; + } + } else + prop = NoName; +#else if (XGetWindowProperty (dpy, Tmp_win->w, Event.xproperty.atom, 0L, MAX_NAME_LEN, False, XA_STRING, &actual, &actual_format, &nitems, &bytesafter, @@ -378,6 +408,7 @@ actual == None) return; if (!prop) prop = NoName; +#endif free_window_names (Tmp_win, True, False); Tmp_win->name = prop; @@ -403,6 +434,31 @@ 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 (text_prop.value) { + text_prop.nitems = strlen(text_prop.value); + if (text_prop.encoding == XA_STRING) + prop = (char *)text_prop.value; + else { + if (XmbTextPropertyToTextList(dpy,&text_prop,&list,&num) >= Success + && num > 0 && *list) + prop = *list; + else + prop = (char *)text_prop.value; + } + } else + prop = NoName; +#else if (XGetWindowProperty (dpy, Tmp_win->w, Event.xproperty.atom, 0, MAX_ICON_NAME_LEN, False, XA_STRING, &actual, &actual_format, &nitems, &bytesafter, @@ -410,6 +466,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 -urN AfterStep-1.0/afterstep/functions.c AfterStep-1.0-I18N/afterstep/functions.c --- AfterStep-1.0/afterstep/functions.c Sat Apr 26 21:50:08 1997 +++ AfterStep-1.0-I18N/afterstep/functions.c Fri Feb 27 15:21:54 1998 @@ -483,6 +483,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 -urN AfterStep-1.0/afterstep/icons.c AfterStep-1.0-I18N/afterstep/icons.c --- AfterStep-1.0/afterstep/icons.c Fri Mar 21 09:09:21 1997 +++ AfterStep-1.0-I18N/afterstep/icons.c Fri Feb 27 15:21:54 1998 @@ -225,40 +225,30 @@ Tmp_win->icon_p_width-2,titleH+6); XSetForeground(dpy, Scr.IconGC, Scr.HiColors.fore); if (Tmp_win->icon_name==NULL) { - if (Tmp_win->name!=NULL) { - cnt = strlen(Tmp_win->name); - textX = XTextWidth(Scr.IconFont.font,Tmp_win->name, cnt); - if (textX < Tmp_win->icon_p_width) { - textX = (Tmp_win->icon_p_width-textX)/2; - text = Tmp_win->name; - } else { - int i; - /* try to find approx. characters that fit here */ - i=(Tmp_win->icon_p_width*cnt)/textX; - textX = 1; - text = &(Tmp_win->name[cnt-i]); - cnt = i; - } - } + if (Tmp_win->name!=NULL) { + cnt = strlen(Tmp_win->name); + textX = XTextWidth(Scr.IconFont.font,Tmp_win->name, cnt); + if (textX > Tmp_win->icon_p_width - 4) + textX = Tmp_win->icon_p_width - 4 - textX; + else + textX = (Tmp_win->icon_p_width - textX)/2; + text = Tmp_win->name; + } } else { - cnt = strlen(Tmp_win->icon_name); - textX = XTextWidth(Scr.IconFont.font,Tmp_win->icon_name, cnt); - if (textX < Tmp_win->icon_p_width) { - textX = (Tmp_win->icon_p_width-textX)/2; - text = Tmp_win->icon_name; - } else { - int i; - /* try to find approx. characters that fit here */ - i=(Tmp_win->icon_p_width*cnt)/textX; - textX = 1; - text = &(Tmp_win->icon_name[cnt-i]); - cnt = i; - } + cnt = strlen(Tmp_win->icon_name); + textX = XTextWidth(Scr.IconFont.font,Tmp_win->icon_name, cnt); + if (textX > Tmp_win->icon_p_width - 4) + textX = Tmp_win->icon_p_width - 4 - textX; + else + textX = (Tmp_win->icon_p_width - textX)/2; + text = Tmp_win->icon_name; } +#undef FONTSET +#define FONTSET Scr.IconFont.fontset XDrawString(dpy, Tmp_win->icon_pixmap_w, Scr.IconGC, textX, - Scr.IconFont.font->ascent+1, text, cnt); + Scr.IconFont.font->ascent+1, text, cnt); + } } - } } diff -urN AfterStep-1.0/afterstep/menus.c AfterStep-1.0-I18N/afterstep/menus.c --- AfterStep-1.0/afterstep/menus.c Sun Apr 20 05:26:01 1997 +++ AfterStep-1.0-I18N/afterstep/menus.c Fri Feb 27 15:21:54 1998 @@ -126,7 +126,7 @@ } if(ActiveItem) { if (!(Scr.flags & MenusHigh)) - y = MenuY - 10 + ((ActiveItem->item_num)*(ActiveItem->y_height)); + y = MenuY + ((ActiveItem->item_num)*(ActiveItem->y_height))-(Scr.EntryHeight & 1) - (Scr.EntryHeight >>1); else y = MenuY + (Scr.EntryHeight >>1); @@ -395,17 +395,37 @@ XChangeGC(dpy,Scr.ScratchGC1,Globalgcm,&Globalgcv); currentGC = Scr.ScratchGC1; } - if(*mi->item) - XDrawString(dpy, mr->w, currentGC,mi->x,text_y, mi->item, mi->strlen); - if(mi->strlen2>0) - XDrawString(dpy, mr->w, currentGC,mi->x2,text_y, mi->item2,mi->strlen2); - - d=(Scr.EntryHeight-7)/2; - if(mi->func != F_POPUP && mi->hotkey != 0) { - hk[0]= mi->hotkey; - XDrawString(dpy, mr->w, currentGC, - mr->width-d-4- XTextWidth(Scr.StdFont.font, hk, 1)/2, - text_y, hk, 1); + if (mi->item_num == 0) { /* when paintig first entry(menu title) */ + text_y = Scr.WindowFont.y + 4; +#undef FONTSET +#define FONTSET Scr.WindowFont.fontset + if(*mi->item) + XDrawString(dpy, mr->w, currentGC,mi->x,text_y, mi->item, mi->strlen); + if(mi->strlen2>0) + XDrawString(dpy, mr->w, currentGC,mi->x2,text_y, mi->item2,mi->strlen2); + + d=(Scr.EntryHeight-7)/2; + if(mi->func != F_POPUP && mi->hotkey != 0) { + hk[0]= mi->hotkey; + XDrawString(dpy, mr->w, currentGC, + mr->width-d-4- XTextWidth(Scr.StdFont.font, hk, 1)/2, + text_y, hk, 1); + } + } else { +#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) + XDrawString(dpy, mr->w, currentGC,mi->x2,text_y, mi->item2,mi->strlen2); + + d=(Scr.EntryHeight-7)/2; + if(mi->func != F_POPUP && mi->hotkey != 0) { + hk[0]= mi->hotkey; + XDrawString(dpy, mr->w, currentGC, + mr->width-d-4- XTextWidth(Scr.StdFont.font, hk, 1)/2, + text_y, hk, 1); + } } d=(Scr.EntryHeight-7)/2; if(mi->func == F_POPUP) diff -urN AfterStep-1.0/afterstep/misc.h AfterStep-1.0-I18N/afterstep/misc.h --- AfterStep-1.0/afterstep/misc.h Wed Mar 19 10:37:12 1997 +++ AfterStep-1.0-I18N/afterstep/misc.h Fri Feb 27 15:21:54 1998 @@ -107,6 +107,17 @@ 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 #else diff -urN AfterStep-1.0/afterstep/module.c AfterStep-1.0-I18N/afterstep/module.c --- AfterStep-1.0/afterstep/module.c Sun Mar 9 09:45:29 1997 +++ AfterStep-1.0-I18N/afterstep/module.c Fri Feb 27 15:21:54 1998 @@ -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 -urN AfterStep-1.0/afterstep/move.c AfterStep-1.0-I18N/afterstep/move.c --- AfterStep-1.0/afterstep/move.c Sat Mar 1 13:26:44 1997 +++ AfterStep-1.0-I18N/afterstep/move.c Fri Feb 27 15:21:54 1998 @@ -317,6 +317,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 -urN AfterStep-1.0/afterstep/pager.c AfterStep-1.0-I18N/afterstep/pager.c --- AfterStep-1.0/afterstep/pager.c Sat Mar 1 13:26:44 1997 +++ AfterStep-1.0-I18N/afterstep/pager.c Fri Feb 27 15:21:54 1998 @@ -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 -urN AfterStep-1.0/afterstep/resize.c AfterStep-1.0-I18N/afterstep/resize.c --- AfterStep-1.0/afterstep/resize.c Sat Mar 1 13:26:45 1997 +++ AfterStep-1.0-I18N/afterstep/resize.c Fri Feb 27 15:21:55 1998 @@ -444,6 +444,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 -urN AfterStep-1.0/afterstep/stepgfx.c AfterStep-1.0-I18N/afterstep/stepgfx.c --- AfterStep-1.0/afterstep/stepgfx.c Sat Mar 1 10:18:57 1997 +++ AfterStep-1.0-I18N/afterstep/stepgfx.c Fri Feb 27 15:21:55 1998 @@ -597,9 +597,13 @@ * text - text to draw * chars - chars in text ************************************************************************/ +#ifdef I18N +void DrawTexturedText(Display *dpy, Drawable d, XFontStruct *font, XFontSet fontset, + int x, int y, Pixmap gradient, char *text, int chars) +#else void DrawTexturedText(Display *dpy, Drawable d, XFontStruct *font, int x, int y, Pixmap gradient, char *text, int chars) - +#endif { Pixmap mask; int w,h; @@ -607,7 +611,11 @@ XGCValues gcv; /* make the mask pixmap */ +#ifdef I18N + w = XmbTextEscapement(fontset,text,chars); +#else w = XTextWidth(font,text,chars); +#endif h = font->ascent+font->descent; mask=XCreatePixmap(dpy,DefaultRootWindow(dpy),w+1,h+1,1); gcv.foreground = 0; @@ -616,7 +624,12 @@ gc = XCreateGC(dpy,mask,GCFunction|GCForeground|GCFont,&gcv); XFillRectangle(dpy,mask,gc,0,0,w,h); XSetForeground(dpy,gc,1); +#ifdef I18N +/* ref: misc.h */ + XmbDrawString(dpy,mask,fontset,gc,0,font->ascent,text,chars); +#else XDrawString(dpy,mask,gc,0,font->ascent,text,chars); +#endif XFreeGC(dpy,gc); /* draw the texture */ gcv.function=GXcopy; diff -urN AfterStep-1.0/afterstep/stepgfx.h AfterStep-1.0-I18N/afterstep/stepgfx.h --- AfterStep-1.0/afterstep/stepgfx.h Thu Oct 17 07:31:59 1996 +++ AfterStep-1.0-I18N/afterstep/stepgfx.h Fri Feb 27 15:21:55 1998 @@ -24,9 +24,13 @@ extern int DrawDegradeRelief(Display *dpy, Drawable d, int x, int y, int w, int h, int from[3], int to[3], int relief, int maxcols); +#ifdef I18N +extern void DrawTexturedText(Display *dpy, Drawable d, XFontStruct *font, XFontSet fontset, + int x, int y, Pixmap gradient, char *text, int chars); +#else extern void DrawTexturedText(Display *dpy, Drawable d, XFontStruct *font, int x, int y, Pixmap gradient, char *text, int chars); - +#endif extern int MakeShadowColors(Display *dpy, int from[3], int to[3], unsigned long *dark, unsigned long *light); diff -urN AfterStep-1.0/afterstep/style.c AfterStep-1.0-I18N/afterstep/style.c --- AfterStep-1.0/afterstep/style.c Wed Mar 19 10:26:42 1997 +++ AfterStep-1.0-I18N/afterstep/style.c Fri Feb 27 15:21:55 1998 @@ -56,11 +56,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')) @@ -83,11 +83,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++; @@ -100,15 +100,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++; @@ -126,11 +126,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++; @@ -148,11 +148,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++; @@ -201,11 +201,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)); } @@ -214,11 +214,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)); } @@ -277,40 +277,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 -urN AfterStep-1.0/configure.h AfterStep-1.0-I18N/configure.h --- AfterStep-1.0/configure.h Mon Mar 3 04:50:40 1997 +++ AfterStep-1.0-I18N/configure.h Fri Feb 27 15:21:55 1998 @@ -62,6 +62,16 @@ #define XPMLIBRARY -L/usr/lib/X11 -lXpm /*************************************************************************** + *#define I18N + * If you want to use i18n feature, specify #define I18N + * Then you can use non-english fonts in window title, Icon, + * and Menu. you have to set the locale appropriately before + * you start the window manager. + ***************************************************************************/ +/* #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 -urN AfterStep-1.0/lib/CopyString.c AfterStep-1.0-I18N/lib/CopyString.c --- AfterStep-1.0/lib/CopyString.c Wed Aug 21 23:23:34 1996 +++ AfterStep-1.0-I18N/lib/CopyString.c Fri Feb 27 15:21:55 1998 @@ -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--;