[hackers] [wmii] Some cleanup: "If you want to go somewhere, goto is the best way to get there."

From: Kris Maglione <jg_AT_suckless.org>
Date: Sat Feb 10 08:34:07 2007

changeset: 1825:9158b6a6593e
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Feb 10 02:29:27 2007 -0500
summary: Some cleanup: "If you want to go somewhere, goto is the best way to get there."

diff -r 566fa270b730 -r 9158b6a6593e area.c
--- a/area.c Sat Feb 10 02:13:29 2007 -0500
+++ b/area.c Sat Feb 10 02:29:27 2007 -0500
@@ -386,23 +386,13 @@ select_area(Area *a, char *arg) {
                         return Ebadvalue;
                 for(p=a->frame; p->anext; p=p->anext)
                         if(p->anext == f) break;
- frame_to_top(p);
- focus(p->client, True);
- if(v == screen->sel)
- restack_view(v);
- flush_masked_events(EnterWindowMask);
- return nil;
+ goto focus_client;
         }
         else if(!strncmp(arg, "down", 5)) {
                 if(!f)
                         return Ebadvalue;
                 p = f->anext ? f->anext : a->frame;
- frame_to_top(p);
- focus(p->client, True);
- if(v == screen->sel)
- restack_view(v);
- flush_masked_events(EnterWindowMask);
- return nil;
+ goto focus_client;
         }
         else {
                 if(sscanf(arg, "%d", &i) != 1)
@@ -412,4 +402,12 @@ select_area(Area *a, char *arg) {
         }
         focus_area(new);
         return nil;
-}
+
+focus_client:
+ frame_to_top(p);
+ focus_client(p->client, True);
+ if(v == screen->sel)
+ restack_view(v);
+ flush_masked_events(EnterWindowMask);
+ return nil;
+}
Received on Sat Feb 10 2007 - 08:34:07 UTC

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