xdg-positioner: add v3 parameters

This commit is contained in:
Kirill Primak 2022-04-12 11:45:21 +03:00 committed by Simon Ser
parent 6f1fce9cb4
commit 8a0835c59c
3 changed files with 40 additions and 1 deletions

View File

@ -56,9 +56,14 @@ struct wlr_xdg_positioner_rules {
enum xdg_positioner_gravity gravity;
enum xdg_positioner_constraint_adjustment constraint_adjustment;
bool reactive;
bool has_parent_configure_serial;
uint32_t parent_configure_serial;
struct {
int32_t width, height;
} size;
} size, parent_size;
struct {
int32_t x, y;
@ -74,6 +79,8 @@ struct wlr_xdg_popup_state {
// Position of the popup relative to the upper left corner of
// the window geometry of the parent surface
struct wlr_box geometry;
bool reactive;
};
struct wlr_xdg_popup_configure {

View File

@ -8,6 +8,7 @@ void handle_xdg_popup_ack_configure(
struct wlr_xdg_popup *popup,
struct wlr_xdg_popup_configure *configure) {
popup->pending.geometry = configure->geometry;
popup->pending.reactive = configure->rules.reactive;
}
struct wlr_xdg_popup_configure *send_xdg_popup_configure(

View File

@ -95,6 +95,34 @@ static void xdg_positioner_handle_set_offset(struct wl_client *client,
positioner->rules.offset.y = y;
}
static void xdg_positioner_handle_set_reactive(
struct wl_client *client, struct wl_resource *resource) {
struct wlr_xdg_positioner *positioner =
wlr_xdg_positioner_from_resource(resource);
positioner->rules.reactive = true;
}
static void xdg_positioner_handle_set_parent_configure(
struct wl_client *client, struct wl_resource *resource,
uint32_t serial) {
struct wlr_xdg_positioner *positioner =
wlr_xdg_positioner_from_resource(resource);
positioner->rules.has_parent_configure_serial = true;
positioner->rules.parent_configure_serial = serial;
}
static void xdg_positioner_handle_set_parent_size(struct wl_client *client,
struct wl_resource *resource,
int32_t parent_width, int32_t parent_height) {
struct wlr_xdg_positioner *positioner =
wlr_xdg_positioner_from_resource(resource);
positioner->rules.parent_size.width = parent_width;
positioner->rules.parent_size.height = parent_height;
}
static void xdg_positioner_handle_destroy(struct wl_client *client,
struct wl_resource *resource) {
wl_resource_destroy(resource);
@ -110,6 +138,9 @@ static const struct xdg_positioner_interface
.set_constraint_adjustment =
xdg_positioner_handle_set_constraint_adjustment,
.set_offset = xdg_positioner_handle_set_offset,
.set_reactive = xdg_positioner_handle_set_reactive,
.set_parent_size = xdg_positioner_handle_set_parent_size,
.set_parent_configure = xdg_positioner_handle_set_parent_configure,
};
static void xdg_positioner_handle_resource_destroy(