wsmoused() called if cmd == WSDISPLAYIO_WSMOUSED only,
authorshadchin <shadchin@openbsd.org>
Wed, 14 May 2014 18:11:24 +0000 (18:11 +0000)
committershadchin <shadchin@openbsd.org>
Wed, 14 May 2014 18:11:24 +0000 (18:11 +0000)
don't need check cmd twice.

ok miod@

sys/dev/wscons/wsdisplay.c
sys/dev/wscons/wsmoused.h

index 0b5a582..a936216 100644 (file)
@@ -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;
 }
index 1c6ad81..7f17bee 100644 (file)
@@ -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);