no change focus on hover
This commit is contained in:
parent
2138a57854
commit
c292d0663a
|
@ -6,6 +6,7 @@ static const unsigned int gappx = 6; /* gaps between windows */
|
|||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const int focusonwheel = 0;
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
|
|
|
@ -72,6 +72,9 @@ static Key keys[] = {
|
|||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} },
|
||||
{ MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
|
||||
{ MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
|
|
1
config.h
1
config.h
|
@ -4,6 +4,7 @@ static const unsigned int gappx = 0; /* gaps between windows */
|
|||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const int focusonwheel = 0;
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
|
|
45
dwm.c
45
dwm.c
|
@ -167,7 +167,6 @@ static void detachstack(Client *c);
|
|||
static Monitor *dirtomon(int dir);
|
||||
static void drawbar(Monitor *m);
|
||||
static void drawbars(void);
|
||||
static void enternotify(XEvent *e);
|
||||
static void expose(XEvent *e);
|
||||
static void focus(Client *c);
|
||||
static void focusin(XEvent *e);
|
||||
|
@ -186,7 +185,6 @@ static void manage(Window w, XWindowAttributes *wa);
|
|||
static void mappingnotify(XEvent *e);
|
||||
static void maprequest(XEvent *e);
|
||||
static void monocle(Monitor *m);
|
||||
static void motionnotify(XEvent *e);
|
||||
static void movemouse(const Arg *arg);
|
||||
static Client *nexttiled(Client *c);
|
||||
static void pop(Client *);
|
||||
|
@ -258,13 +256,11 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
|||
[ConfigureRequest] = configurerequest,
|
||||
[ConfigureNotify] = configurenotify,
|
||||
[DestroyNotify] = destroynotify,
|
||||
[EnterNotify] = enternotify,
|
||||
[Expose] = expose,
|
||||
[FocusIn] = focusin,
|
||||
[KeyPress] = keypress,
|
||||
[MappingNotify] = mappingnotify,
|
||||
[MapRequest] = maprequest,
|
||||
[MotionNotify] = motionnotify,
|
||||
[PropertyNotify] = propertynotify,
|
||||
[UnmapNotify] = unmapnotify
|
||||
};
|
||||
|
@ -442,7 +438,8 @@ buttonpress(XEvent *e)
|
|||
|
||||
click = ClkRootWin;
|
||||
/* focus monitor if necessary */
|
||||
if ((m = wintomon(ev->window)) && m != selmon) {
|
||||
if ((m = wintomon(ev->window)) && m != selmon
|
||||
&& (focusonwheel || (ev->button != Button4 && ev->button != Button5))) {
|
||||
unfocus(selmon->sel, 1);
|
||||
selmon = m;
|
||||
focus(NULL);
|
||||
|
@ -462,8 +459,8 @@ buttonpress(XEvent *e)
|
|||
else
|
||||
click = ClkWinTitle;
|
||||
} else if ((c = wintoclient(ev->window))) {
|
||||
if (focusonwheel || (ev->button != Button4 && ev->button != Button5))
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
XAllowEvents(dpy, ReplayPointer, CurrentTime);
|
||||
click = ClkClientWin;
|
||||
}
|
||||
|
@ -809,25 +806,6 @@ drawbars(void)
|
|||
drawbar(m);
|
||||
}
|
||||
|
||||
void
|
||||
enternotify(XEvent *e)
|
||||
{
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
XCrossingEvent *ev = &e->xcrossing;
|
||||
|
||||
if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
|
||||
return;
|
||||
c = wintoclient(ev->window);
|
||||
m = c ? c->mon : wintomon(ev->window);
|
||||
if (m != selmon) {
|
||||
unfocus(selmon->sel, 1);
|
||||
selmon = m;
|
||||
} else if (!c || c == selmon->sel)
|
||||
return;
|
||||
focus(c);
|
||||
}
|
||||
|
||||
void
|
||||
expose(XEvent *e)
|
||||
{
|
||||
|
@ -1176,23 +1154,6 @@ monocle(Monitor *m)
|
|||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||
}
|
||||
|
||||
void
|
||||
motionnotify(XEvent *e)
|
||||
{
|
||||
static Monitor *mon = NULL;
|
||||
Monitor *m;
|
||||
XMotionEvent *ev = &e->xmotion;
|
||||
|
||||
if (ev->window != root)
|
||||
return;
|
||||
if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
|
||||
unfocus(selmon->sel, 1);
|
||||
selmon = m;
|
||||
focus(NULL);
|
||||
}
|
||||
mon = m;
|
||||
}
|
||||
|
||||
void
|
||||
movemouse(const Arg *arg)
|
||||
{
|
||||
|
|
34
dwm.c.orig
34
dwm.c.orig
|
@ -87,6 +87,7 @@ typedef struct Client Client;
|
|||
struct Client {
|
||||
char name[256];
|
||||
float mina, maxa;
|
||||
float cfact;
|
||||
int x, y, w, h;
|
||||
int oldx, oldy, oldw, oldh;
|
||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||
|
@ -204,6 +205,7 @@ static void setclientstate(Client *c, long state);
|
|||
static void setfocus(Client *c);
|
||||
static void setfullscreen(Client *c, int fullscreen);
|
||||
static void setlayout(const Arg *arg);
|
||||
static void setcfact(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
static void setup(void);
|
||||
static void seturgent(Client *c, int urg);
|
||||
|
@ -1085,6 +1087,7 @@ manage(Window w, XWindowAttributes *wa)
|
|||
c->w = c->oldw = wa->width;
|
||||
c->h = c->oldh = wa->height;
|
||||
c->oldbw = wa->border_width;
|
||||
c->cfact = 1.0;
|
||||
|
||||
updatetitle(c);
|
||||
if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
|
||||
|
@ -1593,6 +1596,23 @@ setlayout(const Arg *arg)
|
|||
drawbar(selmon);
|
||||
}
|
||||
|
||||
void setcfact(const Arg *arg) {
|
||||
float f;
|
||||
Client *c;
|
||||
|
||||
c = selmon->sel;
|
||||
|
||||
if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
|
||||
return;
|
||||
f = arg->f + c->cfact;
|
||||
if(arg->f == 0.0)
|
||||
f = 1.0;
|
||||
else if(f < 0.25 || f > 4.0)
|
||||
return;
|
||||
c->cfact = f;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
/* arg > 1.0 will set mfact absolutely */
|
||||
void
|
||||
setmfact(const Arg *arg)
|
||||
|
@ -1785,9 +1805,15 @@ void
|
|||
tile(Monitor *m)
|
||||
{
|
||||
unsigned int i, n, h, mw, my, ty;
|
||||
float mfacts = 0, sfacts = 0;
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
|
||||
if (n < m->nmaster)
|
||||
mfacts += c->cfact;
|
||||
else
|
||||
sfacts += c->cfact;
|
||||
}
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
|
@ -1797,15 +1823,17 @@ tile(Monitor *m)
|
|||
mw = m->ww;
|
||||
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
h = (m->wh - my) * (c->cfact / mfacts);
|
||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
if (my + HEIGHT(c) < m->wh)
|
||||
my += HEIGHT(c);
|
||||
mfacts -= c->cfact;
|
||||
} else {
|
||||
h = (m->wh - ty) / (n - i);
|
||||
h = (m->wh - ty) * (c->cfact / sfacts);
|
||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
if (ty + HEIGHT(c) < m->wh)
|
||||
ty += HEIGHT(c);
|
||||
sfacts -= c->cfact;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
From 7ac0b812540e21b470f2f6947c6cc1e30bf24b42 Mon Sep 17 00:00:00 2001
|
||||
From: iofq <cjriddz@protonmail.com>
|
||||
Date: Sun, 10 Jan 2021 22:43:16 -0600
|
||||
Subject: [PATCH] tweak fixes floating window mouse controls
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwm.c | 47 ++++-------------------------------------------
|
||||
2 files changed, 5 insertions(+), 43 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 1c0b587..4f2c946 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
+static const int focusonwheel = 0;
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 664c527..de3e883 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -163,7 +163,6 @@ static void detachstack(Client *c);
|
||||
static Monitor *dirtomon(int dir);
|
||||
static void drawbar(Monitor *m);
|
||||
static void drawbars(void);
|
||||
-static void enternotify(XEvent *e);
|
||||
static void expose(XEvent *e);
|
||||
static void focus(Client *c);
|
||||
static void focusin(XEvent *e);
|
||||
@@ -182,7 +181,6 @@ static void manage(Window w, XWindowAttributes *wa);
|
||||
static void mappingnotify(XEvent *e);
|
||||
static void maprequest(XEvent *e);
|
||||
static void monocle(Monitor *m);
|
||||
-static void motionnotify(XEvent *e);
|
||||
static void movemouse(const Arg *arg);
|
||||
static Client *nexttiled(Client *c);
|
||||
static void pop(Client *);
|
||||
@@ -250,13 +248,11 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
||||
[ConfigureRequest] = configurerequest,
|
||||
[ConfigureNotify] = configurenotify,
|
||||
[DestroyNotify] = destroynotify,
|
||||
- [EnterNotify] = enternotify,
|
||||
[Expose] = expose,
|
||||
[FocusIn] = focusin,
|
||||
[KeyPress] = keypress,
|
||||
[MappingNotify] = mappingnotify,
|
||||
[MapRequest] = maprequest,
|
||||
- [MotionNotify] = motionnotify,
|
||||
[PropertyNotify] = propertynotify,
|
||||
[UnmapNotify] = unmapnotify
|
||||
};
|
||||
@@ -425,7 +421,8 @@ buttonpress(XEvent *e)
|
||||
|
||||
click = ClkRootWin;
|
||||
/* focus monitor if necessary */
|
||||
- if ((m = wintomon(ev->window)) && m != selmon) {
|
||||
+ if ((m = wintomon(ev->window)) && m != selmon
|
||||
+ && (focusonwheel || (ev->button != Button4 && ev->button != Button5))) {
|
||||
unfocus(selmon->sel, 1);
|
||||
selmon = m;
|
||||
focus(NULL);
|
||||
@@ -445,8 +442,8 @@ buttonpress(XEvent *e)
|
||||
else
|
||||
click = ClkWinTitle;
|
||||
} else if ((c = wintoclient(ev->window))) {
|
||||
- focus(c);
|
||||
- restack(selmon);
|
||||
+ if (focusonwheel || (ev->button != Button4 && ev->button != Button5))
|
||||
+ focus(c);
|
||||
XAllowEvents(dpy, ReplayPointer, CurrentTime);
|
||||
click = ClkClientWin;
|
||||
}
|
||||
@@ -752,25 +749,6 @@ drawbars(void)
|
||||
drawbar(m);
|
||||
}
|
||||
|
||||
-void
|
||||
-enternotify(XEvent *e)
|
||||
-{
|
||||
- Client *c;
|
||||
- Monitor *m;
|
||||
- XCrossingEvent *ev = &e->xcrossing;
|
||||
-
|
||||
- if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
|
||||
- return;
|
||||
- c = wintoclient(ev->window);
|
||||
- m = c ? c->mon : wintomon(ev->window);
|
||||
- if (m != selmon) {
|
||||
- unfocus(selmon->sel, 1);
|
||||
- selmon = m;
|
||||
- } else if (!c || c == selmon->sel)
|
||||
- return;
|
||||
- focus(c);
|
||||
-}
|
||||
-
|
||||
void
|
||||
expose(XEvent *e)
|
||||
{
|
||||
@@ -1116,23 +1094,6 @@ monocle(Monitor *m)
|
||||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||
}
|
||||
|
||||
-void
|
||||
-motionnotify(XEvent *e)
|
||||
-{
|
||||
- static Monitor *mon = NULL;
|
||||
- Monitor *m;
|
||||
- XMotionEvent *ev = &e->xmotion;
|
||||
-
|
||||
- if (ev->window != root)
|
||||
- return;
|
||||
- if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
|
||||
- unfocus(selmon->sel, 1);
|
||||
- selmon = m;
|
||||
- focus(NULL);
|
||||
- }
|
||||
- mon = m;
|
||||
-}
|
||||
-
|
||||
void
|
||||
movemouse(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.30.0
|
||||
|
Loading…
Reference in New Issue