Consider motif border for floating geometry

When calculating the geometry of a floating window with motif hints that
specify a border style, take into account that this window will have a
different border style when calculating its position with
floating_enable() when the window becomes managed.

A nice side effect of this is that users can override motif hints with
`new_float` config directives when they are specified other than
`normal`.

fixes #1270
This commit is contained in:
Tony Crisci 2014-06-20 07:26:36 -04:00 committed by Michael Stapelberg
parent 14ec68526b
commit 43b447855d
1 changed files with 10 additions and 5 deletions

View File

@ -436,11 +436,6 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
if (nc->geometry.width == 0) if (nc->geometry.width == 0)
nc->geometry = (Rect) {geom->x, geom->y, geom->width, geom->height}; nc->geometry = (Rect) {geom->x, geom->y, geom->width, geom->height};
if (want_floating) {
DLOG("geometry = %d x %d\n", nc->geometry.width, nc->geometry.height);
floating_enable(nc, true);
}
if (motif_border_style != BS_NORMAL) { if (motif_border_style != BS_NORMAL) {
DLOG("MOTIF_WM_HINTS specifies decorations (border_style = %d)\n", motif_border_style); DLOG("MOTIF_WM_HINTS specifies decorations (border_style = %d)\n", motif_border_style);
if (want_floating) { if (want_floating) {
@ -450,6 +445,16 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
} }
} }
if (want_floating) {
DLOG("geometry = %d x %d\n", nc->geometry.width, nc->geometry.height);
/* motif hints will be applied only when `new_float` is `normal` or not
* specified */
bool automatic_border = (config.default_floating_border != BS_NORMAL &&
motif_border_style == BS_NORMAL);
floating_enable(nc, automatic_border);
}
/* to avoid getting an UnmapNotify event due to reparenting, we temporarily /* to avoid getting an UnmapNotify event due to reparenting, we temporarily
* declare no interest in any state change event of this window */ * declare no interest in any state change event of this window */
values[0] = XCB_NONE; values[0] = XCB_NONE;