xdg-positioner: rename structs

To be consistent with other wlr_xdg_* structs,
wlr_xdg_positioner_resource is renamed to wlr_xdg_positioner and made
public, and wlr_xdg_positioner is renamed to wlr_xdg_positioner_rules.
Functions which operated on wlr_xdg_positioner were renamed and updated
accordingly.
This commit is contained in:
Kirill Primak 2022-02-06 23:39:50 +03:00 committed by Simon Ser
parent b5b15b2625
commit 5879e77d68
5 changed files with 109 additions and 125 deletions

View file

@ -5,11 +5,6 @@
#include <wlr/types/wlr_xdg_shell.h> #include <wlr/types/wlr_xdg_shell.h>
#include "xdg-shell-protocol.h" #include "xdg-shell-protocol.h"
struct wlr_xdg_positioner_resource {
struct wl_resource *resource;
struct wlr_xdg_positioner attrs;
};
extern const struct wlr_surface_role xdg_toplevel_surface_role; extern const struct wlr_surface_role xdg_toplevel_surface_role;
extern const struct wlr_surface_role xdg_popup_surface_role; extern const struct wlr_surface_role xdg_popup_surface_role;
@ -24,12 +19,10 @@ void xdg_surface_role_precommit(struct wlr_surface *wlr_surface,
const struct wlr_surface_state *state); const struct wlr_surface_state *state);
void create_xdg_positioner(struct wlr_xdg_client *client, uint32_t id); void create_xdg_positioner(struct wlr_xdg_client *client, uint32_t id);
struct wlr_xdg_positioner_resource *get_xdg_positioner_from_resource(
struct wl_resource *resource);
void create_xdg_popup(struct wlr_xdg_surface *surface, void create_xdg_popup(struct wlr_xdg_surface *surface,
struct wlr_xdg_surface *parent, struct wlr_xdg_surface *parent,
struct wlr_xdg_positioner_resource *positioner, uint32_t id); struct wlr_xdg_positioner *positioner, uint32_t id);
void unmap_xdg_popup(struct wlr_xdg_popup *popup); void unmap_xdg_popup(struct wlr_xdg_popup *popup);
void destroy_xdg_popup(struct wlr_xdg_popup *popup); void destroy_xdg_popup(struct wlr_xdg_popup *popup);
void handle_xdg_popup_committed(struct wlr_xdg_popup *popup); void handle_xdg_popup_committed(struct wlr_xdg_popup *popup);

View file

@ -49,7 +49,7 @@ struct wlr_xdg_client {
struct wl_event_source *ping_timer; struct wl_event_source *ping_timer;
}; };
struct wlr_xdg_positioner { struct wlr_xdg_positioner_rules {
struct wlr_box anchor_rect; struct wlr_box anchor_rect;
enum xdg_positioner_anchor anchor; enum xdg_positioner_anchor anchor;
enum xdg_positioner_gravity gravity; enum xdg_positioner_gravity gravity;
@ -64,6 +64,11 @@ struct wlr_xdg_positioner {
} offset; } offset;
}; };
struct wlr_xdg_positioner {
struct wl_resource *resource;
struct wlr_xdg_positioner_rules rules;
};
struct wlr_xdg_popup { struct wlr_xdg_popup {
struct wlr_xdg_surface *base; struct wlr_xdg_surface *base;
struct wl_list link; struct wl_list link;
@ -77,7 +82,7 @@ struct wlr_xdg_popup {
// geometry of the parent surface // geometry of the parent surface
struct wlr_box geometry; struct wlr_box geometry;
struct wlr_xdg_positioner positioner; struct wlr_xdg_positioner_rules positioner_rules;
struct wl_list grab_link; // wlr_xdg_popup_grab::popups struct wl_list grab_link; // wlr_xdg_popup_grab::popups
}; };
@ -276,6 +281,13 @@ struct wlr_xdg_popup *wlr_xdg_popup_from_resource(
struct wlr_xdg_toplevel *wlr_xdg_toplevel_from_resource( struct wlr_xdg_toplevel *wlr_xdg_toplevel_from_resource(
struct wl_resource *resource); struct wl_resource *resource);
/** Get the corresponding wlr_xdg_positioner from a resource.
*
* Aborts if the resource doesn't have the correct type.
*/
struct wlr_xdg_positioner *wlr_xdg_positioner_from_resource(
struct wl_resource *resource);
/** /**
* Send a ping to the surface. If the surface does not respond in a reasonable * Send a ping to the surface. If the surface does not respond in a reasonable
* amount of time, the ping_timeout event will be emitted. * amount of time, the ping_timeout event will be emitted.
@ -346,12 +358,12 @@ void wlr_xdg_popup_destroy(struct wlr_xdg_popup *popup);
*/ */
void wlr_xdg_popup_get_position(struct wlr_xdg_popup *popup, void wlr_xdg_popup_get_position(struct wlr_xdg_popup *popup,
double *popup_sx, double *popup_sy); double *popup_sx, double *popup_sy);
/** /**
* Get the geometry for this positioner based on the anchor rect, gravity, and * Get the geometry based on positioner rules.
* size of this positioner.
*/ */
struct wlr_box wlr_xdg_positioner_get_geometry( void wlr_xdg_positioner_rules_get_geometry(
struct wlr_xdg_positioner *positioner); struct wlr_xdg_positioner_rules *rules, struct wlr_box *box);
/** /**
* Get the anchor point for this popup in the toplevel parent's coordinate system. * Get the anchor point for this popup in the toplevel parent's coordinate system.
@ -375,16 +387,18 @@ void wlr_xdg_popup_unconstrain_from_box(struct wlr_xdg_popup *popup,
const struct wlr_box *toplevel_sx_box); const struct wlr_box *toplevel_sx_box);
/** /**
Invert the right/left anchor and gravity for this positioner. This can be Invert the top/bottom anchor and gravity for those positioner rules.
used to "flip" the positioner around the anchor rect in the x direction. This can be used to "flip" the positioner around the anchor rect in
the x direction.
*/ */
void wlr_positioner_invert_x(struct wlr_xdg_positioner *positioner); void wlr_xdg_positioner_rules_invert_x(struct wlr_xdg_positioner_rules *rules);
/** /**
Invert the top/bottom anchor and gravity for this positioner. This can be Invert the top/bottom anchor and gravity for those positioner rules.
used to "flip" the positioner around the anchor rect in the y direction. This can be used to "flip" the positioner around the anchor rect in
the y direction.
*/ */
void wlr_positioner_invert_y(struct wlr_xdg_positioner *positioner); void wlr_xdg_positioner_rules_invert_y(struct wlr_xdg_positioner_rules *rules);
/** /**
* Find a surface within this xdg-surface tree at the given surface-local * Find a surface within this xdg-surface tree at the given surface-local

View file

@ -304,9 +304,9 @@ const struct wlr_surface_role xdg_popup_surface_role = {
void create_xdg_popup(struct wlr_xdg_surface *surface, void create_xdg_popup(struct wlr_xdg_surface *surface,
struct wlr_xdg_surface *parent, struct wlr_xdg_surface *parent,
struct wlr_xdg_positioner_resource *positioner, uint32_t id) { struct wlr_xdg_positioner *positioner, uint32_t id) {
if (positioner->attrs.size.width == 0 || if (positioner->rules.size.width == 0 ||
positioner->attrs.anchor_rect.width == 0) { positioner->rules.anchor_rect.width == 0) {
wl_resource_post_error(surface->client->resource, wl_resource_post_error(surface->client->resource,
XDG_WM_BASE_ERROR_INVALID_POSITIONER, XDG_WM_BASE_ERROR_INVALID_POSITIONER,
"positioner object is not complete"); "positioner object is not complete");
@ -348,11 +348,10 @@ void create_xdg_popup(struct wlr_xdg_surface *surface,
surface->role = WLR_XDG_SURFACE_ROLE_POPUP; surface->role = WLR_XDG_SURFACE_ROLE_POPUP;
// positioner properties memcpy(&surface->popup->positioner_rules,
memcpy(&surface->popup->positioner, &positioner->attrs, &positioner->rules, sizeof(positioner->rules));
sizeof(struct wlr_xdg_positioner)); wlr_xdg_positioner_rules_get_geometry(
surface->popup->geometry = &positioner->rules, &surface->popup->geometry);
wlr_xdg_positioner_get_geometry(&positioner->attrs);
if (parent) { if (parent) {
surface->popup->parent = parent->surface; surface->popup->parent = parent->surface;
@ -412,8 +411,8 @@ void wlr_xdg_popup_destroy(struct wlr_xdg_popup *popup) {
void wlr_xdg_popup_get_anchor_point(struct wlr_xdg_popup *popup, void wlr_xdg_popup_get_anchor_point(struct wlr_xdg_popup *popup,
int *root_sx, int *root_sy) { int *root_sx, int *root_sy) {
struct wlr_box rect = popup->positioner.anchor_rect; struct wlr_box rect = popup->positioner_rules.anchor_rect;
enum xdg_positioner_anchor anchor = popup->positioner.anchor; enum xdg_positioner_anchor anchor = popup->positioner_rules.anchor;
int sx = 0, sy = 0; int sx = 0, sy = 0;
if (anchor == XDG_POSITIONER_ANCHOR_NONE) { if (anchor == XDG_POSITIONER_ANCHOR_NONE) {
@ -511,22 +510,22 @@ static bool xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
} }
bool flip_x = offset_x && bool flip_x = offset_x &&
(popup->positioner.constraint_adjustment & (popup->positioner_rules.constraint_adjustment &
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X); XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X);
bool flip_y = offset_y && bool flip_y = offset_y &&
(popup->positioner.constraint_adjustment & (popup->positioner_rules.constraint_adjustment &
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y); XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y);
if (flip_x) { if (flip_x) {
wlr_positioner_invert_x(&popup->positioner); wlr_xdg_positioner_rules_invert_x(&popup->positioner_rules);
} }
if (flip_y) { if (flip_y) {
wlr_positioner_invert_y(&popup->positioner); wlr_xdg_positioner_rules_invert_y(&popup->positioner_rules);
} }
popup->geometry = wlr_xdg_positioner_rules_get_geometry(
wlr_xdg_positioner_get_geometry(&popup->positioner); &popup->positioner_rules, &popup->geometry);
xdg_popup_box_constraints(popup, toplevel_sx_box, xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y); &offset_x, &offset_y);
@ -538,14 +537,14 @@ static bool xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
// revert the positioner back if it didn't fix it and go to the next part // revert the positioner back if it didn't fix it and go to the next part
if (offset_x && flip_x) { if (offset_x && flip_x) {
wlr_positioner_invert_x(&popup->positioner); wlr_xdg_positioner_rules_invert_x(&popup->positioner_rules);
} }
if (offset_y && flip_y) { if (offset_y && flip_y) {
wlr_positioner_invert_y(&popup->positioner); wlr_xdg_positioner_rules_invert_y(&popup->positioner_rules);
} }
popup->geometry = wlr_xdg_positioner_rules_get_geometry(
wlr_xdg_positioner_get_geometry(&popup->positioner); &popup->positioner_rules, &popup->geometry);
return false; return false;
} }
@ -561,11 +560,11 @@ static bool xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
} }
bool slide_x = offset_x && bool slide_x = offset_x &&
(popup->positioner.constraint_adjustment & (popup->positioner_rules.constraint_adjustment &
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X); XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X);
bool slide_y = offset_y && bool slide_y = offset_y &&
(popup->positioner.constraint_adjustment & (popup->positioner_rules.constraint_adjustment &
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y); XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y);
if (slide_x) { if (slide_x) {
@ -604,11 +603,11 @@ static bool xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
} }
bool resize_x = offset_x && bool resize_x = offset_x &&
(popup->positioner.constraint_adjustment & (popup->positioner_rules.constraint_adjustment &
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X); XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X);
bool resize_y = offset_y && bool resize_y = offset_y &&
(popup->positioner.constraint_adjustment & (popup->positioner_rules.constraint_adjustment &
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y); XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y);
if (resize_x) { if (resize_x) {

View file

@ -4,7 +4,7 @@
static const struct xdg_positioner_interface xdg_positioner_implementation; static const struct xdg_positioner_interface xdg_positioner_implementation;
struct wlr_xdg_positioner_resource *get_xdg_positioner_from_resource( struct wlr_xdg_positioner *wlr_xdg_positioner_from_resource(
struct wl_resource *resource) { struct wl_resource *resource) {
assert(wl_resource_instance_of(resource, &xdg_positioner_interface, assert(wl_resource_instance_of(resource, &xdg_positioner_interface,
&xdg_positioner_implementation)); &xdg_positioner_implementation));
@ -13,8 +13,8 @@ struct wlr_xdg_positioner_resource *get_xdg_positioner_from_resource(
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_resource *positioner = struct wlr_xdg_positioner *positioner =
get_xdg_positioner_from_resource(resource); wlr_xdg_positioner_from_resource(resource);
if (width < 1 || height < 1) { if (width < 1 || height < 1) {
wl_resource_post_error(resource, wl_resource_post_error(resource,
@ -23,15 +23,15 @@ static void xdg_positioner_handle_set_size(struct wl_client *client,
return; return;
} }
positioner->attrs.size.width = width; positioner->rules.size.width = width;
positioner->attrs.size.height = height; positioner->rules.size.height = height;
} }
static void xdg_positioner_handle_set_anchor_rect(struct wl_client *client, 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_resource *positioner = struct wlr_xdg_positioner *positioner =
get_xdg_positioner_from_resource(resource); wlr_xdg_positioner_from_resource(resource);
if (width < 0 || height < 0) { if (width < 0 || height < 0) {
wl_resource_post_error(resource, wl_resource_post_error(resource,
@ -40,16 +40,16 @@ static void xdg_positioner_handle_set_anchor_rect(struct wl_client *client,
return; return;
} }
positioner->attrs.anchor_rect.x = x; positioner->rules.anchor_rect.x = x;
positioner->attrs.anchor_rect.y = y; positioner->rules.anchor_rect.y = y;
positioner->attrs.anchor_rect.width = width; positioner->rules.anchor_rect.width = width;
positioner->attrs.anchor_rect.height = height; positioner->rules.anchor_rect.height = height;
} }
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_resource *positioner = struct wlr_xdg_positioner *positioner =
get_xdg_positioner_from_resource(resource); wlr_xdg_positioner_from_resource(resource);
if (anchor > XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT) { if (anchor > XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT) {
wl_resource_post_error(resource, wl_resource_post_error(resource,
@ -58,13 +58,13 @@ static void xdg_positioner_handle_set_anchor(struct wl_client *client,
return; return;
} }
positioner->attrs.anchor = anchor; positioner->rules.anchor = anchor;
} }
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_resource *positioner = struct wlr_xdg_positioner *positioner =
get_xdg_positioner_from_resource(resource); wlr_xdg_positioner_from_resource(resource);
if (gravity > XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT) { if (gravity > XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT) {
wl_resource_post_error(resource, wl_resource_post_error(resource,
@ -73,25 +73,25 @@ static void xdg_positioner_handle_set_gravity(struct wl_client *client,
return; return;
} }
positioner->attrs.gravity = gravity; positioner->rules.gravity = gravity;
} }
static void xdg_positioner_handle_set_constraint_adjustment( 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_resource *positioner = struct wlr_xdg_positioner *positioner =
get_xdg_positioner_from_resource(resource); wlr_xdg_positioner_from_resource(resource);
positioner->attrs.constraint_adjustment = constraint_adjustment; positioner->rules.constraint_adjustment = 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_resource *positioner = struct wlr_xdg_positioner *positioner =
get_xdg_positioner_from_resource(resource); wlr_xdg_positioner_from_resource(resource);
positioner->attrs.offset.x = x; positioner->rules.offset.x = x;
positioner->attrs.offset.y = y; positioner->rules.offset.y = y;
} }
static void xdg_positioner_handle_destroy(struct wl_client *client, static void xdg_positioner_handle_destroy(struct wl_client *client,
@ -113,14 +113,13 @@ static const struct xdg_positioner_interface
static void xdg_positioner_handle_resource_destroy( static void xdg_positioner_handle_resource_destroy(
struct wl_resource *resource) { struct wl_resource *resource) {
struct wlr_xdg_positioner_resource *positioner = struct wlr_xdg_positioner *positioner =
get_xdg_positioner_from_resource(resource); wlr_xdg_positioner_from_resource(resource);
free(positioner); free(positioner);
} }
void create_xdg_positioner(struct wlr_xdg_client *client, uint32_t id) { void create_xdg_positioner(struct wlr_xdg_client *client, uint32_t id) {
struct wlr_xdg_positioner_resource *positioner = struct wlr_xdg_positioner *positioner = calloc(1, sizeof(*positioner));
calloc(1, sizeof(struct wlr_xdg_positioner_resource));
if (positioner == NULL) { if (positioner == NULL) {
wl_client_post_no_memory(client->client); wl_client_post_no_memory(client->client);
return; return;
@ -171,60 +170,40 @@ static bool positioner_gravity_has_edge(enum xdg_positioner_gravity gravity,
(enum xdg_positioner_anchor)edge); (enum xdg_positioner_anchor)edge);
} }
struct wlr_box wlr_xdg_positioner_get_geometry( void wlr_xdg_positioner_rules_get_geometry(
struct wlr_xdg_positioner *positioner) { struct wlr_xdg_positioner_rules *rules, struct wlr_box *box) {
struct wlr_box geometry = { box->x = rules->offset.x;
.x = positioner->offset.x, box->y = rules->offset.y;
.y = positioner->offset.y, box->width = rules->size.width;
.width = positioner->size.width, box->height = rules->size.height;
.height = positioner->size.height,
};
if (positioner_anchor_has_edge(positioner->anchor, if (positioner_anchor_has_edge(rules->anchor, XDG_POSITIONER_ANCHOR_TOP)) {
XDG_POSITIONER_ANCHOR_TOP)) { box->y += rules->anchor_rect.y;
geometry.y += positioner->anchor_rect.y; } else if (positioner_anchor_has_edge(rules->anchor, XDG_POSITIONER_ANCHOR_BOTTOM)) {
} else if (positioner_anchor_has_edge(positioner->anchor, box->y += rules->anchor_rect.y + rules->anchor_rect.height;
XDG_POSITIONER_ANCHOR_BOTTOM)) {
geometry.y +=
positioner->anchor_rect.y + positioner->anchor_rect.height;
} else { } else {
geometry.y += box->y += rules->anchor_rect.y + rules->anchor_rect.height / 2;
positioner->anchor_rect.y + positioner->anchor_rect.height / 2;
} }
if (positioner_anchor_has_edge(positioner->anchor, if (positioner_anchor_has_edge(rules->anchor, XDG_POSITIONER_ANCHOR_LEFT)) {
XDG_POSITIONER_ANCHOR_LEFT)) { box->x += rules->anchor_rect.x;
geometry.x += positioner->anchor_rect.x; } else if (positioner_anchor_has_edge(rules->anchor, XDG_POSITIONER_ANCHOR_RIGHT)) {
} else if (positioner_anchor_has_edge(positioner->anchor, box->x += rules->anchor_rect.x + rules->anchor_rect.width;
XDG_POSITIONER_ANCHOR_RIGHT)) {
geometry.x += positioner->anchor_rect.x + positioner->anchor_rect.width;
} else { } else {
geometry.x += box->x += rules->anchor_rect.x + rules->anchor_rect.width / 2;
positioner->anchor_rect.x + positioner->anchor_rect.width / 2;
} }
if (positioner_gravity_has_edge(positioner->gravity, if (positioner_gravity_has_edge(rules->gravity, XDG_POSITIONER_GRAVITY_TOP)) {
XDG_POSITIONER_GRAVITY_TOP)) { box->y -= box->height;
geometry.y -= geometry.height; } else if (!positioner_gravity_has_edge(rules->gravity, XDG_POSITIONER_GRAVITY_BOTTOM)) {
} else if (!positioner_gravity_has_edge(positioner->gravity, box->y -= box->height / 2;
XDG_POSITIONER_GRAVITY_BOTTOM)) {
geometry.y -= geometry.height / 2;
} }
if (positioner_gravity_has_edge(positioner->gravity, if (positioner_gravity_has_edge(rules->gravity, XDG_POSITIONER_GRAVITY_LEFT)) {
XDG_POSITIONER_GRAVITY_LEFT)) { box->x -= box->width;
geometry.x -= geometry.width; } else if (!positioner_gravity_has_edge(rules->gravity, XDG_POSITIONER_GRAVITY_RIGHT)) {
} else if (!positioner_gravity_has_edge(positioner->gravity, box->x -= box->width / 2;
XDG_POSITIONER_GRAVITY_RIGHT)) {
geometry.x -= geometry.width / 2;
} }
if (positioner->constraint_adjustment ==
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE) {
return geometry;
}
return geometry;
} }
static enum xdg_positioner_anchor positioner_anchor_invert_x( static enum xdg_positioner_anchor positioner_anchor_invert_x(
@ -281,13 +260,12 @@ static enum xdg_positioner_gravity positioner_gravity_invert_y(
(enum xdg_positioner_anchor)gravity); (enum xdg_positioner_anchor)gravity);
} }
void wlr_xdg_positioner_rules_invert_x(struct wlr_xdg_positioner_rules *rules) {
void wlr_positioner_invert_x(struct wlr_xdg_positioner *positioner) { rules->anchor = positioner_anchor_invert_x(rules->anchor);
positioner->anchor = positioner_anchor_invert_x(positioner->anchor); rules->gravity = positioner_gravity_invert_x(rules->gravity);
positioner->gravity = positioner_gravity_invert_x(positioner->gravity);
} }
void wlr_positioner_invert_y(struct wlr_xdg_positioner *positioner) { void wlr_xdg_positioner_rules_invert_y(struct wlr_xdg_positioner_rules *rules) {
positioner->anchor = positioner_anchor_invert_y(positioner->anchor); rules->anchor = positioner_anchor_invert_y(rules->anchor);
positioner->gravity = positioner_gravity_invert_y(positioner->gravity); rules->gravity = positioner_gravity_invert_y(rules->gravity);
} }

View file

@ -186,8 +186,8 @@ static void xdg_surface_handle_get_popup(struct wl_client *client,
if (xdg_surface == NULL) { if (xdg_surface == NULL) {
return; // TODO: create an inert xdg_popup return; // TODO: create an inert xdg_popup
} }
struct wlr_xdg_positioner_resource *positioner = struct wlr_xdg_positioner *positioner =
get_xdg_positioner_from_resource(positioner_resource); wlr_xdg_positioner_from_resource(positioner_resource);
create_xdg_popup(xdg_surface, parent, positioner, id); create_xdg_popup(xdg_surface, parent, positioner, id);
} }