Add toggle for experimental fix

This commit is contained in:
speediegq 2022-09-09 10:07:24 +02:00
parent 59e69b9d6b
commit 5df0ad1a92
2 changed files with 41 additions and 31 deletions

View file

@ -215,7 +215,9 @@ struct Monitor {
int showbar;
int barposition;
int hidsel;
#if USETAGPREVIEWFIX
int mouseactivated;
#endif
Client *clients;
Client *sel;
#if USEIPC
@ -454,7 +456,7 @@ static void spawnbar();
static void unmanagealtbar(Window w);
static void unmanagetray(Window w);
#if USETAGPREVIEW
static void getpreview(void);
static void takepreview(void);
#endif
static void tagmon(const Arg *arg);
#if LAYOUT_TILE
@ -1024,7 +1026,9 @@ buttonpress(XEvent *e)
} while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags) && !hidetags) {
#if USETAGPREVIEWFIX
selmon->mouseactivated = 1;
#endif
click = ClkTagBar;
arg.ui = 1 << i;
} else if (ev->x < x + blw && !leftlayout) // right layout
@ -4213,7 +4217,7 @@ sigchld(int unused)
#if USETAGPREVIEW
void
getpreview(void)
takepreview(void)
{
unsigned int occ = 0, i;
Client *c;
@ -5022,19 +5026,22 @@ view(const Arg *arg)
unsigned int tmptag;
#if USEMOUSE
#if USETAGPREVIEWFIX
selmon->mouseactivated = 1;
#endif
#endif
#if USETAGPREVIEWFIX
#if USETAGPREVIEW
/* fix: tag preview gets captured in the next tag preview if the user switched tag while a preview is showing */
if (selmon->previewshow && !selmon->mouseactivated)
return;
#endif
#endif
if(arg->ui && (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
return;
#if USETAGPREVIEW
getpreview();
takepreview();
#endif
for (m = mons; m; m = m->next)
m->seltags ^= 1;
@ -5070,7 +5077,9 @@ view(const Arg *arg)
#if USETAGPREVIEW
XUnmapWindow(dpy, selmon->tagwin);
#endif
#if USETAGPREVIEWFIX
selmon->mouseactivated = 0;
#endif
focus(NULL);
arrange(NULL);
updatecurrentdesktop();

View file

@ -23,6 +23,7 @@
#define USEIMLIB2 1 /* Whether or not to use imlib2. Required by USEWINICON and USETAGPREVIEW. */
#define USEWINICON 1 /* Whether or not to use window icons. Requires imlib to be enabled in toggle.mk and it must be installed. */
#define USETAGPREVIEW 1 /* Whether or not to use tag previews. Requires imlib to be enabled in toggle.mk and it must be installed. */
#define USETAGPREVIEWFIX 0 /* Experimental fix for tag previews showing up in the tag preview when a window animations are enabled. Using this is not recommended and if you use the mouse to switch tags, it will not work. */
/* Layouts
* If you don't use a layout, you can remove it to keep the speedwm binary small.