Re: [PATCH libinput] touchpad: add a quirk for the HP Pavilion dm4

2016-11-28 Thread Peter Hutterer
On Mon, Nov 28, 2016 at 03:33:25PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 27-11-16 23:55, Peter Hutterer wrote:
> > This touchpad has cursor jumps for 2-finger scrolling that also affects the
> > single-finger emulation. So disable any multitouch bits on this device and
> > disallow the 2-finger scroll method. This still allows for 2-finger
> > tapping/clicking.
> > 
> > https://bugs.freedesktop.org/show_bug.cgi?id=91135
> > 
> > Signed-off-by: Peter Hutterer 
> 
> This sounds a lot like what we're doing for semi-mt devices,
> but then with completely different code-paths. AFAICT we still
> allow BTN_TOOL_DOUBLETAP, etc. for semi-mt, so why not use
> the same method.
> 
> To be specific I'm talking about the "if (tp->semi_mt) { ... }"
> block with the large comment above it in tp_init_slots(), to me
> it sounds like you want to change that to:
> 
>   if (tp->semi_mit ||
>   (tp->device->model_flags & EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD)) {
>   ...
>   }
> 
> Rather then come up with a second approach to only listen to the
> non-mt coordinates.

right, with the semi-mt we do a similar-ish thing but we still allow
two-finger scrolling based on the single position + BTN_TOOL_DOUBLETAP. In
this case the touchpad data is garbage as soon as two fingers are down, even
the single-touch emulation is useless. So it's not quite the same category
as semi-mts which can still be ok for 2fg scrolling. And since it's garbage
anyway, we might as well disable all MT axes.

Cheers,
   Peter
> 
> > ---
> >  src/evdev-mt-touchpad.c|  6 ++
> >  src/evdev.c| 12 
> >  src/evdev.h|  1 +
> >  udev/90-libinput-model-quirks.hwdb |  4 
> >  4 files changed, 23 insertions(+)
> > 
> > diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> > index d72cb19..beb19cd 100644
> > --- a/src/evdev-mt-touchpad.c
> > +++ b/src/evdev-mt-touchpad.c
> > @@ -1909,6 +1909,12 @@ tp_scroll_get_methods(struct tp_dispatch *tp)
> >  {
> > uint32_t methods = LIBINPUT_CONFIG_SCROLL_EDGE;
> > 
> > +   /* Any movement with more than one finger has random cursor
> > +* jumps. Don't allow for 2fg scrolling on this device, see
> > +* fdo bug 91135 */
> > +   if (tp->device->model_flags & EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD)
> > +   return LIBINPUT_CONFIG_SCROLL_EDGE;
> > +
> > if (tp->ntouches >= 2)
> > methods |= LIBINPUT_CONFIG_SCROLL_2FG;
> > 
> > diff --git a/src/evdev.c b/src/evdev.c
> > index fac8fcb..eb4c0d0 100644
> > --- a/src/evdev.c
> > +++ b/src/evdev.c
> > @@ -2179,6 +2179,7 @@ evdev_read_model_flags(struct evdev_device *device)
> > MODEL(APPLE_MAGICMOUSE),
> > MODEL(HP8510_TOUCHPAD),
> > MODEL(HP6910_TOUCHPAD),
> > +   MODEL(HP_PAVILION_DM4_TOUCHPAD),
> >  #undef MODEL
> > { "ID_INPUT_TRACKBALL", EVDEV_MODEL_TRACKBALL },
> > { NULL, EVDEV_MODEL_DEFAULT },
> > @@ -2762,6 +2763,17 @@ evdev_pre_configure_model_quirks(struct evdev_device 
> > *device)
> > if (device->model_flags & EVDEV_MODEL_HP_STREAM11_TOUCHPAD)
> > libevdev_enable_property(device->evdev,
> >  INPUT_PROP_BUTTONPAD);
> > +
> > +   /* Touchpad has random jumps in slots, including for single-finger
> > +* movement. See fdo bug 91135 */
> > +   if (device->model_flags & EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD) {
> > +   unsigned int code;
> > +
> > +   for (code = ABS_MT_SLOT; code <= ABS_MT_TRACKING_ID; code++)
> > +   libevdev_disable_event_code(device->evdev,
> > +   EV_ABS,
> > +   code);
> > +   }
> >  }
> > 
> >  struct evdev_device *
> > diff --git a/src/evdev.h b/src/evdev.h
> > index b811f51..9689051 100644
> > --- a/src/evdev.h
> > +++ b/src/evdev.h
> > @@ -121,6 +121,7 @@ enum evdev_device_model {
> > EVDEV_MODEL_APPLE_MAGICMOUSE = (1 << 20),
> > EVDEV_MODEL_HP8510_TOUCHPAD = (1 << 21),
> > EVDEV_MODEL_HP6910_TOUCHPAD = (1 << 22),
> > +   EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD = (1 << 23),
> >  };
> > 
> >  struct mt_slot {
> > diff --git a/udev/90-libinput-model-quirks.hwdb 
> > b/udev/90-libinput-model-quirks.hwdb
> > index 4bfc0f9..d5b1d78 100644
> > --- a/udev/90-libinput-model-quirks.hwdb
> > +++ b/udev/90-libinput-model-quirks.hwdb
> > @@ -99,6 +99,10 @@ libinput:name:SynPS/2 Synaptics 
> > TouchPad:dmi:*svnHewlett-Packard:*pnHPCompaq6910
> >  libinput:name:SynPS/2 Synaptics 
> > TouchPad:dmi:*svnHewlett-Packard:*pnHPCompaq8510w*
> >   LIBINPUT_MODEL_HP8510_TOUCHPAD=1
> > 
> > +# HP Pavillion dm4
> > +libinput:name:SynPS/2 Synaptics 
> > TouchPad:dmi:*svnHewlett-Packard:*pnHPPaviliondm4NotebookPC*
> > + LIBINPUT_MODEL_HP_PAVILION_DM4_TOUCHPAD=1
> > +
> >  # HP Stream 11
> >  libinput:name:SYN1EDE:00 
> > 06CB:7442:dmi:*svnHewlett-Packard:pnHPStreamNotebookPC11*
> >   LI

[PATCH libinput 4/4] test: add wheel tilt tests

2016-11-28 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 test/Makefile.am  |  1 +
 test/litest-device-mouse-wheel-tilt.c | 76 +++
 test/litest.c |  2 +
 test/litest.h |  1 +
 test/pointer.c| 34 ++--
 5 files changed, 111 insertions(+), 3 deletions(-)
 create mode 100644 test/litest-device-mouse-wheel-tilt.c

diff --git a/test/Makefile.am b/test/Makefile.am
index 5c25b58..ac74b3b 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -33,6 +33,7 @@ liblitest_la_SOURCES = \
litest-device-nexus4-touch-screen.c \
litest-device-magic-trackpad.c \
litest-device-mouse.c \
+   litest-device-mouse-wheel-tilt.c \
litest-device-mouse-roccat.c \
litest-device-mouse-low-dpi.c \
litest-device-mouse-wheel-click-angle.c \
diff --git a/test/litest-device-mouse-wheel-tilt.c 
b/test/litest-device-mouse-wheel-tilt.c
new file mode 100644
index 000..44eefb2
--- /dev/null
+++ b/test/litest-device-mouse-wheel-tilt.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright © 2016 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "litest.h"
+#include "litest-int.h"
+
+static void litest_mouse_setup(void)
+{
+   struct litest_device *d = litest_create_device(LITEST_MOUSE_WHEEL_TILT);
+   litest_set_current_device(d);
+}
+
+static struct input_id input_id = {
+   .bustype = 0x3,
+   .vendor = 0x17ef,
+   .product = 0x6019,
+};
+
+static int events[] = {
+   EV_KEY, BTN_LEFT,
+   EV_KEY, BTN_RIGHT,
+   EV_KEY, BTN_MIDDLE,
+   EV_REL, REL_X,
+   EV_REL, REL_Y,
+   EV_REL, REL_WHEEL,
+   EV_REL, REL_HWHEEL,
+   -1 , -1,
+};
+
+static const char udev_rule[] =
+"ACTION==\"remove\", GOTO=\"wheel_wheel_tilt_end\"\n"
+"KERNEL!=\"event*\", GOTO=\"wheel_wheel_tilt_end\"\n"
+"\n"
+"ATTRS{name}==\"litest Wheel Tilt Mouse*\",\\\n"
+"ENV{MOUSE_WHEEL_TILT_HORIZONTAL}=\"1\",\n"
+"ENV{MOUSE_WHEEL_TILT_VERTICAL}=\"1\"\n"
+"\n"
+"LABEL=\"wheel_wheel_tilt_end\"";
+
+struct litest_test_device litest_mouse_wheel_tilt_device = {
+   .type = LITEST_MOUSE_WHEEL_TILT,
+   .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL,
+   .shortname = "mouse-wheel-tilt",
+   .setup = litest_mouse_setup,
+   .interface = NULL,
+
+   .name = "Wheel Tilt Mouse",
+   .id = &input_id,
+   .absinfo = NULL,
+   .events = events,
+   .udev_rule = udev_rule,
+};
diff --git a/test/litest.c b/test/litest.c
index 148dd86..d93ce95 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -406,6 +406,7 @@ extern struct litest_test_device 
litest_wacom_cintiq_13hdt_pad_device;
 extern struct litest_test_device litest_wacom_hid4800_tablet_device;
 extern struct litest_test_device litest_mouse_wheel_click_count_device;
 extern struct litest_test_device litest_calibrated_touchscreen_device;
+extern struct litest_test_device litest_mouse_wheel_tilt_device;
 
 struct litest_test_device* devices[] = {
&litest_synaptics_clickpad_device,
@@ -464,6 +465,7 @@ struct litest_test_device* devices[] = {
&litest_wacom_hid4800_tablet_device,
&litest_mouse_wheel_click_count_device,
&litest_calibrated_touchscreen_device,
+   &litest_mouse_wheel_tilt_device,
NULL,
 };
 
diff --git a/test/litest.h b/test/litest.h
index 7728c02..e5d1adb 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -226,6 +226,7 @@ enum litest_device_type {
LITEST_WACOM_HID4800_PEN,
LITEST_MOUSE_WHEEL_CLICK_COUNT,
LITEST_CALIBRATED_TOUCHSCREEN,
+   LITEST_MOUSE_WHEEL_TILT,
 };
 
 enum litest_device_feature {
diff --git a/test/pointer.c b/test/pointer.c
index 4f33de5..e40df33 100644
--- a/test/pointer.c
+++ b/test/pointer.c
@@ -531,6 +531,33 @@ out:
return angle;
 }
 
+static

[PATCH libinput 3/4] evdev: add support for wheel tilt

2016-11-28 Thread Peter Hutterer
This is added on top of the click angle handling, so the actual axis values
simply fall back onto whatever is set by udev, including the default fallbacks
to 15 and whatnot.

Signed-off-by: Peter Hutterer 
---
 src/evdev.c| 31 +--
 src/evdev.h|  2 ++
 src/libinput-private.h |  5 +
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 500a0f8..0bb92ab 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -958,6 +958,7 @@ fallback_process_relative(struct fallback_dispatch 
*dispatch,
 {
struct normalized_coords wheel_degrees = { 0.0, 0.0 };
struct discrete_coords discrete = { 0.0, 0.0 };
+   enum libinput_pointer_axis_source source;
 
if (fallback_reject_relative(device, e, time))
return;
@@ -980,11 +981,16 @@ fallback_process_relative(struct fallback_dispatch 
*dispatch,
wheel_degrees.y = -1 * e->value *
device->scroll.wheel_click_angle.x;
discrete.y = -1 * e->value;
+
+   source = device->scroll.is_tilt.vertical ?
+   LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT:
+   LIBINPUT_POINTER_AXIS_SOURCE_WHEEL;
+
evdev_notify_axis(
device,
time,
AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL),
-   LIBINPUT_POINTER_AXIS_SOURCE_WHEEL,
+   source,
&wheel_degrees,
&discrete);
break;
@@ -993,11 +999,16 @@ fallback_process_relative(struct fallback_dispatch 
*dispatch,
wheel_degrees.x = e->value *
device->scroll.wheel_click_angle.y;
discrete.x = e->value;
+
+   source = device->scroll.is_tilt.horizontal ?
+   LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT:
+   LIBINPUT_POINTER_AXIS_SOURCE_WHEEL;
+
evdev_notify_axis(
device,
time,
AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL),
-   LIBINPUT_POINTER_AXIS_SOURCE_WHEEL,
+   source,
&wheel_degrees,
&discrete);
break;
@@ -2110,6 +2121,21 @@ evdev_read_wheel_click_props(struct evdev_device *device)
return angles;
 }
 
+static inline struct wheel_tilt_flags
+evdev_read_wheel_tilt_props(struct evdev_device *device)
+{
+   struct wheel_tilt_flags flags;
+
+   flags.vertical = parse_udev_flag(device,
+device->udev_device,
+"MOUSE_WHEEL_TILT_VERTICAL");
+
+   flags.horizontal = parse_udev_flag(device,
+device->udev_device,
+"MOUSE_WHEEL_TILT_HORIZONTAL");
+   return flags;
+}
+
 static inline int
 evdev_get_trackpoint_dpi(struct evdev_device *device)
 {
@@ -2847,6 +2873,7 @@ evdev_device_create(struct libinput_seat *seat,
device->scroll.direction = 0;
device->scroll.wheel_click_angle =
evdev_read_wheel_click_props(device);
+   device->scroll.is_tilt = evdev_read_wheel_tilt_props(device);
device->model_flags = evdev_read_model_flags(device);
device->dpi = DEFAULT_MOUSE_DPI;
 
diff --git a/src/evdev.h b/src/evdev.h
index b5a54a2..cd5697e 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -197,6 +197,8 @@ struct evdev_device {
 
/* angle per REL_WHEEL click in degrees */
struct wheel_angle wheel_click_angle;
+
+   struct wheel_tilt_flags is_tilt;
} scroll;
 
struct {
diff --git a/src/libinput-private.h b/src/libinput-private.h
index 52f129a..99c8057 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -93,6 +93,11 @@ struct phys_coords {
double y;
 };
 
+/* A pair of tilt flags */
+struct wheel_tilt_flags {
+   bool vertical, horizontal;
+};
+
 struct tablet_axes {
struct device_coords point;
struct normalized_coords delta;
-- 
2.9.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 2/4] Add wheel tilt as axis source

2016-11-28 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/libinput.h  | 15 +++
 tools/event-debug.c |  3 +++
 2 files changed, 18 insertions(+)

diff --git a/src/libinput.h b/src/libinput.h
index 18a96bd..aac93fc 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -259,6 +259,12 @@ enum libinput_pointer_axis_source {
 * The event is caused by the motion of some device.
 */
LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS,
+   /**
+* The event is caused by the tilting of a mouse wheel rather than
+* its rotation. This method is commonly used on mice without
+* separate horizontal scroll wheels.
+*/
+   LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT,
 };
 
 /**
@@ -1285,6 +1291,15 @@ libinput_event_pointer_get_axis_value(struct 
libinput_event_pointer *event,
  * The coordinate system is identical to the cursor movement, i.e. a
  * scroll value of 1 represents the equivalent relative motion of 1.
  *
+ * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT, no
+ * terminating event is guaranteed (though it may happen).
+ * Scrolling is in discrete steps and there is no physical equivalent for
+ * the value returned here. For backwards compatibility, the value returned
+ * by this function is identical to a single mouse wheel rotation by this
+ * device (see the documentation for @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL
+ * above). Callers should not use this value but instead exclusively refer
+ * to the value returned by libinput_event_pointer_get_axis_value_discrete().
+ *
  * For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS,
  * this function returns 0.
  *
diff --git a/tools/event-debug.c b/tools/event-debug.c
index 3e038be..5e9f671 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -377,6 +377,9 @@ print_pointer_axis_event(struct libinput_event *ev)
case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
source = "continuous";
break;
+   case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT:
+   source = "tilt";
+   break;
}
 
if (libinput_event_pointer_has_axis(p,
-- 
2.9.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 0/4] Wheel tilt scroll source

2016-11-28 Thread Peter Hutterer

Quite a few mice have tilt-capable wheels for horizontal scrolling. We can't
detect those automatically so we'll have to rely on systemd/udev for the
tagging. But despite that, we should be honest about the scroll source and
mark them as tilt where possible rather than pretending that they're degrees
like the wheel promises to be.

For backwards compat, I'm leaving the actually returned value as-is, so most
callers that don't support the new scroll source should just work fine.
There's no real value to return anyway despite "tilted" and returning just
-1 or 1 here would likely break the world. And I like this world, I don't
have another one available.

Cheers,
  Peter
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 1/4] evdev: add helper function to parse a udev flag

2016-11-28 Thread Peter Hutterer
Only allow values of 0 and 1 for udev flags. Not that I'm aware of anyone
using anything else (i.e. his shouldn't break anything) but it's best to be as
restrictive as possible here.

Bonus effect: it's now possible to unset LIBINPUT_MODEL_* tags as well,
previously any value (including 0) was counted as "yes".

Signed-off-by: Peter Hutterer 
---
 src/evdev.c | 40 +---
 1 file changed, 29 insertions(+), 11 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index afb5e34..500a0f8 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -93,6 +93,28 @@ static const struct evdev_udev_tag_match 
evdev_udev_tag_matches[] = {
{ 0 },
 };
 
+static inline bool
+parse_udev_flag(struct evdev_device *device,
+   struct udev_device *udev_device,
+   const char *property)
+{
+   const char *val;
+
+   val = udev_device_get_property_value(udev_device, property);
+   if (!val)
+   return false;
+
+   if (streq(val, "1"))
+   return true;
+   if (!streq(val, "0"))
+   log_error(evdev_libinput_context(device),
+ "%s: property %s has invalid value '%s'\n",
+ evdev_device_get_sysname(device),
+ property,
+ val);
+   return false;
+}
+
 static void
 hw_set_key_down(struct fallback_dispatch *dispatch, int code, int pressed)
 {
@@ -1026,8 +1048,7 @@ evdev_tag_trackpoint(struct evdev_device *device,
 {
if (libevdev_has_property(device->evdev,
  INPUT_PROP_POINTING_STICK) ||
-   udev_device_get_property_value(udev_device,
-  "ID_INPUT_POINTINGSTICK"))
+   parse_udev_flag(device, udev_device, "ID_INPUT_POINTINGSTICK"))
device->tags |= EVDEV_TAG_TRACKPOINT;
 }
 
@@ -2192,12 +2213,11 @@ evdev_read_model_flags(struct evdev_device *device)
};
const struct model_map *m = model_map;
uint32_t model_flags = 0;
-   const char *val;
 
while (m->property) {
-   val = udev_device_get_property_value(device->udev_device,
-m->property);
-   if (val && !streq(val, "0")) {
+   if (parse_udev_flag(device,
+   device->udev_device,
+   m->property)) {
log_debug(evdev_libinput_context(device),
  "%s: tagged as %s\n",
  evdev_device_get_sysname(device),
@@ -2293,7 +2313,6 @@ static enum evdev_device_udev_tags
 evdev_device_get_udev_tags(struct evdev_device *device,
   struct udev_device *udev_device)
 {
-   const char *prop;
enum evdev_device_udev_tags tags = 0;
const struct evdev_udev_tag_match *match;
int i;
@@ -2301,10 +2320,9 @@ evdev_device_get_udev_tags(struct evdev_device *device,
for (i = 0; i < 2 && udev_device; i++) {
match = evdev_udev_tag_matches;
while (match->name) {
-   prop = udev_device_get_property_value(
- udev_device,
- match->name);
-   if (prop)
+   if (parse_udev_flag(device,
+   udev_device,
+   match->name))
tags |= match->tag;
 
match++;
-- 
2.9.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput] evdev: init axis range warnings for touch devices too

2016-11-28 Thread Peter Hutterer
Move the code from the touchpad code into the more generic evdev code

Signed-off-by: Peter Hutterer 
---
 src/evdev-mt-touchpad.c | 76 +
 src/evdev-mt-touchpad.h |  5 
 src/evdev.c |  6 
 src/evdev.h | 65 ++
 test/log.c  | 50 
 5 files changed, 134 insertions(+), 68 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 7b8514c..0492851 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -279,39 +279,6 @@ tp_get_delta(struct tp_touch *t)
return tp_normalize_delta(t->tp, delta);
 }
 
-static inline void
-tp_check_axis_range(struct tp_dispatch *tp,
-   unsigned int code,
-   int value)
-{
-   int min, max;
-
-   switch(code) {
-   case ABS_X:
-   case ABS_MT_POSITION_X:
-   min = tp->warning_range.min.x;
-   max = tp->warning_range.max.x;
-   break;
-   case ABS_Y:
-   case ABS_MT_POSITION_Y:
-   min = tp->warning_range.min.y;
-   max = tp->warning_range.max.y;
-   break;
-   default:
-   return;
-   }
-
-   if (value < min || value > max) {
-   log_info_ratelimit(tp_libinput_context(tp),
-  &tp->warning_range.range_warn_limit,
-  "Axis %#x value %d is outside expected range 
[%d, %d]\n"
-  "See %s/absolute_coordinate_ranges.html for 
details\n",
-  code, value, min, max,
-  HTTP_DOC_LINK);
-
-   }
-}
-
 static void
 tp_process_absolute(struct tp_dispatch *tp,
const struct input_event *e,
@@ -321,14 +288,18 @@ tp_process_absolute(struct tp_dispatch *tp,
 
switch(e->code) {
case ABS_MT_POSITION_X:
-   tp_check_axis_range(tp, e->code, e->value);
+   evdev_device_check_abs_axis_range(tp->device,
+ e->code,
+ e->value);
t->point.x = e->value;
t->millis = time;
t->dirty = true;
tp->queued |= TOUCHPAD_EVENT_MOTION;
break;
case ABS_MT_POSITION_Y:
-   tp_check_axis_range(tp, e->code, e->value);
+   evdev_device_check_abs_axis_range(tp->device,
+ e->code,
+ e->value);
t->point.y = e->value;
t->millis = time;
t->dirty = true;
@@ -363,14 +334,18 @@ tp_process_absolute_st(struct tp_dispatch *tp,
 
switch(e->code) {
case ABS_X:
-   tp_check_axis_range(tp, e->code, e->value);
+   evdev_device_check_abs_axis_range(tp->device,
+ e->code,
+ e->value);
t->point.x = e->value;
t->millis = time;
t->dirty = true;
tp->queued |= TOUCHPAD_EVENT_MOTION;
break;
case ABS_Y:
-   tp_check_axis_range(tp, e->code, e->value);
+   evdev_device_check_abs_axis_range(tp->device,
+ e->code,
+ e->value);
t->point.y = e->value;
t->millis = time;
t->dirty = true;
@@ -2241,32 +2216,10 @@ tp_init_hysteresis(struct tp_dispatch *tp)
return;
 }
 
-static void
-tp_init_range_warnings(struct tp_dispatch *tp,
-  struct evdev_device *device,
-  int width,
-  int height)
-{
-   const struct input_absinfo *x, *y;
-
-   x = device->abs.absinfo_x;
-   y = device->abs.absinfo_y;
-
-   tp->warning_range.min.x = x->minimum - 0.05 * width;
-   tp->warning_range.min.y = y->minimum - 0.05 * height;
-   tp->warning_range.max.x = x->maximum + 0.05 * width;
-   tp->warning_range.max.y = y->maximum + 0.05 * height;
-
-   /* One warning every 5 min is enough */
-   ratelimit_init(&tp->warning_range.range_warn_limit, s2us(3000), 1);
-}
-
 static int
 tp_init(struct tp_dispatch *tp,
struct evdev_device *device)
 {
-   int width, height;
-
tp->base.interface = &tp_interface;
tp->device = device;
 
@@ -2278,10 +2231,7 @@ tp_init(struct tp_dispatch *tp,
if (!tp_init_slots(tp, device))
return false;
 
-   width = device->abs.dimensions.x;
-   height = device->abs.dimensions.y;
-
-   tp_init_range_warnings(tp, device, width, height);
+   evdev_device_init_abs_range_warnings(device);
 

Re: [PATCH weston 2/2] compositor-wayland: Destroy cursor images earlier

2016-11-28 Thread Dima Ryazanov
On Thu, Nov 24, 2016 at 7:32 AM, Daniel Stone  wrote:

> Destroying a wl_cursor will attempt to access the wl_display, which
> we have just freed. Avoid a segfault by destroying the cursor images
> before we destroy the display.
>
> Signed-off-by: Daniel Stone 
>

Yep, fixes the crash for me.

Reviewed-by: Dima Ryazanov 

---
>  libweston/compositor-wayland.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libweston/compositor-wayland.c b/libweston/compositor-
> wayland.c
> index d9cbde5..aa69c68 100644
> --- a/libweston/compositor-wayland.c
> +++ b/libweston/compositor-wayland.c
> @@ -2368,10 +2368,6 @@ wayland_destroy(struct weston_compositor *ec)
> if (b->parent.compositor)
> wl_compositor_destroy(b->parent.compositor);
>
> -   wl_registry_destroy(b->parent.registry);
> -   wl_display_flush(b->parent.wl_display);
> -   wl_display_disconnect(b->parent.wl_display);
> -
> if (b->theme)
> theme_destroy(b->theme);
>
> @@ -2380,6 +2376,10 @@ wayland_destroy(struct weston_compositor *ec)
>
> wl_cursor_theme_destroy(b->cursor_theme);
>
> +   wl_registry_destroy(b->parent.registry);
> +   wl_display_flush(b->parent.wl_display);
> +   wl_display_disconnect(b->parent.wl_display);
> +
> free(b);
>  }
>
> --
> 2.9.3
>
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 2/2] compositor-wayland: Destroy cursor images earlier

2016-11-28 Thread Peter Hutterer
On Thu, Nov 24, 2016 at 03:32:41PM +, Daniel Stone wrote:
> Destroying a wl_cursor will attempt to access the wl_display, which
> we have just freed. Avoid a segfault by destroying the cursor images
> before we destroy the display.
> 
> Signed-off-by: Daniel Stone 

Reviewed-by: Peter Hutterer 

Cheers,
   Peter
> ---
>  libweston/compositor-wayland.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
> index d9cbde5..aa69c68 100644
> --- a/libweston/compositor-wayland.c
> +++ b/libweston/compositor-wayland.c
> @@ -2368,10 +2368,6 @@ wayland_destroy(struct weston_compositor *ec)
>   if (b->parent.compositor)
>   wl_compositor_destroy(b->parent.compositor);
>  
> - wl_registry_destroy(b->parent.registry);
> - wl_display_flush(b->parent.wl_display);
> - wl_display_disconnect(b->parent.wl_display);
> -
>   if (b->theme)
>   theme_destroy(b->theme);
>  
> @@ -2380,6 +2376,10 @@ wayland_destroy(struct weston_compositor *ec)
>  
>   wl_cursor_theme_destroy(b->cursor_theme);
>  
> + wl_registry_destroy(b->parent.registry);
> + wl_display_flush(b->parent.wl_display);
> + wl_display_disconnect(b->parent.wl_display);
> +
>   free(b);
>  }
>  
> -- 
> 2.9.3
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 1/2] Don't prepend protocol/ to include paths

2016-11-28 Thread Dima Ryazanov
On Thu, Nov 24, 2016 at 7:32 AM, Daniel Stone  wrote:

> No need to add protocol/, as it's already handled by an explicit
> compiler include path.
>
> Signed-off-by: Daniel Stone 
>

Reviewed-by: Dima Ryazanov 


> ---
>  libweston-desktop/xdg-shell-v5.c | 2 +-
>  libweston-desktop/xdg-shell-v6.c | 2 +-
>  libweston/input.c| 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libweston-desktop/xdg-shell-v5.c
> b/libweston-desktop/xdg-shell-v5.c
> index 9fd3a87..08cf71e 100644
> --- a/libweston-desktop/xdg-shell-v5.c
> +++ b/libweston-desktop/xdg-shell-v5.c
> @@ -32,7 +32,7 @@
>
>  #include "compositor.h"
>  #include "zalloc.h"
> -#include "protocol/xdg-shell-unstable-v5-server-protocol.h"
> +#include "xdg-shell-unstable-v5-server-protocol.h"
>
>  #include "libweston-desktop.h"
>  #include "internal.h"
> diff --git a/libweston-desktop/xdg-shell-v6.c
> b/libweston-desktop/xdg-shell-v6.c
> index edd1dc4..7d0bd8e 100644
> --- a/libweston-desktop/xdg-shell-v6.c
> +++ b/libweston-desktop/xdg-shell-v6.c
> @@ -33,7 +33,7 @@
>
>  #include "compositor.h"
>  #include "zalloc.h"
> -#include "protocol/xdg-shell-unstable-v6-server-protocol.h"
> +#include "xdg-shell-unstable-v6-server-protocol.h"
>
>  #include "libweston-desktop.h"
>  #include "internal.h"
> diff --git a/libweston/input.c b/libweston/input.c
> index 471c65e..4fedc55 100644
> --- a/libweston/input.c
> +++ b/libweston/input.c
> @@ -39,8 +39,8 @@
>  #include "shared/helpers.h"
>  #include "shared/os-compatibility.h"
>  #include "compositor.h"
> -#include "protocol/relative-pointer-unstable-v1-server-protocol.h"
> -#include "protocol/pointer-constraints-unstable-v1-server-protocol.h"
> +#include "relative-pointer-unstable-v1-server-protocol.h"
> +#include "pointer-constraints-unstable-v1-server-protocol.h"
>
>  enum pointer_constraint_type {
> POINTER_CONSTRAINT_TYPE_LOCK,
> --
> 2.9.3
>
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston v3 1/2] editor: Use parse_options() from shared for command line options

2016-11-28 Thread Bryce Harrington
On Sun, Nov 27, 2016 at 02:54:54PM -0800, Yong Bakos wrote:
> On Nov 21, 2016, at 1:26 PM, Bryce Harrington  wrote:
> > 
> > Also add a basic --help option
> > 
> > Signed-off-by: Bryce Harrington 
> 
> This patch extracts some option flags out of main, uses parse_options instead
> of strcmp, and adds some behavior around the help option and error behavior
> around an excess arg count. It reflects the same option-parsing idiom found
> elsewhere in the weston codebase.
> 
> While the `char *text_buffer` declaration in main belongs in 2/2 of this 
> patch,
> this one is:

I've made that change and pushed the two patches with your review, thanks!

To ssh://git.freedesktop.org/git/wayland/weston
   21fac60..411ffab  master -> master

Bryce
 
> Reviewed-by: Yong Bakos 
> 
> yong
> 
> 
> > ---
> > clients/editor.c | 80 
> > 
> > 1 file changed, 58 insertions(+), 22 deletions(-)
> > 
> > diff --git a/clients/editor.c b/clients/editor.c
> > index 30bf555..b8fc63a 100644
> > --- a/clients/editor.c
> > +++ b/clients/editor.c
> > @@ -37,6 +37,7 @@
> > 
> > #include 
> > 
> > +#include "shared/config-parser.h"
> > #include "shared/helpers.h"
> > #include "shared/xalloc.h"
> > #include "window.h"
> > @@ -1489,28 +1490,63 @@ global_handler(struct display *display, uint32_t 
> > name,
> > }
> > }
> > 
> > +/** Display help for command line options, and exit */
> > +static uint32_t opt_help = 0;
> > +
> > +/** Require a distinct click to show the input panel (virtual keyboard) */
> > +static uint32_t opt_click_to_show = 0;
> > +
> > +/** Set a specific (RFC-3066) language.  Used for the virtual keyboard, 
> > etc. */
> > +static const char *opt_preferred_language = NULL;
> > +
> > +/**
> > + * \brief command line options for editor
> > + */
> > +static const struct weston_option editor_options[] = {
> > +   { WESTON_OPTION_BOOLEAN, "help", 'h', &opt_help },
> > +   { WESTON_OPTION_BOOLEAN, "click-to-show", 'C', &opt_click_to_show },
> > +   { WESTON_OPTION_STRING, "preferred-language", 'L', 
> > &opt_preferred_language },
> > +};
> > +
> > +static void
> > +usage(const char *program_name, int exit_code)
> > +{
> > +   unsigned k;
> > +
> > +   fprintf(stderr, "Usage: %s [OPTIONS]\n\n", program_name);
> > +   for (k = 0; k < ARRAY_LENGTH(editor_options); k++) {
> > +   const struct weston_option *p = &editor_options[k];
> > +   if (p->name) {
> > +   fprintf(stderr, "  --%s", p->name);
> > +   if (p->type != WESTON_OPTION_BOOLEAN)
> > +   fprintf(stderr, "=VALUE");
> > +   fprintf(stderr, "\n");
> > +   }
> > +   if (p->short_name) {
> > +   fprintf(stderr, "  -%c", p->short_name);
> > +   if (p->type != WESTON_OPTION_BOOLEAN)
> > +   fprintf(stderr, "VALUE");
> > +   fprintf(stderr, "\n");
> > +   }
> > +   }
> > +   exit(exit_code);
> > +}
> > +
> > int
> > main(int argc, char *argv[])
> > {
> > struct editor editor;
> > -   int i;
> > -   uint32_t click_to_show = 0;
> > -   const char *preferred_language = NULL;
> > -
> > -   for (i = 1; i < argc; i++) {
> > -   if (strcmp("--click-to-show", argv[i]) == 0)
> > -   click_to_show = 1;
> > -   else if (strcmp("--preferred-language", argv[i]) == 0 &&
> > -i + 1 < argc) {
> > -   preferred_language = argv[i + 1];
> > -   i++;
> > -   } else {
> > -   printf("Usage: %s [OPTIONS]\n"
> > -  "  --click-to-show\n"
> > -  "  --preferred-language LANGUAGE\n",
> > -  argv[0]);
> > -   return 1;
> > -   }
> > +   char *text_buffer = NULL;
> > +
> > +   parse_options(editor_options, ARRAY_LENGTH(editor_options),
> > + &argc, argv);
> > +   if (opt_help)
> > +   usage(argv[0], EXIT_SUCCESS);
> > +
> > +   if (argc > 1) {
> > +   usage(argv[0], EXIT_FAILURE);
> > +   /* FIXME: Use remaining arguments as a path/filename to load */
> > +   return 0;
> > }
> > 
> > memset(&editor, 0, sizeof editor);
> > @@ -1537,12 +1573,12 @@ main(int argc, char *argv[])
> > editor.widget = window_frame_create(editor.window, &editor);
> > 
> > editor.entry = text_entry_create(&editor, "Entry");
> > -   editor.entry->click_to_show = click_to_show;
> > -   if (preferred_language)
> > -   editor.entry->preferred_language = strdup(preferred_language);
> > +   editor.entry->click_to_show = opt_click_to_show;
> > +   if (opt_preferred_language)
> > +   editor.entry->preferred_language = 
> > strdup(opt_preferred_language);
> > editor.editor = text_entry_create(&editor, "Numeric");
> > editor.editor->content_purpose = 
> > ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_NUMBER;
> > -   editor.edi

Re: [PATCH weston] compositor-wayland: Set frame callback for Pixman

2016-11-28 Thread Daniel Stone
Hi Dima,

On 28 November 2016 at 21:31, Dima Ryazanov  wrote:
> Yep, fixes the crash, thanks!

Pushed now, thanks!

To ssh://git.freedesktop.org/git/wayland/weston
   6a38ad7..21fac60  upstream -> master

Cheers,
Daniel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston v2] compositor-wayland: Fix a use after free

2016-11-28 Thread Dima Ryazanov
Oh, good catch; just reviewed it. Thanks!

On Mon, Nov 28, 2016 at 10:20 AM, Daniel Stone  wrote:

> Hi Dima,
>
> On 24 November 2016 at 13:13, Dima Ryazanov  wrote:
> > When a window is being closed, the frame_done callback often runs after
> > the output is already destroyed, i.e:
> >
> >   wayland_output_start_repaint_loop
> >   input_handle_button
> > wayland_output_destroy
> >   frame_done
> >
> > To fix this, destroy the callback before destroying the output.
> >
> > (Also, fix the type of output in frame_done: it's passed in
> > a wayland_output, not a weston_output.)
>
> I accidentally pushed this, when I meant to push the gl-renderer patch
> instead. Turns out this breaks Pixman; I've sent a follow-up patch
> which fixes this. Can you please review it when you can?
>
> Cheers,
> Daniel
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] compositor-wayland: Set frame callback for Pixman

2016-11-28 Thread Dima Ryazanov
Yep, fixes the crash, thanks!

Reviewed-by: Dima Ryazanov 

On Mon, Nov 28, 2016 at 8:06 AM, Daniel Stone  wrote:

> Fixing 89c2f637b9, also set the output's frame_cb for the Pixman
> renderer, not just GL. Fixes a segfault when using compositor-wayland
> with --use-pixman.
>
> Signed-off-by: Daniel Stone 
> Cc: Dima Ryazanov 
> ---
>  libweston/compositor-wayland.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libweston/compositor-wayland.c b/libweston/compositor-
> wayland.c
> index 7c814c8..d1e387d 100644
> --- a/libweston/compositor-wayland.c
> +++ b/libweston/compositor-wayland.c
> @@ -593,7 +593,6 @@ wayland_output_repaint_pixman(struct weston_output
> *output_base,
> struct wayland_output *output = to_wayland_output(output_base);
> struct wayland_backend *b =
> to_wayland_backend(output->base.compositor);
> -   struct wl_callback *callback;
> struct wayland_shm_buffer *sb;
>
> if (output->frame) {
> @@ -613,8 +612,8 @@ wayland_output_repaint_pixman(struct weston_output
> *output_base,
>
> wayland_shm_buffer_attach(sb);
>
> -   callback = wl_surface_frame(output->parent.surface);
> -   wl_callback_add_listener(callback, &frame_listener, output);
> +   output->frame_cb = wl_surface_frame(output->parent.surface);
> +   wl_callback_add_listener(output->frame_cb, &frame_listener,
> output);
> wl_surface_commit(output->parent.surface);
> wl_display_flush(b->parent.wl_display);
>
> --
> 2.9.3
>
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston v2] compositor-wayland: Fix a use after free

2016-11-28 Thread Daniel Stone
Hi Dima,

On 24 November 2016 at 13:13, Dima Ryazanov  wrote:
> When a window is being closed, the frame_done callback often runs after
> the output is already destroyed, i.e:
>
>   wayland_output_start_repaint_loop
>   input_handle_button
> wayland_output_destroy
>   frame_done
>
> To fix this, destroy the callback before destroying the output.
>
> (Also, fix the type of output in frame_done: it's passed in
> a wayland_output, not a weston_output.)

I accidentally pushed this, when I meant to push the gl-renderer patch
instead. Turns out this breaks Pixman; I've sent a follow-up patch
which fixes this. Can you please review it when you can?

Cheers,
Daniel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] compositor-wayland: Set frame callback for Pixman

2016-11-28 Thread Daniel Stone
Fixing 89c2f637b9, also set the output's frame_cb for the Pixman
renderer, not just GL. Fixes a segfault when using compositor-wayland
with --use-pixman.

Signed-off-by: Daniel Stone 
Cc: Dima Ryazanov 
---
 libweston/compositor-wayland.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
index 7c814c8..d1e387d 100644
--- a/libweston/compositor-wayland.c
+++ b/libweston/compositor-wayland.c
@@ -593,7 +593,6 @@ wayland_output_repaint_pixman(struct weston_output 
*output_base,
struct wayland_output *output = to_wayland_output(output_base);
struct wayland_backend *b =
to_wayland_backend(output->base.compositor);
-   struct wl_callback *callback;
struct wayland_shm_buffer *sb;
 
if (output->frame) {
@@ -613,8 +612,8 @@ wayland_output_repaint_pixman(struct weston_output 
*output_base,
 
wayland_shm_buffer_attach(sb);
 
-   callback = wl_surface_frame(output->parent.surface);
-   wl_callback_add_listener(callback, &frame_listener, output);
+   output->frame_cb = wl_surface_frame(output->parent.surface);
+   wl_callback_add_listener(output->frame_cb, &frame_listener, output);
wl_surface_commit(output->parent.surface);
wl_display_flush(b->parent.wl_display);
 
-- 
2.9.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH libinput 1/7] test: add a test for safe_atoi

2016-11-28 Thread Hans de Goede

Hi,

On 28-11-16 06:20, Peter Hutterer wrote:

Signed-off-by: Peter Hutterer 


Entire series looks good to me:

Reviewed-by: Hans de Goede 

Regards,

Hans



---
 test/misc.c | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/test/misc.c b/test/misc.c
index 4afd4d0..95776f7 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -861,6 +861,47 @@ START_TEST(time_conversion)
 }
 END_TEST

+struct atoi_test {
+   char *str;
+   bool success;
+   int val;
+};
+
+START_TEST(safe_atoi_test)
+{
+   struct atoi_test tests[] = {
+   { "10", true, 10 },
+   { "20", true, 20 },
+   { "-1", true, -1 },
+   { "2147483647", true, 2147483647 },
+   { "-2147483648", true, -2147483648 },
+   { "4294967295", false, 0 },
+   { "0x0", false, 0 },
+   { "-10x10", false, 0 },
+   { "1x-99", false, 0 },
+   { "", false, 0 },
+   { "abd", false, 0 },
+   { "xabd", false, 0 },
+   { "0xaf", false, 0 },
+   { "0x0x", false, 0 },
+   { "x10", false, 0 },
+   { NULL, false, 0 }
+   };
+   int v;
+   bool success;
+
+   for (int i = 0; tests[i].str != NULL; i++) {
+   v = 0xad;
+   success = safe_atoi(tests[i].str, &v);
+   ck_assert(success == tests[i].success);
+   if (success)
+   ck_assert_int_eq(v, tests[i].val);
+   else
+   ck_assert_int_eq(v, 0xad);
+   }
+}
+END_TEST
+
 static int open_restricted_leak(const char *path, int flags, void *data)
 {
return *(int*)data;
@@ -988,6 +1029,7 @@ litest_setup_tests_misc(void)
litest_add_no_device("misc:parser", wheel_click_count_parser);
litest_add_no_device("misc:parser", trackpoint_accel_parser);
litest_add_no_device("misc:parser", dimension_prop_parser);
+   litest_add_no_device("misc:parser", safe_atoi_test);
litest_add_no_device("misc:time", time_conversion);

litest_add_no_device("misc:fd", fd_no_event_leak);


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH libinput] touchpad: add a quirk for the HP Pavilion dm4

2016-11-28 Thread Hans de Goede

Hi,

On 27-11-16 23:55, Peter Hutterer wrote:

This touchpad has cursor jumps for 2-finger scrolling that also affects the
single-finger emulation. So disable any multitouch bits on this device and
disallow the 2-finger scroll method. This still allows for 2-finger
tapping/clicking.

https://bugs.freedesktop.org/show_bug.cgi?id=91135

Signed-off-by: Peter Hutterer 


This sounds a lot like what we're doing for semi-mt devices,
but then with completely different code-paths. AFAICT we still
allow BTN_TOOL_DOUBLETAP, etc. for semi-mt, so why not use
the same method.

To be specific I'm talking about the "if (tp->semi_mt) { ... }"
block with the large comment above it in tp_init_slots(), to me
it sounds like you want to change that to:

if (tp->semi_mit ||
(tp->device->model_flags & EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD)) {
...
}

Rather then come up with a second approach to only listen to the
non-mt coordinates.

Regards,

Hans





---
 src/evdev-mt-touchpad.c|  6 ++
 src/evdev.c| 12 
 src/evdev.h|  1 +
 udev/90-libinput-model-quirks.hwdb |  4 
 4 files changed, 23 insertions(+)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index d72cb19..beb19cd 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1909,6 +1909,12 @@ tp_scroll_get_methods(struct tp_dispatch *tp)
 {
uint32_t methods = LIBINPUT_CONFIG_SCROLL_EDGE;

+   /* Any movement with more than one finger has random cursor
+* jumps. Don't allow for 2fg scrolling on this device, see
+* fdo bug 91135 */
+   if (tp->device->model_flags & EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD)
+   return LIBINPUT_CONFIG_SCROLL_EDGE;
+
if (tp->ntouches >= 2)
methods |= LIBINPUT_CONFIG_SCROLL_2FG;

diff --git a/src/evdev.c b/src/evdev.c
index fac8fcb..eb4c0d0 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2179,6 +2179,7 @@ evdev_read_model_flags(struct evdev_device *device)
MODEL(APPLE_MAGICMOUSE),
MODEL(HP8510_TOUCHPAD),
MODEL(HP6910_TOUCHPAD),
+   MODEL(HP_PAVILION_DM4_TOUCHPAD),
 #undef MODEL
{ "ID_INPUT_TRACKBALL", EVDEV_MODEL_TRACKBALL },
{ NULL, EVDEV_MODEL_DEFAULT },
@@ -2762,6 +2763,17 @@ evdev_pre_configure_model_quirks(struct evdev_device 
*device)
if (device->model_flags & EVDEV_MODEL_HP_STREAM11_TOUCHPAD)
libevdev_enable_property(device->evdev,
 INPUT_PROP_BUTTONPAD);
+
+   /* Touchpad has random jumps in slots, including for single-finger
+* movement. See fdo bug 91135 */
+   if (device->model_flags & EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD) {
+   unsigned int code;
+
+   for (code = ABS_MT_SLOT; code <= ABS_MT_TRACKING_ID; code++)
+   libevdev_disable_event_code(device->evdev,
+   EV_ABS,
+   code);
+   }
 }

 struct evdev_device *
diff --git a/src/evdev.h b/src/evdev.h
index b811f51..9689051 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -121,6 +121,7 @@ enum evdev_device_model {
EVDEV_MODEL_APPLE_MAGICMOUSE = (1 << 20),
EVDEV_MODEL_HP8510_TOUCHPAD = (1 << 21),
EVDEV_MODEL_HP6910_TOUCHPAD = (1 << 22),
+   EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD = (1 << 23),
 };

 struct mt_slot {
diff --git a/udev/90-libinput-model-quirks.hwdb 
b/udev/90-libinput-model-quirks.hwdb
index 4bfc0f9..d5b1d78 100644
--- a/udev/90-libinput-model-quirks.hwdb
+++ b/udev/90-libinput-model-quirks.hwdb
@@ -99,6 +99,10 @@ libinput:name:SynPS/2 Synaptics 
TouchPad:dmi:*svnHewlett-Packard:*pnHPCompaq6910
 libinput:name:SynPS/2 Synaptics 
TouchPad:dmi:*svnHewlett-Packard:*pnHPCompaq8510w*
  LIBINPUT_MODEL_HP8510_TOUCHPAD=1

+# HP Pavillion dm4
+libinput:name:SynPS/2 Synaptics 
TouchPad:dmi:*svnHewlett-Packard:*pnHPPaviliondm4NotebookPC*
+ LIBINPUT_MODEL_HP_PAVILION_DM4_TOUCHPAD=1
+
 # HP Stream 11
 libinput:name:SYN1EDE:00 
06CB:7442:dmi:*svnHewlett-Packard:pnHPStreamNotebookPC11*
  LIBINPUT_MODEL_HP_STREAM11_TOUCHPAD=1


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland] doc: Remove wayland-util.c from file list

2016-11-28 Thread Daniel Stone
On 27 November 2016 at 09:48, Peter Hutterer  wrote:
> On Fri, Nov 25, 2016 at 10:48:36AM -0800, Yong Bakos wrote:
>> Documentation generation via doxygen includes wayland-util.c in its file
>> list. Although functions are documented in wayland-util.h, doxygen is
>> not automatically using the same documentation for functions in
>> wayland-util.c. In addition, everything listed in the doxygen page for
>> wayland-util.c is documented in the page for wayland-util.h and the
>> pages for corresponding structures. As such, the doxygen page for
>> wayland-util.c has no value, and is redundant.
>>
>> Remove the doxygen page for wayland-util.c.
>>
>> Signed-off-by: Yong Bakos 
>
> Acked-by: Peter Hutterer 

And pushed, thanks!

To ssh://git.freedesktop.org/git/wayland/wayland
   20742b7..deb370c  push -> master

Cheers,
Daniel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] gl-renderer: Fix an invalid write when closing a Weston window

2016-11-28 Thread Daniel Stone
Hi Dima,
Apparently my reply here got lost in the ether ...

On 24 November 2016 at 12:50, Dima Ryazanov  wrote:
> Forgot to mention: this only happens when using the wayland backend, not
> x11. It's triggered by the next call to eglMakeCurrent (when the remaining
> window is repainted), so it might not happen immediately, either. I'm using
> an Intel graphics card and Mesa 12.0.3.

Right, I was using the Wayland backend there too. Maybe it's fixed in
a newer Mesa.

> I actually saw the comment in gl_renderer_destroy and searched for Mesa
> bugs, but found this email:
> https://lists.freedesktop.org/archives/wayland-devel/2013-October/011622.html
> "[...] An EGLSurface is current for a context from eglMakeCurrent up until
> eglMakeCurrent is called for the conetxte with another surface or the
> context is destroyed.  The wl_egl_surface (the native window object) has to
> be available (can not be destroyed) for the entire time the EGLSurface
> exists."
> (Though it's from 2013, so maybe things have changed since.)
>
> There was also a similar fix for the simple-egl client a while ago:
> https://lists.freedesktop.org/archives/wayland-devel/2013-April/008718.html

Hm, yeah. Indeed it is consistent, but I hadn't realised that the
_client_ needed to ensure the NativeWindow stuck around until the
destroy took effect. That's pretty painful. I'll merge this then -
thanks!

To ssh://git.freedesktop.org/git/wayland/weston
   e3a582f..89c2f63  upstream -> master

Cheers,
Daniel

> On Thu, Nov 24, 2016 at 3:51 AM, Daniel Stone  wrote:
>>
>> Hi Dima,
>>
>> On 24 November 2016 at 02:41, Dima Ryazanov  wrote:
>> > Call eglMakeCurrent before destroying the native EGL window, similar to
>> > what
>> > other sample clients are already doing.
>>
>> This doesn't show as an error here, with your suggested reproduction
>> instructions. From eglDestroySurface:
>> 'If the EGL surface surface is not current to any thread,
>> eglDestroySurface destroys it immediately. Otherwise, surface is
>> destroyed when it becomes not current to any thread.'
>>
>> Which GL stack are you using? The comment above the no-surface
>> MakeCurrent in gl_renderer_destroy() is probably pretty telling, that
>> Mesa once had a bug.
>>
>> Regardless of this, I am inclined to apply it to match the others,
>> even just so we can be sure that the destroy takes effect immediately.
>>
>> Cheers,
>> Daniel
>
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel