[PATCH weston] compositor: Support notifying with absolute position too
Daniel Stone
daniel at fooishbar.org
Mon Apr 1 07:33:41 PDT 2013
Hi,
On 1 April 2013 15:02, Eoff, Ullysses A <ullysses.a.eoff at intel.com> wrote:
>
> I already submitted http://lists.freedesktop.org/archives/wayland-devel/2013-March/008103.html that does this same thing... except that it preserved the relative "move_pointer" logic.
One problem I can see with this is co-ordinate scaling. This seems to
assume that the driver which feeds events in will take care of scaling
from (almost always high-resolution) device co-ordinates, to the
co-ordinate space formed by the union of all outputs.
I think what we almost always want for absolute devices is to bind
them to one output rather than all of them, and also to have the core
perform the scaling, so the device code doesn't need to be aware of
outputs and their configurations (and rotation, and, and, and).
Cheers,
Daniel
> -----Original Message-----
> From: wayland-devel-bounces+ullysses.a.eoff=intel.com at lists.freedesktop.org [mailto:wayland-devel-bounces+ullysses.a.eoff=intel.com at lists.freedesktop.org] On Behalf Of Bill Spitzak
> Sent: Wednesday, March 27, 2013 12:24 PM
> To: Bradford, Robert
> Cc: wayland-devel at lists.freedesktop.org
> Subject: Re: [PATCH weston] compositor: Support notifying with absolute position too
>
> Looks like there is a lot of duplicated code between notify_motion and
> notify_motion_absolute.
>
> It might be better to have notify_motion just add pointer->x and
> pointer->y and call notify_motion_absolute, and put all the shared
> logic, and possibly all of move_pointer(), into that.
>
> Rob Bradford wrote:
> > From: Rob Bradford <rob at linux.intel.com>
> >
> > With evdev input devices that generate absolute positions we need to provide
> > an infrastructure in the compositor for supporting those.
> >
> > Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=61997
> > ---
> > src/compositor.c | 25 ++++++++++++++++++++-----
> > src/compositor.h | 5 ++++-
> > src/evdev.c | 2 +-
> > 3 files changed, 25 insertions(+), 7 deletions(-)
> >
> > diff --git a/src/compositor.c b/src/compositor.c
> > index 3e24295..d339472 100644
> > --- a/src/compositor.c
> > +++ b/src/compositor.c
> > @@ -1782,17 +1782,15 @@ clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy)
> > }
> > }
> >
> > +/* Takes absolute values */
> > static void
> > -move_pointer(struct weston_seat *seat, wl_fixed_t dx, wl_fixed_t dy)
> > +move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y)
> > {
> > struct weston_compositor *ec = seat->compositor;
> > struct wl_pointer *pointer = seat->seat.pointer;
> > struct weston_output *output;
> > - wl_fixed_t x, y;
> > int32_t ix, iy;
> >
> > - x = pointer->x + dx;
> > - y = pointer->y + dy;
> > clip_pointer_motion(seat, &x, &y);
> >
> > weston_seat_update_drag_surface(seat, x - pointer->x, y - pointer->y);
> > @@ -1829,7 +1827,24 @@ notify_motion(struct weston_seat *seat,
> >
> > weston_compositor_wake(ec);
> >
> > - move_pointer(seat, dx, dy);
> > + move_pointer(seat, pointer->x + dx, pointer->y + dy);
> > +
> > + interface = pointer->grab->interface;
> > + interface->motion(pointer->grab, time,
> > + pointer->grab->x, pointer->grab->y);
> > +}
> > +
> > +WL_EXPORT void
> > +notify_motion_absolute(struct weston_seat *seat,
> > + uint32_t time, wl_fixed_t x, wl_fixed_t y)
> > +{
> > + const struct wl_pointer_grab_interface *interface;
> > + struct weston_compositor *ec = seat->compositor;
> > + struct wl_pointer *pointer = seat->seat.pointer;
> > +
> > + weston_compositor_wake(ec);
> > +
> > + move_pointer(seat, x, y);
> >
> > interface = pointer->grab->interface;
> > interface->motion(pointer->grab, time,
> > diff --git a/src/compositor.h b/src/compositor.h
> > index 4cc24d8..dc03aeb 100644
> > --- a/src/compositor.h
> > +++ b/src/compositor.h
> > @@ -556,7 +556,10 @@ weston_surface_activate(struct weston_surface *surface,
> > struct weston_seat *seat);
> > void
> > notify_motion(struct weston_seat *seat, uint32_t time,
> > - wl_fixed_t x, wl_fixed_t y);
> > + wl_fixed_t dx, wl_fixed_t dy);
> > +void
> > +notify_motion_absolute(struct weston_seat *seat, uint32_t time,
> > + wl_fixed_t x, wl_fixed_t y);
> > void
> > notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
> > enum wl_pointer_button_state state);
> > diff --git a/src/evdev.c b/src/evdev.c
> > index d2954b5..2c81d2b 100644
> > --- a/src/evdev.c
> > +++ b/src/evdev.c
> > @@ -284,7 +284,7 @@ evdev_flush_motion(struct evdev_device *device, uint32_t time)
> > }
> > if (device->pending_events & EVDEV_ABSOLUTE_MOTION) {
> > transform_absolute(device);
> > - notify_motion(master, time,
> > + notify_motion_absolute(master, time,
> > wl_fixed_from_int(device->abs.x),
> > wl_fixed_from_int(device->abs.y));
> > device->pending_events &= ~EVDEV_ABSOLUTE_MOTION;
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list