do not try to center floating window on itself

Some apps including XTerm start with a WM_CLIENT_LEADER property
containing their own window ID.  Before this commit, i3 tried to center
such windows onto itself and did it wrong since
`leader->rect == {0,0,0,0}` at this moment.

The first affected commit is 128122e766,
however, before it such windows already was misplaced, but got sanitized
afterward [1].

[1]: 8a3ef3a81b/src/floating.c (L329-L335)

Fixes #3606
This commit is contained in:
Albert Safin 2019-10-01 07:24:21 +00:00
parent 7db0d179a3
commit 67217822b8
1 changed files with 1 additions and 0 deletions

View File

@ -371,6 +371,7 @@ void floating_enable(Con *con, bool automatic) {
if (nc->rect.x == 0 && nc->rect.y == 0) {
Con *leader;
if (con->window && con->window->leader != XCB_NONE &&
con->window->id != con->window->leader &&
(leader = con_by_window_id(con->window->leader)) != NULL) {
DLOG("Centering above leader\n");
floating_center(nc, leader->rect);