before major changes to monitor support
This commit is contained in:
@@ -20,7 +20,6 @@ static const float mfact = 0.55;
|
||||
static const int nmaster = 1;
|
||||
static const int resizehints = 1;
|
||||
static const int lockfullscreen = 1;
|
||||
static const int refreshrate = 120;
|
||||
|
||||
static const Layout layouts[] = {
|
||||
{ "T", tile },
|
||||
@@ -35,8 +34,6 @@ static const Layout layouts[] = {
|
||||
|
||||
#include "X11/XF86keysym.h"
|
||||
static const Key keys[] = {
|
||||
{ MODKEY, XK_h, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_l, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_q, killclient, {0} },
|
||||
{ MODKEY, XK_Return, spawn, SHCMD("ghostty -e tmux a") },
|
||||
{ MODKEY, XK_f, spawn, SHCMD("librewolf") },
|
||||
|
||||
+80
-242
@@ -136,7 +136,6 @@ static void enternotify(XEvent *e);
|
||||
static void expose(XEvent *e);
|
||||
static void focus(Client *c);
|
||||
static void focusin(XEvent *e);
|
||||
static void focusstack(const Arg *arg);
|
||||
static Atom getatomprop(Client *c, Atom prop);
|
||||
static int getrootptr(int *x, int *y);
|
||||
static long getstate(Window w);
|
||||
@@ -225,9 +224,7 @@ static Window root, wmcheckwin;
|
||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||
|
||||
/* function implementations */
|
||||
void
|
||||
applyrules(Client *c)
|
||||
{
|
||||
void applyrules(Client *c) {
|
||||
const char *class, *instance;
|
||||
unsigned int i;
|
||||
const Rule *r;
|
||||
@@ -261,9 +258,7 @@ applyrules(Client *c)
|
||||
c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
|
||||
}
|
||||
|
||||
int
|
||||
applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
|
||||
{
|
||||
int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact) {
|
||||
int baseismin;
|
||||
Monitor *m = c->mon;
|
||||
|
||||
@@ -329,9 +324,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
|
||||
return *x != c->x || *y != c->y || *w != c->w || *h != c->h;
|
||||
}
|
||||
|
||||
void
|
||||
arrange(Monitor *m)
|
||||
{
|
||||
void arrange(Monitor *m) {
|
||||
if (m)
|
||||
showhide(m->stack);
|
||||
else for (m = mons; m; m = m->next)
|
||||
@@ -343,31 +336,23 @@ arrange(Monitor *m)
|
||||
arrangemon(m);
|
||||
}
|
||||
|
||||
void
|
||||
arrangemon(Monitor *m)
|
||||
{
|
||||
void arrangemon(Monitor *m) {
|
||||
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
|
||||
if (m->lt[m->sellt]->arrange)
|
||||
m->lt[m->sellt]->arrange(m);
|
||||
}
|
||||
|
||||
void
|
||||
attach(Client *c)
|
||||
{
|
||||
void attach(Client *c) {
|
||||
c->next = c->mon->clients;
|
||||
c->mon->clients = c;
|
||||
}
|
||||
|
||||
void
|
||||
attachstack(Client *c)
|
||||
{
|
||||
void attachstack(Client *c) {
|
||||
c->snext = c->mon->stack;
|
||||
c->mon->stack = c;
|
||||
}
|
||||
|
||||
void
|
||||
cleanup(void)
|
||||
{
|
||||
void cleanup(void) {
|
||||
Arg a = {.ui = ~0};
|
||||
Layout foo = { "", NULL };
|
||||
Monitor *m;
|
||||
@@ -393,9 +378,7 @@ cleanup(void)
|
||||
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
|
||||
}
|
||||
|
||||
void
|
||||
cleanupmon(Monitor *mon)
|
||||
{
|
||||
void cleanupmon(Monitor *mon) {
|
||||
Monitor *m;
|
||||
|
||||
if (mon == mons)
|
||||
@@ -409,9 +392,7 @@ cleanupmon(Monitor *mon)
|
||||
free(mon);
|
||||
}
|
||||
|
||||
void
|
||||
clientmessage(XEvent *e)
|
||||
{
|
||||
void clientmessage(XEvent *e) {
|
||||
XClientMessageEvent *cme = &e->xclient;
|
||||
Client *c = wintoclient(cme->window);
|
||||
|
||||
@@ -428,9 +409,7 @@ clientmessage(XEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
configure(Client *c)
|
||||
{
|
||||
void configure(Client *c) {
|
||||
XConfigureEvent ce;
|
||||
|
||||
ce.type = ConfigureNotify;
|
||||
@@ -447,9 +426,7 @@ configure(Client *c)
|
||||
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
|
||||
}
|
||||
|
||||
void
|
||||
configurenotify(XEvent *e)
|
||||
{
|
||||
void configurenotify(XEvent *e) {
|
||||
Monitor *m;
|
||||
Client *c;
|
||||
XConfigureEvent *ev = &e->xconfigure;
|
||||
@@ -475,9 +452,7 @@ configurenotify(XEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
configurerequest(XEvent *e)
|
||||
{
|
||||
void configurerequest(XEvent *e) {
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
||||
@@ -527,9 +502,7 @@ configurerequest(XEvent *e)
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
Monitor *
|
||||
createmon(void)
|
||||
{
|
||||
Monitor * createmon(void) {
|
||||
Monitor *m;
|
||||
|
||||
m = ecalloc(1, sizeof(Monitor));
|
||||
@@ -545,9 +518,7 @@ createmon(void)
|
||||
return m;
|
||||
}
|
||||
|
||||
void
|
||||
destroynotify(XEvent *e)
|
||||
{
|
||||
void destroynotify(XEvent *e) {
|
||||
Client *c;
|
||||
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
||||
|
||||
@@ -555,18 +526,14 @@ destroynotify(XEvent *e)
|
||||
unmanage(c, 1);
|
||||
}
|
||||
|
||||
void
|
||||
detach(Client *c)
|
||||
{
|
||||
void detach(Client *c) {
|
||||
Client **tc;
|
||||
|
||||
for (tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next);
|
||||
*tc = c->next;
|
||||
}
|
||||
|
||||
void
|
||||
detachstack(Client *c)
|
||||
{
|
||||
void detachstack(Client *c) {
|
||||
Client **tc, *t;
|
||||
|
||||
for (tc = &c->mon->stack; *tc && *tc != c; tc = &(*tc)->snext);
|
||||
@@ -578,9 +545,7 @@ detachstack(Client *c)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
void drawbar(Monitor *m) {
|
||||
int x, w, tw = 0;
|
||||
|
||||
int boxs = drw->fonts->h / 9;
|
||||
@@ -633,18 +598,14 @@ drawbar(Monitor *m)
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
}
|
||||
|
||||
void
|
||||
drawbars(void)
|
||||
{
|
||||
void drawbars(void) {
|
||||
Monitor *m;
|
||||
|
||||
for (m = mons; m; m = m->next)
|
||||
drawbar(m);
|
||||
}
|
||||
|
||||
void
|
||||
enternotify(XEvent *e)
|
||||
{
|
||||
void enternotify(XEvent *e) {
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
XCrossingEvent *ev = &e->xcrossing;
|
||||
@@ -661,9 +622,7 @@ enternotify(XEvent *e)
|
||||
focus(c);
|
||||
}
|
||||
|
||||
void
|
||||
expose(XEvent *e)
|
||||
{
|
||||
void expose(XEvent *e) {
|
||||
Monitor *m;
|
||||
XExposeEvent *ev = &e->xexpose;
|
||||
|
||||
@@ -671,9 +630,7 @@ expose(XEvent *e)
|
||||
drawbar(m);
|
||||
}
|
||||
|
||||
void
|
||||
focus(Client *c)
|
||||
{
|
||||
void focus(Client *c) {
|
||||
if (!c || !ISVISIBLE(c))
|
||||
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
|
||||
if (selmon->sel && selmon->sel != c)
|
||||
@@ -696,44 +653,14 @@ focus(Client *c)
|
||||
}
|
||||
|
||||
/* there are some broken focus acquiring clients needing extra handling */
|
||||
void
|
||||
focusin(XEvent *e)
|
||||
{
|
||||
void focusin(XEvent *e) {
|
||||
XFocusChangeEvent *ev = &e->xfocus;
|
||||
|
||||
if (selmon->sel && ev->window != selmon->sel->win)
|
||||
setfocus(selmon->sel);
|
||||
}
|
||||
|
||||
void
|
||||
focusstack(const Arg *arg)
|
||||
{
|
||||
Client *c = NULL, *i;
|
||||
|
||||
if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen))
|
||||
return;
|
||||
if (arg->i > 0) {
|
||||
for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
|
||||
if (!c)
|
||||
for (c = selmon->clients; c && !ISVISIBLE(c); c = c->next);
|
||||
} else {
|
||||
for (i = selmon->clients; i != selmon->sel; i = i->next)
|
||||
if (ISVISIBLE(i))
|
||||
c = i;
|
||||
if (!c)
|
||||
for (; i; i = i->next)
|
||||
if (ISVISIBLE(i))
|
||||
c = i;
|
||||
}
|
||||
if (c) {
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
}
|
||||
}
|
||||
|
||||
Atom
|
||||
getatomprop(Client *c, Atom prop)
|
||||
{
|
||||
Atom getatomprop(Client *c, Atom prop) {
|
||||
int di;
|
||||
unsigned long dl;
|
||||
unsigned char *p = NULL;
|
||||
@@ -747,9 +674,7 @@ getatomprop(Client *c, Atom prop)
|
||||
return atom;
|
||||
}
|
||||
|
||||
int
|
||||
getrootptr(int *x, int *y)
|
||||
{
|
||||
int getrootptr(int *x, int *y) {
|
||||
int di;
|
||||
unsigned int dui;
|
||||
Window dummy;
|
||||
@@ -757,9 +682,7 @@ getrootptr(int *x, int *y)
|
||||
return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui);
|
||||
}
|
||||
|
||||
long
|
||||
getstate(Window w)
|
||||
{
|
||||
long getstate(Window w) {
|
||||
int format;
|
||||
long result = -1;
|
||||
unsigned char *p = NULL;
|
||||
@@ -775,9 +698,7 @@ getstate(Window w)
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
gettextprop(Window w, Atom atom, char *text, unsigned int size)
|
||||
{
|
||||
int gettextprop(Window w, Atom atom, char *text, unsigned int size) {
|
||||
char **list = NULL;
|
||||
int n;
|
||||
XTextProperty name;
|
||||
@@ -798,9 +719,7 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
grabkeys(void)
|
||||
{
|
||||
void grabkeys(void) {
|
||||
updatenumlockmask();
|
||||
{
|
||||
unsigned int i, j, k;
|
||||
@@ -826,9 +745,7 @@ grabkeys(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
keypress(XEvent *e)
|
||||
{
|
||||
void keypress(XEvent *e) {
|
||||
unsigned int i;
|
||||
KeySym keysym;
|
||||
XKeyEvent *ev;
|
||||
@@ -842,9 +759,7 @@ keypress(XEvent *e)
|
||||
keys[i].func(&(keys[i].arg));
|
||||
}
|
||||
|
||||
void
|
||||
killclient(const Arg *arg)
|
||||
{
|
||||
void killclient(const Arg *arg) {
|
||||
if (!selmon->sel)
|
||||
return;
|
||||
if (!sendevent(selmon->sel, wmatom[WMDelete])) {
|
||||
@@ -858,9 +773,7 @@ killclient(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
manage(Window w, XWindowAttributes *wa)
|
||||
{
|
||||
void manage(Window w, XWindowAttributes *wa) {
|
||||
Client *c, *t = NULL;
|
||||
Window trans = None;
|
||||
XWindowChanges wc;
|
||||
@@ -917,9 +830,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||
focus(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
mappingnotify(XEvent *e)
|
||||
{
|
||||
void mappingnotify(XEvent *e) {
|
||||
XMappingEvent *ev = &e->xmapping;
|
||||
|
||||
XRefreshKeyboardMapping(ev);
|
||||
@@ -927,9 +838,7 @@ mappingnotify(XEvent *e)
|
||||
grabkeys();
|
||||
}
|
||||
|
||||
void
|
||||
maprequest(XEvent *e)
|
||||
{
|
||||
void maprequest(XEvent *e) {
|
||||
static XWindowAttributes wa;
|
||||
XMapRequestEvent *ev = &e->xmaprequest;
|
||||
|
||||
@@ -939,9 +848,7 @@ maprequest(XEvent *e)
|
||||
manage(ev->window, &wa);
|
||||
}
|
||||
|
||||
void
|
||||
motionnotify(XEvent *e)
|
||||
{
|
||||
void motionnotify(XEvent *e) {
|
||||
static Monitor *mon = NULL;
|
||||
Monitor *m;
|
||||
XMotionEvent *ev = &e->xmotion;
|
||||
@@ -956,16 +863,12 @@ motionnotify(XEvent *e)
|
||||
mon = m;
|
||||
}
|
||||
|
||||
Client *
|
||||
nexttiled(Client *c)
|
||||
{
|
||||
Client * nexttiled(Client *c) {
|
||||
for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
|
||||
return c;
|
||||
}
|
||||
|
||||
void
|
||||
propertynotify(XEvent *e)
|
||||
{
|
||||
void propertynotify(XEvent *e) {
|
||||
Client *c;
|
||||
Window trans;
|
||||
XPropertyEvent *ev = &e->xproperty;
|
||||
@@ -1000,9 +903,7 @@ propertynotify(XEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
Monitor *
|
||||
recttomon(int x, int y, int w, int h)
|
||||
{
|
||||
Monitor * recttomon(int x, int y, int w, int h) {
|
||||
Monitor *m, *r = selmon;
|
||||
int a, area = 0;
|
||||
|
||||
@@ -1014,16 +915,12 @@ recttomon(int x, int y, int w, int h)
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
resize(Client *c, int x, int y, int w, int h, int interact)
|
||||
{
|
||||
void resize(Client *c, int x, int y, int w, int h, int interact) {
|
||||
if (applysizehints(c, &x, &y, &w, &h, interact))
|
||||
resizeclient(c, x, y, w, h);
|
||||
}
|
||||
|
||||
void
|
||||
resizeclient(Client *c, int x, int y, int w, int h)
|
||||
{
|
||||
void resizeclient(Client *c, int x, int y, int w, int h) {
|
||||
XWindowChanges wc;
|
||||
|
||||
c->oldx = c->x; c->x = wc.x = x;
|
||||
@@ -1036,9 +933,7 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
void
|
||||
restack(Monitor *m)
|
||||
{
|
||||
void restack(Monitor *m) {
|
||||
Client *c;
|
||||
XEvent ev;
|
||||
XWindowChanges wc;
|
||||
@@ -1061,9 +956,7 @@ restack(Monitor *m)
|
||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||
}
|
||||
|
||||
void
|
||||
run(void)
|
||||
{
|
||||
void run(void) {
|
||||
XEvent ev;
|
||||
/* main event loop */
|
||||
XSync(dpy, False);
|
||||
@@ -1072,9 +965,7 @@ run(void)
|
||||
handler[ev.type](&ev); /* call handler */
|
||||
}
|
||||
|
||||
void
|
||||
scan(void)
|
||||
{
|
||||
void scan(void) {
|
||||
unsigned int i, num;
|
||||
Window d1, d2, *wins = NULL;
|
||||
XWindowAttributes wa;
|
||||
@@ -1099,18 +990,14 @@ scan(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
setclientstate(Client *c, long state)
|
||||
{
|
||||
void setclientstate(Client *c, long state) {
|
||||
long data[] = { state, None };
|
||||
|
||||
XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
|
||||
PropModeReplace, (unsigned char *)data, 2);
|
||||
}
|
||||
|
||||
int
|
||||
sendevent(Client *c, Atom proto)
|
||||
{
|
||||
int sendevent(Client *c, Atom proto) {
|
||||
int n;
|
||||
Atom *protocols;
|
||||
int exists = 0;
|
||||
@@ -1133,9 +1020,7 @@ sendevent(Client *c, Atom proto)
|
||||
return exists;
|
||||
}
|
||||
|
||||
void
|
||||
setfocus(Client *c)
|
||||
{
|
||||
void setfocus(Client *c) {
|
||||
if (!c->neverfocus) {
|
||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||
XChangeProperty(dpy, root, netatom[NetActiveWindow],
|
||||
@@ -1145,9 +1030,7 @@ setfocus(Client *c)
|
||||
sendevent(c, wmatom[WMTakeFocus]);
|
||||
}
|
||||
|
||||
void
|
||||
setfullscreen(Client *c, int fullscreen)
|
||||
{
|
||||
void setfullscreen(Client *c, int fullscreen) {
|
||||
if (fullscreen && !c->isfullscreen) {
|
||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
|
||||
@@ -1173,9 +1056,7 @@ setfullscreen(Client *c, int fullscreen)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
setup(void)
|
||||
{
|
||||
void setup(void) {
|
||||
int i;
|
||||
XSetWindowAttributes wa;
|
||||
Atom utf8string;
|
||||
@@ -1250,9 +1131,7 @@ setup(void)
|
||||
focus(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
seturgent(Client *c, int urg)
|
||||
{
|
||||
void seturgent(Client *c, int urg) {
|
||||
XWMHints *wmh;
|
||||
|
||||
c->isurgent = urg;
|
||||
@@ -1263,9 +1142,7 @@ seturgent(Client *c, int urg)
|
||||
XFree(wmh);
|
||||
}
|
||||
|
||||
void
|
||||
showhide(Client *c)
|
||||
{
|
||||
void showhide(Client *c) {
|
||||
if (!c)
|
||||
return;
|
||||
if (ISVISIBLE(c)) {
|
||||
@@ -1281,9 +1158,7 @@ showhide(Client *c)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
spawn(const Arg *arg)
|
||||
{
|
||||
void spawn(const Arg *arg) {
|
||||
struct sigaction sa;
|
||||
|
||||
if (fork() == 0) {
|
||||
@@ -1301,9 +1176,7 @@ spawn(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tag(const Arg *arg)
|
||||
{
|
||||
void tag(const Arg *arg) {
|
||||
if (selmon->sel && arg->ui & TAGMASK) {
|
||||
selmon->sel->tags = arg->ui & TAGMASK;
|
||||
focus(NULL);
|
||||
@@ -1311,9 +1184,7 @@ tag(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
void tile(Monitor *m) {
|
||||
unsigned int i, n, h, g = 0, mw, my, ty;
|
||||
Client *c;
|
||||
|
||||
@@ -1341,9 +1212,7 @@ tile(Monitor *m)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
unfocus(Client *c, int setfocus)
|
||||
{
|
||||
void unfocus(Client *c, int setfocus) {
|
||||
if (!c)
|
||||
return;
|
||||
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
|
||||
@@ -1353,9 +1222,7 @@ unfocus(Client *c, int setfocus)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
unmanage(Client *c, int destroyed)
|
||||
{
|
||||
void unmanage(Client *c, int destroyed) {
|
||||
Monitor *m = c->mon;
|
||||
XWindowChanges wc;
|
||||
|
||||
@@ -1379,9 +1246,7 @@ unmanage(Client *c, int destroyed)
|
||||
arrange(m);
|
||||
}
|
||||
|
||||
void
|
||||
unmapnotify(XEvent *e)
|
||||
{
|
||||
void unmapnotify(XEvent *e) {
|
||||
Client *c;
|
||||
XUnmapEvent *ev = &e->xunmap;
|
||||
|
||||
@@ -1393,9 +1258,7 @@ unmapnotify(XEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
updatebars(void)
|
||||
{
|
||||
void updatebars(void) {
|
||||
Monitor *m;
|
||||
XSetWindowAttributes wa = {
|
||||
.override_redirect = True,
|
||||
@@ -1415,9 +1278,7 @@ updatebars(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
updatebarpos(Monitor *m)
|
||||
{
|
||||
void updatebarpos(Monitor *m) {
|
||||
m->wy = m->my;
|
||||
m->wh = m->mh;
|
||||
if (m->showbar) {
|
||||
@@ -1428,9 +1289,7 @@ updatebarpos(Monitor *m)
|
||||
m->by = -bh;
|
||||
}
|
||||
|
||||
void
|
||||
updateclientlist(void)
|
||||
{
|
||||
void updateclientlist(void) {
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
|
||||
@@ -1442,9 +1301,7 @@ updateclientlist(void)
|
||||
(unsigned char *) &(c->win), 1);
|
||||
}
|
||||
|
||||
int
|
||||
updategeom(void)
|
||||
{
|
||||
int updategeom(void) {
|
||||
int dirty = 0;
|
||||
|
||||
{ /* default monitor setup */
|
||||
@@ -1464,9 +1321,7 @@ updategeom(void)
|
||||
return dirty;
|
||||
}
|
||||
|
||||
void
|
||||
updatenumlockmask(void)
|
||||
{
|
||||
void updatenumlockmask(void) {
|
||||
unsigned int i, j;
|
||||
XModifierKeymap *modmap;
|
||||
|
||||
@@ -1480,9 +1335,7 @@ updatenumlockmask(void)
|
||||
XFreeModifiermap(modmap);
|
||||
}
|
||||
|
||||
void
|
||||
updatesizehints(Client *c)
|
||||
{
|
||||
void updatesizehints(Client *c) {
|
||||
long msize;
|
||||
XSizeHints size;
|
||||
|
||||
@@ -1500,12 +1353,12 @@ updatesizehints(Client *c)
|
||||
if (size.flags & PResizeInc) {
|
||||
c->incw = size.width_inc;
|
||||
c->inch = size.height_inc;
|
||||
} else
|
||||
} else {
|
||||
c->incw = c->inch = 0;
|
||||
if (size.flags & PMaxSize) {
|
||||
c->maxw = size.max_width;
|
||||
c->maxh = size.max_height;
|
||||
} else
|
||||
} else {
|
||||
c->maxw = c->maxh = 0;
|
||||
if (size.flags & PMinSize) {
|
||||
c->minw = size.min_width;
|
||||
@@ -1513,37 +1366,35 @@ updatesizehints(Client *c)
|
||||
} else if (size.flags & PBaseSize) {
|
||||
c->minw = size.base_width;
|
||||
c->minh = size.base_height;
|
||||
} else
|
||||
} else {
|
||||
c->minw = c->minh = 0;
|
||||
if (size.flags & PAspect) {
|
||||
c->mina = (float)size.min_aspect.y / size.min_aspect.x;
|
||||
c->maxa = (float)size.max_aspect.x / size.max_aspect.y;
|
||||
} else
|
||||
} else {
|
||||
c->maxa = c->mina = 0.0;
|
||||
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
||||
c->hintsvalid = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
updatestatus(void)
|
||||
{
|
||||
void updatestatus(void) {
|
||||
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
||||
strcpy(stext, " dwm ");
|
||||
drawbar(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
updatetitle(Client *c)
|
||||
{
|
||||
void updatetitle(Client *c) {
|
||||
if (!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
|
||||
gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
|
||||
if (c->name[0] == '\0') /* hack to mark broken clients */
|
||||
strcpy(c->name, broken);
|
||||
}
|
||||
|
||||
void
|
||||
updatewindowtype(Client *c)
|
||||
{
|
||||
void updatewindowtype(Client *c) {
|
||||
Atom state = getatomprop(c, netatom[NetWMState]);
|
||||
Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
|
||||
|
||||
@@ -1553,16 +1404,14 @@ updatewindowtype(Client *c)
|
||||
c->isfloating = 1;
|
||||
}
|
||||
|
||||
void
|
||||
updatewmhints(Client *c)
|
||||
{
|
||||
void updatewmhints(Client *c) {
|
||||
XWMHints *wmh;
|
||||
|
||||
if ((wmh = XGetWMHints(dpy, c->win))) {
|
||||
if (c == selmon->sel && wmh->flags & XUrgencyHint) {
|
||||
wmh->flags &= ~XUrgencyHint;
|
||||
XSetWMHints(dpy, c->win, wmh);
|
||||
} else
|
||||
} else {
|
||||
c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0;
|
||||
if (wmh->flags & InputHint)
|
||||
c->neverfocus = !wmh->input;
|
||||
@@ -1571,10 +1420,9 @@ updatewmhints(Client *c)
|
||||
XFree(wmh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view(const Arg *arg)
|
||||
{
|
||||
void view(const Arg *arg) {
|
||||
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
||||
return;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
@@ -1584,9 +1432,7 @@ view(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
Client *
|
||||
wintoclient(Window w)
|
||||
{
|
||||
Client * wintoclient(Window w) {
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
|
||||
@@ -1597,9 +1443,7 @@ wintoclient(Window w)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Monitor *
|
||||
wintomon(Window w)
|
||||
{
|
||||
Monitor * wintomon(Window w) {
|
||||
int x, y;
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
@@ -1617,9 +1461,7 @@ wintomon(Window w)
|
||||
/* There's no way to check accesses to destroyed windows, thus those cases are
|
||||
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
|
||||
* default error handler, which may call exit. */
|
||||
int
|
||||
xerror(Display *dpy, XErrorEvent *ee)
|
||||
{
|
||||
int xerror(Display *dpy, XErrorEvent *ee) {
|
||||
if (ee->error_code == BadWindow
|
||||
|| (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch)
|
||||
|| (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable)
|
||||
@@ -1635,15 +1477,11 @@ xerror(Display *dpy, XErrorEvent *ee)
|
||||
return xerrorxlib(dpy, ee); /* may call exit */
|
||||
}
|
||||
|
||||
int
|
||||
xerrordummy(Display *dpy, XErrorEvent *ee)
|
||||
{
|
||||
int xerrordummy(Display *dpy, XErrorEvent *ee) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int main(int argc, char *argv[]) {
|
||||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
die("dwm: cannot open display");
|
||||
setup();
|
||||
|
||||
Reference in New Issue
Block a user