summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/dwm.c b/dwm.c
index 93d2423..d752216 100644
--- a/dwm.c
+++ b/dwm.c
@@ -951,8 +951,13 @@ expose(XEvent *e)
void
focus(Client *c)
{
- if (!c || !ISVISIBLE(c))
- for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
+ if (!c || !ISVISIBLE(c)) {
+ for (c = selmon->stack; c && (!ISVISIBLE(c) || (c->issticky && !selmon->sel->issticky)); c = c->snext);
+
+ if (!c) /* No windows found; check for available stickies */
+ for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
+ }
+
if (selmon->sel && selmon->sel != c)
unfocus(selmon->sel, 0);
if (c) {
@@ -1229,6 +1234,8 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
+ c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
+ c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)