[hackers] [wmii] Added swapping back to the fs, but without bindings. Fixed a bug from 2 commits ago. Added more gotos :)

From: Kris Maglione <jg_AT_suckless.org>
Date: Tue Feb 13 07:12:41 2007

changeset: 1864:45fc40a05910
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Feb 13 01:10:43 2007 -0500
summary: Added swapping back to the fs, but without bindings. Fixed a bug from 2 commits ago. Added more gotos :)

diff -r 905d1da6f704 -r 45fc40a05910 client.c
--- a/client.c Tue Feb 13 00:41:18 2007 -0500
+++ b/client.c Tue Feb 13 01:10:43 2007 -0500
@@ -328,7 +328,7 @@ set_urgent(Client *c, Bool urgent, Bool
                                 for(f=c->frame; f; f=f->cnext) {
                                         for(a=f->view->area; a; a=a->next)
                                                 for(ff=a->frame; ff; ff=ff->anext)
- if(ff->urgent) break;
+ if(ff->client->urgent) break;
                                         if(!ff)
                                                 write_event("%sUrgentTag %s %s\n", cnot, cwrite, f->view->name);
                                 }
@@ -664,7 +664,7 @@ size_client(Client *c, char *arg) {
 }
 
 char *
-send_client(Frame *f, char *arg) {
+send_client(Frame *f, char *arg, Bool swap) {
         Area *to, *a;
         Client *c;
         Frame *tf;
@@ -681,7 +681,7 @@ send_client(Frame *f, char *arg) {
                         to = c->revert;
                 else
                         to = v->area->next;
- send_to_area(to, a, f);
+ goto send_area;
         }else if(!a->floating) {
                 if(!strncmp(arg, "left", 5)) {
                         if(a->floating)
@@ -692,7 +692,7 @@ send_client(Frame *f, char *arg) {
                                 to=new_column(v, v->area, 0);
                         if(!to)
                                 return Ebadvalue;
- send_to_area(to, a, f);
+ goto send_area;
                 }
                 else if(!strncmp(arg, "right", 5)) {
                         if(a->floating)
@@ -701,33 +701,49 @@ send_client(Frame *f, char *arg) {
                                 to = new_column(v, a, 0);
                         if(!to)
                                 return Ebadvalue;
- send_to_area(to, a, f);
+ goto send_area;
                 }
                 else if(!strncmp(arg, "up", 3)) {
                         for(tf=a->frame; tf; tf=tf->anext)
                                 if(tf->anext == f) break;
                         if(!tf)
                                 return Ebadvalue;
- remove_frame(f);
- insert_frame(tf, f, True);
- arrange_column(a, False);
+ goto send_frame;
                 }
                 else if(!strncmp(arg, "down", 5)) {
                         if(!f->anext)
                                 return Ebadvalue;
- remove_frame(f);
- insert_frame(f->anext, f, False);
- arrange_column(a, False);
+ tf = f->anext;
+ goto send_frame;
                 }
                 else {
                         if(sscanf(arg, "%d", &j) != 1)
                                 return Ebadvalue;
                         for(to=v->area; to; to=to->next)
                                 if(!--j) break;
- send_to_area(to, a, f);
+ goto send_area;
                 }
         }else
                 return Ebadvalue;
+send_frame:
+ if(!swap) {
+ remove_frame(f);
+ insert_frame(tf, f, True);
+ }else
+ swap_frames(f, tf);
+ arrange_column(a, False);
+
+ flush_masked_events(EnterWindowMask);
+ focus_frame(f, True);
+ update_views();
+ return nil;
+
+send_area:
+ if(!swap)
+ send_to_area(to, a, f);
+ else if(to->sel)
+ swap_frames(f, to->sel);
+
         flush_masked_events(EnterWindowMask);
         focus_frame(f, True);
         update_views();
diff -r 905d1da6f704 -r 45fc40a05910 view.c
--- a/view.c Tue Feb 13 00:41:18 2007 -0500
+++ b/view.c Tue Feb 13 01:10:43 2007 -0500
@@ -342,15 +342,18 @@ message_view(View *v, char *message) {
         Client *c;
         Frame *f;
         Area *a;
+ Bool swap;
         static char Ebadvalue[] = "bad value";
 
         if(!strncmp(message, "send ", 5)) {
                 message += 5;
- if(!(c = client_of_message(v, message, &n)))
- return Ebadvalue;
- if(!(f = clientframe_of_view(v, c)))
- return Ebadvalue;
- return send_client(f, &message[n]);
+ swap = False;
+ goto send;
+ }
+ if(!strncmp(message, "swap ", 5)) {
+ message += 5;
+ swap = True;
+ goto send;
         }
         if(!strncmp(message, "select ", 7)) {
                 message += 7;
@@ -371,6 +374,13 @@ message_view(View *v, char *message) {
                 return nil;
         }
         return Ebadvalue;
+
+send:
+ if(!(c = client_of_message(v, message, &n)))
+ return Ebadvalue;
+ if(!(f = clientframe_of_view(v, c)))
+ return Ebadvalue;
+ return send_client(f, &message[n], swap);
 }
 
 void
diff -r 905d1da6f704 -r 45fc40a05910 wmii.h
--- a/wmii.h Tue Feb 13 00:41:18 2007 -0500
+++ b/wmii.h Tue Feb 13 01:10:43 2007 -0500
@@ -298,7 +298,7 @@ extern void focus(Client *c, Bool restac
 extern void focus(Client *c, Bool restack);
 extern void resize_client(Client *c, XRectangle *r);
 extern void match_sizehints(Client *c, XRectangle *r, Bool floating, BlitzAlign sticky);
-extern char *send_client(Frame *f, char *arg);
+extern char *send_client(Frame *f, char *arg, Bool swap);
 extern char * message_client(Client *c, char *message);
 extern void move_client(Client *c, char *arg);
 extern void size_client(Client *c, char *arg);
Received on Tue Feb 13 2007 - 07:12:41 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:15 UTC