diff options
author | nicm <nicm> | 2020-03-31 11:38:35 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-03-31 11:38:35 +0000 |
commit | 01b3bb8e2c695a7a32a332758e5a8f4a650fc98c (patch) | |
tree | 5335bb8548506f5c8fabd3e01959c766a5a6704b /server-client.c | |
parent | 3bbd66c0137fe95c348ce333ea7eec9507db7659 (diff) | |
download | rtmux-01b3bb8e2c695a7a32a332758e5a8f4a650fc98c.tar.gz rtmux-01b3bb8e2c695a7a32a332758e5a8f4a650fc98c.tar.bz2 rtmux-01b3bb8e2c695a7a32a332758e5a8f4a650fc98c.zip |
Add a "second click" key type which is fired for the second click of a
double click, even if the timer hasn't expired to confirm it isn't
actually a triple click. Provides a way for people who don't care about
triple clicks or can make their commands have no side effects to avoid
the double click timer delay.
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 63 |
1 files changed, 55 insertions, 8 deletions
diff --git a/server-client.c b/server-client.c index 75e80c81..aa174d4d 100644 --- a/server-client.c +++ b/server-client.c @@ -440,6 +440,7 @@ server_client_check_mouse(struct client *c, struct key_event *event) UP, DRAG, WHEEL, + SECOND, DOUBLE, TRIPLE } type = NOTYPE; enum { NOWHERE, @@ -493,9 +494,10 @@ server_client_check_mouse(struct client *c, struct key_event *event) evtimer_del(&c->click_timer); c->flags &= ~CLIENT_DOUBLECLICK; if (m->b == c->click_button) { - type = NOTYPE; + type = SECOND; + x = m->x, y = m->y, b = m->b; + log_debug("second-click at %u,%u", x, y); c->flags |= CLIENT_TRIPLECLICK; - goto add_timer; } } else if (c->flags & CLIENT_TRIPLECLICK) { evtimer_del(&c->click_timer); @@ -507,13 +509,12 @@ server_client_check_mouse(struct client *c, struct key_event *event) ignore = 1; goto have_event; } - } else + } else { + type = DOWN; + x = m->x, y = m->y, b = m->b; + log_debug("down at %u,%u", x, y); c->flags |= CLIENT_DOUBLECLICK; - - add_timer: - type = DOWN; - x = m->x, y = m->y, b = m->b; - log_debug("down at %u,%u", x, y); + } if (KEYC_CLICK_TIMEOUT != 0) { memcpy(&c->click_event, m, sizeof c->click_event); @@ -877,6 +878,52 @@ have_event: break; } break; + case SECOND: + switch (MOUSE_BUTTONS(b)) { + case 0: + if (where == PANE) + key = KEYC_SECONDCLICK1_PANE; + if (where == STATUS) + key = KEYC_SECONDCLICK1_STATUS; + if (where == STATUS_LEFT) + key = KEYC_SECONDCLICK1_STATUS_LEFT; + if (where == STATUS_RIGHT) + key = KEYC_SECONDCLICK1_STATUS_RIGHT; + if (where == STATUS_DEFAULT) + key = KEYC_SECONDCLICK1_STATUS_DEFAULT; + if (where == BORDER) + key = KEYC_SECONDCLICK1_BORDER; + break; + case 1: + if (where == PANE) + key = KEYC_SECONDCLICK2_PANE; + if (where == STATUS) + key = KEYC_SECONDCLICK2_STATUS; + if (where == STATUS_LEFT) + key = KEYC_SECONDCLICK2_STATUS_LEFT; + if (where == STATUS_RIGHT) + key = KEYC_SECONDCLICK2_STATUS_RIGHT; + if (where == STATUS_DEFAULT) + key = KEYC_SECONDCLICK2_STATUS_DEFAULT; + if (where == BORDER) + key = KEYC_SECONDCLICK2_BORDER; + break; + case 2: + if (where == PANE) + key = KEYC_SECONDCLICK3_PANE; + if (where == STATUS) + key = KEYC_SECONDCLICK3_STATUS; + if (where == STATUS_LEFT) + key = KEYC_SECONDCLICK3_STATUS_LEFT; + if (where == STATUS_RIGHT) + key = KEYC_SECONDCLICK3_STATUS_RIGHT; + if (where == STATUS_DEFAULT) + key = KEYC_SECONDCLICK3_STATUS_DEFAULT; + if (where == BORDER) + key = KEYC_SECONDCLICK3_BORDER; + break; + } + break; case DOUBLE: switch (MOUSE_BUTTONS(b)) { case 0: |