summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2015-07-17 22:02:15 +0800
committerJonas Ådahl <jadahl@gmail.com>2015-09-13 21:26:22 +0800
commit7c7cf91c322923056532279ca316635ed406cacf (patch)
treec1c2088f705e2ffc4e34621b44b9df8f94962e4d
parente407f5bbaeb832177fc62b1b8eca62e74d5b30a4 (diff)
downloadmutter-7c7cf91c322923056532279ca316635ed406cacf.tar.gz
wayland: Move cursor surface role to meta-wayland-pointer.c
The wl_pointer assigns a role to a wl_surface, so it makes sense to put the related logic there. https://bugzilla.gnome.org/show_bug.cgi?id=744932
-rw-r--r--src/wayland/meta-wayland-pointer.c48
-rw-r--r--src/wayland/meta-wayland-pointer.h7
-rw-r--r--src/wayland/meta-wayland-seat.c9
-rw-r--r--src/wayland/meta-wayland-seat.h1
-rw-r--r--src/wayland/meta-wayland-surface.c50
-rw-r--r--src/wayland/meta-wayland-surface.h8
6 files changed, 66 insertions, 57 deletions
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index f4297e3a7..22ccfec0a 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -58,6 +58,16 @@
#define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int (10)
+struct _MetaWaylandSurfaceRoleCursor
+{
+ MetaWaylandSurfaceRole parent;
+};
+
+GType meta_wayland_surface_role_cursor_get_type (void) G_GNUC_CONST;
+G_DEFINE_TYPE (MetaWaylandSurfaceRoleCursor,
+ meta_wayland_surface_role_cursor,
+ META_TYPE_WAYLAND_SURFACE_ROLE);
+
static MetaWaylandPointerClient *
meta_wayland_pointer_client_new (void)
{
@@ -851,3 +861,41 @@ meta_wayland_pointer_get_top_popup (MetaWaylandPointer *pointer)
grab = (MetaWaylandPopupGrab*)pointer->grab;
return meta_wayland_popup_grab_get_top_popup(grab);
}
+
+static void
+cursor_surface_role_assigned (MetaWaylandSurfaceRole *surface_role)
+{
+ MetaWaylandSurface *surface =
+ meta_wayland_surface_role_get_surface (surface_role);
+
+ meta_wayland_surface_queue_pending_frame_callbacks (surface);
+}
+
+static void
+cursor_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
+ MetaWaylandPendingState *pending)
+{
+ MetaWaylandSurface *surface =
+ meta_wayland_surface_role_get_surface (surface_role);
+ MetaWaylandPointer *pointer = &surface->compositor->seat->pointer;
+
+ meta_wayland_surface_queue_pending_state_frame_callbacks (surface, pending);
+
+ if (pending->newly_attached)
+ meta_wayland_pointer_update_cursor_surface (pointer);
+}
+
+static void
+meta_wayland_surface_role_cursor_init (MetaWaylandSurfaceRoleCursor *role)
+{
+}
+
+static void
+meta_wayland_surface_role_cursor_class_init (MetaWaylandSurfaceRoleCursorClass *klass)
+{
+ MetaWaylandSurfaceRoleClass *surface_role_class =
+ META_WAYLAND_SURFACE_ROLE_CLASS (klass);
+
+ surface_role_class->assigned = cursor_surface_role_assigned;
+ surface_role_class->commit = cursor_surface_role_commit;
+}
diff --git a/src/wayland/meta-wayland-pointer.h b/src/wayland/meta-wayland-pointer.h
index 8d0cb102e..95cf5fd76 100644
--- a/src/wayland/meta-wayland-pointer.h
+++ b/src/wayland/meta-wayland-pointer.h
@@ -27,9 +27,16 @@
#include "meta-wayland-types.h"
#include "meta-wayland-pointer-gesture-swipe.h"
#include "meta-wayland-pointer-gesture-pinch.h"
+#include "meta-wayland-surface.h"
#include <meta/meta-cursor-tracker.h>
+#define META_TYPE_WAYLAND_SURFACE_ROLE_CURSOR (meta_wayland_surface_role_cursor_get_type ())
+G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleCursor,
+ meta_wayland_surface_role_cursor,
+ META, WAYLAND_SURFACE_ROLE_CURSOR,
+ MetaWaylandSurfaceRole);
+
struct _MetaWaylandPointerGrabInterface
{
void (*focus) (MetaWaylandPointerGrab *grab,
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 58f2697b0..e92ee35fc 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -372,15 +372,6 @@ meta_wayland_seat_set_input_focus (MetaWaylandSeat *seat,
meta_wayland_data_device_set_keyboard_focus (&seat->data_device);
}
-void
-meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat)
-{
- if ((seat->capabilities & WL_SEAT_CAPABILITY_POINTER) == 0)
- return;
-
- meta_wayland_pointer_update_cursor_surface (&seat->pointer);
-}
-
gboolean
meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
MetaWaylandSurface *surface,
diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h
index 28034f34a..c0768ec35 100644
--- a/src/wayland/meta-wayland-seat.h
+++ b/src/wayland/meta-wayland-seat.h
@@ -58,7 +58,6 @@ void meta_wayland_seat_set_input_focus (MetaWaylandSeat *seat,
MetaWaylandSurface *surface);
void meta_wayland_seat_repick (MetaWaylandSeat *seat);
-void meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat);
gboolean meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
MetaWaylandSurface *surface,
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 5277e7128..0a2a21a39 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -122,16 +122,6 @@ G_DEFINE_TYPE (MetaWaylandSurfaceRoleWlShellSurface,
meta_wayland_surface_role_wl_shell_surface,
META_TYPE_WAYLAND_SURFACE_ROLE);
-struct _MetaWaylandSurfaceRoleCursor
-{
- MetaWaylandSurfaceRole parent;
-};
-
-GType meta_wayland_surface_role_cursor_get_type (void) G_GNUC_CONST;
-G_DEFINE_TYPE (MetaWaylandSurfaceRoleCursor,
- meta_wayland_surface_role_cursor,
- META_TYPE_WAYLAND_SURFACE_ROLE);
-
struct _MetaWaylandSurfaceRoleDND
{
MetaWaylandSurfaceRole parent;
@@ -268,19 +258,6 @@ meta_wayland_surface_queue_pending_state_frame_callbacks (MetaWaylandSurface
}
static void
-cursor_surface_commit (MetaWaylandSurfaceRole *surface_role,
- MetaWaylandPendingState *pending)
-{
- MetaWaylandSurface *surface =
- meta_wayland_surface_role_get_surface (surface_role);
-
- meta_wayland_surface_queue_pending_state_frame_callbacks (surface, pending);
-
- if (pending->newly_attached)
- meta_wayland_seat_update_cursor_surface (surface->compositor->seat);
-}
-
-static void
dnd_surface_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandPendingState *pending)
{
@@ -2488,15 +2465,21 @@ meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRole *role)
return priv->surface;
}
+void
+meta_wayland_surface_queue_pending_frame_callbacks (MetaWaylandSurface *surface)
+{
+ wl_list_insert_list (&surface->compositor->frame_callbacks,
+ &surface->pending_frame_callback_list);
+ wl_list_init (&surface->pending_frame_callback_list);
+}
+
static void
default_role_assigned (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
- wl_list_insert_list (&surface->compositor->frame_callbacks,
- &surface->pending_frame_callback_list);
- wl_list_init (&surface->pending_frame_callback_list);
+ meta_wayland_surface_queue_pending_frame_callbacks (surface);
}
static void
@@ -2513,21 +2496,6 @@ actor_surface_assigned (MetaWaylandSurfaceRole *surface_role)
}
static void
-meta_wayland_surface_role_cursor_init (MetaWaylandSurfaceRoleCursor *role)
-{
-}
-
-static void
-meta_wayland_surface_role_cursor_class_init (MetaWaylandSurfaceRoleCursorClass *klass)
-{
- MetaWaylandSurfaceRoleClass *surface_role_class =
- META_WAYLAND_SURFACE_ROLE_CLASS (klass);
-
- surface_role_class->assigned = default_role_assigned;
- surface_role_class->commit = cursor_surface_commit;
-}
-
-static void
meta_wayland_surface_role_dnd_init (MetaWaylandSurfaceRoleDND *role)
{
}
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index 49622394a..c0ce8fd40 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -84,12 +84,6 @@ G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleWlShellSurface,
META, WAYLAND_SURFACE_ROLE_WL_SHELL_SURFACE,
MetaWaylandSurfaceRole);
-#define META_TYPE_WAYLAND_SURFACE_ROLE_CURSOR (meta_wayland_surface_role_cursor_get_type ())
-G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleCursor,
- meta_wayland_surface_role_cursor,
- META, WAYLAND_SURFACE_ROLE_CURSOR,
- MetaWaylandSurfaceRole);
-
#define META_TYPE_WAYLAND_SURFACE_ROLE_DND (meta_wayland_surface_role_dnd_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleDND,
meta_wayland_surface_role_dnd,
@@ -251,6 +245,8 @@ void meta_wayland_surface_update_outputs (MetaWaylandSurface *sur
MetaWindow * meta_wayland_surface_get_toplevel_window (MetaWaylandSurface *surface);
+void meta_wayland_surface_queue_pending_frame_callbacks (MetaWaylandSurface *surface);
+
void meta_wayland_surface_queue_pending_state_frame_callbacks (MetaWaylandSurface *surface,
MetaWaylandPendingState *pending);