-/* $OpenBSD: wsmouse.c,v 1.33 2016/07/13 15:41:51 deraadt Exp $ */
+/* $OpenBSD: wsmouse.c,v 1.34 2016/08/18 21:12:35 bru Exp $ */
/* $NetBSD: wsmouse.c,v 1.35 2005/02/27 00:27:52 perry Exp $ */
/*
{
sc->sc_base.me_evp = evp;
+ wsmouse_input_reset(&sc->input);
+
/* enable the device, and punt if that's not possible */
return (*sc->sc_accessops->enable)(sc->sc_accesscookie);
}
&((struct wsmouse_softc *) sc)->input;
int n, size;
+ if (num_slots == input->mt.num_slots
+ && (!tracking == ((input->flags & MT_TRACKING) == 0)))
+ return (0);
+
free_mt_slots(input);
- memset(&input->mt, 0, sizeof(struct mt_state));
if (tracking)
input->flags |= MT_TRACKING;
return (-1);
}
+void
+wsmouse_input_reset(struct wsmouseinput *input)
+{
+ int num_slots, *matrix;
+ struct mt_slot *slots;
+
+ memset(&input->btn, 0, sizeof(struct btn_state));
+ memset(&input->motion, 0, sizeof(struct motion_state));
+ memset(&input->touch, 0, sizeof(struct touch_state));
+ input->touch.min_pressure = input->params.pressure_hi;
+ if ((num_slots = input->mt.num_slots)) {
+ slots = input->mt.slots;
+ matrix = input->mt.matrix;
+ memset(&input->mt, 0, sizeof(struct mt_state));
+ memset(slots, 0, num_slots * sizeof(struct mt_slot));
+ input->mt.num_slots = num_slots;
+ input->mt.slots = slots;
+ input->mt.matrix = matrix;
+ }
+}
+
void
wsmouse_input_init(struct wsmouseinput *input, struct wseventvar **evar)
{
-/* $OpenBSD: wsmouseinput.h,v 1.1 2016/03/30 23:34:12 bru Exp $ */
+/* $OpenBSD: wsmouseinput.h,v 1.2 2016/08/18 21:12:35 bru Exp $ */
/*
* Copyright (c) 2015, 2016 Ulf Brosziewski
void wsmouse_evq_put(struct evq_access *, int, int);
void wsmouse_init_scaling(struct wsmouseinput *);
+void wsmouse_input_reset(struct wsmouseinput *);
void wsmouse_input_init(struct wsmouseinput *, struct wseventvar **);
void wsmouse_input_cleanup(struct wsmouseinput *);