Revert "Revert previous fix for #299"
This reverts commit 04fe4a76b2
.
This brings back the previous incomplete fix attempt for #299. See the
commit message of the revert for why it's incomplete.
A different fix is then attempted, see commit xxxxxxx for how that fix
works.
However, the second fix is incomplete by itself as well. The reason is
that i3 reparent the real window to the frame first, before destroying
the placeholder client of that frame. So briefly, that frame would have
2 client windows. And the frame is mapped before the placeholder is
destroyed. So even though we only call win_recheck_client when/if the
frame window is mapped, it can still be called when there are 2 client
windows, it would pick up the wrong client window in that case.
So what we need is to combine both fixes.
The second fix makes sure we are up to date on the client window
information when we starts to listen for events on the frame window;
while the first fix would keep us up to date afterwards.
This revert also includes a fix for assertion failure raised in #371
See #299 for root cause of the bug.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
10
src/win.c
10
src/win.c
@ -53,8 +53,6 @@ static const int WIN_GET_LEADER_MAX_RECURSION = 20;
|
||||
static const int ROUNDED_PIXELS = 1;
|
||||
static const double ROUNDED_PERCENT = 0.05;
|
||||
|
||||
static void win_recheck_client(session_t *ps, struct managed_win *w);
|
||||
|
||||
/// Generate a "return by value" function, from a function that returns the
|
||||
/// region via a region_t pointer argument.
|
||||
/// Function signature has to be (win *, region_t *)
|
||||
@ -1031,6 +1029,8 @@ void win_mark_client(session_t *ps, struct managed_win *w, xcb_window_t client)
|
||||
*/
|
||||
void win_unmark_client(session_t *ps, struct managed_win *w) {
|
||||
xcb_window_t client = w->client_win;
|
||||
log_debug("Detaching client window %#010x from frame %#010x (%s)", client,
|
||||
w->base.id, w->name);
|
||||
|
||||
w->client_win = XCB_NONE;
|
||||
|
||||
@ -1074,7 +1074,7 @@ static xcb_window_t find_client_win(session_t *ps, xcb_window_t w) {
|
||||
* @param ps current session
|
||||
* @param w struct _win of the parent window
|
||||
*/
|
||||
static void win_recheck_client(session_t *ps, struct managed_win *w) {
|
||||
void win_recheck_client(session_t *ps, struct managed_win *w) {
|
||||
// Initialize wmwin to false
|
||||
w->wmwin = false;
|
||||
|
||||
@ -1084,14 +1084,14 @@ static void win_recheck_client(session_t *ps, struct managed_win *w) {
|
||||
// sets override-redirect flags on all frame windows.
|
||||
xcb_window_t cw = find_client_win(ps, w->base.id);
|
||||
if (cw) {
|
||||
log_trace("(%#010x): client %#010x", w->base.id, cw);
|
||||
log_debug("(%#010x): client %#010x", w->base.id, cw);
|
||||
}
|
||||
// Set a window's client window to itself if we couldn't find a
|
||||
// client window
|
||||
if (!cw) {
|
||||
cw = w->base.id;
|
||||
w->wmwin = !w->a.override_redirect;
|
||||
log_trace("(%#010x): client self (%s)", w->base.id,
|
||||
log_debug("(%#010x): client self (%s)", w->base.id,
|
||||
(w->wmwin ? "wmwin" : "override-redirected"));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user