aboutsummaryrefslogtreecommitdiff
path: root/libcons
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-01 11:49:04 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-01 11:49:04 +0100
commit0affb938ada6ae0572695c62df9c64a8109b971d (patch)
tree53733268d39a765042382b57ac6934762cd8f3e1 /libcons
parent03b9f2ca19c55216363e8d049418d0ee59d149f9 (diff)
downloadhurd-0affb938ada6ae0572695c62df9c64a8109b971d.tar.gz
hurd-0affb938ada6ae0572695c62df9c64a8109b971d.tar.bz2
hurd-0affb938ada6ae0572695c62df9c64a8109b971d.zip
libcons: Do not send event to server when out of range
Diffstat (limited to 'libcons')
-rw-r--r--libcons/vcons-move-mouse.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/libcons/vcons-move-mouse.c b/libcons/vcons-move-mouse.c
index 631f2ef5..46849891 100644
--- a/libcons/vcons-move-mouse.c
+++ b/libcons/vcons-move-mouse.c
@@ -84,18 +84,16 @@ cons_vcons_move_mouse (vcons_t vcons, mouse_event_t ev)
case CONS_VCONS_MOUSE_BUTTON_PRESSED:
/* Make an xterm like event string. */
- CONS_MOUSE_EVENT (event, ev->button, (int) mousepos_x + 1, (int) mousepos_y + 1);
-
- _cons_vcons_input (vcons, event, CONS_MOUSE_EVENT_LENGTH);
- /* And send it to the server. */
+ if (CONS_MOUSE_EVENT (event, ev->button, (int) mousepos_x + 1, (int) mousepos_y + 1))
+ /* And send it to the server. */
+ _cons_vcons_input (vcons, event, CONS_MOUSE_EVENT_LENGTH);
break;
case CONS_VCONS_MOUSE_BUTTON_RELEASED:
/* Make an xterm like event string. */
- CONS_MOUSE_EVENT (event, CONS_MOUSE_RELEASE, (int) mousepos_x + 1, (int) mousepos_y + 1);
-
- /* And send it to the server. */
- _cons_vcons_input (vcons, event, CONS_MOUSE_EVENT_LENGTH);
+ if (CONS_MOUSE_EVENT (event, CONS_MOUSE_RELEASE, (int) mousepos_x + 1, (int) mousepos_y + 1))
+ /* And send it to the server. */
+ _cons_vcons_input (vcons, event, CONS_MOUSE_EVENT_LENGTH);
break;
}
}