[PATCH wayland] protocol: Add pointer gestures (swipe/pinch) protocol
jadahl at gmail.com
Thu Jul 16 18:06:45 PDT 2015
On Thu, Jul 16, 2015 at 08:17:44PM +0200, Carlos Garnacho wrote:
> Hey Jonas :),
> On Thu, Jul 16, 2015 at 3:15 AM, Jonas Ådahl <jadahl at gmail.com> wrote:
> > On Wed, Jul 15, 2015 at 08:02:10PM +0200, Carlos Garnacho wrote:
> >> The lifetime and progress of gestures is maintained by the separate
> >> wl_pointer_gesture_pinch and wl_pointer_gesture_swipe interfaces,
> >> each of these has begin/update(optional)/end phases, as transmitted
> >> by their events.
> >> The gesture interfaces can be obtained from the wl_pointer, and
> >> must be interpreted on the last surface entered by the pointer,
> >> starting from the pointer coordinates.
> > Without having looked at the protocol details, did you consider whether
> > we should put this in weston first, as done with other non-trivial
> > protocol extensions (like wl_subcompositor, wl_relative_pointer,
> > wl_scalar, wl_text_input etc)? It might sure it should belong in
> > wl_pointer as well. We should try to avoid putting things in the core
> > objects when it doesn't make perfect sense, and in this case, I think
> > adding it as an optional extension seems reasonable.
> Peter actually started out like that, with the pinch/gesture
> interfaces being taken from a wl_gestures global. I'm not opposed to
> the idea, but the extra indirection between pointer event handling and
> a global that's just loosely related to the seat struck as weird to me
> when getting my hands in the code, hence the early short-circuit into
Having a wl_gestures where you do, just as in your current proposal,
extend wl_pointer with gesture data, would work just the same and is how
extensions in Wayland generally work. The difference would be that
instead of a 'get_swipe_gesture' that takes no argument, you'd pass a
wl_pointer. This way you'd get the benefit of making it obvious that you
actualy extend the pointer, and that it shares focus etc.
One major reason for not just putting more and more things into
wl_pointer, wl_surface, wl_seat etc, we will sooner or later end up with
protocol dept, i.e. legacy requests and events we will never ever be able
to remove. If we put additions that will have the slightest chance of
ever changing (like any non-trivial addition) and especially additions
that are quite isolated, I think it makes more sense to add them as
extensions instead of required functionality.
Also worth mentioning is that all backends might not be able to
implement gestures. Such backends will, instead of simply not exposing
the extension, have to implement non-working gesture objects.
> Convenience-wise, I'm concerned about having to support multiple
> versions/namespaces of the protocol if we start out like that and this
> is deemed part of wayland.xml someday in a later future. Although if
> it does help on an early adoption, sure...
IMHO that is a reasonable pain to endure.
More information about the wayland-devel