From 50ff9d4c7109ee94db4e3141fee32697690716f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 19 Apr 2018 21:51:31 +0200 Subject: [PATCH] wayland: Rename cursor role types Rename the two cursor role types according to the convention used by the other roles. This means that MetaWaylandSurfaceRoleCursor was renamed to MetaWaylandCursorSurface, and MetaWaylandSurfaceRoleTabletCursor was renamed to MetaWaylandTabletCursorSurface. The corresponding filenames were renamed accordingly too. https://gitlab.gnome.org/GNOME/mutter/issues/77 --- src/Makefile.am | 8 +- ...cursor.c => meta-wayland-cursor-surface.c} | 179 +++++++++--------- src/wayland/meta-wayland-cursor-surface.h | 52 +++++ src/wayland/meta-wayland-pointer.c | 22 +-- .../meta-wayland-surface-role-cursor.h | 52 ----- ...c => meta-wayland-tablet-cursor-surface.c} | 17 +- ...h => meta-wayland-tablet-cursor-surface.h} | 18 +- src/wayland/meta-wayland-tablet-tool.c | 22 +-- 8 files changed, 187 insertions(+), 183 deletions(-) rename src/wayland/{meta-wayland-surface-role-cursor.c => meta-wayland-cursor-surface.c} (59%) create mode 100644 src/wayland/meta-wayland-cursor-surface.h delete mode 100644 src/wayland/meta-wayland-surface-role-cursor.h rename src/wayland/{meta-wayland-surface-role-tablet-cursor.c => meta-wayland-tablet-cursor-surface.c} (63%) rename src/wayland/{meta-wayland-surface-role-tablet-cursor.h => meta-wayland-tablet-cursor-surface.h} (59%) diff --git a/src/Makefile.am b/src/Makefile.am index bcb3505c7..84e2dc130 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -431,10 +431,10 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES += \ wayland/meta-wayland-touch.h \ wayland/meta-wayland-surface.c \ wayland/meta-wayland-surface.h \ - wayland/meta-wayland-surface-role-cursor.c \ - wayland/meta-wayland-surface-role-cursor.h \ - wayland/meta-wayland-surface-role-tablet-cursor.c \ - wayland/meta-wayland-surface-role-tablet-cursor.h \ + wayland/meta-wayland-cursor-surface.c \ + wayland/meta-wayland-cursor-surface.h \ + wayland/meta-wayland-tablet-cursor-surface.c \ + wayland/meta-wayland-tablet-cursor-surface.h \ wayland/meta-wayland-actor-surface.c \ wayland/meta-wayland-actor-surface.h \ wayland/meta-wayland-subsurface.c \ diff --git a/src/wayland/meta-wayland-surface-role-cursor.c b/src/wayland/meta-wayland-cursor-surface.c similarity index 59% rename from src/wayland/meta-wayland-surface-role-cursor.c rename to src/wayland/meta-wayland-cursor-surface.c index d118a8917..7013205c0 100644 --- a/src/wayland/meta-wayland-surface-role-cursor.c +++ b/src/wayland/meta-wayland-cursor-surface.c @@ -23,7 +23,7 @@ #include #include -#include "meta-wayland-surface-role-cursor.h" +#include "meta-wayland-cursor-surface.h" #include "meta-wayland-buffer.h" #include "meta-xwayland.h" #include "screen-private.h" @@ -32,9 +32,9 @@ #include "backends/meta-logical-monitor.h" #include "core/boxes-private.h" -typedef struct _MetaWaylandSurfaceRoleCursorPrivate MetaWaylandSurfaceRoleCursorPrivate; +typedef struct _MetaWaylandCursorSurfacePrivate MetaWaylandCursorSurfacePrivate; -struct _MetaWaylandSurfaceRoleCursorPrivate +struct _MetaWaylandCursorSurfacePrivate { int hot_x; int hot_y; @@ -45,15 +45,17 @@ struct _MetaWaylandSurfaceRoleCursorPrivate gulong cursor_painted_handler_id; }; -G_DEFINE_TYPE_WITH_PRIVATE (MetaWaylandSurfaceRoleCursor, - meta_wayland_surface_role_cursor, +G_DEFINE_TYPE_WITH_PRIVATE (MetaWaylandCursorSurface, + meta_wayland_cursor_surface, META_TYPE_WAYLAND_SURFACE_ROLE) static void -update_cursor_sprite_texture (MetaWaylandSurfaceRoleCursor *cursor_role) +update_cursor_sprite_texture (MetaWaylandCursorSurface *cursor_surface) { - MetaWaylandSurfaceRoleCursorPrivate *priv = meta_wayland_surface_role_cursor_get_instance_private (cursor_role); - MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (cursor_role)); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); + MetaWaylandSurface *surface = + meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (cursor_surface)); MetaWaylandBuffer *buffer = meta_wayland_surface_get_buffer (surface); MetaCursorSprite *cursor_sprite = priv->cursor_sprite; @@ -92,12 +94,12 @@ update_cursor_sprite_texture (MetaWaylandSurfaceRoleCursor *cursor_role) } static void -cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite, - int x, - int y, - MetaWaylandSurfaceRoleCursor *cursor_role) +cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite, + int x, + int y, + MetaWaylandCursorSurface *cursor_surface) { - MetaWaylandSurfaceRole *role = META_WAYLAND_SURFACE_ROLE (cursor_role); + MetaWaylandSurfaceRole *role = META_WAYLAND_SURFACE_ROLE (cursor_surface); MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (role); if (!meta_xwayland_is_xwayland_surface (surface)) @@ -126,14 +128,14 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite, } static void -cursor_surface_role_assigned (MetaWaylandSurfaceRole *surface_role) +meta_wayland_cursor_surface_assigned (MetaWaylandSurfaceRole *surface_role) { MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (surface_role); - MetaWaylandSurfaceRoleCursor *cursor_role = - META_WAYLAND_SURFACE_ROLE_CURSOR (surface_role); - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurface *cursor_surface = + META_WAYLAND_CURSOR_SURFACE (surface_role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); wl_list_insert_list (&priv->frame_callbacks, &surface->pending_frame_callback_list); @@ -141,13 +143,13 @@ cursor_surface_role_assigned (MetaWaylandSurfaceRole *surface_role) } static void -cursor_surface_role_pre_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) +meta_wayland_cursor_surface_pre_commit (MetaWaylandSurfaceRole *surface_role, + MetaWaylandPendingState *pending) { - MetaWaylandSurfaceRoleCursor *cursor_role = - META_WAYLAND_SURFACE_ROLE_CURSOR (surface_role); - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurface *cursor_surface = + META_WAYLAND_CURSOR_SURFACE (surface_role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (surface_role); @@ -159,13 +161,13 @@ cursor_surface_role_pre_commit (MetaWaylandSurfaceRole *surface_role, } static void -cursor_surface_role_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) +meta_wayland_cursor_surface_commit (MetaWaylandSurfaceRole *surface_role, + MetaWaylandPendingState *pending) { - MetaWaylandSurfaceRoleCursor *cursor_role = - META_WAYLAND_SURFACE_ROLE_CURSOR (surface_role); - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurface *cursor_surface = + META_WAYLAND_CURSOR_SURFACE (surface_role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (surface_role); MetaWaylandBuffer *buffer = meta_wayland_surface_get_buffer (surface); @@ -182,19 +184,19 @@ cursor_surface_role_commit (MetaWaylandSurfaceRole *surface_role, wl_list_init (&pending->frame_callback_list); if (pending->newly_attached) - update_cursor_sprite_texture (META_WAYLAND_SURFACE_ROLE_CURSOR (surface_role)); + update_cursor_sprite_texture (META_WAYLAND_CURSOR_SURFACE (surface_role)); } static gboolean -cursor_surface_role_is_on_logical_monitor (MetaWaylandSurfaceRole *role, - MetaLogicalMonitor *logical_monitor) +meta_wayland_cursor_surface_is_on_logical_monitor (MetaWaylandSurfaceRole *role, + MetaLogicalMonitor *logical_monitor) { MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (role); - MetaWaylandSurfaceRoleCursor *cursor_role = - META_WAYLAND_SURFACE_ROLE_CURSOR (surface->role); - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurface *cursor_surface = + META_WAYLAND_CURSOR_SURFACE (surface->role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); ClutterPoint point; ClutterRect logical_monitor_rect; @@ -207,12 +209,12 @@ cursor_surface_role_is_on_logical_monitor (MetaWaylandSurfaceRole *role, } static void -cursor_surface_role_dispose (GObject *object) +meta_wayland_cursor_surface_dispose (GObject *object) { - MetaWaylandSurfaceRoleCursor *cursor_role = - META_WAYLAND_SURFACE_ROLE_CURSOR (object); - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurface *cursor_surface = + META_WAYLAND_CURSOR_SURFACE (object); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (object)); MetaWaylandFrameCallback *cb, *next; @@ -221,7 +223,7 @@ cursor_surface_role_dispose (GObject *object) wl_resource_destroy (cb->resource); g_signal_handlers_disconnect_by_func (priv->cursor_sprite, - cursor_sprite_prepare_at, cursor_role); + cursor_sprite_prepare_at, cursor_surface); g_clear_object (&priv->cursor_renderer); g_clear_object (&priv->cursor_sprite); @@ -232,18 +234,18 @@ cursor_surface_role_dispose (GObject *object) g_clear_object (&priv->buffer); } - G_OBJECT_CLASS (meta_wayland_surface_role_cursor_parent_class)->dispose (object); + G_OBJECT_CLASS (meta_wayland_cursor_surface_parent_class)->dispose (object); } static void -cursor_surface_role_constructed (GObject *object) +meta_wayland_cursor_surface_constructed (GObject *object) { - MetaWaylandSurfaceRoleCursor *cursor_role = - META_WAYLAND_SURFACE_ROLE_CURSOR (object); - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurface *cursor_surface = + META_WAYLAND_CURSOR_SURFACE (object); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); MetaWaylandSurfaceRole *surface_role = - META_WAYLAND_SURFACE_ROLE (cursor_role); + META_WAYLAND_SURFACE_ROLE (cursor_surface); MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (surface_role); MetaWaylandBuffer *buffer; @@ -260,10 +262,10 @@ cursor_surface_role_constructed (GObject *object) } static void -meta_wayland_surface_role_cursor_init (MetaWaylandSurfaceRoleCursor *role) +meta_wayland_cursor_surface_init (MetaWaylandCursorSurface *role) { - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (role); priv->cursor_sprite = meta_cursor_sprite_new (); g_signal_connect_object (priv->cursor_sprite, @@ -275,37 +277,38 @@ meta_wayland_surface_role_cursor_init (MetaWaylandSurfaceRoleCursor *role) } static void -meta_wayland_surface_role_cursor_class_init (MetaWaylandSurfaceRoleCursorClass *klass) +meta_wayland_cursor_surface_class_init (MetaWaylandCursorSurfaceClass *klass) { MetaWaylandSurfaceRoleClass *surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); - surface_role_class->assigned = cursor_surface_role_assigned; - surface_role_class->pre_commit = cursor_surface_role_pre_commit; - surface_role_class->commit = cursor_surface_role_commit; - surface_role_class->is_on_logical_monitor = cursor_surface_role_is_on_logical_monitor; + surface_role_class->assigned = meta_wayland_cursor_surface_assigned; + surface_role_class->pre_commit = meta_wayland_cursor_surface_pre_commit; + surface_role_class->commit = meta_wayland_cursor_surface_commit; + surface_role_class->is_on_logical_monitor = + meta_wayland_cursor_surface_is_on_logical_monitor; - object_class->constructed = cursor_surface_role_constructed; - object_class->dispose = cursor_surface_role_dispose; + object_class->constructed = meta_wayland_cursor_surface_constructed; + object_class->dispose = meta_wayland_cursor_surface_dispose; } MetaCursorSprite * -meta_wayland_surface_role_cursor_get_sprite (MetaWaylandSurfaceRoleCursor *cursor_role) +meta_wayland_cursor_surface_get_sprite (MetaWaylandCursorSurface *cursor_surface) { - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); return priv->cursor_sprite; } void -meta_wayland_surface_role_cursor_set_hotspot (MetaWaylandSurfaceRoleCursor *cursor_role, - gint hotspot_x, - gint hotspot_y) +meta_wayland_cursor_surface_set_hotspot (MetaWaylandCursorSurface *cursor_surface, + int hotspot_x, + int hotspot_y) { - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); if (priv->hot_x == hotspot_x && priv->hot_y == hotspot_y) @@ -313,16 +316,16 @@ meta_wayland_surface_role_cursor_set_hotspot (MetaWaylandSurfaceRoleCursor *curs priv->hot_x = hotspot_x; priv->hot_y = hotspot_y; - update_cursor_sprite_texture (cursor_role); + update_cursor_sprite_texture (cursor_surface); } void -meta_wayland_surface_role_cursor_get_hotspot (MetaWaylandSurfaceRoleCursor *cursor_role, - gint *hotspot_x, - gint *hotspot_y) +meta_wayland_cursor_surface_get_hotspot (MetaWaylandCursorSurface *cursor_surface, + int *hotspot_x, + int *hotspot_y) { - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); if (hotspot_x) *hotspot_x = priv->hot_x; @@ -331,12 +334,12 @@ meta_wayland_surface_role_cursor_get_hotspot (MetaWaylandSurfaceRoleCursor *curs } static void -on_cursor_painted (MetaCursorRenderer *renderer, - MetaCursorSprite *displayed_sprite, - MetaWaylandSurfaceRoleCursor *cursor_role) +on_cursor_painted (MetaCursorRenderer *renderer, + MetaCursorSprite *displayed_sprite, + MetaWaylandCursorSurface *cursor_surface) { - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); guint32 time = (guint32) (g_get_monotonic_time () / 1000); if (displayed_sprite != priv->cursor_sprite) @@ -353,11 +356,11 @@ on_cursor_painted (MetaCursorRenderer *renderer, } void -meta_wayland_surface_role_cursor_set_renderer (MetaWaylandSurfaceRoleCursor *cursor_role, - MetaCursorRenderer *renderer) +meta_wayland_cursor_surface_set_renderer (MetaWaylandCursorSurface *cursor_surface, + MetaCursorRenderer *renderer) { - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); if (priv->cursor_renderer == renderer) return; @@ -373,19 +376,19 @@ meta_wayland_surface_role_cursor_set_renderer (MetaWaylandSurfaceRoleCursor *cur { priv->cursor_painted_handler_id = g_signal_connect_object (renderer, "cursor-painted", - G_CALLBACK (on_cursor_painted), cursor_role, 0); + G_CALLBACK (on_cursor_painted), cursor_surface, 0); g_object_ref (renderer); } priv->cursor_renderer = renderer; - update_cursor_sprite_texture (cursor_role); + update_cursor_sprite_texture (cursor_surface); } MetaCursorRenderer * -meta_wayland_surface_role_cursor_get_renderer (MetaWaylandSurfaceRoleCursor *cursor_role) +meta_wayland_cursor_surface_get_renderer (MetaWaylandCursorSurface *cursor_surface) { - MetaWaylandSurfaceRoleCursorPrivate *priv = - meta_wayland_surface_role_cursor_get_instance_private (cursor_role); + MetaWaylandCursorSurfacePrivate *priv = + meta_wayland_cursor_surface_get_instance_private (cursor_surface); return priv->cursor_renderer; } diff --git a/src/wayland/meta-wayland-cursor-surface.h b/src/wayland/meta-wayland-cursor-surface.h new file mode 100644 index 000000000..2461a85b3 --- /dev/null +++ b/src/wayland/meta-wayland-cursor-surface.h @@ -0,0 +1,52 @@ +/* + * Wayland Support + * + * Copyright (C) 2015 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef META_WAYLAND_CURSOR_SURFACE_H +#define META_WAYLAND_CURSOR_SURFACE_H + +#include "meta-wayland-surface.h" +#include "backends/meta-cursor-renderer.h" + +struct _MetaWaylandCursorSurfaceClass +{ + MetaWaylandSurfaceRoleClass parent_class; +}; + +#define META_TYPE_WAYLAND_CURSOR_SURFACE (meta_wayland_cursor_surface_get_type ()) +G_DECLARE_DERIVABLE_TYPE (MetaWaylandCursorSurface, + meta_wayland_cursor_surface, + META, WAYLAND_CURSOR_SURFACE, + MetaWaylandSurfaceRole); + +MetaCursorSprite * meta_wayland_cursor_surface_get_sprite (MetaWaylandCursorSurface *cursor_surface); + +void meta_wayland_cursor_surface_set_hotspot (MetaWaylandCursorSurface *cursor_surface, + int hotspot_x, + int hotspot_y); +void meta_wayland_cursor_surface_get_hotspot (MetaWaylandCursorSurface *cursor_surface, + int *hotspot_x, + int *hotspot_y); +void meta_wayland_cursor_surface_set_renderer (MetaWaylandCursorSurface *cursor_surface, + MetaCursorRenderer *renderer); +MetaCursorRenderer * meta_wayland_cursor_surface_get_renderer (MetaWaylandCursorSurface *cursor_surface); + + +#endif /* META_WAYLAND_CURSOR_SURFACE_H */ diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index d5c90c169..e8138576e 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -55,7 +55,7 @@ #include "meta-wayland-seat.h" #include "meta-wayland-surface.h" #include "meta-wayland-buffer.h" -#include "meta-wayland-surface-role-cursor.h" +#include "meta-wayland-cursor-surface.h" #include "meta-xwayland.h" #include "meta-cursor.h" #include "meta-cursor-tracker-private.h" @@ -1025,10 +1025,10 @@ meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer) if (pointer->cursor_surface) { - MetaWaylandSurfaceRoleCursor *cursor_role = - META_WAYLAND_SURFACE_ROLE_CURSOR (pointer->cursor_surface->role); + MetaWaylandCursorSurface *cursor_surface = + META_WAYLAND_CURSOR_SURFACE (pointer->cursor_surface->role); - cursor_sprite = meta_wayland_surface_role_cursor_get_sprite (cursor_role); + cursor_sprite = meta_wayland_cursor_surface_get_sprite (cursor_surface); } meta_cursor_tracker_set_window_cursor (cursor_tracker, cursor_sprite); @@ -1102,7 +1102,7 @@ pointer_set_cursor (struct wl_client *client, if (surface && !meta_wayland_surface_assign_role (surface, - META_TYPE_WAYLAND_SURFACE_ROLE_CURSOR, + META_TYPE_WAYLAND_CURSOR_SURFACE, NULL)) { wl_resource_post_error (resource, WL_POINTER_ERROR_ROLE, @@ -1115,13 +1115,13 @@ pointer_set_cursor (struct wl_client *client, { MetaCursorRenderer *cursor_renderer = meta_backend_get_cursor_renderer (meta_get_backend ()); - MetaWaylandSurfaceRoleCursor *cursor_role; + MetaWaylandCursorSurface *cursor_surface; - cursor_role = META_WAYLAND_SURFACE_ROLE_CURSOR (surface->role); - meta_wayland_surface_role_cursor_set_renderer (cursor_role, - cursor_renderer); - meta_wayland_surface_role_cursor_set_hotspot (cursor_role, - hot_x, hot_y); + cursor_surface = META_WAYLAND_CURSOR_SURFACE (surface->role); + meta_wayland_cursor_surface_set_renderer (cursor_surface, + cursor_renderer); + meta_wayland_cursor_surface_set_hotspot (cursor_surface, + hot_x, hot_y); } meta_wayland_pointer_set_cursor_surface (pointer, surface); diff --git a/src/wayland/meta-wayland-surface-role-cursor.h b/src/wayland/meta-wayland-surface-role-cursor.h deleted file mode 100644 index b6d6d4a6a..000000000 --- a/src/wayland/meta-wayland-surface-role-cursor.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Wayland Support - * - * Copyright (C) 2015 Red Hat, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef META_WAYLAND_SURFACE_ROLE_CURSOR_H -#define META_WAYLAND_SURFACE_ROLE_CURSOR_H - -#include "meta-wayland-surface.h" -#include "backends/meta-cursor-renderer.h" - -struct _MetaWaylandSurfaceRoleCursorClass -{ - MetaWaylandSurfaceRoleClass parent_class; -}; - -#define META_TYPE_WAYLAND_SURFACE_ROLE_CURSOR (meta_wayland_surface_role_cursor_get_type ()) -G_DECLARE_DERIVABLE_TYPE (MetaWaylandSurfaceRoleCursor, - meta_wayland_surface_role_cursor, - META, WAYLAND_SURFACE_ROLE_CURSOR, - MetaWaylandSurfaceRole); - -MetaCursorSprite * meta_wayland_surface_role_cursor_get_sprite (MetaWaylandSurfaceRoleCursor *cursor_role); - -void meta_wayland_surface_role_cursor_set_hotspot (MetaWaylandSurfaceRoleCursor *cursor_role, - gint hotspot_x, - gint hotspot_y); -void meta_wayland_surface_role_cursor_get_hotspot (MetaWaylandSurfaceRoleCursor *cursor_role, - gint *hotspot_x, - gint *hotspot_y); -void meta_wayland_surface_role_cursor_set_renderer (MetaWaylandSurfaceRoleCursor *cursor_role, - MetaCursorRenderer *renderer); -MetaCursorRenderer * meta_wayland_surface_role_cursor_get_renderer (MetaWaylandSurfaceRoleCursor *cursor_role); - - -#endif /* META_WAYLAND_SURFACE_ROLE_CURSOR_H */ diff --git a/src/wayland/meta-wayland-surface-role-tablet-cursor.c b/src/wayland/meta-wayland-tablet-cursor-surface.c similarity index 63% rename from src/wayland/meta-wayland-surface-role-tablet-cursor.c rename to src/wayland/meta-wayland-tablet-cursor-surface.c index 075a5e4f6..808bf2820 100644 --- a/src/wayland/meta-wayland-surface-role-tablet-cursor.c +++ b/src/wayland/meta-wayland-tablet-cursor-surface.c @@ -20,23 +20,24 @@ */ #include "config.h" -#include "meta-wayland-surface-role-tablet-cursor.h" -struct _MetaWaylandSurfaceRoleTabletCursor +#include "meta-wayland-tablet-cursor-surface.h" + +struct _MetaWaylandTabletCursorSurface { - MetaWaylandSurfaceRoleCursor parent; + MetaWaylandCursorSurface parent; }; -G_DEFINE_TYPE (MetaWaylandSurfaceRoleTabletCursor, - meta_wayland_surface_role_tablet_cursor, - META_TYPE_WAYLAND_SURFACE_ROLE_CURSOR) +G_DEFINE_TYPE (MetaWaylandTabletCursorSurface, + meta_wayland_tablet_cursor_surface, + META_TYPE_WAYLAND_CURSOR_SURFACE) static void -meta_wayland_surface_role_tablet_cursor_init (MetaWaylandSurfaceRoleTabletCursor *role) +meta_wayland_tablet_cursor_surface_init (MetaWaylandTabletCursorSurface *role) { } static void -meta_wayland_surface_role_tablet_cursor_class_init (MetaWaylandSurfaceRoleTabletCursorClass *klass) +meta_wayland_tablet_cursor_surface_class_init (MetaWaylandTabletCursorSurfaceClass *klass) { } diff --git a/src/wayland/meta-wayland-surface-role-tablet-cursor.h b/src/wayland/meta-wayland-tablet-cursor-surface.h similarity index 59% rename from src/wayland/meta-wayland-surface-role-tablet-cursor.h rename to src/wayland/meta-wayland-tablet-cursor-surface.h index 69fc6cf0f..5c5c198f5 100644 --- a/src/wayland/meta-wayland-surface-role-tablet-cursor.h +++ b/src/wayland/meta-wayland-tablet-cursor-surface.h @@ -19,15 +19,15 @@ * 02111-1307, USA. */ -#ifndef META_WAYLAND_SURFACE_ROLE_TABLET_CURSOR_H -#define META_WAYLAND_SURFACE_ROLE_TABLET_CURSOR_H +#ifndef META_WAYLAND_TABLET_CURSOR_SURFACE_H +#define META_WAYLAND_TABLET_CURSOR_SURFACE_H -#include "meta-wayland-surface-role-cursor.h" +#include "meta-wayland-cursor-surface.h" -#define META_TYPE_WAYLAND_SURFACE_ROLE_TABLET_CURSOR (meta_wayland_surface_role_tablet_cursor_get_type ()) -G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleTabletCursor, - meta_wayland_surface_role_tablet_cursor, - META, WAYLAND_SURFACE_ROLE_TABLET_CURSOR, - MetaWaylandSurfaceRoleCursor); +#define META_TYPE_WAYLAND_TABLET_CURSOR_SURFACE (meta_wayland_tablet_cursor_surface_get_type ()) +G_DECLARE_FINAL_TYPE (MetaWaylandTabletCursorSurface, + meta_wayland_tablet_cursor_surface, + META, WAYLAND_TABLET_CURSOR_SURFACE, + MetaWaylandCursorSurface) -#endif /* META_WAYLAND_SURFACE_ROLE_TABLET_CURSOR_H */ +#endif /* META_WAYLAND_TABLET_CURSOR_SURFACE_H */ diff --git a/src/wayland/meta-wayland-tablet-tool.c b/src/wayland/meta-wayland-tablet-tool.c index 1ea685ed6..c1858d9c7 100644 --- a/src/wayland/meta-wayland-tablet-tool.c +++ b/src/wayland/meta-wayland-tablet-tool.c @@ -31,7 +31,7 @@ #include #include "tablet-unstable-v2-server-protocol.h" #include "meta-wayland-private.h" -#include "meta-wayland-surface-role-tablet-cursor.h" +#include "meta-wayland-tablet-cursor-surface.h" #include "meta-surface-actor-wayland.h" #include "meta-wayland-tablet.h" #include "meta-wayland-tablet-seat.h" @@ -90,10 +90,10 @@ meta_wayland_tablet_tool_update_cursor_surface (MetaWaylandTabletTool *tool) if (tool->cursor_surface && meta_wayland_surface_get_buffer (tool->cursor_surface)) { - MetaWaylandSurfaceRoleCursor *cursor_role = - META_WAYLAND_SURFACE_ROLE_CURSOR (tool->cursor_surface->role); + MetaWaylandCursorSurface *cursor_surface = + META_WAYLAND_CURSOR_SURFACE (tool->cursor_surface->role); - cursor = meta_wayland_surface_role_cursor_get_sprite (cursor_role); + cursor = meta_wayland_cursor_surface_get_sprite (cursor_surface); } else cursor = NULL; @@ -471,7 +471,7 @@ tool_set_cursor (struct wl_client *client, if (surface && !meta_wayland_surface_assign_role (surface, - META_TYPE_WAYLAND_SURFACE_ROLE_TABLET_CURSOR, + META_TYPE_WAYLAND_TABLET_CURSOR_SURFACE, NULL)) { wl_resource_post_error (resource, WL_POINTER_ERROR_ROLE, @@ -482,13 +482,13 @@ tool_set_cursor (struct wl_client *client, if (surface) { - MetaWaylandSurfaceRoleCursor *cursor_role; + MetaWaylandCursorSurface *cursor_surface; - cursor_role = META_WAYLAND_SURFACE_ROLE_CURSOR (surface->role); - meta_wayland_surface_role_cursor_set_renderer (cursor_role, - tool->cursor_renderer); - meta_wayland_surface_role_cursor_set_hotspot (cursor_role, - hotspot_x, hotspot_y); + cursor_surface = META_WAYLAND_CURSOR_SURFACE (surface->role); + meta_wayland_cursor_surface_set_renderer (cursor_surface, + tool->cursor_renderer); + meta_wayland_cursor_surface_set_hotspot (cursor_surface, + hotspot_x, hotspot_y); } meta_wayland_tablet_tool_set_cursor_surface (tool, surface);