From: Michael Stapelberg Date: Fri, 21 Jan 2011 20:01:02 +0000 (+0100) Subject: Bugfix: Don’t send fake configure notify with not yet rendered rect for floating... X-Git-Tag: tree-pr2~112 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=81ff1f976df43ebda6fdcfb794f926b5d14f3364;p=i3%2Fi3 Bugfix: Don’t send fake configure notify with not yet rendered rect for floating windows This fixes a bug where opening the Xpdf find dialog when Xpdf is in fullscreen mode would crash Xpdf due to a zero-width and zero-height ConfigureNotify rect. --- diff --git a/src/floating.c b/src/floating.c index 3cf8ab5f..85b2c0ae 100644 --- a/src/floating.c +++ b/src/floating.c @@ -87,12 +87,14 @@ void floating_enable(Con *con, bool automatic) { i3Font *font = load_font(conn, config.font); int deco_height = font->height + 5; + DLOG("Original rect: (%d, %d) with %d x %d\n", con->rect.x, con->rect.y, con->rect.width, con->rect.height); nc->rect = con->rect; /* add pixels for the decoration */ /* TODO: don’t add them when the user automatically puts new windows into * 1pixel/borderless mode */ nc->rect.height += deco_height + 4; nc->rect.width += 4; + DLOG("Floating rect: (%d, %d) with %d x %d\n", nc->rect.x, nc->rect.y, nc->rect.width, nc->rect.height); nc->orientation = NO_ORIENTATION; nc->type = CT_FLOATING_CON; TAILQ_INSERT_TAIL(&(nc->parent->floating_head), nc, floating_windows); @@ -120,6 +122,10 @@ void floating_enable(Con *con, bool automatic) { } } + /* render the cons to get initial window_rect correct */ + render_con(nc, false); + render_con(con, false); + TAILQ_INSERT_TAIL(&(nc->nodes_head), con, nodes); TAILQ_INSERT_TAIL(&(nc->focus_head), con, focused); // TODO: don’t influence focus handling when Con was not focused before. diff --git a/src/xcb.c b/src/xcb.c index 4b400ae5..ff7dadbc 100644 --- a/src/xcb.c +++ b/src/xcb.c @@ -192,6 +192,8 @@ void fake_absolute_configure_notify(Con *con) { absolute.width = con->window_rect.width; absolute.height = con->window_rect.height; + DLOG("fake rect = (%d, %d, %d, %d)\n", absolute.x, absolute.y, absolute.width, absolute.height); + fake_configure_notify(conn, absolute, con->window->id); }