aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRouven Czerwinski <rouven@czerwinskis.de>2019-11-16 07:45:43 +0100
committerSimon Ser <contact@emersion.fr>2019-11-16 10:18:26 +0100
commitdf1a0468756b4a6d68cc5904313c4630edf14dd1 (patch)
tree5485f88f23808b9b179c803677c4d0d5eef51b1f
parent37afbc4dbced99d008ec7014e75d65d37ff3adb3 (diff)
xwayland: get_constraints using size hints
Previously, Xwayland windows did not have size_constraints implemented, resulting in the window being resizable. This implements the constraints through the X11 size hints supplied by the window itself.
-rw-r--r--sway/desktop/xwayland.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 28d7c058..845d158d 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -1,4 +1,5 @@
#define _POSIX_C_SOURCE 199309L
+#include <float.h>
#include <stdbool.h>
#include <stdlib.h>
#include <wayland-server-core.h>
@@ -293,7 +294,18 @@ static void destroy(struct sway_view *view) {
free(xwayland_view);
}
+static void get_constraints(struct sway_view *view, double *min_width,
+ double *max_width, double *min_height, double *max_height) {
+ struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
+ struct wlr_xwayland_surface_size_hints *size_hints = surface->size_hints;
+ *min_width = size_hints->min_width > 0 ? size_hints->min_width : DBL_MIN;
+ *max_width = size_hints->max_width > 0 ? size_hints->max_width : DBL_MAX;
+ *min_height = size_hints->min_height > 0 ? size_hints->min_height : DBL_MIN;
+ *max_height = size_hints->max_height > 0 ? size_hints->max_height : DBL_MAX;
+}
+
static const struct sway_view_impl view_impl = {
+ .get_constraints = get_constraints,
.get_string_prop = get_string_prop,
.get_int_prop = get_int_prop,
.configure = configure,