patched windowmap

This commit is contained in:
tavo-wasd 2024-05-02 21:41:12 -06:00
parent 2db17b48e3
commit 4d52a0a8a6

View file

@ -8,10 +8,11 @@ dwm-movestack-20211115-a786211.diff
dwm-fullgaps-6.4.diff dwm-fullgaps-6.4.diff
dwm-attachbottom-6.3.diff dwm-attachbottom-6.3.diff
dwm-alwayscenter-20200625-f04cac6.diff dwm-alwayscenter-20200625-f04cac6.diff
dwm-windowmap-20221026.diff
--- ---
diff '--color=auto' -Nu a/config.def.h b/config.def.h diff '--color=auto' -Nu a/config.def.h b/config.def.h
--- a/config.def.h 2024-03-19 05:24:52.000000000 -0600 --- a/config.def.h 2024-03-19 05:24:52.000000000 -0600
+++ b/config.def.h 2024-04-28 21:58:33.535704620 -0600 +++ b/config.def.h 2024-05-02 21:39:10.483748489 -0600
@@ -2,7 +2,9 @@ @@ -2,7 +2,9 @@
/* appearance */ /* appearance */
@ -74,18 +75,18 @@ diff '--color=auto' -Nu a/config.def.h b/config.def.h
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
diff '--color=auto' -Nu a/config.h b/config.h diff '--color=auto' -Nu a/config.h b/config.h
--- a/config.h 1969-12-31 18:00:00.000000000 -0600 --- a/config.h 1969-12-31 18:00:00.000000000 -0600
+++ b/config.h 2024-04-28 22:01:48.845590861 -0600 +++ b/config.h 2024-05-02 21:39:10.483748489 -0600
@@ -0,0 +1,172 @@ @@ -0,0 +1,170 @@
+/* See LICENSE file for copyright and license details. */ +/* See LICENSE file for copyright and license details. */
+#include <X11/XF86keysym.h> +#include <X11/XF86keysym.h>
+ +
+/* appearance */ +/* appearance */
+static const unsigned int borderpx = 2; /* border pixel of windows */ +static const unsigned int borderpx = 2; /* border pixel of windows */
+static const unsigned int gappx = 5; /* gaps between windows */ +static const unsigned int gappx = 15; /* gaps between windows */
+static const unsigned int snap = 5; /* snap pixel */ +static const unsigned int snap = 5; /* snap pixel */
+static const int swallowfloating = 0; /* 1 means swallow floating windows by default */ +static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
+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 = 0; /* 0 means bottom bar */
+static const char *fonts[] = { "JetBrainsMono:bold:size=10" }; +static const char *fonts[] = { "JetBrainsMono:bold:size=10" };
+static const char dmenufont[] = "JetBrainsMono:bold:size=10"; +static const char dmenufont[] = "JetBrainsMono:bold:size=10";
+static const char col_gray1[] = "#222222"; +static const char col_gray1[] = "#222222";
@ -94,16 +95,14 @@ diff '--color=auto' -Nu a/config.h b/config.h
+static const char col_gray4[] = "#eeeeee"; +static const char col_gray4[] = "#eeeeee";
+static const char col_cyan[] = "#005577"; +static const char col_cyan[] = "#005577";
+/* custom colors */ +/* custom colors */
+static const char col_light[] = "#689d6a"; +static const char col_light[] = "#fabd2f";
+static const char col_dark[] = "#1d2021"; +static const char col_dark[] = "#1d2021";
+static const char col_main_light[] = "#fabd2f"; +static const char col_black[] = "#000000";
+static const char col_main_dark[] = "#1d2021";
+static const char col_main_contr[] = "#012b27";
+static const char *colors[][3] = { +static const char *colors[][3] = {
+/* --------------- */ +/* --------------- */
+ /* fg bg border */ + /* fg bg border */
+ [SchemeNorm] = { col_light, col_main_contr, col_main_dark }, + [SchemeNorm] = { col_dark, col_black, col_dark },
+ [SchemeSel] = { col_dark, col_main_light, col_main_light }, + [SchemeSel] = { col_dark, col_light, col_light },
+}; +};
+ +
+/* tagging */ +/* tagging */
@ -114,14 +113,14 @@ diff '--color=auto' -Nu a/config.h b/config.h
+ * WM_CLASS(STRING) = instance, class + * WM_CLASS(STRING) = instance, class
+ * WM_NAME(STRING) = title + * WM_NAME(STRING) = title
+ */ + */
+ /* class instance title tags mask isfloating isterminal noswallow monitor */ + /* class instance title tags mask isfloating isterminal noswallow monitor */
+ { "st", NULL, NULL, 0, 0, 1, 0, -1 }, + { "st", NULL, NULL, 0, 0, 1, 0, -1 },
+ { "Display-im6.q16", NULL, NULL, 0, 1, 1, 0, -1 }, + { "Display-im6.q16", NULL, NULL, 0, 1, 1, 0, -1 },
+ { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */ + { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
+}; +};
+ +
+/* layout(s) */ +/* layout(s) */
+static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
+static const int nmaster = 1; /* number of clients in master area */ +static const int nmaster = 1; /* number of clients in master area */
+static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ +static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
+static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ +static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
@ -250,7 +249,7 @@ diff '--color=auto' -Nu a/config.h b/config.h
+ +
diff '--color=auto' -Nu a/config.mk b/config.mk diff '--color=auto' -Nu a/config.mk b/config.mk
--- a/config.mk 2024-03-19 05:24:52.000000000 -0600 --- a/config.mk 2024-03-19 05:24:52.000000000 -0600
+++ b/config.mk 2024-04-28 21:58:33.535704620 -0600 +++ b/config.mk 2024-05-02 21:39:10.483748489 -0600
@@ -20,10 +20,11 @@ @@ -20,10 +20,11 @@
# OpenBSD (uncomment) # OpenBSD (uncomment)
#FREETYPEINC = ${X11INC}/freetype2 #FREETYPEINC = ${X11INC}/freetype2
@ -266,7 +265,7 @@ diff '--color=auto' -Nu a/config.mk b/config.mk
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff '--color=auto' -Nu a/dwm.c b/dwm.c diff '--color=auto' -Nu a/dwm.c b/dwm.c
--- a/dwm.c 2024-03-19 05:24:52.000000000 -0600 --- a/dwm.c 2024-03-19 05:24:52.000000000 -0600
+++ b/dwm.c 2024-04-28 21:58:33.535704620 -0600 +++ b/dwm.c 2024-05-02 21:39:10.487748219 -0600
@@ -40,6 +40,12 @@ @@ -40,6 +40,12 @@
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */ #endif /* XINERAMA */
@ -375,15 +374,18 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus); static void unfocus(Client *c, int setfocus);
@@ -227,6 +244,7 @@ @@ -227,6 +244,10 @@
static void updatewindowtype(Client *c); static void updatewindowtype(Client *c);
static void updatewmhints(Client *c); static void updatewmhints(Client *c);
static void view(const Arg *arg); static void view(const Arg *arg);
+static void warp(const Client *c); +static void warp(const Client *c);
+static void window_set_state(Display *dpy, Window win, long state);
+static void window_map(Display *dpy, Client *c, int deiconify);
+static void window_unmap(Display *dpy, Window win, Window root, int iconify);
static Client *wintoclient(Window w); static Client *wintoclient(Window w);
static Monitor *wintomon(Window w); static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee); static int xerror(Display *dpy, XErrorEvent *ee);
@@ -234,6 +252,12 @@ @@ -234,6 +255,12 @@
static int xerrorstart(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg); static void zoom(const Arg *arg);
@ -396,7 +398,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
/* variables */ /* variables */
static const char broken[] = "broken"; static const char broken[] = "broken";
static char stext[256]; static char stext[256];
@@ -268,9 +292,20 @@ @@ -268,9 +295,20 @@
static Monitor *mons, *selmon; static Monitor *mons, *selmon;
static Window root, wmcheckwin; static Window root, wmcheckwin;
@ -417,7 +419,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
/* compile-time check if all tags fit into an unsigned int bit array. */ /* compile-time check if all tags fit into an unsigned int bit array. */
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
@@ -297,6 +332,8 @@ @@ -297,6 +335,8 @@
&& (!r->class || strstr(class, r->class)) && (!r->class || strstr(class, r->class))
&& (!r->instance || strstr(instance, r->instance))) && (!r->instance || strstr(instance, r->instance)))
{ {
@ -426,7 +428,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
c->tags |= r->tags; c->tags |= r->tags;
for (m = mons; m && m->num != r->monitor; m = m->next); for (m = mons; m && m->num != r->monitor; m = m->next);
@@ -409,6 +446,15 @@ @@ -409,6 +449,15 @@
} }
void void
@ -442,7 +444,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
attachstack(Client *c) attachstack(Client *c)
{ {
c->snext = c->mon->stack; c->snext = c->mon->stack;
@@ -416,6 +462,53 @@ @@ -416,6 +465,53 @@
} }
void void
@ -496,7 +498,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
buttonpress(XEvent *e) buttonpress(XEvent *e)
{ {
unsigned int i, x, click; unsigned int i, x, click;
@@ -441,10 +534,8 @@ @@ -441,10 +537,8 @@
arg.ui = 1 << i; arg.ui = 1 << i;
} else if (ev->x < x + TEXTW(selmon->ltsymbol)) } else if (ev->x < x + TEXTW(selmon->ltsymbol))
click = ClkLtSymbol; click = ClkLtSymbol;
@ -508,7 +510,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
} else if ((c = wintoclient(ev->window))) { } else if ((c = wintoclient(ev->window))) {
focus(c); focus(c);
restack(selmon); restack(selmon);
@@ -525,6 +616,10 @@ @@ -525,6 +619,10 @@
|| cme->data.l[2] == netatom[NetWMFullscreen]) || cme->data.l[2] == netatom[NetWMFullscreen])
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
@ -519,7 +521,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
} else if (cme->message_type == netatom[NetActiveWindow]) { } else if (cme->message_type == netatom[NetActiveWindow]) {
if (c != selmon->sel && !c->isurgent) if (c != selmon->sel && !c->isurgent)
seturgent(c, 1); seturgent(c, 1);
@@ -634,6 +729,7 @@ @@ -634,6 +732,7 @@
createmon(void) createmon(void)
{ {
Monitor *m; Monitor *m;
@ -527,7 +529,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
m = ecalloc(1, sizeof(Monitor)); m = ecalloc(1, sizeof(Monitor));
m->tagset[0] = m->tagset[1] = 1; m->tagset[0] = m->tagset[1] = 1;
@@ -641,9 +737,24 @@ @@ -641,9 +740,24 @@
m->nmaster = nmaster; m->nmaster = nmaster;
m->showbar = showbar; m->showbar = showbar;
m->topbar = topbar; m->topbar = topbar;
@ -552,7 +554,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
return m; return m;
} }
@@ -655,6 +766,9 @@ @@ -655,6 +769,9 @@
if ((c = wintoclient(ev->window))) if ((c = wintoclient(ev->window)))
unmanage(c, 1); unmanage(c, 1);
@ -562,7 +564,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
} }
void void
@@ -735,15 +849,8 @@ @@ -735,15 +852,8 @@
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
if ((w = m->ww - tw - x) > bh) { if ((w = m->ww - tw - x) > bh) {
@ -578,7 +580,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
} }
drw_map(drw, m->barwin, 0, 0, m->ww, bh); drw_map(drw, m->barwin, 0, 0, m->ww, bh);
} }
@@ -833,6 +940,7 @@ @@ -833,6 +943,7 @@
unfocus(selmon->sel, 0); unfocus(selmon->sel, 0);
selmon = m; selmon = m;
focus(NULL); focus(NULL);
@ -586,7 +588,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
} }
void void
@@ -980,7 +1088,7 @@ @@ -980,7 +1091,7 @@
void void
incnmaster(const Arg *arg) incnmaster(const Arg *arg)
{ {
@ -595,7 +597,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
arrange(selmon); arrange(selmon);
} }
@@ -1031,12 +1139,13 @@ @@ -1031,12 +1142,13 @@
void void
manage(Window w, XWindowAttributes *wa) manage(Window w, XWindowAttributes *wa)
{ {
@ -610,7 +612,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
/* geometry */ /* geometry */
c->x = c->oldx = wa->x; c->x = c->oldx = wa->x;
c->y = c->oldy = wa->y; c->y = c->oldy = wa->y;
@@ -1051,6 +1160,7 @@ @@ -1051,6 +1163,7 @@
} else { } else {
c->mon = selmon; c->mon = selmon;
applyrules(c); applyrules(c);
@ -618,7 +620,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
} }
if (c->x + WIDTH(c) > c->mon->wx + c->mon->ww) if (c->x + WIDTH(c) > c->mon->wx + c->mon->ww)
@@ -1068,13 +1178,15 @@ @@ -1068,13 +1181,15 @@
updatewindowtype(c); updatewindowtype(c);
updatesizehints(c); updatesizehints(c);
updatewmhints(c); updatewmhints(c);
@ -635,7 +637,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
attachstack(c); attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1); (unsigned char *) &(c->win), 1);
@@ -1085,6 +1197,8 @@ @@ -1085,6 +1200,8 @@
c->mon->sel = c; c->mon->sel = c;
arrange(c->mon); arrange(c->mon);
XMapWindow(dpy, c->win); XMapWindow(dpy, c->win);
@ -644,7 +646,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
focus(NULL); focus(NULL);
} }
@@ -1245,11 +1359,8 @@ @@ -1245,11 +1362,8 @@
drawbars(); drawbars();
break; break;
} }
@ -657,7 +659,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
if (ev->atom == netatom[NetWMWindowType]) if (ev->atom == netatom[NetWMWindowType])
updatewindowtype(c); updatewindowtype(c);
} }
@@ -1375,6 +1486,8 @@ @@ -1375,6 +1489,8 @@
wc.sibling = c->win; wc.sibling = c->win;
} }
} }
@ -666,7 +668,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
XSync(dpy, False); XSync(dpy, False);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
} }
@@ -1427,7 +1540,7 @@ @@ -1427,7 +1543,7 @@
detachstack(c); detachstack(c);
c->mon = m; c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
@ -675,7 +677,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
attachstack(c); attachstack(c);
focus(NULL); focus(NULL);
arrange(NULL); arrange(NULL);
@@ -1508,12 +1621,39 @@ @@ -1508,12 +1624,39 @@
} }
void void
@ -717,7 +719,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
if (selmon->sel) if (selmon->sel)
arrange(selmon); arrange(selmon);
@@ -1532,7 +1672,7 @@ @@ -1532,7 +1675,7 @@
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
if (f < 0.05 || f > 0.95) if (f < 0.05 || f > 0.95)
return; return;
@ -726,7 +728,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
arrange(selmon); arrange(selmon);
} }
@@ -1576,6 +1716,7 @@ @@ -1576,6 +1719,7 @@
netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
@ -734,7 +736,24 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
@@ -1697,25 +1838,25 @@ @@ -1633,14 +1777,12 @@
return;
if (ISVISIBLE(c)) {
/* show clients top down */
- XMoveWindow(dpy, c->win, c->x, c->y);
- if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
- resize(c, c->x, c->y, c->w, c->h, 0);
+ window_map(dpy, c, 1);
showhide(c->snext);
} else {
/* hide clients bottom up */
showhide(c->snext);
- XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
+ window_unmap(dpy, c->win, root, 1);
}
}
@@ -1697,25 +1839,25 @@
if (n > m->nmaster) if (n > m->nmaster)
mw = m->nmaster ? m->ww * m->mfact : 0; mw = m->nmaster ? m->ww * m->mfact : 0;
else else
@ -772,7 +791,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
updatebarpos(selmon); updatebarpos(selmon);
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
arrange(selmon); arrange(selmon);
@@ -1736,6 +1877,15 @@ @@ -1736,6 +1878,15 @@
} }
void void
@ -788,7 +807,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
toggletag(const Arg *arg) toggletag(const Arg *arg)
{ {
unsigned int newtags; unsigned int newtags;
@@ -1754,9 +1904,33 @@ @@ -1754,9 +1905,33 @@
toggleview(const Arg *arg) toggleview(const Arg *arg)
{ {
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
@ -822,7 +841,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
focus(NULL); focus(NULL);
arrange(selmon); arrange(selmon);
} }
@@ -1781,6 +1955,20 @@ @@ -1781,6 +1956,20 @@
Monitor *m = c->mon; Monitor *m = c->mon;
XWindowChanges wc; XWindowChanges wc;
@ -843,7 +862,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
detach(c); detach(c);
detachstack(c); detachstack(c);
if (!destroyed) { if (!destroyed) {
@@ -1796,9 +1984,12 @@ @@ -1796,9 +1985,12 @@
XUngrabServer(dpy); XUngrabServer(dpy);
} }
free(c); free(c);
@ -859,7 +878,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
} }
void void
@@ -1916,6 +2107,7 @@ @@ -1916,6 +2108,7 @@
detachstack(c); detachstack(c);
c->mon = mons; c->mon = mons;
attach(c); attach(c);
@ -867,7 +886,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
attachstack(c); attachstack(c);
} }
if (m == selmon) if (m == selmon)
@@ -2025,10 +2217,13 @@ @@ -2025,10 +2218,13 @@
Atom state = getatomprop(c, netatom[NetWMState]); Atom state = getatomprop(c, netatom[NetWMState]);
Atom wtype = getatomprop(c, netatom[NetWMWindowType]); Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
@ -885,8 +904,55 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
} }
void void
@@ -2053,15 +2248,193 @@ @@ -2051,17 +2247,240 @@
}
void void
+window_set_state(Display *dpy, Window win, long state)
+{
+ long data[] = { state, None };
+
+ XChangeProperty(dpy, win, wmatom[WMState], wmatom[WMState], 32,
+ PropModeReplace, (unsigned char*)data, 2);
+}
+
+void
+window_map(Display *dpy, Client *c, int deiconify)
+{
+ Window win = c->win;
+
+ if (deiconify)
+ window_set_state(dpy, win, NormalState);
+
+ XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
+ XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
+ XMapWindow(dpy, win);
+}
+
+void
+window_unmap(Display *dpy, Window win, Window root, int iconify)
+{
+ static XWindowAttributes ca, ra;
+
+ XGrabServer(dpy);
+ XGetWindowAttributes(dpy, root, &ra);
+ XGetWindowAttributes(dpy, win, &ca);
+
+ /* Prevent UnmapNotify events */
+ XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
+ XSelectInput(dpy, win, ca.your_event_mask & ~StructureNotifyMask);
+
+ XUnmapWindow(dpy, win);
+
+ if (iconify)
+ window_set_state(dpy, win, IconicState);
+
+ XSelectInput(dpy, root, ra.your_event_mask);
+ XSelectInput(dpy, win, ca.your_event_mask);
+ XUngrabServer(dpy);
+}
+
+void
view(const Arg *arg) view(const Arg *arg)
{ {
+ int i; + int i;
@ -1080,7 +1146,7 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
Client * Client *
wintoclient(Window w) wintoclient(Window w)
{ {
@@ -2151,10 +2524,12 @@ @@ -2151,10 +2570,12 @@
fputs("warning: no locale support\n", stderr); fputs("warning: no locale support\n", stderr);
if (!(dpy = XOpenDisplay(NULL))) if (!(dpy = XOpenDisplay(NULL)))
die("dwm: cannot open display"); die("dwm: cannot open display");
@ -1094,14 +1160,14 @@ diff '--color=auto' -Nu a/dwm.c b/dwm.c
die("pledge"); die("pledge");
#endif /* __OpenBSD__ */ #endif /* __OpenBSD__ */
scan(); scan();
@@ -2163,3 +2538,4 @@ @@ -2163,3 +2584,4 @@
XCloseDisplay(dpy); XCloseDisplay(dpy);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
+ +
diff '--color=auto' -Nu a/movestack.c b/movestack.c diff '--color=auto' -Nu a/movestack.c b/movestack.c
--- a/movestack.c 1969-12-31 18:00:00.000000000 -0600 --- a/movestack.c 1969-12-31 18:00:00.000000000 -0600
+++ b/movestack.c 2024-04-28 21:58:33.535704620 -0600 +++ b/movestack.c 2024-05-02 21:39:10.487748219 -0600
@@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
+void +void
+movestack(const Arg *arg) { +movestack(const Arg *arg) {