]> git.sur5r.net Git - i3/i3/commitdiff
parser: implement 'layout'
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 1 Jun 2010 21:20:57 +0000 (23:20 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 1 Jun 2010 21:20:57 +0000 (23:20 +0200)
src/cmdparse.l
src/cmdparse.y
src/render.c

index 0102d14558e8185fb4842e290743839727caa311..8850ff6419d96f75b7af69d5d8cc9d54770810e7 100644 (file)
@@ -88,6 +88,7 @@ global                          { return TOK_GLOBAL; }
 layout                          { return TOK_LAYOUT; }
 default                         { return TOK_DEFAULT; }
 stacked                         { return TOK_STACKED; }
+stacking                        { return TOK_STACKED; }
 tabbed                          { return TOK_TABBED; }
 border                          { return TOK_BORDER; }
 none                            { return TOK_NONE; }
index 40fd65af0aede67497e2a453be277288735228eb..51690a59e9b9588096ce5b1639626b3a3c2a6152 100644 (file)
@@ -252,8 +252,8 @@ operation:
     | restart
     /*| reload
     | mark
-    | layout
     | border */
+    | layout
     | restore
     | move
     | workspace
@@ -466,3 +466,28 @@ restore:
         tree_append_json($<string>3);
     }
     ;
+
+layout:
+    TOK_LAYOUT WHITESPACE layout_mode
+    {
+        printf("changing layout to %d\n", $<number>3);
+        owindow *current;
+
+        /* check if the match is empty, not if the result is empty */
+        if (match_is_empty(&current_match))
+            focused->layout = $<number>3;
+        else {
+            TAILQ_FOREACH(current, &owindows, owindows) {
+                printf("matching: %p / %s\n", current->con, current->con->name);
+                current->con->layout = $<number>3;
+            }
+        }
+
+    }
+    ;
+
+layout_mode:
+    TOK_DEFAULT   { $<number>$ = L_DEFAULT; }
+    | TOK_STACKED { $<number>$ = L_STACKED; }
+    | TOK_TABBED  { $<number>$ = L_TABBED; }
+    ;
index c0dbdd5f07c35b76b4f9d3e7dd3739d0ff4c8d59..51e0fc26f4b558651616d81aebad4c42d2493800 100644 (file)
@@ -124,7 +124,8 @@ void render_con(Con *con) {
     /* in a stacking container, we ensure the focused client is raised */
     if (con->layout == L_STACKED) {
         Con *foc = TAILQ_FIRST(&(con->focus_head));
-        x_raise_con(foc);
+        if (foc != TAILQ_END(&(con->focus_head)))
+            x_raise_con(foc);
     }
 
     TAILQ_FOREACH(child, &(con->floating_head), floating_windows) {