[mutter] wayland: Move cursor surface role to meta-wayland-pointer.c
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Move cursor surface role to meta-wayland-pointer.c
- Date: Sun, 13 Sep 2015 13:28:03 +0000 (UTC)
commit 7c7cf91c322923056532279ca316635ed406cacf
Author: Jonas Ådahl <jadahl gmail com>
Date: Fri Jul 17 22:02:15 2015 +0800
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
src/wayland/meta-wayland-pointer.c | 48 ++++++++++++++++++++++++++++++++++
src/wayland/meta-wayland-pointer.h | 7 +++++
src/wayland/meta-wayland-seat.c | 9 ------
src/wayland/meta-wayland-seat.h | 1 -
src/wayland/meta-wayland-surface.c | 50 ++++++-----------------------------
src/wayland/meta-wayland-surface.h | 8 +----
6 files changed, 66 insertions(+), 57 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index f4297e3..22ccfec 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 8d0cb10..95cf5fd 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 58f2697..e92ee35 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 28034f3..c0768ec 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 5277e71..0a2a21a 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 4962239..c0ce8fd 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]