event: reparent: handle reparenting from one frame to another

Basically, don't ignore the reparent notify if the window is already a
client window. We already unmark it from its previous frame, so this
commit make sure it gets marked with its new frame.

Related: #299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-04-05 22:02:51 +01:00
parent fb24e33d52
commit 481ac54f67
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 12 additions and 9 deletions

View File

@ -349,15 +349,13 @@ static inline void ev_reparent_notify(session_t *ps, xcb_reparent_notify_event_t
ps->c, ev->window, XCB_CW_EVENT_MASK, ps->c, ev->window, XCB_CW_EVENT_MASK,
(const uint32_t[]){determine_evmask(ps, ev->window, WIN_EVMODE_UNKNOWN)}); (const uint32_t[]){determine_evmask(ps, ev->window, WIN_EVMODE_UNKNOWN)});
// Check if the window is an undetected client window // Mark the window as the client window of its parent.
// Firstly, check if it's a known client window auto w_real_top = find_managed_window_or_parent(ps, ev->parent);
if (!w_top) { // If found, and the client window has not been determined, or its
// If not, look for its frame window // frame may not have a correct client, continue
auto w_real_top = find_managed_window_or_parent(ps, ev->parent); if (w_real_top) {
// If found, and the client window has not been determined, or its if (!w_real_top->client_win ||
// frame may not have a correct client, continue w_real_top->client_win == w_real_top->base.id) {
if (w_real_top && (!w_real_top->client_win ||
w_real_top->client_win == w_real_top->base.id)) {
// If it has WM_STATE, mark it the client window // If it has WM_STATE, mark it the client window
if (wid_has_prop(ps, ev->window, ps->atoms->aWM_STATE)) { if (wid_has_prop(ps, ev->window, ps->atoms->aWM_STATE)) {
w_real_top->wmwin = false; w_real_top->wmwin = false;
@ -372,6 +370,11 @@ static inline void ev_reparent_notify(session_t *ps, xcb_reparent_notify_event_t
determine_evmask(ps, ev->window, WIN_EVMODE_UNKNOWN) | determine_evmask(ps, ev->window, WIN_EVMODE_UNKNOWN) |
XCB_EVENT_MASK_PROPERTY_CHANGE}); XCB_EVENT_MASK_PROPERTY_CHANGE});
} }
} else {
log_warn("Window %#010x reparented to a window that "
"already has a client window, the parent is "
"%#010x (%s)",
ev->window, w_real_top->base.id, w_real_top->name);
} }
} }
} }