=== modified file 'driver-csi.c' --- driver-csi.c 2012-11-30 15:23:41 +0000 +++ driver-csi.c 2012-11-30 15:01:20 +0000 @@ -134,25 +134,19 @@ * Handler for CSI u extended Unicode keys */ -static TermKeyResult handle_csi_u(TermKey *tk, TermKeyKey *key, int cmd, long *arg, int args) +static TermKeyResult handle_csi_unicode(TermKey *tk, TermKeyKey *key, int cmd, long *arg, int args) { - switch(cmd) { - case 'u': { - if(args > 1 && arg[1] != -1) - key->modifiers = arg[1] - 1; - else - key->modifiers = 0; - - int mod = key->modifiers; - key->type = TERMKEY_TYPE_KEYSYM; - (*tk->method.emit_codepoint)(tk, arg[0], key); - key->modifiers |= mod; - - return TERMKEY_RES_KEY; - } - default: - return TERMKEY_RES_NONE; - } + if(args > 1 && arg[1] != -1) + key->modifiers = arg[1] - 1; + else + key->modifiers = 0; + + int mod = key->modifiers; + key->type = TERMKEY_TYPE_KEYSYM; + (*tk->method.emit_codepoint)(tk, arg[0], key); + key->modifiers |= mod; + + return TERMKEY_RES_KEY; } /* @@ -160,19 +154,11 @@ * Note: This does not handle X10 encoding */ -static TermKeyResult handle_csi_m(TermKey *tk, TermKeyKey *key, int cmd, long *arg, int args) +static TermKeyResult handle_csi_mouse(TermKey *tk, TermKeyKey *key, int cmd, long *arg, int args) { int initial = cmd >> 8; cmd &= 0xff; - switch(cmd) { - case 'M': - case 'm': - break; - default: - return TERMKEY_RES_NONE; - } - if(!initial && args >= 3) { // rxvt protocol key->type = TERMKEY_TYPE_MOUSE; key->code.mouse[0] = arg[0]; @@ -260,20 +246,15 @@ * Handler for CSI R position reports */ -static TermKeyResult handle_csi_R(TermKey *tk, TermKeyKey *key, int cmd, long *arg, int args) +static TermKeyResult handle_csi_position(TermKey *tk, TermKeyKey *key, int cmd, long *arg, int args) { - switch(cmd) { - case 'R': - if(args < 2) - return TERMKEY_RES_NONE; - - key->type = TERMKEY_TYPE_POSITION; - termkey_key_set_linecol(key, arg[1], arg[0]); - - return TERMKEY_RES_KEY; - default: - return TERMKEY_RES_NONE; - } + if(args < 2) + return TERMKEY_RES_NONE; + + key->type = TERMKEY_TYPE_POSITION; + termkey_key_set_linecol(key, arg[1], arg[0]); + + return TERMKEY_RES_KEY; } TermKeyResult termkey_interpret_position(TermKey *tk, const TermKeyKey *key, int *line, int *col) @@ -444,12 +425,12 @@ register_csifunc(TERMKEY_TYPE_FUNCTION, 19, 33); register_csifunc(TERMKEY_TYPE_FUNCTION, 20, 34); - csi_handlers['u' - 0x40] = &handle_csi_u; - - csi_handlers['M' - 0x40] = &handle_csi_m; - csi_handlers['m' - 0x40] = &handle_csi_m; - - csi_handlers['R' - 0x40] = &handle_csi_R; + csi_handlers['u' - 0x40] = &handle_csi_unicode; + + csi_handlers['M' - 0x40] = &handle_csi_mouse; + csi_handlers['m' - 0x40] = &handle_csi_mouse; + + csi_handlers['R' - 0x40] = &handle_csi_position; keyinfo_initialised = 1; return 1;