From 8f329a9b3c1f733b58ac08f4ef10dcb3e0188d31 Mon Sep 17 00:00:00 2001 From: witekfl Date: Tue, 28 Feb 2006 22:56:27 +0100 Subject: [PATCH] sysmouse: Selection works after toggle mouse --- src/osdep/unix/bsd.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/osdep/unix/bsd.c b/src/osdep/unix/bsd.c index 2259d4ab..42ff9bf8 100644 --- a/src/osdep/unix/bsd.c +++ b/src/osdep/unix/bsd.c @@ -5,7 +5,6 @@ #endif #include "osdep/system.h" -#include #ifdef CONFIG_SYSMOUSE #ifdef HAVE_SYS_CONSIO_H @@ -199,26 +198,43 @@ handle_mouse(int cons, void (*fn)(void *, unsigned char *, int), } else { return NULL; } - } void unhandle_mouse(void *data) { - if (data) install_signal_handler(SIGUSR2, NULL, NULL, 0); + if (data) { + mouse_info_t mi; + int fd = get_output_handle(); + + mi.operation = MOUSE_MODE; + mi.u.mode.mode = 0; + mi.u.mode.signal = 0; + install_signal_handler(SIGUSR2, NULL, NULL, 0); + ioctl(fd, CONS_MOUSECTL, &mi); + } } void suspend_mouse(void *data) { - if (data) install_signal_handler(SIGUSR2, NULL, NULL, 0); + unhandle_mouse(data); } void resume_mouse(void *data) { - if (data) install_signal_handler(SIGUSR2, + if (data) { + mouse_info_t mi; + int fd = get_output_handle(); + + mi.operation = MOUSE_MODE; + mi.u.mode.mode = 0; + mi.u.mode.signal = SIGUSR2;; + install_signal_handler(SIGUSR2, (void (*)(void *))sysmouse_signal_handler, data, 0); + ioctl(fd, CONS_MOUSECTL, &mi); + } } #endif