From 0affb938ada6ae0572695c62df9c64a8109b971d Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 1 Jan 2023 11:49:04 +0100 Subject: libcons: Do not send event to server when out of range --- libcons/vcons-move-mouse.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'libcons/vcons-move-mouse.c') 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; } } -- cgit v1.2.3