aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2022-04-12 11:45:21 +0300
committerSimon Ser <contact@emersion.fr>2022-05-27 13:31:30 +0000
commit8a0835c59c5569d6e0d24b5d246cce069262ad3c (patch)
tree8e123c7a18d86184ae3f035e61d81be3da5a57d4
parent6f1fce9cb450e22b6312369392d8835667825171 (diff)
xdg-positioner: add v3 parameters
-rw-r--r--include/wlr/types/wlr_xdg_shell.h9
-rw-r--r--types/xdg_shell/wlr_xdg_popup.c1
-rw-r--r--types/xdg_shell/wlr_xdg_positioner.c31
3 files changed, 40 insertions, 1 deletions
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(