Fix freezing by temp removing mouse click to focus patch

This commit is contained in:
speediegq 2022-08-25 19:51:43 +02:00
parent 6e170d60fa
commit 7693207ef2
4 changed files with 8 additions and 29 deletions

View file

@ -95,7 +95,6 @@
- speedwm.fadeinactive: 1
- speedwm.defaultlayout: 1
- speedwm.wmclass: 1
- speedwm.clicktofocus: 0
- speedwm.stairpx: 20
- speedwm.stairdirection: 1
- speedwm.stairsamesize: 1

View file

@ -184,7 +184,7 @@ static char *scratchpadcmd[] = {"s", TERMINAL, "-t", "scratchpa
static int warpcursor = 1; /* Warp cursor when switching client/monitor */
static int pertag = 1; /* Use different mfact and layout for each layout */
static int wmclass = 1; /* Enable (1) workaround for when a class cannot be grabbed */
static int clicktofocus = 0; /* Click to focus a window, instead of focusing when touched. (1/0) */
static int focusontouch = 1; /* Focus when the users' mouse touches a window (1) */
/* Full screen options */
static int movefullscreenmon = 1; /* Move fullscreen windows to another monitor */

View file

@ -931,12 +931,8 @@ if (!leftlayout) {
} else if ((c = wintoclient(ev->window))) {
focus(c);
if (clicktofocus) {
restack(selmon);
XAllowEvents(dpy, ReplayPointer, CurrentTime);
}
click = ClkClientWin;
}
} else {
@ -996,10 +992,8 @@ if (!leftlayout) {
}
} else if ((c = wintoclient(ev->window))) {
focus(c);
if (clicktofocus) {
restack(selmon);
XAllowEvents(dpy, ReplayPointer, CurrentTime);
}
click = ClkClientWin;
}
}
@ -1712,7 +1706,6 @@ drawbars(void)
void
enternotify(XEvent *e)
{
if (!clicktofocus) {
Client *c;
Monitor *m;
XCrossingEvent *ev = &e->xcrossing;
@ -1726,6 +1719,7 @@ enternotify(XEvent *e)
selmon = m;
} else if (!c || c == selmon->sel)
return;
if (focusontouch) {
focus(c);
}
}
@ -2044,11 +2038,9 @@ grabbuttons(Client *c, int focused)
unsigned int i, j;
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
if (!clicktofocus) {
if (!focused)
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
BUTTONMASK, GrabModeSync, GrabModeSync, None, None);
for (i = 0; i < LENGTH(buttons); i++)
if (buttons[i].click == ClkClientWin)
for (j = 0; j < LENGTH(modifiers); j++)
@ -2056,18 +2048,6 @@ grabbuttons(Client *c, int focused)
buttons[i].mask | modifiers[j],
c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
} else {
if(!focused)
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
BUTTONMASK, GrabModeSync, GrabModeSync, None, None);
for(i = 0; i < LENGTH(buttons); i++)
if(buttons[i].click == ClkClientWin)
for(j = 0; j < LENGTH(modifiers); j++)
XGrabButton(dpy, buttons[i].button,
buttons[i].mask | modifiers[j],
c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
}
}
}
@ -3433,7 +3413,7 @@ restack(Monitor *m)
XSync(dpy, False);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
if (warpcursor)
if (warpcursor && focusontouch)
{
if (m == selmon && (m->tagset[m->seltags] & m->sel->tags) && selmon->lt[selmon->sellt] != &layouts[2])
warp(m->sel);

View file

@ -152,7 +152,7 @@ ResourcePref resources[] = {
{ "deckcount", INTEGER, &deckcount },
{ "defaultlayout", INTEGER, &defaultlayout },
{ "wmclass", INTEGER, &wmclass },
{ "clicktofocus", INTEGER, &clicktofocus },
{ "focusontouch", INTEGER, &focusontouch },
{ "roundedcorners", INTEGER, &roundedcorners },
{ "cornerradius", INTEGER, &cornerradius },
{ "underline", INTEGER, &underline },