]> git.sur5r.net Git - i3/i3/blobdiff - src/cfgparse.y
implement con_id for matching containers, extend testcase
[i3/i3] / src / cfgparse.y
index e2b034126c1ae8902e68cad5a9dca5e4733befef..99367adbd0126d081e5d25fce8042cea0a54a5f0 100644 (file)
@@ -3,25 +3,12 @@
  * vim:ts=8:expandtab
  *
  */
-#include <stdio.h>
-#include <string.h>
-#include <xcb/xcb.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include "data.h"
-#include "config.h"
-#include "i3.h"
-#include "util.h"
-#include "queue.h"
-#include "table.h"
-#include "workspace.h"
-#include "xcb.h"
-#include "log.h"
+
+#include "all.h"
 
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
 extern int yylex(struct context *context);
@@ -70,7 +57,7 @@ void parse_file(const char *f) {
         if (fstat(fd, &stbuf) == -1)
                 die("Could not fstat file: %s\n", strerror(errno));
 
-        buf = smalloc(stbuf.st_size * sizeof(char));
+        buf = scalloc((stbuf.st_size + 1) * sizeof(char));
         while (read_bytes < stbuf.st_size) {
                 if ((ret = read(fd, buf + read_bytes, (stbuf.st_size - read_bytes))) < 0)
                         die("Could not read(): %s\n", strerror(errno));
@@ -372,6 +359,7 @@ new_container:
                 DLOG("new containers will be in mode %d\n", $<number>3);
                 config.container_mode = $<number>3;
 
+#if 0
                 /* We also need to change the layout of the already existing
                  * workspaces here. Workspaces may exist at this point because
                  * of the other directives which are modifying workspaces
@@ -388,6 +376,7 @@ new_container:
                                            ws->table[0][0],
                                            config.container_mode);
                 }
+#endif
         }
         | TOKNEWCONTAINER WHITESPACE TOKSTACKLIMIT WHITESPACE TOKSTACKLIMIT WHITESPACE NUMBER
         {
@@ -395,6 +384,7 @@ new_container:
                 config.container_stack_limit = $<number>5;
                 config.container_stack_limit_value = $<number>7;
 
+#if 0
                 /* See the comment above */
                 Workspace *ws;
                 TAILQ_FOREACH(ws, workspaces, workspaces) {
@@ -404,6 +394,7 @@ new_container:
                         con->stack_limit = config.container_stack_limit;
                         con->stack_limit_value = config.container_stack_limit_value;
                 }
+#endif
         }
         ;
 
@@ -454,12 +445,14 @@ workspace:
                 if (ws_num < 1) {
                         DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
                 } else {
+#if 0
                         Workspace *ws = workspace_get(ws_num - 1);
                         ws->preferred_output = $<string>7;
                         if ($<string>8 != NULL) {
                                 workspace_set_name(ws, $<string>8);
                                 free($<string>8);
                         }
+#endif
                 }
         }
         | TOKWORKSPACE WHITESPACE NUMBER WHITESPACE workspace_name
@@ -469,10 +462,12 @@ workspace:
                         DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
                 } else {
                         DLOG("workspace name to: %s\n", $<string>5);
+#if 0
                         if ($<string>5 != NULL) {
                                 workspace_set_name(workspace_get(ws_num - 1), $<string>5);
                                 free($<string>5);
                         }
+#endif
                 }
         }
         ;
@@ -491,6 +486,7 @@ workspace_name:
 assign:
         TOKASSIGN WHITESPACE window_class WHITESPACE optional_arrow assign_target
         {
+#if 0
                 printf("assignment of %s\n", $<string>3);
 
                 struct Assignment *new = $<assignment>6;
@@ -498,29 +494,36 @@ assign:
                 printf("  floating = %d\n", new->floating);
                 new->windowclass_title = $<string>3;
                 TAILQ_INSERT_TAIL(&assignments, new, assignments);
+#endif
         }
         ;
 
 assign_target:
         NUMBER
         {
+#if 0
                 struct Assignment *new = scalloc(sizeof(struct Assignment));
                 new->workspace = $<number>1;
                 new->floating = ASSIGN_FLOATING_NO;
                 $<assignment>$ = new;
+#endif
         }
         | '~'
         {
+#if 0
                 struct Assignment *new = scalloc(sizeof(struct Assignment));
                 new->floating = ASSIGN_FLOATING_ONLY;
                 $<assignment>$ = new;
+#endif
         }
         | '~' NUMBER
         {
+#if 0
                 struct Assignment *new = scalloc(sizeof(struct Assignment));
                 new->workspace = $<number>2;
                 new->floating = ASSIGN_FLOATING;
                 $<assignment>$ = new;
+#endif
         }
         ;
 
@@ -584,7 +587,7 @@ colorpixel:
                 char *hex;
                 if (asprintf(&hex, "#%s", $<string>2) == -1)
                         die("asprintf()");
-                $<number>$ = get_colorpixel(global_conn, hex);
+                $<number>$ = get_colorpixel(hex);
                 free(hex);
         }
         ;