diff options
author | okan | 2014-09-17 14:31:37 +0000 |
---|---|---|
committer | okan | 2014-09-17 14:31:37 +0000 |
commit | 67e11ccf55b1c98c1db978ca29a41a2fdd71e061 (patch) | |
tree | 22232314f7b2343e6ec9beb945f348f219382add | |
parent | a826ef268d5ad05429f4b269d6961839bae35822 (diff) | |
download | cwm-67e11ccf55b1c98c1db978ca29a41a2fdd71e061.tar.gz |
Introduce a check to see if a group holds only 'sticky' clients and use
this check to decide if a group is virtually empty. Rationale: if a
group contains *only* 'sticky' clients, it should be skipped while
cycling through groups. Apply similar logic to the group menu.
Based on an idea from phessler@, who also tested another version.
Diffstat (limited to '')
-rw-r--r-- | calmwm.h | 4 | ||||
-rw-r--r-- | group.c | 17 | ||||
-rw-r--r-- | mousefunc.c | 4 |
3 files changed, 19 insertions, 6 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: calmwm.h,v 1.275 2014/09/10 20:30:38 okan Exp $ + * $OpenBSD: calmwm.h,v 1.276 2014/09/17 14:31:37 okan Exp $ */ #ifndef _CALMWM_H_ @@ -407,11 +407,11 @@ void group_cycle(struct screen_ctx *, int); int group_hidden_state(struct group_ctx *); void group_hide(struct group_ctx *); void group_hidetoggle(struct screen_ctx *, int); +int group_holds_only_sticky(struct group_ctx *); void group_init(struct screen_ctx *); void group_movetogroup(struct client_ctx *, int); void group_only(struct screen_ctx *, int); void group_show(struct group_ctx *); -void group_sticky(struct client_ctx *); void group_sticky_toggle_enter(struct client_ctx *); void group_sticky_toggle_exit(struct client_ctx *); void group_update_names(struct screen_ctx *); @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: group.c,v 1.102 2014/09/08 21:15:14 okan Exp $ + * $OpenBSD: group.c,v 1.103 2014/09/17 14:31:37 okan Exp $ */ #include <sys/param.h> @@ -202,6 +202,19 @@ group_sticky_toggle_exit(struct client_ctx *cc) client_draw_border(cc); } +int +group_holds_only_sticky(struct group_ctx *gc) +{ + struct client_ctx *cc; + + /* Check if all clients in the group are 'sticky'. */ + TAILQ_FOREACH(cc, &gc->clientq, group_entry) { + if (!(cc->flags & CLIENT_STICKY)) + return(0); + } + return(1); +} + /* * If all clients in a group are hidden, then the group state is hidden. */ @@ -283,7 +296,7 @@ group_cycle(struct screen_ctx *sc, int flags) if (gc == sc->group_active) break; - if (!TAILQ_EMPTY(&gc->clientq) && showgroup == NULL) + if (!group_holds_only_sticky(gc) && showgroup == NULL) showgroup = gc; else if (!group_hidden_state(gc)) group_hide(gc); diff --git a/mousefunc.c b/mousefunc.c index c8f7a73..5114d9a 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: mousefunc.c,v 1.80 2014/09/08 21:15:14 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.81 2014/09/17 14:31:37 okan Exp $ */ #include <sys/param.h> @@ -188,7 +188,7 @@ mousefunc_menu_group(struct client_ctx *cc, union arg *arg) TAILQ_INIT(&menuq); TAILQ_FOREACH(gc, &sc->groupq, entry) { - if (TAILQ_EMPTY(&gc->clientq)) + if (group_holds_only_sticky(gc)) continue; menuq_add(&menuq, gc, group_hidden_state(gc) ? "%d: [%s]" : "%d: %s", |