focus on click
This commit is contained in:
parent
c4e21ce6e5
commit
fa93c71a43
@ -10,6 +10,7 @@ static const unsigned int gappov = 30; /* vert outer gap between window
|
|||||||
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom 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 *fonts[] = { "monospace:size=10" };
|
||||||
static const char dmenufont[] = "monospace:size=10";
|
static const char dmenufont[] = "monospace:size=10";
|
||||||
static const char col_gray1[] = "#222222";
|
static const char col_gray1[] = "#222222";
|
||||||
|
1
config.h
1
config.h
@ -10,6 +10,7 @@ static const unsigned int gappov = 10; /* vert outer gap between window
|
|||||||
static int smartgaps = 1; /* 1 means no outer gap when there is only one window */
|
static int smartgaps = 1; /* 1 means no outer gap when there is only one window */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
static const int focusonwheel = 0;
|
||||||
static const char *fonts[] = { "Hack Nerd Font:size=10" };
|
static const char *fonts[] = { "Hack Nerd Font:size=10" };
|
||||||
static const char dmenufont[] = "Hack Nerd Font:size=10";
|
static const char dmenufont[] = "Hack Nerd Font:size=10";
|
||||||
static const char col_gray1[] = "#222222";
|
static const char col_gray1[] = "#222222";
|
||||||
|
47
dwm.c
47
dwm.c
@ -169,7 +169,6 @@ static void detachstack(Client *c);
|
|||||||
static Monitor *dirtomon(int dir);
|
static Monitor *dirtomon(int dir);
|
||||||
static void drawbar(Monitor *m);
|
static void drawbar(Monitor *m);
|
||||||
static void drawbars(void);
|
static void drawbars(void);
|
||||||
static void enternotify(XEvent *e);
|
|
||||||
static void expose(XEvent *e);
|
static void expose(XEvent *e);
|
||||||
static void focus(Client *c);
|
static void focus(Client *c);
|
||||||
static void focusin(XEvent *e);
|
static void focusin(XEvent *e);
|
||||||
@ -188,7 +187,6 @@ static void manage(Window w, XWindowAttributes *wa);
|
|||||||
static void mappingnotify(XEvent *e);
|
static void mappingnotify(XEvent *e);
|
||||||
static void maprequest(XEvent *e);
|
static void maprequest(XEvent *e);
|
||||||
static void monocle(Monitor *m);
|
static void monocle(Monitor *m);
|
||||||
static void motionnotify(XEvent *e);
|
|
||||||
static void movemouse(const Arg *arg);
|
static void movemouse(const Arg *arg);
|
||||||
static Client *nexttiled(Client *c);
|
static Client *nexttiled(Client *c);
|
||||||
static void pop(Client *);
|
static void pop(Client *);
|
||||||
@ -258,13 +256,11 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
|||||||
[ConfigureRequest] = configurerequest,
|
[ConfigureRequest] = configurerequest,
|
||||||
[ConfigureNotify] = configurenotify,
|
[ConfigureNotify] = configurenotify,
|
||||||
[DestroyNotify] = destroynotify,
|
[DestroyNotify] = destroynotify,
|
||||||
[EnterNotify] = enternotify,
|
|
||||||
[Expose] = expose,
|
[Expose] = expose,
|
||||||
[FocusIn] = focusin,
|
[FocusIn] = focusin,
|
||||||
[KeyPress] = keypress,
|
[KeyPress] = keypress,
|
||||||
[MappingNotify] = mappingnotify,
|
[MappingNotify] = mappingnotify,
|
||||||
[MapRequest] = maprequest,
|
[MapRequest] = maprequest,
|
||||||
[MotionNotify] = motionnotify,
|
|
||||||
[PropertyNotify] = propertynotify,
|
[PropertyNotify] = propertynotify,
|
||||||
[UnmapNotify] = unmapnotify
|
[UnmapNotify] = unmapnotify
|
||||||
};
|
};
|
||||||
@ -439,7 +435,8 @@ buttonpress(XEvent *e)
|
|||||||
|
|
||||||
click = ClkRootWin;
|
click = ClkRootWin;
|
||||||
/* focus monitor if necessary */
|
/* 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);
|
unfocus(selmon->sel, 1);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
@ -457,8 +454,8 @@ buttonpress(XEvent *e)
|
|||||||
else
|
else
|
||||||
click = ClkStatusText;
|
click = ClkStatusText;
|
||||||
} else if ((c = wintoclient(ev->window))) {
|
} else if ((c = wintoclient(ev->window))) {
|
||||||
focus(c);
|
if (focusonwheel || (ev->button != Button4 && ev->button != Button5))
|
||||||
restack(selmon);
|
focus(c);
|
||||||
XAllowEvents(dpy, ReplayPointer, CurrentTime);
|
XAllowEvents(dpy, ReplayPointer, CurrentTime);
|
||||||
click = ClkClientWin;
|
click = ClkClientWin;
|
||||||
}
|
}
|
||||||
@ -764,25 +761,6 @@ drawbars(void)
|
|||||||
drawbar(m);
|
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
|
void
|
||||||
expose(XEvent *e)
|
expose(XEvent *e)
|
||||||
{
|
{
|
||||||
@ -1128,23 +1106,6 @@ monocle(Monitor *m)
|
|||||||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
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
|
void
|
||||||
movemouse(const Arg *arg)
|
movemouse(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user