]> git.sur5r.net Git - i3/i3/commitdiff
Invert logic for the last commit
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 29 Jan 2010 20:51:38 +0000 (21:51 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 29 Jan 2010 20:58:50 +0000 (21:58 +0100)
This makes it more clear that the option is meant to be a special
case (it *disables* part of the focus handling). Also, when
initializing the config data structure with zeros, it will get
initialized with the right value.

Furthermore, the config file parser now also accepts various values
which represent "true", not only numbers.

include/config.h
src/cfgparse.y
src/handlers.c

index b81c3492231806955c48e507949e66c3cd399329..fe5405bc260c27120ad70a2ca986a4fbe623b7f1 100644 (file)
@@ -77,7 +77,11 @@ struct Config {
         int container_stack_limit;
         int container_stack_limit_value;
 
-        bool focus_follows_mouse;
+        /** By default, focus follows mouse. If the user explicitly wants to
+         * turn this off (and instead rely only on the keyboard for changing
+         * focus), we allow him to do this with this relatively special option.
+         * It is not planned to add any different focus models. */
+        bool disable_focus_follows_mouse;
 
         const char *default_border;
 
index cc1b2d16a00b7f0f3146993a71f9b680f908011d..6b458e2cc95c26014407e7fe6884245c45b79196 100644 (file)
@@ -381,10 +381,27 @@ new_window:
         }
         ;
 
+bool:
+        NUMBER
+        {
+                $<number>$ = ($<number>1 == 1);
+        }
+        | WORD
+        {
+                DLOG("checking word \"%s\"\n", $<string>1);
+                $<number>$ = (strcasecmp($<string>1, "yes") == 0 ||
+                              strcasecmp($<string>1, "true") == 0 ||
+                              strcasecmp($<string>1, "on") == 0 ||
+                              strcasecmp($<string>1, "enable") == 0 ||
+                              strcasecmp($<string>1, "active") == 0);
+        }
+        ;
+
 focus_follows_mouse:
-        TOKFOCUSFOLLOWSMOUSE WHITESPACE NUMBER
+        TOKFOCUSFOLLOWSMOUSE WHITESPACE bool
         {
-                config.focus_follows_mouse = ($<number>3 == 0 ? 0 : 1);
+                DLOG("focus follows mouse = %d\n", $<number>3);
+                config.disable_focus_follows_mouse = !($<number>3);
         }
         ;
 
index a0097bcd92baf038e6a9f7dc557f4d9ba67a2173..6e54b04b67ba3a928f1d172e2b2c1207be17a319 100644 (file)
@@ -236,7 +236,7 @@ int handle_enter_notify(void *ignored, xcb_connection_t *conn, xcb_enter_notify_
                 return 1;
         }
 
-        if (config.focus_follows_mouse)
+        if (!config.disable_focus_follows_mouse)
                 set_focus(conn, client, false);
 
         return 1;