xdg-shell-v6: rename shared private functions to prevent conflicts with xdg-shell stable

This commit is contained in:
emersion 2018-05-14 19:16:46 +01:00
parent 1e5b5d15a6
commit c7480d5084
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
6 changed files with 75 additions and 75 deletions

View File

@ -10,36 +10,36 @@ struct wlr_xdg_positioner_v6_resource {
struct wlr_xdg_positioner_v6 attrs; struct wlr_xdg_positioner_v6 attrs;
}; };
#define XDG_TOPLEVEL_ROLE "xdg_toplevel_v6" #define XDG_TOPLEVEL_V6_ROLE "xdg_toplevel_v6"
#define XDG_POPUP_ROLE "xdg_popup_v6" #define XDG_POPUP_V6_ROLE "xdg_popup_v6"
uint32_t xdg_surface_v6_schedule_configure(struct wlr_xdg_surface_v6 *surface); uint32_t schedule_xdg_surface_v6_configure(struct wlr_xdg_surface_v6 *surface);
struct wlr_xdg_surface_v6 *xdg_surface_v6_create( struct wlr_xdg_surface_v6 *create_xdg_surface_v6(
struct wlr_xdg_client_v6 *client, struct wlr_surface *surface, struct wlr_xdg_client_v6 *client, struct wlr_surface *surface,
uint32_t id); uint32_t id);
void xdg_surface_unmap(struct wlr_xdg_surface_v6 *surface); void unmap_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface);
void xdg_surface_destroy(struct wlr_xdg_surface_v6 *surface); void destroy_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface);
void xdg_positioner_v6_create(struct wlr_xdg_client_v6 *client, uint32_t id); void create_xdg_positioner_v6(struct wlr_xdg_client_v6 *client, uint32_t id);
struct wlr_xdg_positioner_v6_resource *xdg_positioner_from_resource( struct wlr_xdg_positioner_v6_resource *get_xdg_positioner_v6_from_resource(
struct wl_resource *resource); struct wl_resource *resource);
void xdg_popup_v6_create(struct wlr_xdg_surface_v6 *xdg_surface, void create_xdg_popup_v6(struct wlr_xdg_surface_v6 *xdg_surface,
struct wlr_xdg_surface_v6 *parent, struct wlr_xdg_surface_v6 *parent,
struct wlr_xdg_positioner_v6_resource *positioner, int32_t id); struct wlr_xdg_positioner_v6_resource *positioner, int32_t id);
void xdg_surface_v6_popup_committed(struct wlr_xdg_surface_v6 *surface); void handle_xdg_surface_v6_popup_committed(struct wlr_xdg_surface_v6 *surface);
struct wlr_xdg_popup_grab_v6 *xdg_shell_popup_grab_from_seat( struct wlr_xdg_popup_grab_v6 *get_xdg_shell_v6_popup_grab_from_seat(
struct wlr_xdg_shell_v6 *shell, struct wlr_seat *seat); struct wlr_xdg_shell_v6 *shell, struct wlr_seat *seat);
void xdg_popup_destroy(struct wlr_xdg_surface_v6 *surface); void destroy_xdg_popup_v6(struct wlr_xdg_surface_v6 *surface);
void xdg_toplevel_v6_create(struct wlr_xdg_surface_v6 *xdg_surface, void create_xdg_toplevel_v6(struct wlr_xdg_surface_v6 *xdg_surface,
uint32_t id); uint32_t id);
void xdg_surface_v6_toplevel_committed(struct wlr_xdg_surface_v6 *surface); void handle_xdg_surface_v6_toplevel_committed(struct wlr_xdg_surface_v6 *surface);
void xdg_toplevel_v6_send_configure(struct wlr_xdg_surface_v6 *surface, void send_xdg_toplevel_v6_configure(struct wlr_xdg_surface_v6 *surface,
struct wlr_xdg_surface_v6_configure *configure); struct wlr_xdg_surface_v6_configure *configure);
void xdg_toplevel_v6_ack_configure(struct wlr_xdg_surface_v6 *surface, void handle_xdg_toplevel_v6_ack_configure(struct wlr_xdg_surface_v6 *surface,
struct wlr_xdg_surface_v6_configure *configure); struct wlr_xdg_surface_v6_configure *configure);
bool xdg_surface_v6_toplevel_state_compare(struct wlr_xdg_toplevel_v6 *state); bool compare_xdg_surface_v6_toplevel_state(struct wlr_xdg_toplevel_v6 *state);
void xdg_toplevel_destroy(struct wlr_xdg_surface_v6 *surface); void destroy_xdg_toplevel_v6(struct wlr_xdg_surface_v6 *surface);
#endif #endif

View File

@ -107,14 +107,14 @@ static void xdg_popup_grab_handle_seat_destroy(
struct wlr_xdg_popup_v6 *popup, *next; struct wlr_xdg_popup_v6 *popup, *next;
wl_list_for_each_safe(popup, next, &xdg_grab->popups, grab_link) { wl_list_for_each_safe(popup, next, &xdg_grab->popups, grab_link) {
xdg_surface_destroy(popup->base); destroy_xdg_surface_v6(popup->base);
} }
wl_list_remove(&xdg_grab->link); wl_list_remove(&xdg_grab->link);
free(xdg_grab); free(xdg_grab);
} }
struct wlr_xdg_popup_grab_v6 *xdg_shell_popup_grab_from_seat( struct wlr_xdg_popup_grab_v6 *get_xdg_shell_v6_popup_grab_from_seat(
struct wlr_xdg_shell_v6 *shell, struct wlr_seat *seat) { struct wlr_xdg_shell_v6 *shell, struct wlr_seat *seat) {
struct wlr_xdg_popup_grab_v6 *xdg_grab; struct wlr_xdg_popup_grab_v6 *xdg_grab;
wl_list_for_each(xdg_grab, &shell->popup_grabs, link) { wl_list_for_each(xdg_grab, &shell->popup_grabs, link) {
@ -154,9 +154,9 @@ static struct wlr_xdg_surface_v6 *xdg_surface_from_xdg_popup_resource(
return wl_resource_get_user_data(resource); return wl_resource_get_user_data(resource);
} }
void xdg_popup_destroy(struct wlr_xdg_surface_v6 *surface) { void destroy_xdg_popup_v6(struct wlr_xdg_surface_v6 *surface) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP);
xdg_surface_unmap(surface); unmap_xdg_surface_v6(surface);
wl_resource_set_user_data(surface->popup->resource, NULL); wl_resource_set_user_data(surface->popup->resource, NULL);
wl_list_remove(&surface->popup->link); wl_list_remove(&surface->popup->link);
@ -182,7 +182,7 @@ static void xdg_popup_handle_grab(struct wl_client *client,
} }
struct wlr_xdg_popup_grab_v6 *popup_grab = struct wlr_xdg_popup_grab_v6 *popup_grab =
xdg_shell_popup_grab_from_seat(surface->client->shell, get_xdg_shell_v6_popup_grab_from_seat(surface->client->shell,
seat_client->seat); seat_client->seat);
struct wlr_xdg_surface_v6 *topmost = xdg_popup_grab_get_topmost(popup_grab); struct wlr_xdg_surface_v6 *topmost = xdg_popup_grab_get_topmost(popup_grab);
@ -232,20 +232,20 @@ static void xdg_popup_handle_resource_destroy(struct wl_resource *resource) {
struct wlr_xdg_surface_v6 *surface = struct wlr_xdg_surface_v6 *surface =
xdg_surface_from_xdg_popup_resource(resource); xdg_surface_from_xdg_popup_resource(resource);
if (surface != NULL) { if (surface != NULL) {
xdg_popup_destroy(surface); destroy_xdg_popup_v6(surface);
} }
} }
void xdg_surface_v6_popup_committed(struct wlr_xdg_surface_v6 *surface) { void handle_xdg_surface_v6_popup_committed(struct wlr_xdg_surface_v6 *surface) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP);
if (!surface->popup->committed) { if (!surface->popup->committed) {
xdg_surface_v6_schedule_configure(surface); schedule_xdg_surface_v6_configure(surface);
surface->popup->committed = true; surface->popup->committed = true;
} }
} }
void xdg_popup_v6_create(struct wlr_xdg_surface_v6 *xdg_surface, void create_xdg_popup_v6(struct wlr_xdg_surface_v6 *xdg_surface,
struct wlr_xdg_surface_v6 *parent, struct wlr_xdg_surface_v6 *parent,
struct wlr_xdg_positioner_v6_resource *positioner, int32_t id) { struct wlr_xdg_positioner_v6_resource *positioner, int32_t id) {
if (positioner->attrs.size.width == 0 || if (positioner->attrs.size.width == 0 ||
@ -256,7 +256,7 @@ void xdg_popup_v6_create(struct wlr_xdg_surface_v6 *xdg_surface,
return; return;
} }
if (wlr_surface_set_role(xdg_surface->surface, XDG_POPUP_ROLE, if (wlr_surface_set_role(xdg_surface->surface, XDG_POPUP_V6_ROLE,
xdg_surface->resource, ZXDG_SHELL_V6_ERROR_ROLE)) { xdg_surface->resource, ZXDG_SHELL_V6_ERROR_ROLE)) {
return; return;
} }

View File

@ -5,7 +5,7 @@
static const struct zxdg_positioner_v6_interface static const struct zxdg_positioner_v6_interface
zxdg_positioner_v6_implementation; zxdg_positioner_v6_implementation;
struct wlr_xdg_positioner_v6_resource *xdg_positioner_from_resource( struct wlr_xdg_positioner_v6_resource *get_xdg_positioner_v6_from_resource(
struct wl_resource *resource) { struct wl_resource *resource) {
assert(wl_resource_instance_of(resource, &zxdg_positioner_v6_interface, assert(wl_resource_instance_of(resource, &zxdg_positioner_v6_interface,
&zxdg_positioner_v6_implementation)); &zxdg_positioner_v6_implementation));
@ -14,7 +14,7 @@ struct wlr_xdg_positioner_v6_resource *xdg_positioner_from_resource(
static void xdg_positioner_destroy(struct wl_resource *resource) { static void xdg_positioner_destroy(struct wl_resource *resource) {
struct wlr_xdg_positioner_v6_resource *positioner = struct wlr_xdg_positioner_v6_resource *positioner =
xdg_positioner_from_resource(resource); get_xdg_positioner_v6_from_resource(resource);
free(positioner); free(positioner);
} }
@ -26,7 +26,7 @@ static void xdg_positioner_handle_destroy(struct wl_client *client,
static void xdg_positioner_handle_set_size(struct wl_client *client, static void xdg_positioner_handle_set_size(struct wl_client *client,
struct wl_resource *resource, int32_t width, int32_t height) { struct wl_resource *resource, int32_t width, int32_t height) {
struct wlr_xdg_positioner_v6_resource *positioner = struct wlr_xdg_positioner_v6_resource *positioner =
xdg_positioner_from_resource(resource); get_xdg_positioner_v6_from_resource(resource);
if (width < 1 || height < 1) { if (width < 1 || height < 1) {
wl_resource_post_error(resource, wl_resource_post_error(resource,
@ -43,7 +43,7 @@ static void xdg_positioner_handle_set_anchor_rect(struct wl_client *client,
struct wl_resource *resource, int32_t x, int32_t y, int32_t width, struct wl_resource *resource, int32_t x, int32_t y, int32_t width,
int32_t height) { int32_t height) {
struct wlr_xdg_positioner_v6_resource *positioner = struct wlr_xdg_positioner_v6_resource *positioner =
xdg_positioner_from_resource(resource); get_xdg_positioner_v6_from_resource(resource);
if (width < 1 || height < 1) { if (width < 1 || height < 1) {
wl_resource_post_error(resource, wl_resource_post_error(resource,
@ -61,7 +61,7 @@ static void xdg_positioner_handle_set_anchor_rect(struct wl_client *client,
static void xdg_positioner_handle_set_anchor(struct wl_client *client, static void xdg_positioner_handle_set_anchor(struct wl_client *client,
struct wl_resource *resource, uint32_t anchor) { struct wl_resource *resource, uint32_t anchor) {
struct wlr_xdg_positioner_v6_resource *positioner = struct wlr_xdg_positioner_v6_resource *positioner =
xdg_positioner_from_resource(resource); get_xdg_positioner_v6_from_resource(resource);
if (((anchor & ZXDG_POSITIONER_V6_ANCHOR_TOP ) && if (((anchor & ZXDG_POSITIONER_V6_ANCHOR_TOP ) &&
(anchor & ZXDG_POSITIONER_V6_ANCHOR_BOTTOM)) || (anchor & ZXDG_POSITIONER_V6_ANCHOR_BOTTOM)) ||
@ -79,7 +79,7 @@ static void xdg_positioner_handle_set_anchor(struct wl_client *client,
static void xdg_positioner_handle_set_gravity(struct wl_client *client, static void xdg_positioner_handle_set_gravity(struct wl_client *client,
struct wl_resource *resource, uint32_t gravity) { struct wl_resource *resource, uint32_t gravity) {
struct wlr_xdg_positioner_v6_resource *positioner = struct wlr_xdg_positioner_v6_resource *positioner =
xdg_positioner_from_resource(resource); get_xdg_positioner_v6_from_resource(resource);
if (((gravity & ZXDG_POSITIONER_V6_GRAVITY_TOP) && if (((gravity & ZXDG_POSITIONER_V6_GRAVITY_TOP) &&
(gravity & ZXDG_POSITIONER_V6_GRAVITY_BOTTOM)) || (gravity & ZXDG_POSITIONER_V6_GRAVITY_BOTTOM)) ||
@ -98,7 +98,7 @@ static void xdg_positioner_handle_set_constraint_adjustment(
struct wl_client *client, struct wl_resource *resource, struct wl_client *client, struct wl_resource *resource,
uint32_t constraint_adjustment) { uint32_t constraint_adjustment) {
struct wlr_xdg_positioner_v6_resource *positioner = struct wlr_xdg_positioner_v6_resource *positioner =
xdg_positioner_from_resource(resource); get_xdg_positioner_v6_from_resource(resource);
positioner->attrs.constraint_adjustment = constraint_adjustment; positioner->attrs.constraint_adjustment = constraint_adjustment;
} }
@ -106,7 +106,7 @@ static void xdg_positioner_handle_set_constraint_adjustment(
static void xdg_positioner_handle_set_offset(struct wl_client *client, static void xdg_positioner_handle_set_offset(struct wl_client *client,
struct wl_resource *resource, int32_t x, int32_t y) { struct wl_resource *resource, int32_t x, int32_t y) {
struct wlr_xdg_positioner_v6_resource *positioner = struct wlr_xdg_positioner_v6_resource *positioner =
xdg_positioner_from_resource(resource); get_xdg_positioner_v6_from_resource(resource);
positioner->attrs.offset.x = x; positioner->attrs.offset.x = x;
positioner->attrs.offset.y = y; positioner->attrs.offset.y = y;
@ -213,7 +213,7 @@ void wlr_positioner_v6_invert_y(
} }
} }
void xdg_positioner_v6_create(struct wlr_xdg_client_v6 *client, uint32_t id) { void create_xdg_positioner_v6(struct wlr_xdg_client_v6 *client, uint32_t id) {
struct wlr_xdg_positioner_v6_resource *positioner = struct wlr_xdg_positioner_v6_resource *positioner =
calloc(1, sizeof(struct wlr_xdg_positioner_v6_resource)); calloc(1, sizeof(struct wlr_xdg_positioner_v6_resource));
if (positioner == NULL) { if (positioner == NULL) {

View File

@ -18,7 +18,7 @@ static void xdg_shell_handle_create_positioner(struct wl_client *wl_client,
struct wl_resource *resource, uint32_t id) { struct wl_resource *resource, uint32_t id) {
struct wlr_xdg_client_v6 *client = struct wlr_xdg_client_v6 *client =
xdg_client_from_resource(resource); xdg_client_from_resource(resource);
xdg_positioner_v6_create(client, id); create_xdg_positioner_v6(client, id);
} }
static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client, static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client,
@ -27,7 +27,7 @@ static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client,
struct wlr_xdg_client_v6 *client = struct wlr_xdg_client_v6 *client =
xdg_client_from_resource(client_resource); xdg_client_from_resource(client_resource);
struct wlr_surface *surface = wlr_surface_from_resource(surface_resource); struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
xdg_surface_v6_create(client, surface, id); create_xdg_surface_v6(client, surface, id);
} }
static void xdg_shell_handle_pong(struct wl_client *wl_client, static void xdg_shell_handle_pong(struct wl_client *wl_client,

View File

@ -7,8 +7,8 @@
bool wlr_surface_is_xdg_surface_v6(struct wlr_surface *surface) { bool wlr_surface_is_xdg_surface_v6(struct wlr_surface *surface) {
return surface->role != NULL && return surface->role != NULL &&
(strcmp(surface->role, XDG_TOPLEVEL_ROLE) == 0 || (strcmp(surface->role, XDG_TOPLEVEL_V6_ROLE) == 0 ||
strcmp(surface->role, XDG_POPUP_ROLE) == 0); strcmp(surface->role, XDG_POPUP_V6_ROLE) == 0);
} }
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_from_wlr_surface( struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_from_wlr_surface(
@ -36,7 +36,7 @@ static void xdg_surface_configure_destroy(
free(configure); free(configure);
} }
void xdg_surface_unmap(struct wlr_xdg_surface_v6 *surface) { void unmap_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface) {
assert(surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE); assert(surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE);
// TODO: probably need to ungrab before this event // TODO: probably need to ungrab before this event
@ -54,7 +54,7 @@ void xdg_surface_unmap(struct wlr_xdg_surface_v6 *surface) {
case WLR_XDG_SURFACE_V6_ROLE_POPUP: case WLR_XDG_SURFACE_V6_ROLE_POPUP:
if (surface->popup->seat != NULL) { if (surface->popup->seat != NULL) {
struct wlr_xdg_popup_grab_v6 *grab = struct wlr_xdg_popup_grab_v6 *grab =
xdg_shell_popup_grab_from_seat(surface->client->shell, get_xdg_shell_v6_popup_grab_from_seat(surface->client->shell,
surface->popup->seat); surface->popup->seat);
wl_list_remove(&surface->popup->grab_link); wl_list_remove(&surface->popup->grab_link);
@ -93,19 +93,19 @@ void xdg_surface_unmap(struct wlr_xdg_surface_v6 *surface) {
memset(&surface->next_geometry, 0, sizeof(struct wlr_box)); memset(&surface->next_geometry, 0, sizeof(struct wlr_box));
} }
void xdg_surface_destroy(struct wlr_xdg_surface_v6 *surface) { void destroy_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface) {
if (surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE) { if (surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE) {
xdg_surface_unmap(surface); unmap_xdg_surface_v6(surface);
} }
wlr_signal_emit_safe(&surface->events.destroy, surface); wlr_signal_emit_safe(&surface->events.destroy, surface);
switch (surface->role) { switch (surface->role) {
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL: case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
xdg_toplevel_destroy(surface); destroy_xdg_toplevel_v6(surface);
break; break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP: case WLR_XDG_SURFACE_V6_ROLE_POPUP:
xdg_popup_destroy(surface); destroy_xdg_popup_v6(surface);
break; break;
case WLR_XDG_SURFACE_V6_ROLE_NONE: case WLR_XDG_SURFACE_V6_ROLE_NONE:
// This space is intentionally left blank // This space is intentionally left blank
@ -122,7 +122,7 @@ void xdg_surface_destroy(struct wlr_xdg_surface_v6 *surface) {
static void xdg_surface_handle_get_toplevel(struct wl_client *client, static void xdg_surface_handle_get_toplevel(struct wl_client *client,
struct wl_resource *resource, uint32_t id) { struct wl_resource *resource, uint32_t id) {
struct wlr_xdg_surface_v6 *xdg_surface = xdg_surface_from_resource(resource); struct wlr_xdg_surface_v6 *xdg_surface = xdg_surface_from_resource(resource);
xdg_toplevel_v6_create(xdg_surface, id); create_xdg_toplevel_v6(xdg_surface, id);
} }
static void xdg_surface_handle_get_popup(struct wl_client *wl_client, static void xdg_surface_handle_get_popup(struct wl_client *wl_client,
@ -134,9 +134,9 @@ static void xdg_surface_handle_get_popup(struct wl_client *wl_client,
struct wlr_xdg_surface_v6 *parent = struct wlr_xdg_surface_v6 *parent =
xdg_surface_from_resource(parent_resource); xdg_surface_from_resource(parent_resource);
struct wlr_xdg_positioner_v6_resource *positioner = struct wlr_xdg_positioner_v6_resource *positioner =
xdg_positioner_from_resource(positioner_resource); get_xdg_positioner_v6_from_resource(positioner_resource);
xdg_popup_v6_create(xdg_surface, parent, positioner, id); create_xdg_popup_v6(xdg_surface, parent, positioner, id);
} }
static void xdg_surface_handle_ack_configure(struct wl_client *client, static void xdg_surface_handle_ack_configure(struct wl_client *client,
@ -174,7 +174,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
assert(0 && "not reached"); assert(0 && "not reached");
break; break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL: case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
xdg_toplevel_v6_ack_configure(surface, configure); handle_xdg_toplevel_v6_ack_configure(surface, configure);
break; break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP: case WLR_XDG_SURFACE_V6_ROLE_POPUP:
break; break;
@ -246,7 +246,7 @@ static void xdg_surface_send_configure(void *user_data) {
assert(0 && "not reached"); assert(0 && "not reached");
break; break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL: case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
xdg_toplevel_v6_send_configure(surface, configure); send_xdg_toplevel_v6_configure(surface, configure);
break; break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP: case WLR_XDG_SURFACE_V6_ROLE_POPUP:
zxdg_popup_v6_send_configure(surface->popup->resource, zxdg_popup_v6_send_configure(surface->popup->resource,
@ -260,7 +260,7 @@ static void xdg_surface_send_configure(void *user_data) {
zxdg_surface_v6_send_configure(surface->resource, configure->serial); zxdg_surface_v6_send_configure(surface->resource, configure->serial);
} }
uint32_t xdg_surface_v6_schedule_configure(struct wlr_xdg_surface_v6 *surface) { uint32_t schedule_xdg_surface_v6_configure(struct wlr_xdg_surface_v6 *surface) {
struct wl_display *display = wl_client_get_display(surface->client->client); struct wl_display *display = wl_client_get_display(surface->client->client);
struct wl_event_loop *loop = wl_display_get_event_loop(display); struct wl_event_loop *loop = wl_display_get_event_loop(display);
bool pending_same = false; bool pending_same = false;
@ -271,7 +271,7 @@ uint32_t xdg_surface_v6_schedule_configure(struct wlr_xdg_surface_v6 *surface) {
break; break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL: case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
pending_same = pending_same =
xdg_surface_v6_toplevel_state_compare(surface->toplevel); compare_xdg_surface_v6_toplevel_state(surface->toplevel);
break; break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP: case WLR_XDG_SURFACE_V6_ROLE_POPUP:
break; break;
@ -336,7 +336,7 @@ static void xdg_surface_handle_surface_destroy(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_xdg_surface_v6 *xdg_surface = struct wlr_xdg_surface_v6 *xdg_surface =
wl_container_of(listener, xdg_surface, surface_destroy_listener); wl_container_of(listener, xdg_surface, surface_destroy_listener);
xdg_surface_destroy(xdg_surface); destroy_xdg_surface_v6(xdg_surface);
} }
static void handle_surface_committed(struct wlr_surface *wlr_surface, static void handle_surface_committed(struct wlr_surface *wlr_surface,
@ -365,10 +365,10 @@ static void handle_surface_committed(struct wlr_surface *wlr_surface,
"xdg_surface must have a role"); "xdg_surface must have a role");
break; break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL: case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
xdg_surface_v6_toplevel_committed(surface); handle_xdg_surface_v6_toplevel_committed(surface);
break; break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP: case WLR_XDG_SURFACE_V6_ROLE_POPUP:
xdg_surface_v6_popup_committed(surface); handle_xdg_surface_v6_popup_committed(surface);
break; break;
} }
@ -384,18 +384,18 @@ static void handle_surface_committed(struct wlr_surface *wlr_surface,
} }
if (surface->configured && !wlr_surface_has_buffer(surface->surface) && if (surface->configured && !wlr_surface_has_buffer(surface->surface) &&
surface->mapped) { surface->mapped) {
xdg_surface_unmap(surface); unmap_xdg_surface_v6(surface);
} }
} }
static void xdg_surface_handle_resource_destroy(struct wl_resource *resource) { static void xdg_surface_handle_resource_destroy(struct wl_resource *resource) {
struct wlr_xdg_surface_v6 *surface = xdg_surface_from_resource(resource); struct wlr_xdg_surface_v6 *surface = xdg_surface_from_resource(resource);
if (surface != NULL) { if (surface != NULL) {
xdg_surface_destroy(surface); destroy_xdg_surface_v6(surface);
} }
} }
struct wlr_xdg_surface_v6 *xdg_surface_v6_create( struct wlr_xdg_surface_v6 *create_xdg_surface_v6(
struct wlr_xdg_client_v6 *client, struct wlr_surface *surface, struct wlr_xdg_client_v6 *client, struct wlr_surface *surface,
uint32_t id) { uint32_t id) {
if (wlr_surface_has_buffer(surface)) { if (wlr_surface_has_buffer(surface)) {

View File

@ -15,9 +15,9 @@ static struct wlr_xdg_surface_v6 *xdg_surface_from_xdg_toplevel_resource(
return wl_resource_get_user_data(resource); return wl_resource_get_user_data(resource);
} }
void xdg_toplevel_destroy(struct wlr_xdg_surface_v6 *surface) { void destroy_xdg_toplevel_v6(struct wlr_xdg_surface_v6 *surface) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
xdg_surface_unmap(surface); unmap_xdg_surface_v6(surface);
wl_resource_set_user_data(surface->toplevel->resource, NULL); wl_resource_set_user_data(surface->toplevel->resource, NULL);
free(surface->toplevel); free(surface->toplevel);
@ -257,7 +257,7 @@ static const struct zxdg_toplevel_v6_interface
.set_minimized = xdg_toplevel_handle_set_minimized, .set_minimized = xdg_toplevel_handle_set_minimized,
}; };
void xdg_toplevel_v6_ack_configure(struct wlr_xdg_surface_v6 *surface, void handle_xdg_toplevel_v6_ack_configure(struct wlr_xdg_surface_v6 *surface,
struct wlr_xdg_surface_v6_configure *configure) { struct wlr_xdg_surface_v6_configure *configure) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
assert(configure->toplevel_state != NULL); assert(configure->toplevel_state != NULL);
@ -272,7 +272,7 @@ void xdg_toplevel_v6_ack_configure(struct wlr_xdg_surface_v6 *surface,
configure->toplevel_state->activated; configure->toplevel_state->activated;
} }
bool xdg_surface_v6_toplevel_state_compare(struct wlr_xdg_toplevel_v6 *state) { bool compare_xdg_surface_v6_toplevel_state(struct wlr_xdg_toplevel_v6 *state) {
struct { struct {
struct wlr_xdg_toplevel_v6_state state; struct wlr_xdg_toplevel_v6_state state;
uint32_t width, height; uint32_t width, height;
@ -321,7 +321,7 @@ bool xdg_surface_v6_toplevel_state_compare(struct wlr_xdg_toplevel_v6 *state) {
return false; return false;
} }
void xdg_toplevel_v6_send_configure(struct wlr_xdg_surface_v6 *surface, void send_xdg_toplevel_v6_configure(struct wlr_xdg_surface_v6 *surface,
struct wlr_xdg_surface_v6_configure *configure) { struct wlr_xdg_surface_v6_configure *configure) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
@ -386,13 +386,13 @@ error_out:
wl_resource_post_no_memory(surface->toplevel->resource); wl_resource_post_no_memory(surface->toplevel->resource);
} }
void xdg_surface_v6_toplevel_committed(struct wlr_xdg_surface_v6 *surface) { void handle_xdg_surface_v6_toplevel_committed(struct wlr_xdg_surface_v6 *surface) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
if (!surface->toplevel->added) { if (!surface->toplevel->added) {
// on the first commit, send a configure request to tell the client it // on the first commit, send a configure request to tell the client it
// is added // is added
xdg_surface_v6_schedule_configure(surface); schedule_xdg_surface_v6_configure(surface);
surface->toplevel->added = true; surface->toplevel->added = true;
return; return;
} }
@ -412,13 +412,13 @@ static void xdg_toplevel_handle_resource_destroy(struct wl_resource *resource) {
struct wlr_xdg_surface_v6 *surface = struct wlr_xdg_surface_v6 *surface =
xdg_surface_from_xdg_toplevel_resource(resource); xdg_surface_from_xdg_toplevel_resource(resource);
if (surface != NULL) { if (surface != NULL) {
xdg_toplevel_destroy(surface); destroy_xdg_toplevel_v6(surface);
} }
} }
void xdg_toplevel_v6_create(struct wlr_xdg_surface_v6 *xdg_surface, void create_xdg_toplevel_v6(struct wlr_xdg_surface_v6 *xdg_surface,
uint32_t id) { uint32_t id) {
if (wlr_surface_set_role(xdg_surface->surface, XDG_TOPLEVEL_ROLE, if (wlr_surface_set_role(xdg_surface->surface, XDG_TOPLEVEL_V6_ROLE,
xdg_surface->resource, ZXDG_SHELL_V6_ERROR_ROLE)) { xdg_surface->resource, ZXDG_SHELL_V6_ERROR_ROLE)) {
return; return;
} }
@ -458,7 +458,7 @@ uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
surface->toplevel->server_pending.width = width; surface->toplevel->server_pending.width = width;
surface->toplevel->server_pending.height = height; surface->toplevel->server_pending.height = height;
return xdg_surface_v6_schedule_configure(surface); return schedule_xdg_surface_v6_configure(surface);
} }
uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface, uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
@ -466,7 +466,7 @@ uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.activated = activated; surface->toplevel->server_pending.activated = activated;
return xdg_surface_v6_schedule_configure(surface); return schedule_xdg_surface_v6_configure(surface);
} }
uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface, uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
@ -474,7 +474,7 @@ uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.maximized = maximized; surface->toplevel->server_pending.maximized = maximized;
return xdg_surface_v6_schedule_configure(surface); return schedule_xdg_surface_v6_configure(surface);
} }
uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface, uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
@ -482,7 +482,7 @@ uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.fullscreen = fullscreen; surface->toplevel->server_pending.fullscreen = fullscreen;
return xdg_surface_v6_schedule_configure(surface); return schedule_xdg_surface_v6_configure(surface);
} }
uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface, uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
@ -490,5 +490,5 @@ uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.resizing = resizing; surface->toplevel->server_pending.resizing = resizing;
return xdg_surface_v6_schedule_configure(surface); return schedule_xdg_surface_v6_configure(surface);
} }