From: Bastien Dejean Date: Tue, 29 Jan 2019 16:52:02 +0000 (+0100) Subject: Automatically shrink pseudo-tiled windows X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=f30b3bf319d609ec37e41e3b417b3549053a35b5;p=bspwm.git Automatically shrink pseudo-tiled windows Fixes #914. --- diff --git a/doc/bspwm.1 b/doc/bspwm.1 index f7a9994..107d306 100644 --- a/doc/bspwm.1 +++ b/doc/bspwm.1 @@ -2,12 +2,12 @@ .\" Title: bspwm .\" Author: [see the "Author" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/24/2019 +.\" Date: 01/29/2019 .\" Manual: Bspwm Manual -.\" Source: Bspwm 0.9.5-31-ga8b40f5 +.\" Source: Bspwm 0.9.5-35-g32ff624 .\" Language: English .\" -.TH "BSPWM" "1" "01/24/2019" "Bspwm 0\&.9\&.5\-31\-ga8b40f5" "Bspwm Manual" +.TH "BSPWM" "1" "01/29/2019" "Bspwm 0\&.9\&.5\-35\-g32ff624" "Bspwm Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -527,22 +527,22 @@ Only consider monitors where the focused desktop is occupied\&. .PP tiled .RS 4 -Its size and position are determined by the splitting type and ratio of each node of its path in the window tree\&. +Its size and position are determined by the window tree\&. .RE .PP pseudo_tiled .RS 4 -Has an unrestricted size while being centered in its tiling space\&. +A tiled window that automatically shrinks but doesn\(cqt stretch beyond its floating size\&. .RE .PP floating .RS 4 -Can be moved/resized freely\&. Although it doesn\(cqt occupy any tiling space, it is still part of the window tree\&. +Can be moved/resized freely\&. Although it doesn\(cqt use any tiling space, it is still part of the window tree\&. .RE .PP fullscreen .RS 4 -Fills its monitor rectangle and has no borders\&. It is send in the ABOVE layer by default\&. +Fills its monitor rectangle and has no borders\&. .RE .SH "NODE FLAGS" .PP diff --git a/doc/bspwm.1.asciidoc b/doc/bspwm.1.asciidoc index 823c677..e958399 100644 --- a/doc/bspwm.1.asciidoc +++ b/doc/bspwm.1.asciidoc @@ -156,8 +156,6 @@ parent:: Modifiers ^^^^^^^^^ - - [!]focused:: Only consider the focused node. @@ -326,16 +324,16 @@ Window States ------------- tiled:: - Its size and position are determined by the splitting type and ratio of each node of its path in the window tree. + Its size and position are determined by the window tree. pseudo_tiled:: - Has an unrestricted size while being centered in its tiling space. + A tiled window that automatically shrinks but doesn't stretch beyond its floating size. floating:: - Can be moved/resized freely. Although it doesn't occupy any tiling space, it is still part of the window tree. + Can be moved/resized freely. Although it doesn't use any tiling space, it is still part of the window tree. fullscreen:: - Fills its monitor rectangle and has no borders. It is send in the ABOVE layer by default. + Fills its monitor rectangle and has no borders. Node Flags diff --git a/src/tree.c b/src/tree.c index dbd1594..fa79a1b 100644 --- a/src/tree.c +++ b/src/tree.c @@ -101,23 +101,21 @@ void apply_layout(monitor_t *m, desktop_t *d, node_t *n, layout_t l, xcb_rectang xcb_rectangle_t r; xcb_rectangle_t cr = get_window_rectangle(n); client_state_t s = n->client->state; + /* tiled and pseudo-tiled clients */ if (s == STATE_TILED || s == STATE_PSEUDO_TILED) { int wg = (gapless_monocle && l == LAYOUT_MONOCLE ? 0 : d->window_gap); - /* tiled clients */ - if (s == STATE_TILED) { - r = rect; - int bleed = wg + 2 * bw; - r.width = (bleed < r.width ? r.width - bleed : 1); - r.height = (bleed < r.height ? r.height - bleed : 1); + r = rect; + int bleed = wg + 2 * bw; + r.width = (bleed < r.width ? r.width - bleed : 1); + r.height = (bleed < r.height ? r.height - bleed : 1); /* pseudo-tiled clients */ - } else { - r = n->client->floating_rectangle; + if (s == STATE_PSEUDO_TILED) { + xcb_rectangle_t f = n->client->floating_rectangle; + r.width = MIN(r.width, f.width); + r.height = MIN(r.height, f.height); if (center_pseudo_tiled) { r.x = rect.x - bw + (rect.width - wg - r.width) / 2; r.y = rect.y - bw + (rect.height - wg - r.height) / 2; - } else { - r.x = rect.x; - r.y = rect.y; } } n->client->tiled_rectangle = r;