dwm-push_no_master-6.1.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-push_no_master-6.1.diff (1557B)
       ---
            1 diff --git a/dwm.c b/dwm.c
            2 index 0362114..d61d736 100644
            3 --- a/dwm.c
            4 +++ b/dwm.c
            5 @@ -186,7 +186,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 @@ -1225,6 +1228,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 @@ -1263,6 +1276,37 @@ propertynotify(XEvent *e)
           34  }
           35  
           36  void
           37 +pushdown(const Arg *arg) {
           38 +        Client *sel = selmon->sel, *c;
           39 +
           40 +        if(!sel || sel->isfloating || sel == nexttiled(selmon->clients))
           41 +                return;
           42 +        if((c = nexttiled(sel->next))) {
           43 +                detach(sel);
           44 +                sel->next = c->next;
           45 +                c->next = sel;
           46 +        }
           47 +        focus(sel);
           48 +        arrange(selmon);
           49 +}
           50 +
           51 +void
           52 +pushup(const Arg *arg) {
           53 +        Client *sel = selmon->sel, *c;
           54 +
           55 +        if(!sel || sel->isfloating)
           56 +                return;
           57 +        if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) {
           58 +                detach(sel);
           59 +                sel->next = c;
           60 +                for(c = selmon->clients; c->next != sel->next; c = c->next);
           61 +                        c->next = sel;
           62 +        }
           63 +        focus(sel);
           64 +        arrange(selmon);
           65 +}
           66 +
           67 +void
           68  quit(const Arg *arg)
           69  {
           70          running = 0;