[RFC libinput] Add an API for touchpad gesture events

Hans de Goede hdegoede at redhat.com
Fri Jan 23 05:57:52 PST 2015


Hi,

On 23-01-15 14:53, Jonas Ã…dahl wrote:
> On Fri, Jan 23, 2015 at 12:18:01PM +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 23-01-15 05:21, Peter Hutterer wrote:

<snip>

>>>> +double
>>>> +libinput_event_gesture_get_absolute_x(struct libinput_event_gesture *event);
>>>
>>> this is a bit inconsistent with the other API where absolute_x returns a
>>> value in mm. I think we should do that here as well and provide
>>> get_absolute_x_transformed - callers that need it in relation to the
>>> touchpad size can just provide 1.0 as width/height.
>>
>> I don't think mm is really interesting on a touchpad, and in many cases if we
>> say this is in mm we would be lying as we do not know the exact dimensions. I
>> see using (fake) mm-s here and then having users call get_absolute_x_transformed
>> with 100 or 1.0 to get the percentage they very likely want from the beginning
>> as just adding baggage without any gain.
>>
>> The intend behind these absolute coordinates is for them to be used in e.g.
>> a virtual desktop switching animation when switching using a swipe, this way the
>> user can start a swipe, see the new virtual desktop, realize it is the wrong one
>> and abort, or if it is the right one continue, and then past say 2/3ths of the
>> touchpad the animation will show the new virtual desktop locking into place, and
>> the user will know he can stop swiping. Notice the key thing here is the swipe
>> reaching the 2/3th threshold, not some magical amount of (fake) mm-s.
>>
>> Carlos, Jonas what do you think ?
>
> That would still be possible with a mm based absolute coordinate as we
> can retrieve the physical dimension of the touchpad with
> libinput_device_get_size(). And as long as the driver gives us reasonably
> correct physical dimension data, the mm-s aren't fake; or do you mean
> most drivers lie to us? It'd be better also not to have it simply 1.0 x
> 1.0, as that'd make making a circle on the device result in an ellipse in
> the API.
>
> Since we already do mm-s everywhere, I don't see it that horrible to not
> drop that information here in order for some smart future usage, or at
> least consistency.

Ok, I'll change this to mm for v3 then (just send v2 addressing the other
review comments and adding a core implementation).

Regards,

Hans


More information about the wayland-devel mailing list