Updated dwm-flexipatch to commit 8191c07 & ddb2e83

This is for fiixing focusonclick for hover related patches.

- 8191c07: focusonclick: not skipping motionnotify events as to avoid
  interferring with tagpreview and other on hover patches
- ddb2e83: tagpreview: adding compatibility with powerline tags and taglabels
This commit is contained in:
Alexis Jhon Gaspar 2023-10-02 18:36:52 +08:00
parent b68fc4c64f
commit fd31f4da70
6 changed files with 64 additions and 22 deletions

View file

@ -562,7 +562,7 @@ static const BarRule barrules[] = {
{ -1, 1, BAR_ALIGN_RIGHT, width_stbutton5, draw_stbutton5, click_stbutton5, NULL, "statusbutton5" },
#endif // BAR_STATUSBUTTON_PATCH
#if BAR_POWERLINE_TAGS_PATCH
{ 0, 0, BAR_ALIGN_LEFT, width_pwrl_tags, draw_pwrl_tags, click_pwrl_tags, NULL, "powerline_tags" },
{ 0, 0, BAR_ALIGN_LEFT, width_pwrl_tags, draw_pwrl_tags, click_pwrl_tags, hover_pwrl_tags, "powerline_tags" },
#endif // BAR_POWERLINE_TAGS_PATCH
#if BAR_TAGS_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, hover_tags, "tags" },

View file

@ -683,9 +683,7 @@ static void killclient(const Arg *arg);
static void manage(Window w, XWindowAttributes *wa);
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
#if !FOCUSONCLICK_PATCH
static void motionnotify(XEvent *e);
#endif // FOCUSONCLICK_PATCH
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
#if !ZOOMSWAP_PATCH || TAGINTOSTACK_ALLMASTER_PATCH || TAGINTOSTACK_ONEMASTER_PATCH
@ -821,9 +819,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
#endif // COMBO_PATCH / BAR_HOLDBAR_PATCH
[MappingNotify] = mappingnotify,
[MapRequest] = maprequest,
#if !FOCUSONCLICK_PATCH
[MotionNotify] = motionnotify,
#endif // FOCUSONCLICK_PATCH
[PropertyNotify] = propertynotify,
#if BAR_SYSTRAY_PATCH
[ResizeRequest] = resizerequest,
@ -1866,7 +1862,7 @@ void
drawbar(Monitor *m)
{
Bar *bar;
#if !BAR_FLEXWINTITLE_PATCH
if (m->showbar)
#endif // BAR_FLEXWINTITLE_PATCH
@ -2706,12 +2702,13 @@ maprequest(XEvent *e)
manage(ev->window, &wa);
}
#if !FOCUSONCLICK_PATCH
void
motionnotify(XEvent *e)
{
#if !FOCUSONCLICK_PATCH
static Monitor *mon = NULL;
Monitor *m;
#endif // FOCUSONCLICK_PATCH
Bar *bar;
#if LOSEFULLSCREEN_PATCH
Client *sel;
@ -2728,6 +2725,7 @@ motionnotify(XEvent *e)
hidetagpreview(selmon);
#endif // BAR_TAGPREVIEW_PATCH
#if !FOCUSONCLICK_PATCH
if (ev->window != root)
return;
if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
@ -2742,8 +2740,8 @@ motionnotify(XEvent *e)
focus(NULL);
}
mon = m;
#endif // FOCUSONCLICK_PATCH
}
#endif // FOCUSONCLICK_PATCH
void
movemouse(const Arg *arg)
@ -5251,4 +5249,3 @@ main(int argc, char *argv[])
#endif // RESTARTSIG_PATCH
return EXIT_SUCCESS;
}

View file

@ -105,3 +105,57 @@ click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a)
return ClkTagBar;
}
int
hover_pwrl_tags(Bar *bar, BarArg *a, XMotionEvent *ev)
{
#if BAR_TAGPREVIEW_PATCH
int i = 0, x = lrpad / 2;
int px, py;
int plw = drw->fonts->h / 2 + 1;
Monitor *m = bar->mon;
#if VANITYGAPS_PATCH
int ov = gappov;
int oh = gappoh;
#else
int ov = 0;
int oh = 0;
#endif // VANITYGAPS_PATCH
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
do {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
x += TEXTW(tagicon(bar->mon, i)) + plw;
} while (a->x >= x && ++i < NUMTAGS);
if (i < NUMTAGS) {
if ((i + 1) != selmon->previewshow && !(selmon->tagset[selmon->seltags] & 1 << i)) {
if (bar->by > m->my + m->mh / 2) // bottom bar
py = bar->by - m->mh / scalepreview - oh;
else // top bar
py = bar->by + bar->bh + oh;
px = bar->bx + ev->x - m->mw / scalepreview / 2;
if (px + m->mw / scalepreview > m->mx + m->mw)
px = m->wx + m->ww - m->mw / scalepreview - ov;
else if (px < bar->bx)
px = m->wx + ov;
selmon->previewshow = i + 1;
showtagpreview(i, px, py);
} else if (selmon->tagset[selmon->seltags] & 1 << i) {
hidetagpreview(selmon);
}
} else if (selmon->previewshow != 0) {
hidetagpreview(selmon);
}
#endif // BAR_TAGPREVIEW_PATCH
return 1;
}

View file

@ -1,4 +1,4 @@
static int width_pwrl_tags(Bar *bar, BarArg *a);
static int draw_pwrl_tags(Bar *bar, BarArg *a);
static int click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a);
static int hover_pwrl_tags(Bar *bar, BarArg *a, XMotionEvent *ev);

View file

@ -105,18 +105,9 @@ hover_taglabels(Bar *bar, BarArg *a, XMotionEvent *ev)
int oh = 0;
#endif // VANITYGAPS_PATCH
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
do {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
if (!m->taglabel[i][0])
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
x += TEXTW(m->taglabel[i]);
} while (a->x >= x && ++i < NUMTAGS);

View file

@ -650,7 +650,7 @@
* client window that remains under the mouse cursor rather than the most recently focused window.
* https://github.com/bakkeby/patches/wiki/focusfollowmouse
*/
#define FOCUSFOLLOWMOUSE_PATCH 1
#define FOCUSFOLLOWMOUSE_PATCH 0
/* A simple patch that just puts focus back to the master client.
* https://dwm.suckless.org/patches/focusmaster/
@ -660,7 +660,7 @@
/* Switch focus only by mouse click and not sloppy (focus follows mouse pointer).
* https://dwm.suckless.org/patches/focusonclick/
*/
#define FOCUSONCLICK_PATCH 0
#define FOCUSONCLICK_PATCH 1
/* Selects the next window having the urgent flag regardless of the tag it is on.
* The urgent flag can be artificially set with the following xdotool command on any window: