aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@firemail.cc>2023-04-30 14:54:40 +0530
committersinanmohd <sinan@firemail.cc>2023-04-30 14:54:40 +0530
commit0c6b108cf79dc0fbe296b47cf8db340c2c1ecba6 (patch)
treec6c29e44050358af2e26c33f5e5cd0c0f8e6fbaa
parent95c94d5d8a0ad259e59cfbf6fdc48f4bfd6efcfc (diff)
parent797e0c74b2cbf4a49f83c9269abec06f3293d00c (diff)
repo: merge upstream changes
-rw-r--r--config.def.h5
-rw-r--r--dwl.c49
2 files changed, 29 insertions, 25 deletions
diff --git a/config.def.h b/config.def.h
index 51b29f2..c4d57c6 100644
--- a/config.def.h
+++ b/config.def.h
@@ -2,14 +2,13 @@
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 = 2; /* border pixel of windows */
-static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
static const float bordercolor[] = {0.27, 0.27, 0.27, 1.0};
static const float focuscolor[] = {0.0, 0.33, 0.47, 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 isterm noswallow monitor */
diff --git a/dwl.c b/dwl.c
index 72aea76..591c505 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)
@@ -82,7 +82,7 @@ enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar,
typedef union {
int i;
- unsigned int ui;
+ uint32_t ui;
float f;
const void *v;
} Arg;
@@ -124,8 +124,8 @@ struct Client {
struct wl_listener set_hints;
#endif
unsigned int bw;
- unsigned int tags;
int isfloating, isurgent, isfullscreen, isterm, noswallow;
+ uint32_t tags;
uint32_t resize; /* configure serial of a pending resize */
pid_t pid;
Client *swallowing, *swallowedby;
@@ -190,9 +190,10 @@ 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];
};
typedef struct {
@@ -208,7 +209,7 @@ typedef struct {
typedef struct {
const char *id;
const char *title;
- unsigned int tags;
+ uint32_t tags;
int isfloating;
int isterm;
int noswallow;
@@ -297,7 +298,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);
@@ -419,9 +420,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)
@@ -433,7 +431,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 */
@@ -455,7 +453,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;
@@ -493,7 +491,9 @@ arrange(Monitor *m)
wlr_scene_node_set_enabled(&m->fullscreen_bg->node,
(c = focustop(m)) && c->isfullscreen);
- 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);
@@ -642,13 +642,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;
}
@@ -981,6 +981,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
@@ -1213,7 +1214,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;
@@ -1248,7 +1249,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)) {
@@ -1674,12 +1675,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);
}
@@ -1902,7 +1907,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) {
@@ -1933,7 +1938,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);
}
@@ -2126,7 +2131,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();
}
@@ -2147,7 +2152,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;
@@ -2486,7 +2491,7 @@ togglefullscreen(const Arg *arg)
void
toggletag(const Arg *arg)
{
- unsigned int newtags;
+ uint32_t newtags;
Client *sel = focustop(selmon);
if (!sel)
return;
@@ -2502,7 +2507,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;