From 6722a8953243387545a6bab23514b84cffd6a3bf Mon Sep 17 00:00:00 2001 From: A Frederick Christensen Date: Tue, 28 Feb 2023 21:32:35 -0600 Subject: Missing apostrophe --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index 8043bf9..fbe4c24 100644 --- a/dwl.c +++ b/dwl.c @@ -424,7 +424,7 @@ applybounds(Client *c, struct wlr_box *bbox) c->geom.width = MAX(min.width + (2 * (int)c->bw), c->geom.width); c->geom.height = MAX(min.height + (2 * (int)c->bw), c->geom.height); /* Some clients set their max size to INT_MAX, which does not violate the - * protocol but its unnecesary, as they can set their max size to zero. */ + * protocol but it's unnecesary, as they can set their max size to zero. */ if (max.width > 0 && !(2 * c->bw > INT_MAX - max.width)) /* Checks for overflow */ c->geom.width = MIN(max.width + (2 * c->bw), c->geom.width); if (max.height > 0 && !(2 * c->bw > INT_MAX - max.height)) /* Checks for overflow */ -- cgit v1.2.3 From 21930621eec5bc4acc3ae5c42cffd6a9422dc615 Mon Sep 17 00:00:00 2001 From: Palanix Date: Mon, 13 Mar 2023 12:00:46 +0100 Subject: Remove rootcolor --- config.def.h | 1 - 1 file changed, 1 deletion(-) diff --git a/config.def.h b/config.def.h index a1a6795..f98eab2 100644 --- a/config.def.h +++ b/config.def.h @@ -2,7 +2,6 @@ static const int sloppyfocus = 1; /* focus follows mouse */ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ static const unsigned int borderpx = 1; /* border pixel of windows */ -static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0}; static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0}; static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0}; /* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ -- cgit v1.2.3 From bbdf2a913b72e7a308ee0dfde6518a4285d4a775 Mon Sep 17 00:00:00 2001 From: Yves Zoundi Date: Tue, 21 Feb 2023 13:00:10 -0500 Subject: display clients count in monocle symbol - Replicate missing functionality from dwl to display the client count in monocle mode - Add ltsymbol field to Monitor struct - Display client count in monocle mode when greater than zero - Tested with somebar and dwlb --- dwl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index fbe4c24..1b59c21 100644 --- a/dwl.c +++ b/dwl.c @@ -190,6 +190,7 @@ struct Monitor { unsigned int tagset[2]; double mfact; int nmaster; + char ltsymbol[16]; }; typedef struct { @@ -482,6 +483,8 @@ arrange(Monitor *m) wlr_scene_node_set_enabled(&m->fullscreen_bg->node, (c = focustop(m)) && c->isfullscreen); + if (m) + strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); if (m && m->lt[m->sellt]->arrange) m->lt[m->sellt]->arrange(m); motionnotify(0); @@ -970,6 +973,7 @@ createmon(struct wl_listener *listener, void *data) wlr_output_layout_add_auto(output_layout, wlr_output); else wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y); + strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); } void @@ -1592,12 +1596,16 @@ void monocle(Monitor *m) { Client *c; + int n = 0; wl_list_for_each(c, &clients, link) { if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) continue; resize(c, m->w, 0); + n++; } + if (n) + snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n); if ((c = focustop(m))) wlr_scene_node_raise_to_top(&c->scene->node); } @@ -1851,7 +1859,7 @@ printstatus(void) printf("%s selmon %u\n", m->wlr_output->name, m == selmon); printf("%s tags %u %u %u %u\n", m->wlr_output->name, occ, m->tagset[m->seltags], sel, urg); - printf("%s layout %s\n", m->wlr_output->name, m->lt[m->sellt]->symbol); + printf("%s layout %s\n", m->wlr_output->name, m->ltsymbol); } fflush(stdout); } @@ -2044,7 +2052,7 @@ setlayout(const Arg *arg) selmon->sellt ^= 1; if (arg && arg->v) selmon->lt[selmon->sellt] = (Layout *)arg->v; - /* TODO change layout symbol? */ + strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol)); arrange(selmon); printstatus(); } -- cgit v1.2.3 From 9d68554c59a886b641d27a364884fb461af2d4f1 Mon Sep 17 00:00:00 2001 From: Ben Collerson Date: Thu, 23 Mar 2023 09:38:48 +1000 Subject: remove tag labels from dwl Tag labels are not used in dwl. Only the number of tags is important. Tag labels should be defined for each tag in whatever status bar is used. --- config.def.h | 4 ++-- dwl.c | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/config.def.h b/config.def.h index f98eab2..c6a4950 100644 --- a/config.def.h +++ b/config.def.h @@ -7,8 +7,8 @@ static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0}; /* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; -/* tagging */ -static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +/* tagging - tagcount must be no greater than 31 */ +static const int tagcount = 9; static const Rule rules[] = { /* app_id title tags mask isfloating monitor */ diff --git a/dwl.c b/dwl.c index 1b59c21..fbdf096 100644 --- a/dwl.c +++ b/dwl.c @@ -67,7 +67,7 @@ #define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags])) #define LENGTH(X) (sizeof X / sizeof X[0]) #define END(A) ((A) + LENGTH(A)) -#define TAGMASK ((1 << LENGTH(tags)) - 1) +#define TAGMASK ((1u << tagcount) - 1) #define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L))) #define IDLE_NOTIFY_ACTIVITY wlr_idle_notify_activity(idle, seat), wlr_idle_notifier_v1_notify_activity(idle_notifier, seat) @@ -411,9 +411,6 @@ static Atom netatom[NetLast]; /* attempt to encapsulate suck into one file */ #include "client.h" -/* compile-time check if all tags fit into an unsigned int bit array. */ -struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; - /* function implementations */ void applybounds(Client *c, struct wlr_box *bbox) -- cgit v1.2.3 From 20f61a59afeb4634dbdccfcbead95ec5852ef456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Sat, 8 Apr 2023 11:29:18 -0600 Subject: use fixed-size type for client tags while the size of `int` in most compilers is 32-bits, the size of int and all other integer types are implementation defined, so make sure we can use up to 32-bits --- dwl.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dwl.c b/dwl.c index fbdf096..6c34e32 100644 --- a/dwl.c +++ b/dwl.c @@ -123,7 +123,7 @@ typedef struct { struct wl_listener set_hints; #endif unsigned int bw; - unsigned int tags; + uint32_t tags; int isfloating, isurgent, isfullscreen; uint32_t resize; /* configure serial of a pending resize */ } Client; @@ -187,7 +187,7 @@ struct Monitor { const Layout *lt[2]; unsigned int seltags; unsigned int sellt; - unsigned int tagset[2]; + uint32_t tagset[2]; double mfact; int nmaster; char ltsymbol[16]; @@ -206,7 +206,7 @@ typedef struct { typedef struct { const char *id; const char *title; - unsigned int tags; + uint32_t tags; int isfloating; int monitor; } Rule; @@ -293,7 +293,7 @@ static void setfloating(Client *c, int floating); static void setfullscreen(Client *c, int fullscreen); static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); -static void setmon(Client *c, Monitor *m, unsigned int newtags); +static void setmon(Client *c, Monitor *m, uint32_t newtags); static void setpsel(struct wl_listener *listener, void *data); static void setsel(struct wl_listener *listener, void *data); static void setup(void); @@ -444,7 +444,7 @@ applyrules(Client *c) { /* rule matching */ const char *appid, *title; - unsigned int i, newtags = 0; + uint32_t i, newtags = 0; const Rule *r; Monitor *mon = selmon, *m; @@ -1825,7 +1825,7 @@ printstatus(void) { Monitor *m = NULL; Client *c; - unsigned int occ, urg, sel; + uint32_t occ, urg, sel; const char *appid, *title; wl_list_for_each(m, &mons, link) { @@ -2070,7 +2070,7 @@ setmfact(const Arg *arg) } void -setmon(Client *c, Monitor *m, unsigned int newtags) +setmon(Client *c, Monitor *m, uint32_t newtags) { Monitor *oldmon = c->mon; @@ -2409,7 +2409,7 @@ togglefullscreen(const Arg *arg) void toggletag(const Arg *arg) { - unsigned int newtags; + uint32_t newtags; Client *sel = focustop(selmon); if (!sel) return; @@ -2425,7 +2425,7 @@ toggletag(const Arg *arg) void toggleview(const Arg *arg) { - unsigned int newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0; + uint32_t newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0; if (newtagset) { selmon->tagset[selmon->seltags] = newtagset; -- cgit v1.2.3 From da77e34ee55ef4d2f92f632fea880610e8fc7fda Mon Sep 17 00:00:00 2001 From: Ben Collerson Date: Sun, 9 Apr 2023 14:48:55 +1000 Subject: Use uint32_t for ui Arg --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index 6c34e32..e59eae4 100644 --- a/dwl.c +++ b/dwl.c @@ -82,7 +82,7 @@ enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar, typedef union { int i; - unsigned int ui; + uint32_t ui; float f; const void *v; } Arg; -- cgit v1.2.3 From 3c760bcd4ae640ec27229da8c75e9539bfd0d5cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Wed, 12 Apr 2023 19:31:55 -0600 Subject: remove unneeded check of `m` in arrange() arrange must never be called with a NULL argument --- dwl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dwl.c b/dwl.c index e59eae4..3442dcb 100644 --- a/dwl.c +++ b/dwl.c @@ -480,9 +480,9 @@ arrange(Monitor *m) wlr_scene_node_set_enabled(&m->fullscreen_bg->node, (c = focustop(m)) && c->isfullscreen); - if (m) - strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); - if (m && m->lt[m->sellt]->arrange) + strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); + + if (m->lt[m->sellt]->arrange) m->lt[m->sellt]->arrange(m); motionnotify(0); checkidleinhibitor(NULL); -- cgit v1.2.3 From 797e0c74b2cbf4a49f83c9269abec06f3293d00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Wed, 12 Apr 2023 21:37:19 -0600 Subject: correctly check if a scene node is enabled checking only wlr_scene_node.enabled may result in a false positive because it does not consider if its ancestors are enabled as well. --- dwl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dwl.c b/dwl.c index 3442dcb..b7436bb 100644 --- a/dwl.c +++ b/dwl.c @@ -631,13 +631,13 @@ chvt(const Arg *arg) void checkidleinhibitor(struct wlr_surface *exclude) { - int inhibited = 0; + int inhibited = 0, unused_lx, unused_ly; struct wlr_idle_inhibitor_v1 *inhibitor; wl_list_for_each(inhibitor, &idle_inhibit_mgr->inhibitors, link) { struct wlr_surface *surface = wlr_surface_get_root_surface(inhibitor->surface); struct wlr_scene_tree *tree = surface->data; if (exclude != surface && (bypass_surface_visibility || (!tree - || tree->node.enabled))) { + || wlr_scene_node_coords(&tree->node, &unused_lx, &unused_ly)))) { inhibited = 1; break; } @@ -1201,7 +1201,7 @@ void focusclient(Client *c, int lift) { struct wlr_surface *old = seat->keyboard_state.focused_surface; - int i; + int i, unused_lx, unused_ly; if (locked) return; @@ -1236,7 +1236,7 @@ focusclient(Client *c, int lift) Client *w = NULL; LayerSurface *l = NULL; int type = toplevel_from_wlr_surface(old, &w, &l); - if (type == LayerShell && l->scene->node.enabled + if (type == LayerShell && wlr_scene_node_coords(&l->scene->node, &unused_lx, &unused_ly) && l->layer_surface->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) { return; } else if (w && w == exclusive_focus && client_wants_focus(w)) { -- cgit v1.2.3