sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-6.2-push_no_master.diff (1545B)


      1 diff --git a/dwm.c b/dwm.c
      2 index 4465af1..49e63f0 100644
      3 --- a/dwm.c
      4 +++ b/dwm.c
      5 @@ -185,7 +185,10 @@ static void motionnotify(XEvent *e);
      6  static void movemouse(const Arg *arg);
      7  static Client *nexttiled(Client *c);
      8  static void pop(Client *);
      9 +static Client *prevtiled(Client *c);
     10  static void propertynotify(XEvent *e);
     11 +static void pushdown(const Arg *arg);
     12 +static void pushup(const Arg *arg);
     13  static void quit(const Arg *arg);
     14  static Monitor *recttomon(int x, int y, int w, int h);
     15  static void resize(Client *c, int x, int y, int w, int h, int interact);
     16 @@ -1208,6 +1211,16 @@ pop(Client *c)
     17  	arrange(c->mon);
     18  }
     19  
     20 +Client *
     21 +prevtiled(Client *c) {
     22 +	Client *p, *r;
     23 +
     24 +	for(p = selmon->clients, r = NULL; p && p != c; p = p->next)
     25 +		if(!p->isfloating && ISVISIBLE(p))
     26 +			r = p;
     27 +	return r;
     28 +}
     29 +
     30  void
     31  propertynotify(XEvent *e)
     32  {
     33 @@ -1245,6 +1258,37 @@ propertynotify(XEvent *e)
     34  	}
     35  }
     36  
     37 +void
     38 +pushdown(const Arg *arg) {
     39 +	Client *sel = selmon->sel, *c;
     40 +
     41 +	if(!sel || sel->isfloating || sel == nexttiled(selmon->clients))
     42 +		return;
     43 +	if((c = nexttiled(sel->next))) {
     44 +		detach(sel);
     45 +		sel->next = c->next;
     46 +		c->next = sel;
     47 +	}
     48 +	focus(sel);
     49 +	arrange(selmon);
     50 +}
     51 +
     52 +void
     53 +pushup(const Arg *arg) {
     54 +	Client *sel = selmon->sel, *c;
     55 +
     56 +	if(!sel || sel->isfloating)
     57 +		return;
     58 +	if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) {
     59 +		detach(sel);
     60 +		sel->next = c;
     61 +		for(c = selmon->clients; c->next != sel->next; c = c->next);
     62 +		c->next = sel;
     63 +	}
     64 +	focus(sel);
     65 +	arrange(selmon);
     66 +}
     67 +
     68  void
     69  quit(const Arg *arg)
     70  {