]> skyeroc.xyz Git - dgamelaunch/commitdiff
Make sending select-utf8-charset escape code configurable.
authorPasi Kallinen <paxed@alt.org>
Wed, 5 Oct 2011 13:57:32 +0000 (13:57 +0000)
committerPasi Kallinen <paxed@alt.org>
Wed, 5 Oct 2011 13:57:32 +0000 (13:57 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@611 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

config.l
config.y
dgamelaunch.c
dgamelaunch.h
dgl-common.c
examples/dgamelaunch.conf

index 0779001443c625e5b012fe41b9353d20240d586a..358b3c60956f5f57e3f7a037e8c9ce357f62cabe 100644 (file)
--- a/config.l
+++ b/config.l
@@ -94,6 +94,7 @@ commands      { return TYPE_CMDQUEUE; }
 postcommands   { return TYPE_POSTCMDQUEUE; }
 encoding       { return TYPE_ENCODING; }
 locale         { return TYPE_LOCALE; }
+utf8esc                { return TYPE_UTF8ESC; }
 yes            { yylval.i = 1; return TYPE_BOOL; }
 no             { yylval.i = 0; return TYPE_BOOL; }
 dglstart       { yylval.i = DGLTIME_DGLSTART; return TYPE_CMDQUEUENAME; }
index 436bf67d49bc19398a08e7e25e349b2de79d2aab..a81d5dc2eac3b49e655a61fde7b0c7f3ff692906 100644 (file)
--- a/config.y
+++ b/config.y
@@ -59,7 +59,7 @@ static int sortmode_number(const char *sortmode_name) {
 %token TYPE_CMDQUEUE TYPE_DEFINE_MENU TYPE_BANNER_FILE TYPE_CURSOR
 %token TYPE_POSTCMDQUEUE
 %token TYPE_MAX_IDLE_TIME TYPE_MENU_MAX_IDLE_TIME TYPE_EXTRA_INFO_FILE
-%token TYPE_ENCODING TYPE_LOCALE
+%token TYPE_ENCODING TYPE_LOCALE TYPE_UTF8ESC
 %token <s> TYPE_VALUE
 %token <i> TYPE_NUMBER TYPE_CMDQUEUENAME
 %type  <kt> KeyType
@@ -226,6 +226,9 @@ KeyPair: TYPE_CMDQUEUE '[' TYPE_CMDQUEUENAME ']'
            case TYPE_ALLOW_REGISTRATION:
                globalconfig.allow_registration = $<i>3;
                break;
+           case TYPE_UTF8ESC:
+               globalconfig.utf8esc = $<i>3;
+               break;
            default:
                fprintf(stderr, "%s:%d: token %s does not take a boolean, bailing out\n",
                        config, line, lookup_token($1)); 
@@ -628,6 +631,7 @@ KeyType : TYPE_SUSER        { $$ = TYPE_SUSER; }
        | TYPE_PATH_INPROGRESS  { $$ = TYPE_PATH_INPROGRESS; }
        | TYPE_ENCODING         { $$ = TYPE_ENCODING; }
        | TYPE_LOCALE           { $$ = TYPE_LOCALE; }
+       | TYPE_UTF8ESC          { $$ = TYPE_UTF8ESC; }
        | TYPE_RC_FMT           { $$ = TYPE_RC_FMT; }
        | TYPE_WATCH_SORTMODE   { $$ = TYPE_WATCH_SORTMODE; }
        | TYPE_SERVER_ID        { $$ = TYPE_SERVER_ID; }
@@ -664,6 +668,7 @@ const char* lookup_token (int t)
     case TYPE_WATCH_COLUMNS: return "watch_columns";
     case TYPE_SERVER_ID: return "server_id";
     case TYPE_LOCALE: return "locale";
+    case TYPE_UTF8ESC: return "utf8esc";
     default: abort();
   }
 }
index 10c5cee1fe446eb41ae287660a366c9908670d8a..623754f2642b6d52f791ac545a9f2f8a9212572b 100644 (file)
@@ -1061,7 +1061,7 @@ inprogressmenu (int gameid)
            break;
 
        case 12: case 18: /* ^L, ^R */
-         write(1, "\033%G", 3);
+         if (globalconfig.utf8esc) write(1, "\033%G", 3);
          clear ();
          break;
 
@@ -1099,7 +1099,7 @@ watchgame:
               clear ();
               refresh ();
               endwin ();
-              write(1, "\033%G", 3);
+             if (globalconfig.utf8esc) write(1, "\033%G", 3);
 #ifdef USE_SHMEM
              signals_block();
              if (games[idx]->is_in_shm) {
@@ -1610,7 +1610,7 @@ initcurses ()
   use_default_colors();
   init_pair(1, -1, -1);
   init_pair(2, COLOR_RED, -1);
-  write(1, "\033%G", 3);
+  if (globalconfig.utf8esc) write(1, "\033%G", 3);
 #endif
   clear();
   refresh();
@@ -2457,7 +2457,7 @@ runmenuloop(struct dg_menu *menu)
        term_resize_check();
        if (doclear) {
            doclear = 0;
-           write(1, "\033%G", 3);
+           if (globalconfig.utf8esc) write(1, "\033%G", 3);
            clear();
        }
        drawbanner(&ban, 1, 0);
index 7f7daec52c30b27089b592469a71fef0f063d4ac..23a54f51146506ef7607c97958cca791b2219df3 100644 (file)
@@ -226,6 +226,7 @@ struct dg_globalconfig
     int sortmode; /* default watching-screen sortmode */
     char *server_id; /* string for the server name or whatever */
     char *locale;
+    int utf8esc; /* send select-utf8-charset escape code */
 
     struct dg_cmdpart *cmdqueue[NUM_DGLTIMES];
 
index a3c7e4265ed07440315a17588724f2ca09ffd6a0..0b197f6203dc747cc29c285adb8f793a724f2ecc 100644 (file)
@@ -744,6 +744,7 @@ create_config ()
   globalconfig.shed_gid = (gid_t)-1;
 
   globalconfig.sortmode = SORTMODE_USERNAME;
+  globalconfig.utf8esc = 0;
 
   if (config)
   {
index bd9868307b7922f233ca348463a3534e6a543c2d..374502c46de4dd560db855572ea970a006786ac0 100644 (file)
@@ -77,6 +77,10 @@ shed_gid = 60
 # Locale. Leaving this out, dgamelaunch will not explicitly set locale.
 locale = "en_US.UTF-8"
 
+# Should dgl send select-UTF8-charset escape code? (that is: ESC % G)
+# default is no.
+#utf8esc = yes
+
 # Maximum time in seconds user can idle in the dgamelaunch menus
 # before dgl exits. Default value is 0, which disables the idling timer.
 # Does not apply to external programs or config editors.