diff options
| author | Abhinav <abhinav.prsai@gmail.com> | 2025-06-10 11:52:43 +0100 |
|---|---|---|
| committer | Abhinav <abhinav.prsai@gmail.com> | 2025-06-10 11:52:43 +0100 |
| commit | 642f40f285e83af702578b43c1adf195e33b93bf (patch) | |
| tree | 74c58ead85ad23e53c0bbf1f27847741ce31a02f | |
| parent | 140f5d359a0f191d679061585e77453eb75a578b (diff) | |
fix windows being mapped twice
when you click a link it used to summon the window to your workspace but
now it leaves everything be so you have to go there manually
| -rw-r--r-- | src/sxwm.c | 50 |
1 files changed, 26 insertions, 24 deletions
@@ -744,25 +744,6 @@ void hdl_client_msg(XEvent *xev) } return; } - - if (xev->xclient.message_type == XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False)) { - Window target = xev->xclient.data.l[0]; - for (int ws = 0; ws < NUM_WORKSPACES; ws++) { - for (Client *c = workspaces[ws]; c; c = c->next) { - if (c->win == target) { - /* do NOT move to current ws */ - if (ws == current_ws) { - focused = c; - send_wm_take_focus(c->win); - XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); - XRaiseWindow(dpy, c->win); - update_borders(); - } - return; - } - } - } - } } void hdl_config_ntf(XEvent *xev) @@ -948,6 +929,30 @@ void hdl_map_req(XEvent *xev) return; } + /* check if this window is already managed on any workspace */ + for (int ws = 0; ws < NUM_WORKSPACES; ws++) { + for (Client *c = workspaces[ws]; c; c = c->next) { + if (c->win == w) { + if (ws == current_ws) { + if (!c->mapped) { + XMapWindow(dpy, w); + c->mapped = True; + } + if (user_config.new_win_focus) { + focused = c; + XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); + send_wm_take_focus(c->win); + if (user_config.warp_cursor) { + warp_cursor(c); + } + } + update_borders(); + } + return; + } + } + } + Atom type; int format; unsigned long nitems, after; @@ -1033,11 +1038,8 @@ void hdl_map_req(XEvent *xev) } XMapWindow(dpy, w); - for (Client *c = workspaces[current_ws]; c; c = c->next) { - if (c->win == w) { - c->mapped = True; - } - } + c->mapped = True; + if (user_config.new_win_focus) { focused = c; XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
