kbgwm

sucklessy floating window manager
git clone https://git.neuralcrash.com/kbgwm.git
Log | Files | Refs | README | LICENSE

commit 704ae54acf5b8a316ec6fb90e2c7ded84c30ae5a
parent 90417f0edb2a955456d0deefbdfc463438a8f9c4
Author: Kebigon <git@kebigon.xyz>
Date:   Mon, 26 Jul 2021 17:00:52 +0900

Get position and size from hints when possible

Diffstat:
Mclient.c | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/client.c b/client.c @@ -88,12 +88,17 @@ void client_create(xcb_window_t id) client *new_client = emalloc(sizeof(client)); new_client->id = id; - new_client->x = geometry->x; - new_client->y = geometry->y; - new_client->width = geometry->width; - new_client->height = geometry->height; new_client->maximized = false; + const bool position = + hints.flags & (XCB_ICCCM_SIZE_HINT_US_POSITION | XCB_ICCCM_SIZE_HINT_P_POSITION); + new_client->x = position ? hints.x : geometry->x; + new_client->y = position ? hints.y : geometry->y; + + const bool size = hints.flags & (XCB_ICCCM_SIZE_HINT_US_SIZE | XCB_ICCCM_SIZE_HINT_P_SIZE); + new_client->width = size ? hints.width : geometry->width; + new_client->height = size ? hints.height : geometry->height; + const bool min_size = hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE; new_client->min_width = min_size ? hints.min_width : 0; new_client->min_height = min_size ? hints.min_height : 0;