*/
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
/*
* ÆüËܸì(EUC-JAPAN)Âбþ (-DJP)
* ¡¦´Á»ú¥Õ¥©¥ó¥È¤Î°·¤¤¤òÄɲÃ
static infowin *Focuswin = (infowin*)(NULL);
#endif
static infoclr *Infoclr = (infoclr*)(NULL);
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
static infofnt *Infofnt = (infofnt*)(NULL);
static infofnt *Infokfnt = (infofnt*)(NULL);
#else
/**** Generic code ****/
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
#define Infokfnt_set(I) \
(Infokfnt = (I))
#endif
{
infofnt *ifnt = Infofnt;
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
infofnt *ikfnt = Infokfnt;
#endif
/* Deal with 'name' */
string_free(ifnt->name);
}
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
if (ikfnt->name)
{
/* Free the name */
string_free(ikfnt->name);
}
#endif
+
/* Nuke info if needed */
if (ifnt->nuke)
{
/* Free the font */
+#ifdef USE_FONTSET
+ XFreeFontSet(Metadpy->dpy, ifnt->info);
+#else
XFreeFont(Metadpy->dpy, ifnt->info);
+#endif
}
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
if (ikfnt->nuke)
{
/* Free the font */
/*
* Prepare a new 'infofnt'
*/
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
static errr Infofnt_prepare(XFontStruct *info, XFontStruct *kinfo)
#else
#ifdef USE_FONTSET
{
infofnt *ifnt = Infofnt;
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
infofnt *ikfnt = Infokfnt;
#endif
XCharStruct *cs;
else
ifnt->twid = ifnt->wid;
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
/* Assign the struct */
ikfnt->info = kinfo;
/*
* Initialize a new 'infofnt'.
*/
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
static errr Infofnt_init_real(XFontStruct *info, XFontStruct *kinfo)
#else
#ifdef USE_FONTSET
/* Wipe the thing */
(void)WIPE(Infofnt, infofnt);
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
WIPE(Infokfnt, infofnt);
#endif
/* No nuking */
Infofnt->nuke = 0;
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
Infokfnt->nuke = 0;
#endif
/* Attempt to prepare it */
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
return (Infofnt_prepare (info, kinfo));
#else
return (Infofnt_prepare(info));
* Inputs:
* name: The name of the requested Font
*/
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
static void Infofnt_init_data(cptr name, cptr kname)
#else
static void Infofnt_init_data(cptr name)
#endif
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
XFontStruct *kinfo;
#endif
/*** Load the info Fresh, using the name ***/
/* If the name is not given, report an error */
if (!name || !*name) quit("Missing font!");
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
if (!kname || !*kname) quit("Missing kanji font!");
#endif
/* Attempt to load the font */
}
#else
info = XLoadQueryFont(Metadpy->dpy, name);
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
kinfo = XLoadQueryFont(Metadpy->dpy, kname);
#endif
#endif
/* The load failed, try to recover */
if (!info) quit_fmt("Failed to find font:\"%s\"", name);
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
if (!kinfo) quit_fmt("Failed to find font:\"%s\"", kname);
#endif
/* Wipe the thing */
(void)WIPE(Infofnt, infofnt);
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
WIPE(Infokfnt, infofnt);
#endif
/* Attempt to prepare it */
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
if (Infofnt_prepare(info, kinfo))
#else
if (Infofnt_prepare(info))
XFreeFontSet(Metadpy->dpy, info);
#else
XFreeFont(Metadpy->dpy, info);
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
XFreeFont(Metadpy->dpy, kinfo);
#endif
#endif
/* Save a copy of the font name */
Infofnt->name = string_make(name);
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
Infokfnt->name = string_make(kname);
#endif
/* Mark it as nukable */
Infofnt->nuke = 1;
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
Infokfnt->nuke = 1;
#endif
}
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
/*
* EUCÆüËܸ쥳¡¼¥É¤ò´Þ¤àʸ»úÎó¤òɽ¼¨¤¹¤ë (Xlib)
*/
/*** Actually draw 'str' onto the infowin ***/
-#if 1
-#ifndef JP
+#ifndef USE_FONTSET
/* Be sure the correct font is ready */
XSetFont(Metadpy->dpy, Infoclr->gc, Infofnt->info->fid);
#endif
-#endif
/*** Handle the fake mono we can enforce on fonts ***/
/* Monotize the font */
if (Infofnt->mono)
{
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
/* Be sure the correct font is ready */
XSetFont(Metadpy->dpy, Infoclr->gc, Infofnt->info->fid);
#endif
else
{
/* Note that the Infoclr is set up to contain the Infofnt */
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
/* ´Á»ú¥Õ¥©¥ó¥È¤Îɽ¼¨Éý¤Ï ASCII¥Õ¥©¥ó¥È¤Î2Çܤ˸ÇÄê */
XDrawMultiString(Metadpy->dpy, Infowin->win, Infoclr->gc,
x, y, str, len,
term t;
infofnt *fnt;
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
infofnt *kfnt;
#endif
*/
static void react_keypress(XKeyEvent *xev)
{
- int i, n, mc, ms, mo;
+ int i, n, mc, ms, mo, mx;
uint ks1;
mc = (ev->state & ControlMask) ? TRUE : FALSE;
ms = (ev->state & ShiftMask) ? TRUE : FALSE;
mo = (ev->state & Mod1Mask) ? TRUE : FALSE;
+ mx = (ev->state & Mod2Mask) ? TRUE : FALSE;
/* Normal keys with no modifiers */
- if (n && !mo && !IsSpecialKey(ks))
+ if (n && !mo && !mx && !IsSpecialKey(ks))
{
/* Enqueue the normal key(s) */
for (i = 0; buf[i]; i++) Term_keypress(buf[i]);
/* Hack -- Use the KeySym */
if (ks)
{
- sprintf(msg, "%c%s%s%s_%lX%c", 31,
+ sprintf(msg, "%c%s%s%s%s_%lX%c", 31,
mc ? "N" : "", ms ? "S" : "",
- mo ? "O" : "",
+ mo ? "O" : "", mx ? "M" : "",
(unsigned long)(ks), 13);
}
/* Hack -- Use the Keycode */
else
{
- sprintf(msg, "%c%s%s%sK_%X%c", 31,
+ sprintf(msg, "%c%s%s%s%sK_%X%c", 31,
mc ? "N" : "", ms ? "S" : "",
- mo ? "O" : "",
+ mo ? "O" : "", mx ? "M" : "",
ev->keycode, 13);
}
if (!sound_file[v]) return (1);
sprintf(buf,"./playwave.sh %s\n", sound_file[v]);
- system(buf);
- return (0);
+ return (system(buf) < 0);
}
#endif /* USE_SOUND */
/* Activate the font */
Infofnt_set(td->fnt);
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
Infokfnt_set(td->kfnt);
#endif
}
cptr name = angband_term_name[i];
cptr font;
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
cptr kfont;
#endif
}
}
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
/* Window specific font name */
sprintf(buf, "ANGBAND_X11_KFONT_%d", i);
/* Prepare the standard font */
-#ifdef _JP
+#ifdef USE_JP_FONTSTRUCT
MAKE(td->fnt, infofnt);
Infofnt_set(td->fnt);
MAKE(td->kfnt, infofnt);
}
#ifdef USE_LOCALE
+
+#ifdef JP
+ /* Get locale information from environment variables */
setlocale(LC_ALL, "");
+
#ifdef DEFAULT_LOCALE
if(!strcmp(setlocale(LC_ALL, NULL), "C")){
printf("try default locale \"%s\"\n", DEFAULT_LOCALE);
setlocale(LC_ALL, DEFAULT_LOCALE);
}
#endif
+
+ if(!strcmp(setlocale(LC_ALL, NULL), "C"))
{
- char *current_locale = setlocale(LC_ALL, NULL);
-/* printf("set locale to \"%s\"\n", current_locale); */
- if(!strcmp(current_locale, "C")){
- printf("WARNING: Locale is not supported. Non-english font may be displayed incorrectly.\n");
- }
+ printf("WARNING: Locale is not supported. Non-english font may be displayed incorrectly.\n");
}
if(!XSupportsLocale()){
printf("can't support locale in X\n");
setlocale(LC_ALL, "C");
}
+#else
+ /* Set locale to "C" without using environment variables */
+ setlocale(LC_ALL, "C");
+#endif /* JP */
+
#endif /* USE_LOCALE */