wayland-surface: Remove MetaWaylandSurfaceExtension
It only contained a pointer to a wl_resource, which isn't much of value. Just replace it with the wl_resource instead. Any future private data should be handled by our future role system.
This commit is contained in:
parent
4ef2f2ce09
commit
acd928044f
@ -716,10 +716,10 @@ meta_wayland_pointer_start_popup_grab (MetaWaylandPointer *pointer,
|
|||||||
popup->grab = grab;
|
popup->grab = grab;
|
||||||
popup->surface = surface;
|
popup->surface = surface;
|
||||||
popup->surface_destroy_listener.notify = on_popup_surface_destroy;
|
popup->surface_destroy_listener.notify = on_popup_surface_destroy;
|
||||||
if (surface->xdg_popup.resource)
|
if (surface->xdg_popup)
|
||||||
wl_resource_add_destroy_listener (surface->xdg_popup.resource, &popup->surface_destroy_listener);
|
wl_resource_add_destroy_listener (surface->xdg_popup, &popup->surface_destroy_listener);
|
||||||
else if (surface->wl_shell_surface.resource)
|
else if (surface->wl_shell_surface)
|
||||||
wl_resource_add_destroy_listener (surface->wl_shell_surface.resource, &popup->surface_destroy_listener);
|
wl_resource_add_destroy_listener (surface->wl_shell_surface, &popup->surface_destroy_listener);
|
||||||
|
|
||||||
wl_list_insert (&grab->all_popups, &popup->link);
|
wl_list_insert (&grab->all_popups, &popup->link);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -463,7 +463,7 @@ commit_pending_state (MetaWaylandSurface *surface,
|
|||||||
dnd_surface_commit (surface, pending);
|
dnd_surface_commit (surface, pending);
|
||||||
else if (surface->window)
|
else if (surface->window)
|
||||||
toplevel_surface_commit (surface, pending);
|
toplevel_surface_commit (surface, pending);
|
||||||
else if (surface->wl_subsurface.resource)
|
else if (surface->wl_subsurface)
|
||||||
subsurface_surface_commit (surface, pending);
|
subsurface_surface_commit (surface, pending);
|
||||||
|
|
||||||
g_list_foreach (surface->subsurfaces, parent_surface_committed, NULL);
|
g_list_foreach (surface->subsurfaces, parent_surface_committed, NULL);
|
||||||
@ -654,7 +654,7 @@ surface_should_be_reactive (MetaWaylandSurface *surface)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* If we're a subsurface, we should be reactive */
|
/* If we're a subsurface, we should be reactive */
|
||||||
if (surface->wl_subsurface.resource)
|
if (surface->wl_subsurface)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -760,7 +760,7 @@ xdg_surface_destructor (struct wl_resource *resource)
|
|||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
destroy_window (surface);
|
destroy_window (surface);
|
||||||
surface->xdg_surface.resource = NULL;
|
surface->xdg_surface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -998,7 +998,7 @@ xdg_shell_get_xdg_surface (struct wl_client *client,
|
|||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
||||||
MetaWindow *window;
|
MetaWindow *window;
|
||||||
|
|
||||||
if (surface->xdg_surface.resource != NULL)
|
if (surface->xdg_surface != NULL)
|
||||||
{
|
{
|
||||||
wl_resource_post_error (surface_resource,
|
wl_resource_post_error (surface_resource,
|
||||||
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
||||||
@ -1006,8 +1006,8 @@ xdg_shell_get_xdg_surface (struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->xdg_surface.resource = wl_resource_create (client, &xdg_surface_interface, wl_resource_get_version (resource), id);
|
surface->xdg_surface = wl_resource_create (client, &xdg_surface_interface, wl_resource_get_version (resource), id);
|
||||||
wl_resource_set_implementation (surface->xdg_surface.resource, &meta_wayland_xdg_surface_interface, surface, xdg_surface_destructor);
|
wl_resource_set_implementation (surface->xdg_surface, &meta_wayland_xdg_surface_interface, surface, xdg_surface_destructor);
|
||||||
|
|
||||||
surface->xdg_shell_resource = resource;
|
surface->xdg_shell_resource = resource;
|
||||||
|
|
||||||
@ -1021,7 +1021,7 @@ xdg_popup_destructor (struct wl_resource *resource)
|
|||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
destroy_window (surface);
|
destroy_window (surface);
|
||||||
surface->xdg_popup.resource = NULL;
|
surface->xdg_popup = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1056,7 +1056,7 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
|
|||||||
if (parent_surf == NULL || parent_surf->window == NULL)
|
if (parent_surf == NULL || parent_surf->window == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (surface->xdg_popup.resource != NULL)
|
if (surface->xdg_popup != NULL)
|
||||||
{
|
{
|
||||||
wl_resource_post_error (surface_resource,
|
wl_resource_post_error (surface_resource,
|
||||||
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
||||||
@ -1064,8 +1064,8 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->xdg_popup.resource = wl_resource_create (client, &xdg_popup_interface, wl_resource_get_version (resource), id);
|
surface->xdg_popup = wl_resource_create (client, &xdg_popup_interface, wl_resource_get_version (resource), id);
|
||||||
wl_resource_set_implementation (surface->xdg_popup.resource, &meta_wayland_xdg_popup_interface, surface, xdg_popup_destructor);
|
wl_resource_set_implementation (surface->xdg_popup, &meta_wayland_xdg_popup_interface, surface, xdg_popup_destructor);
|
||||||
|
|
||||||
surface->xdg_shell_resource = resource;
|
surface->xdg_shell_resource = resource;
|
||||||
|
|
||||||
@ -1114,7 +1114,7 @@ wl_shell_surface_destructor (struct wl_resource *resource)
|
|||||||
{
|
{
|
||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
surface->wl_shell_surface.resource = NULL;
|
surface->wl_shell_surface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1322,7 +1322,7 @@ wl_shell_get_shell_surface (struct wl_client *client,
|
|||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
||||||
MetaWindow *window;
|
MetaWindow *window;
|
||||||
|
|
||||||
if (surface->wl_shell_surface.resource != NULL)
|
if (surface->wl_shell_surface != NULL)
|
||||||
{
|
{
|
||||||
wl_resource_post_error (surface_resource,
|
wl_resource_post_error (surface_resource,
|
||||||
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
||||||
@ -1330,8 +1330,8 @@ wl_shell_get_shell_surface (struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->wl_shell_surface.resource = wl_resource_create (client, &wl_shell_surface_interface, wl_resource_get_version (resource), id);
|
surface->wl_shell_surface = wl_resource_create (client, &wl_shell_surface_interface, wl_resource_get_version (resource), id);
|
||||||
wl_resource_set_implementation (surface->wl_shell_surface.resource, &meta_wayland_wl_shell_surface_interface, surface, wl_shell_surface_destructor);
|
wl_resource_set_implementation (surface->wl_shell_surface, &meta_wayland_wl_shell_surface_interface, surface, wl_shell_surface_destructor);
|
||||||
|
|
||||||
window = meta_window_wayland_new (meta_get_display (), surface);
|
window = meta_window_wayland_new (meta_get_display (), surface);
|
||||||
meta_wayland_surface_set_window (surface, window);
|
meta_wayland_surface_set_window (surface, window);
|
||||||
@ -1358,7 +1358,7 @@ gtk_surface_destructor (struct wl_resource *resource)
|
|||||||
{
|
{
|
||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
surface->gtk_surface.resource = NULL;
|
surface->gtk_surface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1401,7 +1401,7 @@ get_gtk_surface (struct wl_client *client,
|
|||||||
{
|
{
|
||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
||||||
|
|
||||||
if (surface->gtk_surface.resource != NULL)
|
if (surface->gtk_surface != NULL)
|
||||||
{
|
{
|
||||||
wl_resource_post_error (surface_resource,
|
wl_resource_post_error (surface_resource,
|
||||||
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
||||||
@ -1409,8 +1409,8 @@ get_gtk_surface (struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->gtk_surface.resource = wl_resource_create (client, >k_surface_interface, wl_resource_get_version (resource), id);
|
surface->gtk_surface = wl_resource_create (client, >k_surface_interface, wl_resource_get_version (resource), id);
|
||||||
wl_resource_set_implementation (surface->gtk_surface.resource, &meta_wayland_gtk_surface_interface, surface, gtk_surface_destructor);
|
wl_resource_set_implementation (surface->gtk_surface, &meta_wayland_gtk_surface_interface, surface, gtk_surface_destructor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct gtk_shell_interface meta_wayland_gtk_shell_interface = {
|
static const struct gtk_shell_interface meta_wayland_gtk_shell_interface = {
|
||||||
@ -1511,7 +1511,7 @@ wl_subsurface_destructor (struct wl_resource *resource)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pending_state_destroy (&surface->sub.pending);
|
pending_state_destroy (&surface->sub.pending);
|
||||||
surface->wl_subsurface.resource = NULL;
|
surface->wl_subsurface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1675,7 +1675,7 @@ wl_subcompositor_get_subsurface (struct wl_client *client,
|
|||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
||||||
MetaWaylandSurface *parent = wl_resource_get_user_data (parent_resource);
|
MetaWaylandSurface *parent = wl_resource_get_user_data (parent_resource);
|
||||||
|
|
||||||
if (surface->wl_subsurface.resource != NULL)
|
if (surface->wl_subsurface != NULL)
|
||||||
{
|
{
|
||||||
wl_resource_post_error (surface_resource,
|
wl_resource_post_error (surface_resource,
|
||||||
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
||||||
@ -1683,8 +1683,8 @@ wl_subcompositor_get_subsurface (struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->wl_subsurface.resource = wl_resource_create (client, &wl_subsurface_interface, wl_resource_get_version (resource), id);
|
surface->wl_subsurface = wl_resource_create (client, &wl_subsurface_interface, wl_resource_get_version (resource), id);
|
||||||
wl_resource_set_implementation (surface->wl_subsurface.resource, &meta_wayland_subsurface_interface, surface, wl_subsurface_destructor);
|
wl_resource_set_implementation (surface->wl_subsurface, &meta_wayland_subsurface_interface, surface, wl_subsurface_destructor);
|
||||||
|
|
||||||
pending_state_init (&surface->sub.pending);
|
pending_state_init (&surface->sub.pending);
|
||||||
surface->sub.synchronous = TRUE;
|
surface->sub.synchronous = TRUE;
|
||||||
@ -1777,9 +1777,9 @@ meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
|
|||||||
int new_height,
|
int new_height,
|
||||||
MetaWaylandSerial *sent_serial)
|
MetaWaylandSerial *sent_serial)
|
||||||
{
|
{
|
||||||
if (surface->xdg_surface.resource)
|
if (surface->xdg_surface)
|
||||||
{
|
{
|
||||||
struct wl_client *client = wl_resource_get_client (surface->xdg_surface.resource);
|
struct wl_client *client = wl_resource_get_client (surface->xdg_surface);
|
||||||
struct wl_display *display = wl_client_get_display (client);
|
struct wl_display *display = wl_client_get_display (client);
|
||||||
uint32_t serial = wl_display_next_serial (display);
|
uint32_t serial = wl_display_next_serial (display);
|
||||||
struct wl_array states;
|
struct wl_array states;
|
||||||
@ -1793,7 +1793,7 @@ meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
|
|||||||
new_width /= surface->scale;
|
new_width /= surface->scale;
|
||||||
new_height /= surface->scale;
|
new_height /= surface->scale;
|
||||||
|
|
||||||
xdg_surface_send_configure (surface->xdg_surface.resource, new_width, new_height, &states, serial);
|
xdg_surface_send_configure (surface->xdg_surface, new_width, new_height, &states, serial);
|
||||||
|
|
||||||
wl_array_release (&states);
|
wl_array_release (&states);
|
||||||
|
|
||||||
@ -1803,13 +1803,13 @@ meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
|
|||||||
sent_serial->value = serial;
|
sent_serial->value = serial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (surface->xdg_popup.resource)
|
else if (surface->xdg_popup)
|
||||||
{
|
{
|
||||||
/* This can happen if the popup window loses or receives focus.
|
/* This can happen if the popup window loses or receives focus.
|
||||||
* Just ignore it. */
|
* Just ignore it. */
|
||||||
}
|
}
|
||||||
else if (surface->wl_shell_surface.resource)
|
else if (surface->wl_shell_surface)
|
||||||
wl_shell_surface_send_configure (surface->wl_shell_surface.resource,
|
wl_shell_surface_send_configure (surface->wl_shell_surface,
|
||||||
0, new_width, new_height);
|
0, new_width, new_height);
|
||||||
else
|
else
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@ -1821,15 +1821,15 @@ meta_wayland_surface_ping (MetaWaylandSurface *surface,
|
|||||||
{
|
{
|
||||||
if (surface->xdg_shell_resource)
|
if (surface->xdg_shell_resource)
|
||||||
xdg_shell_send_ping (surface->xdg_shell_resource, serial);
|
xdg_shell_send_ping (surface->xdg_shell_resource, serial);
|
||||||
else if (surface->wl_shell_surface.resource)
|
else if (surface->wl_shell_surface)
|
||||||
wl_shell_surface_send_ping (surface->wl_shell_surface.resource, serial);
|
wl_shell_surface_send_ping (surface->wl_shell_surface, serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_surface_delete (MetaWaylandSurface *surface)
|
meta_wayland_surface_delete (MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
if (surface->xdg_surface.resource)
|
if (surface->xdg_surface)
|
||||||
xdg_surface_send_close (surface->xdg_surface.resource);
|
xdg_surface_send_close (surface->xdg_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1839,8 +1839,8 @@ meta_wayland_surface_popup_done (MetaWaylandSurface *surface)
|
|||||||
struct wl_display *display = wl_client_get_display (client);
|
struct wl_display *display = wl_client_get_display (client);
|
||||||
uint32_t serial = wl_display_next_serial (display);
|
uint32_t serial = wl_display_next_serial (display);
|
||||||
|
|
||||||
if (surface->xdg_popup.resource)
|
if (surface->xdg_popup)
|
||||||
xdg_popup_send_popup_done (surface->xdg_popup.resource, serial);
|
xdg_popup_send_popup_done (surface->xdg_popup, serial);
|
||||||
else if (surface->wl_shell_surface.resource)
|
else if (surface->wl_shell_surface)
|
||||||
wl_shell_surface_send_popup_done (surface->wl_shell_surface.resource);
|
wl_shell_surface_send_popup_done (surface->wl_shell_surface);
|
||||||
}
|
}
|
||||||
|
@ -70,11 +70,6 @@ typedef struct
|
|||||||
gboolean has_new_geometry;
|
gboolean has_new_geometry;
|
||||||
} MetaWaylandPendingState;
|
} MetaWaylandPendingState;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
struct wl_resource *resource;
|
|
||||||
} MetaWaylandSurfaceExtension;
|
|
||||||
|
|
||||||
struct _MetaWaylandSurface
|
struct _MetaWaylandSurface
|
||||||
{
|
{
|
||||||
/* Generic stuff */
|
/* Generic stuff */
|
||||||
@ -91,12 +86,12 @@ struct _MetaWaylandSurface
|
|||||||
/* All the pending state that wl_surface.commit will apply. */
|
/* All the pending state that wl_surface.commit will apply. */
|
||||||
MetaWaylandPendingState pending;
|
MetaWaylandPendingState pending;
|
||||||
|
|
||||||
/* Extension structs. */
|
/* Extension resources. */
|
||||||
MetaWaylandSurfaceExtension xdg_surface;
|
struct wl_resource *xdg_surface;
|
||||||
MetaWaylandSurfaceExtension xdg_popup;
|
struct wl_resource *xdg_popup;
|
||||||
MetaWaylandSurfaceExtension wl_shell_surface;
|
struct wl_resource *wl_shell_surface;
|
||||||
MetaWaylandSurfaceExtension gtk_surface;
|
struct wl_resource *gtk_surface;
|
||||||
MetaWaylandSurfaceExtension wl_subsurface;
|
struct wl_resource *wl_subsurface;
|
||||||
|
|
||||||
/* xdg_surface stuff */
|
/* xdg_surface stuff */
|
||||||
struct wl_resource *xdg_shell_resource;
|
struct wl_resource *xdg_shell_resource;
|
||||||
|
Loading…
Reference in New Issue
Block a user