Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
simplified manage
[dwm.git]
/
view.c
diff --git
a/view.c
b/view.c
index
3270160
..
cb92eee
100644
(file)
--- a/
view.c
+++ b/
view.c
@@
-3,31
+3,39
@@
* See LICENSE file for license details.
*/
#include "dwm.h"
* See LICENSE file for license details.
*/
#include "dwm.h"
+#include <stdio.h>
/* static */
/* static */
+static Client *
+minclient()
+{
+ Client *c, *min;
+
+ for(min = c = clients; c; c = c->next)
+ if(c->weight < min->weight)
+ min = c;
+ return min;
+}
+
+
static void
reorder()
{
static void
reorder()
{
- Client *c, *orig, *p;
-
- orig = clients;
- clients = NULL;
+ Client *c, *newclients, *tail;
- while((c = orig)) {
- orig = orig->next;
+ newclients = tail = NULL;
+ while((c = minclient())) {
detach(c);
detach(c);
-
- for(p = clients; p && p->next && p->weight <= c->weight; p = p->next);
- c->prev = p;
- if(p) {
- if((c->next = p->next))
- c->next->prev = c;
- p->next = c;
+ if(tail) {
+ c->prev = tail;
+ tail->next = c;
+ tail = c;
}
else
}
else
- clients = c;
+
tail = new
clients = c;
}
}
+ clients = newclients;
}
/* extern */
}
/* extern */
@@
-51,8
+59,9
@@
dofloat(Arg *arg)
{
Client *c;
{
Client *c;
+ maximized = False;
+
for(c = clients; c; c = c->next) {
for(c = clients; c; c = c->next) {
- c->ismax = False;
if(isvisible(c)) {
resize(c, True, TopLeft);
}
if(isvisible(c)) {
resize(c, True, TopLeft);
}
@@
-60,11
+69,7
@@
dofloat(Arg *arg)
ban(c);
}
if(!sel || !isvisible(sel))
ban(c);
}
if(!sel || !isvisible(sel))
- sel = getnext(clients);
- if(sel)
- focus(sel);
- else
- XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+ focus(getnext(clients));
restack();
}
restack();
}
@@
-74,6
+79,8
@@
dotile(Arg *arg)
int h, i, n, w;
Client *c;
int h, i, n, w;
Client *c;
+ maximized = False;
+
w = sw - mw;
for(n = 0, c = clients; c; c = c->next)
if(isvisible(c) && !c->isfloat)
w = sw - mw;
for(n = 0, c = clients; c; c = c->next)
if(isvisible(c) && !c->isfloat)
@@
-85,7
+92,6
@@
dotile(Arg *arg)
h = sh - bh;
for(i = 0, c = clients; c; c = c->next) {
h = sh - bh;
for(i = 0, c = clients; c; c = c->next) {
- c->ismax = False;
if(isvisible(c)) {
if(c->isfloat) {
resize(c, True, TopLeft);
if(isvisible(c)) {
if(c->isfloat) {
resize(c, True, TopLeft);
@@
-125,11
+131,7
@@
dotile(Arg *arg)
ban(c);
}
if(!sel || !isvisible(sel))
ban(c);
}
if(!sel || !isvisible(sel))
- sel = getnext(clients);
- if(sel)
- focus(sel);
- else
- XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+ focus(getnext(clients));
restack();
}
restack();
}
@@
-257,7
+259,6
@@
void
view(Arg *arg)
{
unsigned int i;
view(Arg *arg)
{
unsigned int i;
- Client *c;
for(i = 0; i < ntags; i++)
seltag[i] = False;
for(i = 0; i < ntags; i++)
seltag[i] = False;
@@
-266,12
+267,23
@@
view(Arg *arg)
arrange(NULL);
}
arrange(NULL);
}
+void
+viewall(Arg *arg)
+{
+ unsigned int i;
+
+ for(i = 0; i < ntags; i++)
+ seltag[i] = True;
+ reorder();
+ arrange(NULL);
+}
+
void
zoom(Arg *arg)
{
Client *c = sel;
void
zoom(Arg *arg)
{
Client *c = sel;
- if(!c || (arrange != dotile) || c->isfloat ||
c->ismax
)
+ if(!c || (arrange != dotile) || c->isfloat ||
maximized
)
return;
if(c == getnext(clients))
return;
if(c == getnext(clients))