From 5c7071e6c1911e2fcd8548142364ad5e0cd7a84a Mon Sep 17 00:00:00 2001 From: shadchin Date: Wed, 14 May 2014 18:11:24 +0000 Subject: [PATCH] wsmoused() called if cmd == WSDISPLAYIO_WSMOUSED only, don't need check cmd twice. ok miod@ --- sys/dev/wscons/wsdisplay.c | 53 ++++++++++++++++++-------------------- sys/dev/wscons/wsmoused.h | 4 +-- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 0b5a5824f1a..a9362169a54 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.117 2013/11/04 05:45:04 miod Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.118 2014/05/14 18:11:24 shadchin Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -1319,7 +1319,7 @@ wsdisplay_cfg_ioctl(struct wsdisplay_softc *sc, u_long cmd, caddr_t data, switch (cmd) { #ifdef HAVE_WSMOUSED_SUPPORT case WSDISPLAYIO_WSMOUSED: - error = wsmoused(sc, cmd, data, flag, p); + error = wsmoused(sc, data, flag, p); return (error); #endif case WSDISPLAYIO_ADDSCREEN: @@ -2381,36 +2381,33 @@ wsdisplay_burner(void *v) * Main function, called from wsdisplay_cfg_ioctl. */ int -wsmoused(struct wsdisplay_softc *sc, u_long cmd, caddr_t data, - int flag, struct proc *p) +wsmoused(struct wsdisplay_softc *sc, caddr_t data, int flag, struct proc *p) { struct wscons_event mouse_event = *(struct wscons_event *)data; - if (cmd == WSDISPLAYIO_WSMOUSED) { - if (IS_MOTION_EVENT(mouse_event.type)) { - if (sc->sc_focus != NULL) - motion_event(sc->sc_focus, mouse_event.type, - mouse_event.value); - return 0; - } - if (IS_BUTTON_EVENT(mouse_event.type)) { - if (sc->sc_focus != NULL) { - /* XXX tv_sec contains the number of clicks */ - if (mouse_event.type == - WSCONS_EVENT_MOUSE_DOWN) { - button_event(sc->sc_focus, - mouse_event.value, - mouse_event.time.tv_sec); - } else - button_event(sc->sc_focus, - mouse_event.value, 0); - } - return (0); - } - if (IS_CTRL_EVENT(mouse_event.type)) { - return ctrl_event(sc, mouse_event.type, - mouse_event.value, p); + if (IS_MOTION_EVENT(mouse_event.type)) { + if (sc->sc_focus != NULL) + motion_event(sc->sc_focus, mouse_event.type, + mouse_event.value); + return 0; + } + if (IS_BUTTON_EVENT(mouse_event.type)) { + if (sc->sc_focus != NULL) { + /* XXX tv_sec contains the number of clicks */ + if (mouse_event.type == + WSCONS_EVENT_MOUSE_DOWN) { + button_event(sc->sc_focus, + mouse_event.value, + mouse_event.time.tv_sec); + } else + button_event(sc->sc_focus, + mouse_event.value, 0); } + return (0); + } + if (IS_CTRL_EVENT(mouse_event.type)) { + return ctrl_event(sc, mouse_event.type, + mouse_event.value, p); } return -1; } diff --git a/sys/dev/wscons/wsmoused.h b/sys/dev/wscons/wsmoused.h index 1c6ad81ec61..7f17beeddbc 100644 --- a/sys/dev/wscons/wsmoused.h +++ b/sys/dev/wscons/wsmoused.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmoused.h,v 1.8 2009/05/31 17:02:20 miod Exp $ */ +/* $OpenBSD: wsmoused.h,v 1.9 2014/05/14 18:11:24 shadchin Exp $ */ /* * Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon @@ -35,7 +35,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -int wsmoused(struct wsdisplay_softc *, u_long, caddr_t, int, struct proc *); +int wsmoused(struct wsdisplay_softc *, caddr_t, int, struct proc *); void motion_event(struct wsscreen *, u_int, int); void button_event(struct wsscreen *, int, int); -- 2.20.1