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
Failed to generate hash of commit

18
dwl.c
View file

@ -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;