aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2022-02-06 23:39:50 +0300
committerSimon Ser <contact@emersion.fr>2022-02-21 17:26:51 +0000
commit5879e77d689ede8a1001daef2a71f14399ef3ef7 (patch)
tree1e5ff7fb241f019a31ba5e6ff43355343d06bc33 /include
parentb5b15b26258bc5e29736b3eb0268fa460acc9dd0 (diff)
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.
Diffstat (limited to 'include')
-rw-r--r--include/types/wlr_xdg_shell.h9
-rw-r--r--include/wlr/types/wlr_xdg_shell.h38
2 files changed, 27 insertions, 20 deletions
diff --git a/include/types/wlr_xdg_shell.h b/include/types/wlr_xdg_shell.h
index 1ad6b0ae..cfed6ee1 100644
--- a/include/types/wlr_xdg_shell.h
+++ b/include/types/wlr_xdg_shell.h
@@ -5,11 +5,6 @@
#include <wlr/types/wlr_xdg_shell.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_popup_surface_role;
@@ -24,12 +19,10 @@ void xdg_surface_role_precommit(struct wlr_surface *wlr_surface,
const struct wlr_surface_state *state);
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,
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 destroy_xdg_popup(struct wlr_xdg_popup *popup);
void handle_xdg_popup_committed(struct wlr_xdg_popup *popup);
diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h
index d4a9f62b..72cd6f27 100644
--- a/include/wlr/types/wlr_xdg_shell.h
+++ b/include/wlr/types/wlr_xdg_shell.h
@@ -49,7 +49,7 @@ struct wlr_xdg_client {
struct wl_event_source *ping_timer;
};
-struct wlr_xdg_positioner {
+struct wlr_xdg_positioner_rules {
struct wlr_box anchor_rect;
enum xdg_positioner_anchor anchor;
enum xdg_positioner_gravity gravity;
@@ -64,6 +64,11 @@ struct wlr_xdg_positioner {
} offset;
};
+struct wlr_xdg_positioner {
+ struct wl_resource *resource;
+ struct wlr_xdg_positioner_rules rules;
+};
+
struct wlr_xdg_popup {
struct wlr_xdg_surface *base;
struct wl_list link;
@@ -77,7 +82,7 @@ struct wlr_xdg_popup {
// geometry of the parent surface
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
};
@@ -276,6 +281,13 @@ struct wlr_xdg_popup *wlr_xdg_popup_from_resource(
struct wlr_xdg_toplevel *wlr_xdg_toplevel_from_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
* 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,
double *popup_sx, double *popup_sy);
+
/**
- * Get the geometry for this positioner based on the anchor rect, gravity, and
- * size of this positioner.
+ * Get the geometry based on positioner rules.
*/
-struct wlr_box wlr_xdg_positioner_get_geometry(
- struct wlr_xdg_positioner *positioner);
+void wlr_xdg_positioner_rules_get_geometry(
+ struct wlr_xdg_positioner_rules *rules, struct wlr_box *box);
/**
* 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);
/**
- Invert the right/left anchor and gravity for this positioner. This can be
- used to "flip" the positioner around the anchor rect in the x direction.
+ Invert the top/bottom anchor and gravity for those positioner rules.
+ 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
- used to "flip" the positioner around the anchor rect in the y direction.
+ Invert the top/bottom anchor and gravity for those positioner rules.
+ 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