diff --git a/usr.sbin/wsmoused/selection.c b/usr.sbin/wsmoused/selection.c index b9dd4633270c..1161b7d5a028 100644 --- a/usr.sbin/wsmoused/selection.c +++ b/usr.sbin/wsmoused/selection.c @@ -1,4 +1,4 @@ -/* $NetBSD: selection.c,v 1.6 2004/01/05 11:17:14 jmmv Exp $ */ +/* $NetBSD: selection.c,v 1.7 2004/01/05 12:01:52 jmmv Exp $ */ /* * Copyright (c) 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: selection.c,v 1.6 2004/01/05 11:17:14 jmmv Exp $"); +__RCSID("$NetBSD: selection.c,v 1.7 2004/01/05 12:01:52 jmmv Exp $"); #endif /* not lint */ #include @@ -44,6 +44,7 @@ __RCSID("$NetBSD: selection.c,v 1.6 2004/01/05 11:17:14 jmmv Exp $"); #include #include #include +#include #include #include #include @@ -61,7 +62,7 @@ __RCSID("$NetBSD: selection.c,v 1.6 2004/01/05 11:17:14 jmmv Exp $"); int selection_startup(struct mouse *m); int selection_cleanup(void); void selection_wsmouse_event(struct wscons_event); -void selection_wscons_event(struct wscons_event); +void selection_wscons_event(struct wscons_event, bool); void selection_poll_timeout(void); struct mode_bootstrap Selection_Mode = { @@ -309,21 +310,23 @@ selection_wsmouse_event(struct wscons_event evt) /* Parse wscons status events. */ void -selection_wscons_event(struct wscons_event evt) +selection_wscons_event(struct wscons_event evt, bool preclose) { switch (evt.type) { case WSCONS_EVENT_SCREEN_SWITCH: - if (Selmouse.sm_selecting) - selarea_hide(); - cursor_hide(); + if (preclose) { + if (Selmouse.sm_selecting) + selarea_hide(); + cursor_hide(); + } else { + if (!Selmouse.sm_mouse->m_disabled) + open_tty(evt.value); - if (!Selmouse.sm_mouse->m_disabled) - open_tty(evt.value); - - cursor_show(); - if (Selmouse.sm_selecting) - selarea_show(); + cursor_show(); + if (Selmouse.sm_selecting) + selarea_show(); + } break; } diff --git a/usr.sbin/wsmoused/wsmoused.c b/usr.sbin/wsmoused/wsmoused.c index b5c4c47ba0de..d5a549c5fd60 100644 --- a/usr.sbin/wsmoused/wsmoused.c +++ b/usr.sbin/wsmoused/wsmoused.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsmoused.c,v 1.14 2004/01/05 10:56:02 jmmv Exp $ */ +/* $NetBSD: wsmoused.c,v 1.15 2004/01/05 12:01:52 jmmv Exp $ */ /* * Copyright (c) 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 2002, 2003\n" "The NetBSD Foundation, Inc. All rights reserved.\n"); -__RCSID("$NetBSD: wsmoused.c,v 1.14 2004/01/05 10:56:02 jmmv Exp $"); +__RCSID("$NetBSD: wsmoused.c,v 1.15 2004/01/05 12:01:52 jmmv Exp $"); #endif /* not lint */ #include @@ -50,6 +50,7 @@ __RCSID("$NetBSD: wsmoused.c,v 1.14 2004/01/05 10:56:02 jmmv Exp $"); #include #include #include +#include #include #include #include @@ -291,11 +292,15 @@ event_loop(void) if (res != sizeof(event)) log_warn("failed to read from mouse stat"); + for (i = 0; i < MAX_MODES && Modes[i] != NULL; i++) + if (Modes[i]->mb_wscons_event != NULL) + Modes[i]->mb_wscons_event(event, true); + generic_wscons_event(event); for (i = 0; i < MAX_MODES && Modes[i] != NULL; i++) if (Modes[i]->mb_wscons_event != NULL) - Modes[i]->mb_wscons_event(event); + Modes[i]->mb_wscons_event(event, false); } else if (fds[1].revents & POLLIN) { res = read(Mouse.m_devfd, &event, sizeof(event)); diff --git a/usr.sbin/wsmoused/wsmoused.h b/usr.sbin/wsmoused/wsmoused.h index dc7c624e20f1..bc43b94c17d9 100644 --- a/usr.sbin/wsmoused/wsmoused.h +++ b/usr.sbin/wsmoused/wsmoused.h @@ -1,4 +1,4 @@ -/* $NetBSD: wsmoused.h,v 1.5 2003/08/06 23:58:40 jmmv Exp $ */ +/* $NetBSD: wsmoused.h,v 1.6 2004/01/05 12:01:52 jmmv Exp $ */ /* * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -32,6 +32,8 @@ #ifndef _WSMOUSED_WSMOUSED_H #define _WSMOUSED_WSMOUSED_H +#include + #define IS_MOTION_EVENT(type) (((type) == WSCONS_EVENT_MOUSE_DELTA_X) || \ ((type) == WSCONS_EVENT_MOUSE_DELTA_Y) || \ ((type) == WSCONS_EVENT_MOUSE_DELTA_Z)) @@ -52,7 +54,7 @@ struct mode_bootstrap { int (*mb_startup)(struct mouse *); int (*mb_cleanup)(void); void (*mb_wsmouse_event)(struct wscons_event); - void (*mb_wscons_event)(struct wscons_event); + void (*mb_wscons_event)(struct wscons_event, bool); void (*mb_poll_timeout)(void); };