wayland: heavily refactor pointer grabs

Grabs are now slice allocated structures that are handled by
whoever starts the grab. They contain a generic grab structure
with the interface and a backpointer to the MetaWaylandPointer.
The grab interface has been changed to pass full clutter events,
which allowed to remove the confusion between grab->focus and
pointer->focus. Invidual grabs are now required to keep their
focus, and choose whoever gets the events.

https://bugzilla.gnome.org/show_bug.cgi?id=707863
This commit is contained in:
Giovanni Campagna
2013-09-11 14:06:05 +02:00
parent 76e2455d1b
commit 776a86a65f
7 changed files with 378 additions and 422 deletions

View File

@ -28,22 +28,19 @@
struct _MetaWaylandPointerGrabInterface
{
void (*focus) (MetaWaylandPointerGrab * grab,
MetaWaylandSurface * surface, wl_fixed_t x, wl_fixed_t y);
void (*motion) (MetaWaylandPointerGrab * grab,
uint32_t time, wl_fixed_t x, wl_fixed_t y);
void (*button) (MetaWaylandPointerGrab * grab,
uint32_t time, uint32_t button, uint32_t state);
void (*focus) (MetaWaylandPointerGrab *grab,
MetaWaylandSurface *surface,
const ClutterEvent *event);
void (*motion) (MetaWaylandPointerGrab *grab,
const ClutterEvent *event);
void (*button) (MetaWaylandPointerGrab *grab,
const ClutterEvent *event);
};
struct _MetaWaylandPointerGrab
{
const MetaWaylandPointerGrabInterface *interface;
MetaWaylandPointer *pointer;
MetaWaylandSurface *focus;
wl_fixed_t x, y;
struct wl_listener focus_destroy_listener;
};
struct _MetaWaylandPointer
@ -59,6 +56,7 @@ struct _MetaWaylandPointer
MetaWaylandPointerGrab *grab;
MetaWaylandPointerGrab default_grab;
wl_fixed_t grab_x, grab_y;
wl_fixed_t focus_x, focus_y;
guint32 grab_button;
guint32 grab_serial;
guint32 grab_time;
@ -80,10 +78,7 @@ meta_wayland_pointer_release (MetaWaylandPointer *pointer);
void
meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
MetaWaylandSurface *surface,
wl_fixed_t sx,
wl_fixed_t sy);
MetaWaylandSurface *surface);
void
meta_wayland_pointer_destroy_focus (MetaWaylandPointer *pointer);
@ -107,4 +102,10 @@ void
meta_wayland_pointer_set_current (MetaWaylandPointer *pointer,
MetaWaylandSurface *surface);
void
meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
MetaWaylandSurface *surface,
wl_fixed_t *x,
wl_fixed_t *y);
#endif /* __META_WAYLAND_POINTER_H__ */