Add config option "flowcontrol" to disable XON/XOFF.

This commit is contained in:
Pasi Kallinen 2012-12-18 18:34:06 +02:00
parent d30dbda897
commit 768cddff32
6 changed files with 19 additions and 0 deletions

View File

@ -97,6 +97,7 @@ encoding { return TYPE_ENCODING; }
locale { return TYPE_LOCALE; }
default_term { return TYPE_DEFTERM; }
utf8esc { return TYPE_UTF8ESC; }
flowcontrol { return TYPE_FLOWCTRL; }
filemode { return TYPE_FILEMODE; }
yes { yylval.i = 1; return TYPE_BOOL; }
no { yylval.i = 0; return TYPE_BOOL; }

View File

@ -60,6 +60,7 @@ static int sortmode_number(const char *sortmode_name) {
%token TYPE_POSTCMDQUEUE TYPE_TIMEFORMAT
%token TYPE_MAX_IDLE_TIME TYPE_MENU_MAX_IDLE_TIME TYPE_EXTRA_INFO_FILE
%token TYPE_ENCODING TYPE_LOCALE TYPE_UTF8ESC TYPE_FILEMODE TYPE_DEFTERM
%token TYPE_FLOWCTRL
%token <s> TYPE_VALUE
%token <i> TYPE_NUMBER TYPE_CMDQUEUENAME
%type <kt> KeyType
@ -233,6 +234,9 @@ KeyPair: TYPE_CMDQUEUE '[' TYPE_CMDQUEUENAME ']'
case TYPE_UTF8ESC:
globalconfig.utf8esc = $<i>3;
break;
case TYPE_FLOWCTRL:
globalconfig.flowctrl = $<i>3;
break;
default:
fprintf(stderr, "%s:%d: token %s does not take a boolean, bailing out\n",
config, line, lookup_token($1));
@ -652,6 +656,7 @@ KeyType : TYPE_SUSER { $$ = TYPE_SUSER; }
| TYPE_LOCALE { $$ = TYPE_LOCALE; }
| TYPE_DEFTERM { $$ = TYPE_DEFTERM; }
| TYPE_UTF8ESC { $$ = TYPE_UTF8ESC; }
| TYPE_FLOWCTRL { $$ = TYPE_FLOWCTRL; }
| TYPE_RC_FMT { $$ = TYPE_RC_FMT; }
| TYPE_WATCH_SORTMODE { $$ = TYPE_WATCH_SORTMODE; }
| TYPE_FILEMODE { $$ = TYPE_FILEMODE; }
@ -690,6 +695,7 @@ const char* lookup_token (int t)
case TYPE_LOCALE: return "locale";
case TYPE_DEFTERM: return "default_term";
case TYPE_UTF8ESC: return "utf8esc";
case TYPE_FLOWCTRL: return "flowcontrol";
case TYPE_FILEMODE: return "filemode";
default: abort();
}

View File

@ -2791,6 +2791,12 @@ main (int argc, char** argv)
signal (SIGTERM, catch_sighup);
(void) tcgetattr (0, &tt);
if (!globalconfig.flowctrl) {
tt.c_iflag &= ~(IXON | IXOFF | IXANY); /* Disable XON/XOFF */
(void) tcsetattr(0, TCSANOW, &tt);
}
if (-1 == ioctl (0, TIOCGWINSZ, (char *) &win) || win.ws_row < 4 ||
win.ws_col < 4) /* Rudimentary validity check */
{

View File

@ -240,6 +240,7 @@ struct dg_globalconfig
char *locale;
int utf8esc; /* send select-utf8-charset escape code */
char *defterm; /* default TERM in case user TERM is unknown */
int flowctrl; /* XON/XOFF for games? */
struct dg_cmdpart *cmdqueue[NUM_DGLTIMES];

View File

@ -774,6 +774,7 @@ create_config ()
globalconfig.sortmode = SORTMODE_USERNAME;
globalconfig.utf8esc = 0;
globalconfig.flowctrl = -1; /* undefined, don't touch it */
if (config)
{

View File

@ -94,6 +94,10 @@ default_term = "xterm"
# default is no.
#utf8esc = yes
# Should dgl allow XON/XOFF? Default is "yes", meaning "don't touch it".
# "no" disables XON/XOFF
#flowcontrol = no
# 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.