path: root/input
diff options
authorwm4 <wm4@nowhere>2014-04-18 16:37:27 +0200
committerwm4 <wm4@nowhere>2014-04-18 16:37:27 +0200
commitecb4c08ee2f0f87cc2a3afce1435ea84956936f0 (patch)
treebc55c14eb95acc2179100e825a6deac9976fa89d /input
parent3b12d0add912ffc1e2f79e5292b5d2d732d07c9c (diff)
input: close window when window close button is pressed with --input-test
The window close button is usually mapped to the CLOSE_WIN pseudo-key. Until now, --input-test treated this pseudo-key like any other key (like the rest of the input handling code), so you couldn't close the window in this mode. The manpage had silly instructions and warnings how to deal with this. Just always quit when CLOSE_WIN is received, and improve the instructions.
Diffstat (limited to 'input')
1 files changed, 9 insertions, 0 deletions
diff --git a/input/input.c b/input/input.c
index 39644fd723..0d8118d8fe 100644
--- a/input/input.c
+++ b/input/input.c
@@ -311,6 +311,15 @@ static void append_bind_info(struct input_ctx *ictx, char **pmsg,
static mp_cmd_t *handle_test(struct input_ctx *ictx, int code)
+ if (code == MP_KEY_CLOSE_WIN) {
+ MP_WARN(ictx,
+ "CLOSE_WIN was received. This pseudo key can be remapped too,\n"
+ "but --input-test will always quit when receiving it.\n");
+ const char *args[] = {"quit", NULL};
+ mp_cmd_t *res = mp_input_parse_cmd_strv(ictx->log, 0, args, "");
+ return res;
+ }
char *key_buf = mp_input_get_key_combo_name(&code, 1);
char *msg = talloc_asprintf(NULL, "Key %s is bound to:\n", key_buf);