From 8a0835c59c5569d6e0d24b5d246cce069262ad3c Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Tue, 12 Apr 2022 11:45:21 +0300 Subject: [PATCH] xdg-positioner: add v3 parameters --- include/wlr/types/wlr_xdg_shell.h | 9 +++++++- types/xdg_shell/wlr_xdg_popup.c | 1 + types/xdg_shell/wlr_xdg_positioner.c | 31 ++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index bfb475fb..687883e9 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -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 { diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c index 26b5f0ef..eb405d96 100644 --- a/types/xdg_shell/wlr_xdg_popup.c +++ b/types/xdg_shell/wlr_xdg_popup.c @@ -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( diff --git a/types/xdg_shell/wlr_xdg_positioner.c b/types/xdg_shell/wlr_xdg_positioner.c index eff81ea3..6a991bba 100644 --- a/types/xdg_shell/wlr_xdg_positioner.c +++ b/types/xdg_shell/wlr_xdg_positioner.c @@ -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(