mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
The mouse valid flag needs to be correct before we fire the dragging
callback, so move the callback outside of server_client_check_mouse and use a new special key code to indicate it.
This commit is contained in:
parent
84319aa8f0
commit
6f8cedb1bc
@ -474,10 +474,9 @@ have_event:
|
|||||||
case NOTYPE:
|
case NOTYPE:
|
||||||
break;
|
break;
|
||||||
case DRAG:
|
case DRAG:
|
||||||
if (c->tty.mouse_drag_update != NULL) {
|
if (c->tty.mouse_drag_update != NULL)
|
||||||
c->tty.mouse_drag_update(c, m);
|
key = KEYC_DRAGGING;
|
||||||
key = KEYC_MOUSE;
|
else {
|
||||||
} else {
|
|
||||||
switch (MOUSE_BUTTONS(b)) {
|
switch (MOUSE_BUTTONS(b)) {
|
||||||
case 0:
|
case 0:
|
||||||
if (where == PANE)
|
if (where == PANE)
|
||||||
@ -730,6 +729,7 @@ server_client_handle_key(struct client *c, key_code key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for mouse keys. */
|
/* Check for mouse keys. */
|
||||||
|
m->valid = 0;
|
||||||
if (key == KEYC_MOUSE) {
|
if (key == KEYC_MOUSE) {
|
||||||
if (c->flags & CLIENT_READONLY)
|
if (c->flags & CLIENT_READONLY)
|
||||||
return;
|
return;
|
||||||
@ -741,11 +741,13 @@ server_client_handle_key(struct client *c, key_code key)
|
|||||||
m->key = key;
|
m->key = key;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A mouse event that continues to be valid but that we do not
|
* Mouse drag is in progress, so fire the callback (now that
|
||||||
* want to pass through.
|
* the mouse event is valid).
|
||||||
*/
|
*/
|
||||||
if (key == KEYC_MOUSE)
|
if (key == KEYC_DRAGGING) {
|
||||||
|
c->tty.mouse_drag_update(c, m);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
m->valid = 0;
|
m->valid = 0;
|
||||||
|
|
||||||
|
1
tmux.h
1
tmux.h
@ -135,6 +135,7 @@ enum {
|
|||||||
|
|
||||||
/* Mouse keys. */
|
/* Mouse keys. */
|
||||||
KEYC_MOUSE, /* unclassified mouse event */
|
KEYC_MOUSE, /* unclassified mouse event */
|
||||||
|
KEYC_DRAGGING, /* dragging in progress */
|
||||||
KEYC_MOUSE_KEY(MOUSEDOWN1),
|
KEYC_MOUSE_KEY(MOUSEDOWN1),
|
||||||
KEYC_MOUSE_KEY(MOUSEDOWN2),
|
KEYC_MOUSE_KEY(MOUSEDOWN2),
|
||||||
KEYC_MOUSE_KEY(MOUSEDOWN3),
|
KEYC_MOUSE_KEY(MOUSEDOWN3),
|
||||||
|
Loading…
Reference in New Issue
Block a user