applied sticky patch

This commit is contained in:
Aaro Koivukangas
2024-11-23 01:52:11 +02:00
parent 384ad5e34f
commit 49a91197e8
+25 -2
View File
@@ -90,7 +90,7 @@
#define MIN(A, B) ((A) < (B) ? (A) : (B)) #define MIN(A, B) ((A) < (B) ? (A) : (B))
#endif /* MIN */ #endif /* MIN */
#define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS) #define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags])) #define VISIBLEON(C, M) ((M) && (C)->mon == (M) && (((C)->tags & (M)->tagset[(M)->seltags]) || C->issticky))
#define LENGTH(X) (sizeof X / sizeof X[0]) #define LENGTH(X) (sizeof X / sizeof X[0])
#define END(A) ((A) + LENGTH(A)) #define END(A) ((A) + LENGTH(A))
#define TAGMASK ((1u << LENGTH(tags)) - 1) #define TAGMASK ((1u << LENGTH(tags)) - 1)
@@ -162,7 +162,7 @@ struct Client {
#endif #endif
unsigned int bw; unsigned int bw;
uint32_t tags; uint32_t tags;
int isfloating, isurgent, isfullscreen, isterm, noswallow; int isfloating, isurgent, isfullscreen, isterm, noswallow, issticky;
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
pid_t pid; pid_t pid;
Client *swallowing, *swallowedby; Client *swallowing, *swallowedby;
@@ -396,6 +396,7 @@ static void setcursor(struct wl_listener *listener, void *data);
static void setcursorshape(struct wl_listener *listener, void *data); static void setcursorshape(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating); static void setfloating(Client *c, int floating);
static void setfullscreen(Client *c, int fullscreen); static void setfullscreen(Client *c, int fullscreen);
static void setsticky(Client *c, int sticky);
static void setgamma(struct wl_listener *listener, void *data); static void setgamma(struct wl_listener *listener, void *data);
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
@@ -411,6 +412,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m); static void tile(Monitor *m);
static void togglebar(const Arg *arg); static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglesticky(const Arg *arg);
static void togglefullscreen(const Arg *arg); static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
@@ -2903,6 +2905,17 @@ setgamma(struct wl_listener *listener, void *data)
wlr_output_schedule_frame(m->wlr_output); wlr_output_schedule_frame(m->wlr_output);
} }
void
setsticky(Client *c, int sticky)
{
if(sticky && !c->issticky) {
c->issticky = 1;
} else if(!sticky && c->issticky) {
c->issticky = 0;
arrange(c->mon);
}
}
void void
setlayout(const Arg *arg) setlayout(const Arg *arg)
{ {
@@ -3353,6 +3366,16 @@ togglefullscreen(const Arg *arg)
setfullscreen(sel, !sel->isfullscreen); setfullscreen(sel, !sel->isfullscreen);
} }
void
togglesticky(const Arg *arg)
{
Client *c = focustop(selmon);
if(!c)
return;
setsticky(c, !c->issticky);
}
void void
toggletag(const Arg *arg) toggletag(const Arg *arg)
{ {