aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
authorLibravatar Rouven Czerwinski <rouven@czerwinskis.de>2019-11-16 07:45:43 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2019-11-16 10:18:26 +0100
commitdf1a0468756b4a6d68cc5904313c4630edf14dd1 (patch)
tree5485f88f23808b9b179c803677c4d0d5eef51b1f /sway/desktop/xwayland.c
parentseatop_default: handle focus for unmanaged xwayland windows last (diff)
downloadsway-df1a0468756b4a6d68cc5904313c4630edf14dd1.tar.gz
sway-df1a0468756b4a6d68cc5904313c4630edf14dd1.tar.zst
sway-df1a0468756b4a6d68cc5904313c4630edf14dd1.zip
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.
Diffstat (limited to 'sway/desktop/xwayland.c')
-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 @@
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-core.h> 5#include <wayland-server-core.h>
@@ -293,7 +294,18 @@ static void destroy(struct sway_view *view) {
293 free(xwayland_view); 294 free(xwayland_view);
294} 295}
295 296
297static void get_constraints(struct sway_view *view, double *min_width,
298 double *max_width, double *min_height, double *max_height) {
299 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
300 struct wlr_xwayland_surface_size_hints *size_hints = surface->size_hints;
301 *min_width = size_hints->min_width > 0 ? size_hints->min_width : DBL_MIN;
302 *max_width = size_hints->max_width > 0 ? size_hints->max_width : DBL_MAX;
303 *min_height = size_hints->min_height > 0 ? size_hints->min_height : DBL_MIN;
304 *max_height = size_hints->max_height > 0 ? size_hints->max_height : DBL_MAX;
305}
306
296static const struct sway_view_impl view_impl = { 307static const struct sway_view_impl view_impl = {
308 .get_constraints = get_constraints,
297 .get_string_prop = get_string_prop, 309 .get_string_prop = get_string_prop,
298 .get_int_prop = get_int_prop, 310 .get_int_prop = get_int_prop,
299 .configure = configure, 311 .configure = configure,