Merge pull request #3400 from Synray/next

Respect max size from WM_NORMAL_HINTS
This commit is contained in:
Orestis
2018-09-20 11:36:22 +03:00
committed by GitHub
5 changed files with 110 additions and 0 deletions

View File

@ -96,6 +96,18 @@ void floating_check_size(Con *floating_con) {
floating_con->rect.height += border_rect.height;
}
if (focused_con->window->max_width) {
floating_con->rect.width -= border_rect.width;
floating_con->rect.width = min(floating_con->rect.width, focused_con->window->max_width);
floating_con->rect.width += border_rect.width;
}
if (focused_con->window->max_height) {
floating_con->rect.height -= border_rect.height;
floating_con->rect.height = min(floating_con->rect.height, focused_con->window->max_height);
floating_con->rect.height += border_rect.height;
}
if (focused_con->window->height_increment &&
floating_con->rect.height >= focused_con->window->base_height + border_rect.height) {
floating_con->rect.height -= focused_con->window->base_height + border_rect.height;

View File

@ -981,9 +981,18 @@ static bool handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t stat
con->window->min_height = size_hints.min_height;
}
if ((size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)) {
DLOG("Maximum size: %d (width) x %d (height)\n", size_hints.max_width, size_hints.max_height);
con->window->max_width = size_hints.max_width;
con->window->max_height = size_hints.max_height;
}
if (con_is_floating(con)) {
win_width = MAX(win_width, con->window->min_width);
win_height = MAX(win_height, con->window->min_height);
win_width = MIN(win_width, con->window->max_width);
win_height = MIN(win_height, con->window->max_height);
}
bool changed = false;

View File

@ -520,6 +520,12 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
nc->window->min_height = wm_size_hints.min_height;
}
if (wm_size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE) {
DLOG("Window specifies maximum size %d x %d\n", wm_size_hints.max_width, wm_size_hints.max_height);
nc->window->max_width = wm_size_hints.max_width;
nc->window->max_height = wm_size_hints.max_height;
}
/* Store the requested geometry. The width/height gets raised to at least
* 75x50 when entering floating mode, which is the minimum size for a
* window to be useful (smaller windows are usually overlays/toolbars/…