OSDN Git Service

配列に対して行っている不要なNULLチェックを削除
[hengband/hengband.git] / src / main-x11.c
index 9703fe0..3fccd1c 100644 (file)
@@ -1830,7 +1830,7 @@ static x11_selection_type s_ptr[1];
  */
 static void react_keypress(XKeyEvent *xev)
 {
-       int i, n, mc, ms, mo;
+       int i, n, mc, ms, mo, mx;
 
        uint ks1;
 
@@ -1888,10 +1888,11 @@ static void react_keypress(XKeyEvent *xev)
        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]);
@@ -1938,18 +1939,18 @@ static void react_keypress(XKeyEvent *xev)
        /* 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);
        }
 
@@ -3721,25 +3722,32 @@ errr init_x11(int argc, char *argv[])
        }
 
 #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 */