summaryrefslogtreecommitdiffhomepage
path: root/dwm.c
diff options
context:
space:
mode:
authorStein Gunnar Bakkeby <[email protected]>2022-07-05 14:55:42 +0200
committerGitHub <[email protected]>2022-07-05 14:55:42 +0200
commit5f7df0b0dc78ae00f21d5bbe892456c450506b9b (patch)
tree73610f0475c0e5b7ef5a2017e11813908e769fcd /dwm.c
parent20692bea017353bcaf069625bcf3bda6eed4ad51 (diff)
downloaddwm-flexipatch-5f7df0b0dc78ae00f21d5bbe892456c450506b9b.tar.gz
dwm-flexipatch-5f7df0b0dc78ae00f21d5bbe892456c450506b9b.zip
Adding tagpreview patch (#271)
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/dwm.c b/dwm.c
index 8d8ca19..1c77a15 100644
--- a/dwm.c
+++ b/dwm.c
@@ -314,6 +314,7 @@ typedef struct {
int (*widthfunc)(Bar *bar, BarArg *a);
int (*drawfunc)(Bar *bar, BarArg *a);
int (*clickfunc)(Bar *bar, Arg *arg, BarArg *a);
+ int (*hoverfunc)(Bar *bar, BarArg *a, XMotionEvent *ev);
char *name; // for debugging
int x, w; // position, width for internal use
} BarRule;
@@ -515,6 +516,11 @@ struct Monitor {
Client *lastsel;
const Layout *lastlt;
#endif // IPC_PATCH
+ #if BAR_TAGPREVIEW_PATCH
+ Window tagwin;
+ int previewshow;
+ Pixmap tagmap[NUMTAGS];
+ #endif // BAR_TAGPREVIEW_PATCH
};
typedef struct {
@@ -1308,6 +1314,13 @@ cleanupmon(Monitor *mon)
#if PERTAG_PATCH
free(mon->pertag);
#endif // PERTAG_PATCH
+ #if BAR_TAGPREVIEW_PATCH
+ for (size_t i = 0; i < NUMTAGS; i++)
+ if (mon->tagmap[i])
+ XFreePixmap(dpy, mon->tagmap[i]);
+ XUnmapWindow(dpy, mon->tagwin);
+ XDestroyWindow(dpy, mon->tagwin);
+ #endif // BAR_TAGPREVIEW_PATCH
free(mon);
}
@@ -2621,11 +2634,22 @@ motionnotify(XEvent *e)
{
static Monitor *mon = NULL;
Monitor *m;
+ Bar *bar;
#if LOSEFULLSCREEN_PATCH
Client *sel;
#endif // LOSEFULLSCREEN_PATCH
XMotionEvent *ev = &e->xmotion;
+ if ((bar = wintobar(ev->window))) {
+ barhover(e, bar);
+ return;
+ }
+
+ #if BAR_TAGPREVIEW_PATCH
+ if (selmon->previewshow != 0)
+ hidetagpreview(selmon);
+ #endif // BAR_TAGPREVIEW_PATCH
+
if (ev->window != root)
return;
if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
@@ -3732,6 +3756,9 @@ setup(void)
updatebars();
updatestatus();
+ #if BAR_TAGPREVIEW_PATCH
+ updatepreview();
+ #endif // BAR_TAGPREVIEW_PATCH
/* supporting window for NetWMCheck */
wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
@@ -4198,6 +4225,9 @@ toggleview(const Arg *arg)
#if !EMPTYVIEW_PATCH
if (newtagset) {
#endif // EMPTYVIEW_PATCH
+ #if BAR_TAGPREVIEW_PATCH
+ tagpreviewswitchtag();
+ #endif // BAR_TAGPREVIEW_PATCH
selmon->tagset[selmon->seltags] = newtagset;
#if PERTAG_PATCH
@@ -4421,7 +4451,11 @@ updatebars(void)
#else
.background_pixmap = ParentRelative,
#endif // BAR_ALPHA_PATCH
+ #if BAR_TAGPREVIEW_PATCH
+ .event_mask = ButtonPressMask|ExposureMask|PointerMotionMask
+ #else
.event_mask = ButtonPressMask|ExposureMask
+ #endif // BAR_TAGPREVIEW_PATCH
};
XClassHint ch = {"dwm", "dwm"};
for (m = mons; m; m = m->next) {
@@ -4828,6 +4862,9 @@ view(const Arg *arg)
#endif // TOGGLETAG_PATCH
return;
}
+ #if BAR_TAGPREVIEW_PATCH
+ tagpreviewswitchtag();
+ #endif // BAR_TAGPREVIEW_PATCH
selmon->seltags ^= 1; /* toggle sel tagset */
#if PERTAG_PATCH
pertagview(arg);