wayland: GObject:ify surface roles

Make a surface roles into objects with vfuncs for things where there
before was a big switch statement. The declaration and definition
boilerplate is hidden behind C macros.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
This commit is contained in:
Jonas Ådahl
2015-07-08 16:14:00 +08:00
parent 8e5fb03611
commit 83c17134f1
6 changed files with 474 additions and 125 deletions

View File

@ -774,16 +774,14 @@ pointer_set_cursor (struct wl_client *client,
if (pointer->focus_serial - serial > G_MAXUINT32 / 2)
return;
if (surface)
if (surface &&
!meta_wayland_surface_assign_role (surface,
META_TYPE_WAYLAND_SURFACE_ROLE_CURSOR))
{
if (!meta_wayland_surface_assign_role (surface,
META_WAYLAND_SURFACE_ROLE_CURSOR))
{
wl_resource_post_error (resource, WL_POINTER_ERROR_ROLE,
"wl_surface@%d already has a different role",
wl_resource_get_id (surface_resource));
return;
}
wl_resource_post_error (resource, WL_POINTER_ERROR_ROLE,
"wl_surface@%d already has a different role",
wl_resource_get_id (surface_resource));
return;
}
pointer->hotspot_x = x;