renamed manage.c to view.c
parent
2e95bc0413
commit
64871a7045
96
client.c
96
client.c
|
@ -46,6 +46,21 @@ grabbuttons(Client *c, Bool focused) {
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
GrabModeAsync, GrabModeSync, None, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Bool
|
||||||
|
isprotodel(Client *c) {
|
||||||
|
int i, n;
|
||||||
|
Atom *protocols;
|
||||||
|
Bool ret = False;
|
||||||
|
|
||||||
|
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
|
||||||
|
for(i = 0; !ret && i < n; i++)
|
||||||
|
if(protocols[i] == wmatom[WMDelete])
|
||||||
|
ret = True;
|
||||||
|
XFree(protocols);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setclientstate(Client *c, long state) {
|
setclientstate(Client *c, long state) {
|
||||||
long data[] = {state, None};
|
long data[] = {state, None};
|
||||||
|
@ -60,6 +75,20 @@ xerrordummy(Display *dsply, XErrorEvent *ee) {
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
|
|
||||||
|
void
|
||||||
|
attach(Client *c) {
|
||||||
|
if(clients)
|
||||||
|
clients->prev = c;
|
||||||
|
c->next = clients;
|
||||||
|
clients = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
attachstack(Client *c) {
|
||||||
|
c->snext = stack;
|
||||||
|
stack = c;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
configure(Client *c) {
|
configure(Client *c) {
|
||||||
XConfigureEvent ce;
|
XConfigureEvent ce;
|
||||||
|
@ -78,6 +107,24 @@ configure(Client *c) {
|
||||||
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
|
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
detach(Client *c) {
|
||||||
|
if(c->prev)
|
||||||
|
c->prev->next = c->next;
|
||||||
|
if(c->next)
|
||||||
|
c->next->prev = c->prev;
|
||||||
|
if(c == clients)
|
||||||
|
clients = c->next;
|
||||||
|
c->next = c->prev = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
detachstack(Client *c) {
|
||||||
|
Client **tc;
|
||||||
|
for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
|
||||||
|
*tc = c->snext;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
focus(Client *c) {
|
focus(Client *c) {
|
||||||
if(c && !isvisible(c))
|
if(c && !isvisible(c))
|
||||||
|
@ -103,19 +150,46 @@ focus(Client *c) {
|
||||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
void
|
||||||
isprotodel(Client *c) {
|
focusnext(Arg *arg) {
|
||||||
int i, n;
|
Client *c;
|
||||||
Atom *protocols;
|
|
||||||
Bool ret = False;
|
|
||||||
|
|
||||||
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
|
if(!sel)
|
||||||
for(i = 0; !ret && i < n; i++)
|
return;
|
||||||
if(protocols[i] == wmatom[WMDelete])
|
for(c = sel->next; c && !isvisible(c); c = c->next);
|
||||||
ret = True;
|
if(!c)
|
||||||
XFree(protocols);
|
for(c = clients; c && !isvisible(c); c = c->next);
|
||||||
|
if(c) {
|
||||||
|
focus(c);
|
||||||
|
restack();
|
||||||
}
|
}
|
||||||
return ret;
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
focusprev(Arg *arg) {
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
if(!sel)
|
||||||
|
return;
|
||||||
|
for(c = sel->prev; c && !isvisible(c); c = c->prev);
|
||||||
|
if(!c) {
|
||||||
|
for(c = clients; c && c->next; c = c->next);
|
||||||
|
for(; c && !isvisible(c); c = c->prev);
|
||||||
|
}
|
||||||
|
if(c) {
|
||||||
|
focus(c);
|
||||||
|
restack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Client *
|
||||||
|
getclient(Window w) {
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for(c = clients; c; c = c->next)
|
||||||
|
if(c->win == w)
|
||||||
|
return c;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
14
dwm.h
14
dwm.h
|
@ -99,8 +99,15 @@ extern Display *dpy;
|
||||||
extern Window root, barwin;
|
extern Window root, barwin;
|
||||||
|
|
||||||
/* client.c */
|
/* client.c */
|
||||||
|
extern void attach(Client *c); /* attaches c to global client list */
|
||||||
|
extern void attachstack(Client *c); /* attaches client to stack */
|
||||||
extern void configure(Client *c); /* send synthetic configure event */
|
extern void configure(Client *c); /* send synthetic configure event */
|
||||||
|
extern void detach(Client *c); /* detaches c from global client list */
|
||||||
|
extern void detachstack(Client *c); /* detaches client from stack */
|
||||||
extern void focus(Client *c); /* focus c, c may be NULL */
|
extern void focus(Client *c); /* focus c, c may be NULL */
|
||||||
|
extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
|
||||||
|
extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
|
||||||
|
extern Client *getclient(Window w); /* return client of w */
|
||||||
extern void killclient(Arg *arg); /* kill c nicely */
|
extern void killclient(Arg *arg); /* kill c nicely */
|
||||||
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
||||||
extern void resize(Client *c, int x, int y,
|
extern void resize(Client *c, int x, int y,
|
||||||
|
@ -125,16 +132,9 @@ extern void sendevent(Window w, Atom a, long value); /* send synthetic event to
|
||||||
extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
|
extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
|
||||||
|
|
||||||
/* manage.c */
|
/* manage.c */
|
||||||
extern void attach(Client *c); /* attaches c to global client list */
|
|
||||||
extern void attachstack(Client *c); /* attaches client to stack */
|
|
||||||
extern void compileregexps(void); /* initialize regexps of rules defined in config.h */
|
extern void compileregexps(void); /* initialize regexps of rules defined in config.h */
|
||||||
extern void detach(Client *c); /* detaches c from global client list */
|
|
||||||
extern void detachstack(Client *c); /* detaches client from stack */
|
|
||||||
extern void dofloat(void); /* arranges all windows floating */
|
extern void dofloat(void); /* arranges all windows floating */
|
||||||
extern void dotile(void); /* arranges all windows tiled */
|
extern void dotile(void); /* arranges all windows tiled */
|
||||||
extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
|
|
||||||
extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
|
|
||||||
extern Client *getclient(Window w); /* return client of w */
|
|
||||||
extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */
|
extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */
|
||||||
extern Bool isvisible(Client *c); /* returns True if client is visible */
|
extern Bool isvisible(Client *c); /* returns True if client is visible */
|
||||||
extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */
|
extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */
|
||||||
|
|
|
@ -58,20 +58,6 @@ togglemax(Client *c) {
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
|
|
||||||
void
|
|
||||||
attach(Client *c) {
|
|
||||||
if(clients)
|
|
||||||
clients->prev = c;
|
|
||||||
c->next = clients;
|
|
||||||
clients = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
attachstack(Client *c) {
|
|
||||||
c->snext = stack;
|
|
||||||
stack = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
compileregexps(void) {
|
compileregexps(void) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -99,24 +85,6 @@ compileregexps(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
detach(Client *c) {
|
|
||||||
if(c->prev)
|
|
||||||
c->prev->next = c->next;
|
|
||||||
if(c->next)
|
|
||||||
c->next->prev = c->prev;
|
|
||||||
if(c == clients)
|
|
||||||
clients = c->next;
|
|
||||||
c->next = c->prev = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
detachstack(Client *c) {
|
|
||||||
Client **tc;
|
|
||||||
for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
|
|
||||||
*tc = c->snext;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
dofloat(void) {
|
dofloat(void) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
@ -191,48 +159,6 @@ dotile(void) {
|
||||||
restack();
|
restack();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
focusnext(Arg *arg) {
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
if(!sel)
|
|
||||||
return;
|
|
||||||
for(c = sel->next; c && !isvisible(c); c = c->next);
|
|
||||||
if(!c)
|
|
||||||
for(c = clients; c && !isvisible(c); c = c->next);
|
|
||||||
if(c) {
|
|
||||||
focus(c);
|
|
||||||
restack();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
focusprev(Arg *arg) {
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
if(!sel)
|
|
||||||
return;
|
|
||||||
for(c = sel->prev; c && !isvisible(c); c = c->prev);
|
|
||||||
if(!c) {
|
|
||||||
for(c = clients; c && c->next; c = c->next);
|
|
||||||
for(; c && !isvisible(c); c = c->prev);
|
|
||||||
}
|
|
||||||
if(c) {
|
|
||||||
focus(c);
|
|
||||||
restack();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Client *
|
|
||||||
getclient(Window w) {
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for(c = clients; c; c = c->next)
|
|
||||||
if(c->win == w)
|
|
||||||
return c;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
incnmaster(Arg *arg) {
|
incnmaster(Arg *arg) {
|
||||||
if((arrange == dofloat) || (nmaster + arg->i < 1)
|
if((arrange == dofloat) || (nmaster + arg->i < 1)
|
Loading…
Reference in New Issue