Call wscons mode hooks before and after generic_wscons_event. This is to

allow the selection mode hide the mouse before the device is closed, thus
fixing a minor problem (the pointer remained visible when returning from
X for some seconds).
This commit is contained in:
jmmv 2004-01-05 12:01:52 +00:00
parent 033feda138
commit d6a1e75dd8
3 changed files with 28 additions and 18 deletions

View File

@ -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 <sys/cdefs.h>
#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 <sys/ioctl.h>
@ -44,6 +44,7 @@ __RCSID("$NetBSD: selection.c,v 1.6 2004/01/05 11:17:14 jmmv Exp $");
#include <ctype.h>
#include <err.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -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;
}

View File

@ -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 <sys/ioctl.h>
@ -50,6 +50,7 @@ __RCSID("$NetBSD: wsmoused.c,v 1.14 2004/01/05 10:56:02 jmmv Exp $");
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
@ -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));

View File

@ -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 <stdbool.h>
#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);
};