This commit is contained in:
speedie 2022-12-18 19:06:04 +01:00
parent e80f9a3768
commit c29f3d336d

144
speedwm.c
View file

@ -92,8 +92,8 @@ enum { SchemeBorderNorm,
SchemeBar,
SchemeTitleNorm,
SchemeTitleSel,
SchemeTitleHidden,
SchemeTitleUrg,
SchemeTitleHidden,
SchemeTitleUrg,
SchemeLayout,
SchemeStatus,
SchemeSystray,
@ -233,17 +233,17 @@ struct Client {
#if USEWINICON
unsigned int icw, ich; Picture icon;
#endif
int isfixed,
ispermanent,
isfloating,
isurgent,
neverfocus,
oldstate,
isfullscreen,
ignoretransient,
issticky,
isterminal,
noswallow,
int isfixed,
ispermanent,
isfloating,
isurgent,
neverfocus,
oldstate,
isfullscreen,
ignoretransient,
issticky,
isterminal,
noswallow,
needresize; /* window rules */
pid_t pid;
char scratchkey; /* scratchpad key */
@ -359,7 +359,7 @@ struct Monitor {
int colorselectedtitle;
int colorhiddentitle;
int colorlayout;
/* for padding funcs */
int cpadv;
int cpadh;
@ -848,44 +848,44 @@ static Monitor *lastselmon; /* IPC */
/* See flextile_deluxe for reference */
enum {
layout,
master,
stack,
stack2,
layout,
master,
stack,
stack2,
ltaxislast,
};
enum {
nosplit,
splitvertical,
splithorizontal,
splitcenteredvertical,
splitcenteredhorizontal,
splitverticaldualstack,
splithorizontaldualstack,
floatingmaster,
splitverticalfixed,
splithorizontalfixed,
splitcenteredverticalfixed,
splitcenteredhorizontalfixed,
splitverticaldualstackfixed,
splithorizontaldualstackfixed,
floatingmasterfixed,
splitvertical,
splithorizontal,
splitcenteredvertical,
splitcenteredhorizontal,
splitverticaldualstack,
splithorizontaldualstack,
floatingmaster,
splitverticalfixed,
splithorizontalfixed,
splitcenteredverticalfixed,
splitcenteredhorizontalfixed,
splitverticaldualstackfixed,
splithorizontaldualstackfixed,
floatingmasterfixed,
layoutlast,
};
enum {
toptobottom,
lefttoright,
monocle,
dynamicgrid,
dynamicgridalt1,
dynamicgridalt2,
grid,
horizgrid,
dwindle,
spiral,
tatami,
toptobottom,
lefttoright,
monocle,
dynamicgrid,
dynamicgridalt1,
dynamicgridalt2,
grid,
horizgrid,
dwindle,
spiral,
tatami,
axislast,
};
@ -1057,7 +1057,7 @@ applyrules(Client *c)
XFree(ch.res_class);
if (ch.res_name)
XFree(ch.res_name);
if(c->tags & TAGMASK) c->tags = c->tags & TAGMASK;
else if(c->mon->tagset[c->mon->seltags]) c->tags = c->mon->tagset[c->mon->seltags];
else c->tags = 1;
@ -1241,7 +1241,7 @@ attachbelow(Client *c)
c->next = c->mon->sel->next;
c->mon->sel->next = c;
}
void
attachbottom(Client *c)
{
@ -1458,7 +1458,7 @@ cleanup(void)
free(systray);
}
#endif
for (i = 0; i < CurLast; i++)
drw_cur_free(drw, cursor[i]);
for (i = 0; i < LENGTH(colors) + 1; i++)
@ -1496,7 +1496,7 @@ cleanupmon(Monitor *mon)
}
#if USETAGPREVIEW
size_t i;
for (i = 0; i < LENGTH(tags); i++)
if (mon->tagmap[i])
XFreePixmap(dpy, mon->tagmap[i]);
@ -1749,7 +1749,7 @@ createmon(void)
m->mastercount = mastercount;
m->stackcount = stackcount;
m->showbar = !hidebar;
/* bar items */
m->hidelayout = hidelayout;
m->hidetitle = hidetitle;
@ -1878,7 +1878,7 @@ destroynotify(XEvent *e)
removesystrayicon(c);
drawbarwin(systray->bar);
#endif
} else if ((c = swallowingclient(ev->window))) {
unmanage(c->swallowing, 1);
}
@ -2073,8 +2073,8 @@ dragmfact(const Arg *arg)
}
}
/* do not allow mfact to be modified under certain conditions */
if (!m->lt[m->sellt]->arrange
|| (!fixed && m->mastercount && n <= m->mastercount)
if (!m->lt[m->sellt]->arrange
|| (!fixed && m->mastercount && n <= m->mastercount)
|| m->lt[m->sellt]->arrange == &ngrid
|| m->lt[m->sellt]->arrange == &hgrid
|| (m->lt[m->sellt]->arrange == &tile && m->ltaxis[layout] == nosplit)
@ -2450,7 +2450,7 @@ focusstack(int inc, int hid)
{
Client *c = NULL, *i;
if ((!selmon->sel && !hid) || (selmon->sel && selmon->sel->isfullscreen && lockfullscreen))
if ((!selmon->sel && !hid) || (selmon->sel && selmon->sel->isfullscreen && lockfullscreen))
return;
if (!selmon->clients)
@ -2537,9 +2537,9 @@ geticonprop(Window win, unsigned int *picw, unsigned int *pich)
unsigned long n, extra, *p = NULL;
Atom real;
if (XGetWindowProperty(dpy, win, netatom[NetWMIcon], 0L, LONG_MAX, False, AnyPropertyType,
if (XGetWindowProperty(dpy, win, netatom[NetWMIcon], 0L, LONG_MAX, False, AnyPropertyType,
&real, &format, &n, &extra, (unsigned char **)&p) != Success)
return None;
return None;
if (n == 0 || format != 32) { XFree(p); return None; }
unsigned long *bstp = NULL;
@ -2629,7 +2629,7 @@ getstate(Window w)
return result;
}
int
gettextprop(Window w, Atom atom, char *text, unsigned int size)
{
@ -2962,7 +2962,7 @@ show(const Arg *arg)
}
void
showall(const Arg *arg)
showall(const Arg *arg)
{
Client *c = NULL;
selmon->hidsel = 0;
@ -2979,7 +2979,7 @@ showall(const Arg *arg)
}
void
hideall(const Arg *arg)
hideall(const Arg *arg)
{
Client *c = NULL;
for (c = selmon->clients; c; c = c->next) {
@ -3018,7 +3018,7 @@ showhide(Client *c)
XMoveWindow(dpy, c->win, c->x, c->y);
}
window_map(dpy, c, 1);
showhide(c->snext);
} else {
@ -3131,7 +3131,7 @@ setbarpaddingv(const Arg *arg)
vp = 0;
return;
}
updatebarpos(selmon);
for (bar = selmon->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
@ -3157,7 +3157,7 @@ setbarpaddingh(const Arg *arg)
sp = 0;
return;
}
updatebarpos(selmon);
for (bar = selmon->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
@ -3408,7 +3408,7 @@ manage(Window w, XWindowAttributes *wa)
c->sfw = c->w;
c->sfh = c->h;
}
updatemotifhints(c);
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
@ -3417,7 +3417,7 @@ manage(Window w, XWindowAttributes *wa)
}
XRaiseWindow(dpy, c->win);
switch(attachdirection){
case 1:
attachabove(c);
@ -3684,7 +3684,7 @@ switcherend()
/*
* move all clients between 1st and choosen position,
* one down in stack and put choosen client to the first position
* one down in stack and put choosen client to the first position
* so they remain in right order for the next time that alt-tab is used
*/
if (selmon->nclients > 1) {
@ -4350,8 +4350,8 @@ propertynotify(XEvent *e)
switch(ev->atom) {
default: break;
case XA_WM_TRANSIENT_FOR:
if (!c->ignoretransient && !c->isfloating &&
(XGetTransientForHint(dpy, c->win, &trans)) &&
if (!c->ignoretransient && !c->isfloating &&
(XGetTransientForHint(dpy, c->win, &trans)) &&
(c->isfloating = (wintoclient(trans)) != NULL))
arrange(c->mon);
break;
@ -4741,7 +4741,7 @@ static void scratchpad_hide ()
selmon -> sel -> tags = SCRATCHPAD_MASK;
if (floatscratchpad)
selmon -> sel -> isfloating = 1;
focus(NULL);
arrange(selmon);
}
@ -5490,7 +5490,7 @@ void
togglesystray(const Arg *arg)
{
selmon->hidesystray = !selmon->hidesystray;
updatebarpos(selmon);
updatestatus();
}
@ -5509,7 +5509,7 @@ togglesingleborder(const Arg *arg)
selmon->hidesingleborder = !selmon->hidesingleborder;
arrange(selmon);
}
void
togglebartags(const Arg *arg)
{
@ -5595,7 +5595,7 @@ togglefloating(const Arg *arg)
selmon->sel->sfw = selmon->sel->w;
selmon->sel->sfh = selmon->sel->h;
}
arrange(selmon);
}
@ -5787,7 +5787,7 @@ updateclientlist()
XChangeProperty(dpy, root, netatom[NetClientList],
XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1);
XDeleteProperty(dpy, root, netatom[NetClientListStacking]);
for (m = mons; m; m = m->next)
for (c = m->stack; c; c = c->snext)
@ -6044,7 +6044,7 @@ updaterules(Client *c)
{
c->tags=0;
found_rule=1;
}
}
c->tags |= r->tags;
for (m = mons; m && m->num != r->monitor; m = m->next)
if (m)
@ -6074,7 +6074,7 @@ updatetitle(Client *c)
#endif
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')
strcpy(c->name, notitle);