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
This commit is contained in:
Leonardo Hernández Hernández 2023-04-08 11:29:18 -06:00
parent 9d68554c59
commit 20f61a59af
No known key found for this signature in database
GPG key ID: E538897EE11B9624

18
dwl.c
View file

@ -123,7 +123,7 @@ typedef struct {
struct wl_listener set_hints; struct wl_listener set_hints;
#endif #endif
unsigned int bw; unsigned int bw;
unsigned int tags; uint32_t tags;
int isfloating, isurgent, isfullscreen; int isfloating, isurgent, isfullscreen;
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
} Client; } Client;
@ -187,7 +187,7 @@ struct Monitor {
const Layout *lt[2]; const Layout *lt[2];
unsigned int seltags; unsigned int seltags;
unsigned int sellt; unsigned int sellt;
unsigned int tagset[2]; uint32_t tagset[2];
double mfact; double mfact;
int nmaster; int nmaster;
char ltsymbol[16]; char ltsymbol[16];
@ -206,7 +206,7 @@ typedef struct {
typedef struct { typedef struct {
const char *id; const char *id;
const char *title; const char *title;
unsigned int tags; uint32_t tags;
int isfloating; int isfloating;
int monitor; int monitor;
} Rule; } Rule;
@ -293,7 +293,7 @@ static void setfloating(Client *c, int floating);
static void setfullscreen(Client *c, int fullscreen); static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(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 setpsel(struct wl_listener *listener, void *data);
static void setsel(struct wl_listener *listener, void *data); static void setsel(struct wl_listener *listener, void *data);
static void setup(void); static void setup(void);
@ -444,7 +444,7 @@ applyrules(Client *c)
{ {
/* rule matching */ /* rule matching */
const char *appid, *title; const char *appid, *title;
unsigned int i, newtags = 0; uint32_t i, newtags = 0;
const Rule *r; const Rule *r;
Monitor *mon = selmon, *m; Monitor *mon = selmon, *m;
@ -1825,7 +1825,7 @@ printstatus(void)
{ {
Monitor *m = NULL; Monitor *m = NULL;
Client *c; Client *c;
unsigned int occ, urg, sel; uint32_t occ, urg, sel;
const char *appid, *title; const char *appid, *title;
wl_list_for_each(m, &mons, link) { wl_list_for_each(m, &mons, link) {
@ -2070,7 +2070,7 @@ setmfact(const Arg *arg)
} }
void void
setmon(Client *c, Monitor *m, unsigned int newtags) setmon(Client *c, Monitor *m, uint32_t newtags)
{ {
Monitor *oldmon = c->mon; Monitor *oldmon = c->mon;
@ -2409,7 +2409,7 @@ togglefullscreen(const Arg *arg)
void void
toggletag(const Arg *arg) toggletag(const Arg *arg)
{ {
unsigned int newtags; uint32_t newtags;
Client *sel = focustop(selmon); Client *sel = focustop(selmon);
if (!sel) if (!sel)
return; return;
@ -2425,7 +2425,7 @@ toggletag(const Arg *arg)
void void
toggleview(const Arg *arg) 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) { if (newtagset) {
selmon->tagset[selmon->seltags] = newtagset; selmon->tagset[selmon->seltags] = newtagset;