diff options
author | Ilia Bozhinov <ammen99@gmail.com> | 2019-03-03 21:29:35 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-03 14:13:55 -0700 |
commit | c9b9e4852518edfb5c8c5cacaae18515b881bb9b (patch) | |
tree | 5c89e3c34b5166b2516a4ff36166cc7f7affa821 | |
parent | 6a60dafe596e3eed680f6176466d7855222d1395 (diff) |
xwm: use min size as base size hint if it is missing and vice versa
This is what ICCCM states that a WM should do.
-rw-r--r-- | xwayland/xwm.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c index fc99490b..cf6a230f 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -583,10 +583,22 @@ static void read_surface_normal_hints(struct wlr_xwm *xwm, memcpy(xsurface->size_hints, &size_hints, sizeof(struct wlr_xwayland_surface_size_hints)); - if ((size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE) == 0) { + bool has_min_size_hints = (size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE) == 0; + bool has_base_size_hints = (size_hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE) == 0; + /* ICCCM says that if absent, min size is equal to base size and vice versa */ + if (!has_min_size_hints && !has_base_size_hints) { xsurface->size_hints->min_width = -1; xsurface->size_hints->min_height = -1; + xsurface->size_hints->base_width = -1; + xsurface->size_hints->base_height = -1; + } else if (!has_base_size_hints) { + xsurface->size_hints->base_width = xsurface->size_hints->min_width; + xsurface->size_hints->base_height = xsurface->size_hints->min_height; + } else if (!has_min_size_hints) { + xsurface->size_hints->base_width = xsurface->size_hints->min_width; + xsurface->size_hints->base_height = xsurface->size_hints->min_height; } + if ((size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE) == 0) { xsurface->size_hints->max_width = -1; xsurface->size_hints->max_height = -1; |