diff options
author | okan | 2016-09-14 19:45:33 +0000 |
---|---|---|
committer | okan | 2016-09-14 19:45:33 +0000 |
commit | 21f94c6aa8f7753b6ba8e738bcdcf29567e3f7f9 (patch) | |
tree | 34fb0000ffe68dda325f0ce700df305d7f91a109 | |
parent | 94f916d33826c67c48de8587c500ea39d746630d (diff) | |
download | cwm-21f94c6aa8f7753b6ba8e738bcdcf29567e3f7f9.tar.gz |
Fix-up a few simple uses of client_current(): check CLIENT_ACTIVE flag
instead of relying on curcc.
Diffstat (limited to '')
-rw-r--r-- | client.c | 14 | ||||
-rw-r--r-- | search.c | 6 | ||||
-rw-r--r-- | xevents.c | 11 |
3 files changed, 17 insertions, 14 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: client.c,v 1.219 2016/09/13 17:42:58 okan Exp $ + * $OpenBSD: client.c,v 1.220 2016/09/14 19:45:33 okan Exp $ */ #include <sys/types.h> @@ -176,12 +176,12 @@ client_delete(struct client_ctx *cc) xu_ewmh_net_client_list(sc); xu_ewmh_net_client_list_stacking(sc); + if (cc->flags & CLIENT_ACTIVE) + client_none(sc); + if (cc->gc != NULL) TAILQ_REMOVE(&cc->gc->clientq, cc, group_entry); - if (cc == client_current()) - client_none(sc); - while ((wn = TAILQ_FIRST(&cc->nameq)) != NULL) { TAILQ_REMOVE(&cc->nameq, wn, entry); free(wn->name); @@ -510,12 +510,12 @@ client_hide(struct client_ctx *cc) { XUnmapWindow(X_Dpy, cc->win); + if (cc->flags & CLIENT_ACTIVE) + client_none(cc->sc); + cc->flags &= ~CLIENT_ACTIVE; cc->flags |= CLIENT_HIDDEN; client_set_wm_state(cc, IconicState); - - if (cc == client_current()) - client_none(cc->sc); } void @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: search.c,v 1.51 2015/08/27 18:53:15 okan Exp $ + * $OpenBSD: search.c,v 1.52 2016/09/14 19:45:33 okan Exp $ */ #include <sys/types.h> @@ -94,7 +94,7 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search) * window. Furthermore, this is denoted by a "!" when * printing the window name in the search menu. */ - if (cc == client_current() && tier < nitems(tierp) - 1) + if ((cc->flags & CLIENT_ACTIVE) && (tier < nitems(tierp) - 1)) tier++; /* Clients that are hidden get ranked one up. */ @@ -147,7 +147,7 @@ search_print_client(struct menu *mi, int list) struct client_ctx *cc = (struct client_ctx *)mi->ctx; char flag = ' '; - if (cc == client_current()) + if (cc->flags & CLIENT_ACTIVE) flag = '!'; else if (cc->flags & CLIENT_HIDDEN) flag = '&'; @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: xevents.c,v 1.120 2015/11/10 20:05:33 okan Exp $ + * $OpenBSD: xevents.c,v 1.121 2016/09/14 19:45:33 okan Exp $ */ /* @@ -250,10 +250,13 @@ xev_handle_buttonpress(XEvent *ee) static void xev_handle_buttonrelease(XEvent *ee) { - struct client_ctx *cc; + XButtonEvent *e = &ee->xbutton; + struct client_ctx *cc; - if ((cc = client_current()) != NULL) - group_toggle_membership_leave(cc); + if ((cc = client_find(e->window)) != NULL) { + if (cc->flags & CLIENT_ACTIVE) + group_toggle_membership_leave(cc); + } } static void |