[PATCH libinput] filter: always average the velocity of the first two events

2018-04-25 Thread Peter Hutterer
Don't apply any velocity diff checking on the first two events, always average
them (unless the timeout is hit or the direction changes). This averages out
some of the jumps we get on slow motion.

Signed-off-by: Peter Hutterer 
---
Still waiting on test results but this papers over some of the jumps. Turns
out the xserver has that code too, it's just well-hidden. Together with
synaptic's lower acceleration (in most cases) this is probably a reason why
pointer jumps in libinput are more pronounced.

 src/filter.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/filter.c b/src/filter.c
index 7b7e005a..fe60c62a 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -248,7 +248,10 @@ trackers_velocity(struct pointer_trackers *trackers, 
uint64_t time)
break;
}
 
-   if (initial_velocity == 0.0) {
+   /* Always average the first two events. On some touchpads
+* where the first event is jumpy, this somewhat reduces
+* pointer jumps on slow motions. */
+   if (initial_velocity == 0.0 || offset <= 2) {
result = initial_velocity = velocity;
} else {
/* Stop if velocity differs too much from initial */
-- 
2.14.3

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


Re: [PATCH weston 21/25] protocol: add weston_touch_calibration

2018-04-25 Thread Peter Hutterer
On Tue, Apr 24, 2018 at 02:03:41PM +0300, Pekka Paalanen wrote:
> On Wed, 18 Apr 2018 11:30:42 +0300
> Pekka Paalanen  wrote:
> 
> > On Mon, 16 Apr 2018 13:40:44 +1000
> > Peter Hutterer  wrote:
> > 
> > > On Fri, Apr 13, 2018 at 10:51:37AM +0300, Pekka Paalanen wrote:  
> > > >   
> > > > Well, it does touch-downs at least. I think if motion event would end
> > > > up out of range, I'll send cancel event followed by invalid touch.
> > > > Whee, I found use for the cancel event!
> > > 
> > > The cancel event would also be used for the multitouch-case, right?
> > > If a second touch appears before the first one is fully processed, you 
> > > also
> > > need to cancel the first touch. Doesn't even need to be intentional by the
> > > user, could be a palm touch or an accidental touch where they're holding 
> > > the
> > > screen on an edge.  
> > 
> > I hadn't even thought of that, sounds good.
> 
> Actually, I don't have to filter multiple touchpoints in the server.
> The protocol is copied from the wl_touch interface and can handle
> multiple touch points just fine. It can be up to the client to enter a
> denial mode on a second touch down until they are all up.

> Likewise, if the user puts first touch down on a right device, and a
> second touch down on a wrong device which results in a invalid_touch
> event, it can be up to the client to decide whether it accepts the
> first touch or not.
> 
> I'll just have to make the client deal with those.
> 
> Do you see any problem with this?

nope, all good. Sorry, I forgot about the touch ID being in the events...

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


[PATCH libinput] gestures: if two fingers are in definitive pinch position, pinch

2018-04-25 Thread Peter Hutterer
Two fingers on the touchpad, they're 40x40mm apart, that's a pinch. But only
after a timeout because we don't want to start a 2fg gesture if the user puts
down the third/fourth finger within the next few ms.

Related to: https://bugs.freedesktop.org/show_bug.cgi?id=99830

Signed-off-by: Peter Hutterer 
---
 src/evdev-mt-touchpad-gestures.c | 21 -
 src/evdev.h  | 11 +++
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 37682fb4..8f2dda7f 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -31,6 +31,7 @@
 
 #define DEFAULT_GESTURE_SWITCH_TIMEOUT ms2us(100)
 #define DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT ms2us(150)
+#define DEFAULT_GESTURE_2FG_PINCH_TIMEOUT ms2us(75)
 
 static inline const char*
 gesture_state_to_str(enum tp_gesture_state state)
@@ -328,8 +329,11 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, 
uint64_t time)
struct tp_touch *first = tp->gesture.touches[0],
*second = tp->gesture.touches[1];
uint32_t dir1, dir2;
-   int yres = tp->device->abs.absinfo_y->resolution;
-   int vert_distance;
+   struct phys_coords mm;
+   int vert_distance, horiz_distance;
+
+   vert_distance = abs(first->point.y - second->point.y);
+   horiz_distance = abs(first->point.x - second->point.x);
 
if (time > (tp->gesture.initial_time + 
DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
/* for two-finger gestures, if the fingers stay unmoving for a
@@ -345,9 +349,10 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, 
uint64_t time)
 
/* for 3+ finger gestures, check if one finger is > 20mm
   below the others */
-   vert_distance = abs(first->point.y - second->point.y);
-   if (vert_distance > 20 * yres &&
-   tp->gesture.enabled) {
+   mm = evdev_convert_xy_to_mm(tp->device,
+   horiz_distance,
+   vert_distance);
+   if (mm.y > 20 && tp->gesture.enabled) {
tp_gesture_init_pinch(tp);
return GESTURE_STATE_PINCH;
} else {
@@ -355,6 +360,12 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, 
uint64_t time)
}
}
 
+   if (time > (tp->gesture.initial_time + 
DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
+   mm = evdev_convert_xy_to_mm(tp->device, horiz_distance, 
vert_distance);
+   if (tp->gesture.finger_count == 2 && mm.x > 40 && mm.y > 40)
+   return GESTURE_STATE_PINCH;
+   }
+
/* Else wait for both fingers to have moved */
dir1 = tp_gesture_get_direction(tp, first, tp->gesture.finger_count);
dir2 = tp_gesture_get_direction(tp, second, tp->gesture.finger_count);
diff --git a/src/evdev.h b/src/evdev.h
index 42d71a05..0c602ea0 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -586,6 +586,17 @@ evdev_convert_to_mm(const struct input_absinfo *absinfo, 
double v)
return value/absinfo->resolution;
 }
 
+static inline struct phys_coords
+evdev_convert_xy_to_mm(const struct evdev_device *device, int x, int y)
+{
+   struct phys_coords mm;
+
+   mm.x = evdev_convert_to_mm(device->abs.absinfo_x, x);
+   mm.y = evdev_convert_to_mm(device->abs.absinfo_y, y);
+
+   return mm;
+}
+
 void
 evdev_init_left_handed(struct evdev_device *device,
   void (*change_to_left_handed)(struct evdev_device *));
-- 
2.14.3

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


Finding a window's icon

2018-04-25 Thread Nicholas Bishop
Hi,

As I understand it, windows under Wayland don't directly expose an icon.
Instead xdg-shell provides an application ID [1] that can be used to
identify the application. The application ID is suggested to be the
basename of the appropriate .desktop file.

>From that I'm guessing that a wayland shell is supposed to search a set of
well-known directories containing .desktop files and attempt to match the
application ID with a filename?

My question is, does that work in practice? Do most applications actually
set the application ID as suggested? (So far I haven't found any that do,
but maybe I'm just testing too small a set of applications.) If that's not
how Wayland shells implement the icon lookup, what's the right way?

More generally, does this mean that displaying the icon for a remote
application requires a corresponding desktop file on the local machine? I
feel like I'm missing something here :)

-Nicholas

[1]
https://github.com/wayland-project/wayland-protocols/blob/master/stable/xdg-shell/xdg-shell.xml#L591
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston v5 0/3] simple-dmabuf-drm: Support etnaviv and freedreno cleanups

2018-04-25 Thread Guido Günther
On Tue, Mar 20, 2018 at 09:41:57AM +0100, Guido Günther wrote:
> Former patches 1-2 where already applied thanks Derek.
> 
> Changes from v4
> - configure: use true if etnaviv drm was not found as with
>   other drm backends (avoids an unused variable assignment)
> - configure: use (hopefully) correct english
> - simplify several if (cond) return 1; return 0; statements
> - unmap buffer
> 
> Former patches 1-3 where already applied thanks Peka.
> 
> Changes from v3:
> - Use ALIGN macro by default
> - Don't multiply by bpp twice
> - unmap buffer
> 
> Changes from v2:
> - Use stride to calculate buffer size (etnaviv)
> - Use stride to calculate buffer size (freedreno)
> - Use less generic name for ALIGN macro
> 
> Changes from v1:
> - Split up changes
> - autoconf:
>   - don't define unused have_ variables. Use true instead to
> prevent abort of PKG_CHECK_MODULES
>   - use && instead of -a in test
>   - properly check variables
> - use vfunc for drm_device_destroy
> 
> 
> Guido Günther (3):
>   simple-dmabuf-drm: 0 is a valid fd (freedreno)
>   simple-dmabuf-drm: simplify fd_map_bo
>   simple-dmabuf-drm: support etnaviv drm as well
> 
>  Makefile.am |  1 +
>  clients/simple-dmabuf-drm.c | 79 
> +++--
>  configure.ac|  5 ++-
>  3 files changed, 75 insertions(+), 10 deletions(-)

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