aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-04-24 12:54:08 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2023-04-24 12:54:08 +0200
commitfcd14b59ef5eb34c8b107388a3fafe65119119f4 (patch)
tree57d877861b593849fa351e53a29a48ee10ccc9b1
parent3db042af964707626bdf094de0fdd5fe3affa4d4 (diff)
parent797e0c74b2cbf4a49f83c9269abec06f3293d00c (diff)
Merge branch 'main' of https://github.com/djpohly/dwl
-rw-r--r--config.def.h4
-rw-r--r--dwl.c39
2 files changed, 20 insertions, 23 deletions
diff --git a/config.def.h b/config.def.h
index 6ac9a4d..5a80e21 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 677edb9..57024ca 100644
--- a/dwl.c
+++ b/dwl.c
@@ -73,7 +73,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)
@@ -88,7 +88,7 @@ enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar,
typedef union {
int i;
- unsigned int ui;
+ uint32_t ui;
float f;
const void *v;
} Arg;
@@ -129,7 +129,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;
@@ -200,7 +200,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];
@@ -227,7 +227,7 @@ typedef struct {
typedef struct {
const char *id;
const char *title;
- unsigned int tags;
+ uint32_t tags;
int isfloating;
int monitor;
} Rule;
@@ -333,7 +333,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);
@@ -462,9 +462,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)
@@ -498,7 +495,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;
@@ -534,9 +531,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, NULL, 0, 0, 0, 0);
}
@@ -720,13 +717,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;
}
@@ -1607,7 +1604,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;
@@ -1642,7 +1639,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)) {
@@ -2266,7 +2263,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) {
@@ -2512,7 +2509,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;
@@ -2857,7 +2854,7 @@ togglefullscreen(const Arg *arg)
void
toggletag(const Arg *arg)
{
- unsigned int newtags;
+ uint32_t newtags;
Client *sel = focustop(selmon);
if (!sel)
return;
@@ -2873,7 +2870,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;