aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell_v6.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-21 12:13:00 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-22 23:10:19 +1000
commit011d1ebfa4219eb666487529a5a5e7189c14fd40 (patch)
tree4dd3efa39573b7baa9e3965ed3b03799af849c54 /sway/desktop/xdg_shell_v6.c
parentStore last button and use it when views request to move or resize (diff)
downloadsway-011d1ebfa4219eb666487529a5a5e7189c14fd40.tar.gz
sway-011d1ebfa4219eb666487529a5a5e7189c14fd40.tar.zst
sway-011d1ebfa4219eb666487529a5a5e7189c14fd40.zip
Consider view's min/max sizes when resizing
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r--sway/desktop/xdg_shell_v6.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 4bd6af5e..57b51908 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -1,4 +1,5 @@
1#define _POSIX_C_SOURCE 199309L 1#define _POSIX_C_SOURCE 199309L
2#include <float.h>
2#include <stdbool.h> 3#include <stdbool.h>
3#include <stdlib.h> 4#include <stdlib.h>
4#include <wayland-server.h> 5#include <wayland-server.h>
@@ -94,6 +95,16 @@ static struct sway_xdg_shell_v6_view *xdg_shell_v6_view_from_view(
94 return (struct sway_xdg_shell_v6_view *)view; 95 return (struct sway_xdg_shell_v6_view *)view;
95} 96}
96 97
98static void get_constraints(struct sway_view *view, double *min_width,
99 double *max_width, double *min_height, double *max_height) {
100 struct wlr_xdg_toplevel_v6_state *state =
101 &view->wlr_xdg_surface_v6->toplevel->current;
102 *min_width = state->min_width > 0 ? state->min_width : DBL_MIN;
103 *max_width = state->max_width > 0 ? state->max_width : DBL_MAX;
104 *min_height = state->min_height > 0 ? state->min_height : DBL_MIN;
105 *max_height = state->max_height > 0 ? state->max_height : DBL_MAX;
106}
107
97static const char *get_string_prop(struct sway_view *view, enum sway_view_prop prop) { 108static const char *get_string_prop(struct sway_view *view, enum sway_view_prop prop) {
98 if (xdg_shell_v6_view_from_view(view) == NULL) { 109 if (xdg_shell_v6_view_from_view(view) == NULL) {
99 return NULL; 110 return NULL;
@@ -184,6 +195,7 @@ static void destroy(struct sway_view *view) {
184} 195}
185 196
186static const struct sway_view_impl view_impl = { 197static const struct sway_view_impl view_impl = {
198 .get_constraints = get_constraints,
187 .get_string_prop = get_string_prop, 199 .get_string_prop = get_string_prop,
188 .configure = configure, 200 .configure = configure,
189 .set_activated = set_activated, 201 .set_activated = set_activated,