]> git.lizzy.rs Git - bspwm.git/commitdiff
Fix handling of ID/name frictions
authorBastien Dejean <nihilhill@gmail.com>
Sun, 20 Mar 2016 09:38:11 +0000 (10:38 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Sun, 20 Mar 2016 09:38:11 +0000 (10:38 +0100)
It seems that `resource_base_id` isn't the lower bound of the set of
possible IDs.

bspwm.c
bspwm.h
doc/bspwm.1
doc/bspwm.1.asciidoc
parse.c
query.c

diff --git a/bspwm.c b/bspwm.c
index f1d3f1dd1477b5c059ae6438749412962c3d7eaa..6f22ec2194c4f81ff9c3a71132a26db7b0eb937d 100644 (file)
--- a/bspwm.c
+++ b/bspwm.c
@@ -226,9 +226,7 @@ void setup(void)
 {
        init();
        ewmh_init();
-       const xcb_setup_t *current_setup = xcb_get_setup(dpy);
-       resource_id_base = current_setup->resource_id_base;
-       screen = xcb_setup_roots_iterator(current_setup).data;
+       screen = xcb_setup_roots_iterator(xcb_get_setup(dpy)).data;
 
        if (screen == NULL) {
                err("Can't acquire the default screen.\n");
diff --git a/bspwm.h b/bspwm.h
index 8b9586219a448ef183423e0ee3346a87c9e53752..61942e5b03cc531a8907f98b1ce5f8463e443d16 100644 (file)
--- a/bspwm.h
+++ b/bspwm.h
@@ -39,7 +39,6 @@
 xcb_connection_t *dpy;
 int default_screen, screen_width, screen_height;
 uint32_t clients_count;
-uint32_t resource_id_base;
 xcb_screen_t *screen;
 xcb_window_t root;
 char config_path[MAXLEN];
index 473b36594dbcedc308c8fb60ebb8189b7acb5899..878dbfaac1895a31f7b1c56ea01664c00c643188 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 03/16/2016
+.\"      Date: 03/20/2016
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.1-2-g212442e
+.\"    Source: Bspwm 0.9.1-3-g9ae96eb
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "03/16/2016" "Bspwm 0\&.9\&.1\-2\-g212442e" "Bspwm Manual"
+.TH "BSPWM" "1" "03/20/2016" "Bspwm 0\&.9\&.1\-3\-g9ae96eb" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -92,7 +92,7 @@ Select a node\&.
 .RS 4
 .\}
 .nf
-NODE_SEL := (<node_id>|PATH|DIR|CYCLE_DIR|last|older|newer|biggest|focused)[\&.[!]focused][\&.[!]automatic][\&.[!]local][\&.[!]leaf][\&.[!]STATE][\&.[!]FLAG][\&.[!]LAYER][\&.[!]same_class]
+NODE_SEL := (DIR|CYCLE_DIR|PATH|last|older|newer|focused|biggest|<node_id>)[\&.[!]focused][\&.[!]automatic][\&.[!]local][\&.[!]leaf][\&.[!]STATE][\&.[!]FLAG][\&.[!]LAYER][\&.[!]same_class]
 
 STATE := tiled|pseudo_tiled|floating|fullscreen
 
@@ -116,16 +116,6 @@ JUMP := first|1|second|2|brother|parent|DIR
 \fBDescriptors\fR
 .RS 4
 .PP
-<node_id>
-.RS 4
-Selects the node with the given ID\&.
-.RE
-.PP
-\fIPATH\fR
-.RS 4
-Selects the node at the given path\&.
-.RE
-.PP
 \fIDIR\fR
 .RS 4
 Selects the window in the given (spacial) direction relative to the active node\&.
@@ -136,9 +126,9 @@ Selects the window in the given (spacial) direction relative to the active node\
 Selects the window in the given (cyclic) direction\&.
 .RE
 .PP
-biggest
+\fIPATH\fR
 .RS 4
-Selects the biggest window on the current desktop\&.
+Selects the node at the given path\&.
 .RE
 .PP
 last
@@ -146,19 +136,29 @@ last
 Selects the previously focused node\&.
 .RE
 .PP
+older
+.RS 4
+Selects the node older than the focused node in the history\&.
+.RE
+.PP
+newer
+.RS 4
+Selects the node newer than the focused node in the history\&.
+.RE
+.PP
 focused
 .RS 4
 Selects the currently focused node\&.
 .RE
 .PP
-older
+biggest
 .RS 4
-Selects the node older than the focused node in the history\&.
+Selects the biggest window on the current desktop\&.
 .RE
 .PP
-newer
+<node_id>
 .RS 4
-Selects the node newer than the focused node in the history\&.
+Selects the node with the given ID\&.
 .RE
 .RE
 .sp
@@ -254,7 +254,7 @@ Select a desktop\&.
 .RS 4
 .\}
 .nf
-DESKTOP_SEL := (<desktop_id>|<desktop_name>|[MONITOR_SEL:](focused|^<n>)|CYCLE_DIR|last|older|newer)[\&.[!]occupied][\&.[!]focused][\&.[!]urgent][\&.[!]local]
+DESKTOP_SEL := (CYCLE_DIR|last|older|newer|[MONITOR_SEL:](focused|^<n>)|<desktop_id>|<desktop_name>)[\&.[!]occupied][\&.[!]focused][\&.[!]urgent][\&.[!]local]
 .fi
 .if n \{\
 .RE
@@ -268,44 +268,44 @@ DESKTOP_SEL := (<desktop_id>|<desktop_name>|[MONITOR_SEL:](focused|^<n>)|CYCLE_D
 \fBDescriptors\fR
 .RS 4
 .PP
-<desktop_id>
+\fICYCLE_DIR\fR
 .RS 4
-Selects the desktop with the given ID\&.
+Selects the desktop in the given direction relative to the active desktop\&.
 .RE
 .PP
-<desktop_name>
+last
 .RS 4
-Selects the desktop with the given name\&.
+Selects the previously focused desktop\&.
 .RE
 .PP
-^<n>
+older
 .RS 4
-Selects the nth desktop\&.
+Selects the desktop older than the focused desktop in the history\&.
 .RE
 .PP
-\fICYCLE_DIR\fR
+newer
 .RS 4
-Selects the desktop in the given direction relative to the active desktop\&.
+Selects the desktop newer than the focused desktop in the history\&.
 .RE
 .PP
-last
+focused
 .RS 4
-Selects the previously focused desktop\&.
+Selects the currently focused desktop\&.
 .RE
 .PP
-focused
+^<n>
 .RS 4
-Selects the currently focused desktop\&.
+Selects the nth desktop\&.
 .RE
 .PP
-older
+<desktop_id>
 .RS 4
-Selects the desktop older than the focused desktop in the history\&.
+Selects the desktop with the given ID\&.
 .RE
 .PP
-newer
+<desktop_name>
 .RS 4
-Selects the desktop newer than the focused desktop in the history\&.
+Selects the desktop with the given name\&.
 .RE
 .RE
 .sp
@@ -345,7 +345,7 @@ Select a monitor\&.
 .RS 4
 .\}
 .nf
-MONITOR_SEL := (<monitor_id>|<monitor_name>|^<n>|DIR|CYCLE_DIR|last|primary|focused|older|newer)[\&.[!]occupied][\&.[!]focused]
+MONITOR_SEL := (DIR|CYCLE_DIR|last|older|newer|focused|primary|^<n>|<monitor_id>|<monitor_name>)[\&.[!]occupied][\&.[!]focused]
 .fi
 .if n \{\
 .RE
@@ -359,54 +359,54 @@ MONITOR_SEL := (<monitor_id>|<monitor_name>|^<n>|DIR|CYCLE_DIR|last|primary|focu
 \fBDescriptors\fR
 .RS 4
 .PP
-<monitor_id>
+\fIDIR\fR
 .RS 4
-Selects the monitor with the given ID\&.
+Selects the monitor in the given (spacial) direction relative to the active monitor\&.
 .RE
 .PP
-<monitor_name>
+\fICYCLE_DIR\fR
 .RS 4
-Selects the monitor with the given name\&.
+Selects the monitor in the given (cyclic) direction relative to the active monitor\&.
 .RE
 .PP
-^<n>
+last
 .RS 4
-Selects the nth monitor\&.
+Selects the previously focused monitor\&.
 .RE
 .PP
-\fIDIR\fR
+older
 .RS 4
-Selects the monitor in the given (spacial) direction relative to the active monitor\&.
+Selects the monitor older than the focused monitor in the history\&.
 .RE
 .PP
-\fICYCLE_DIR\fR
+newer
 .RS 4
-Selects the monitor in the given (cyclic) direction relative to the active monitor\&.
+Selects the monitor newer than the focused monitor in the history\&.
 .RE
 .PP
-primary
+focused
 .RS 4
-Selects the primary monitor\&.
+Selects the currently focused monitor\&.
 .RE
 .PP
-last
+primary
 .RS 4
-Selects the previously focused monitor\&.
+Selects the primary monitor\&.
 .RE
 .PP
-focused
+^<n>
 .RS 4
-Selects the currently focused monitor\&.
+Selects the nth monitor\&.
 .RE
 .PP
-older
+<monitor_id>
 .RS 4
-Selects the monitor older than the focused monitor in the history\&.
+Selects the monitor with the given ID\&.
 .RE
 .PP
-newer
+<monitor_name>
 .RS 4
-Selects the monitor newer than the focused monitor in the history\&.
+Selects the monitor with the given name\&.
 .RE
 .RE
 .sp
index 4444b4dac469df7e86a959ee3979d7ebd5c38043..a7990c4372624e2b8684001e553e7e0a5a7380ad 100644 (file)
@@ -64,7 +64,7 @@ Node
 Select a node.
 
 ----
-NODE_SEL := (<node_id>|PATH|DIR|CYCLE_DIR|last|older|newer|biggest|focused)[.[!]focused][.[!]automatic][.[!]local][.[!]leaf][.[!]STATE][.[!]FLAG][.[!]LAYER][.[!]same_class]
+NODE_SEL := (DIR|CYCLE_DIR|PATH|last|older|newer|focused|biggest|<node_id>)[.[!]focused][.[!]automatic][.[!]local][.[!]leaf][.[!]STATE][.[!]FLAG][.[!]LAYER][.[!]same_class]
 
 STATE := tiled|pseudo_tiled|floating|fullscreen
 
@@ -80,33 +80,33 @@ JUMP := first|1|second|2|brother|parent|DIR
 Descriptors
 ^^^^^^^^^^^
 
-<node_id>::
-       Selects the node with the given ID.
-
-'PATH'::
-       Selects the node at the given path.
-
 'DIR'::
        Selects the window in the given (spacial) direction relative to the active node.
 
 'CYCLE_DIR'::
        Selects the window in the given (cyclic) direction.
 
-biggest::
-       Selects the biggest window on the current desktop.
+'PATH'::
+       Selects the node at the given path.
 
 last::
        Selects the previously focused node.
 
-focused::
-       Selects the currently focused node.
-
 older::
        Selects the node older than the focused node in the history.
 
 newer::
        Selects the node newer than the focused node in the history.
 
+focused::
+       Selects the currently focused node.
+
+biggest::
+       Selects the biggest window on the current desktop.
+
+<node_id>::
+       Selects the node with the given ID.
+
 Path Jumps
 ^^^^^^^^^^
 
@@ -160,36 +160,36 @@ Desktop
 Select a desktop.
 
 ----
-DESKTOP_SEL := (<desktop_id>|<desktop_name>|[MONITOR_SEL:](focused|^<n>)|CYCLE_DIR|last|older|newer)[.[!]occupied][.[!]focused][.[!]urgent][.[!]local]
+DESKTOP_SEL := (CYCLE_DIR|last|older|newer|[MONITOR_SEL:](focused|^<n>)|<desktop_id>|<desktop_name>)[.[!]occupied][.[!]focused][.[!]urgent][.[!]local]
 ----
 
 Descriptors
 ^^^^^^^^^^^
 
-<desktop_id>::
-       Selects the desktop with the given ID.
-
-<desktop_name>::
-       Selects the desktop with the given name.
-
-^<n>::
-       Selects the nth desktop.
-
 'CYCLE_DIR'::
        Selects the desktop in the given direction relative to the active desktop.
 
 last::
        Selects the previously focused desktop.
 
-focused::
-       Selects the currently focused desktop.
-
 older::
        Selects the desktop older than the focused desktop in the history.
 
 newer::
        Selects the desktop newer than the focused desktop in the history.
 
+focused::
+       Selects the currently focused desktop.
+
+^<n>::
+       Selects the nth desktop.
+
+<desktop_id>::
+       Selects the desktop with the given ID.
+
+<desktop_name>::
+       Selects the desktop with the given name.
+
 Modifiers
 ^^^^^^^^^
 
@@ -211,42 +211,43 @@ Monitor
 Select a monitor.
 
 ----
-MONITOR_SEL := (<monitor_id>|<monitor_name>|^<n>|DIR|CYCLE_DIR|last|primary|focused|older|newer)[.[!]occupied][.[!]focused]
+MONITOR_SEL := (DIR|CYCLE_DIR|last|older|newer|focused|primary|^<n>|<monitor_id>|<monitor_name>)[.[!]occupied][.[!]focused]
 ----
 
 Descriptors
 ^^^^^^^^^^^
 
-<monitor_id>::
-       Selects the monitor with the given ID.
-
-<monitor_name>::
-       Selects the monitor with the given name.
-
-^<n>::
-       Selects the nth monitor.
-
 'DIR'::
        Selects the monitor in the given (spacial) direction relative to the active monitor.
 
 'CYCLE_DIR'::
        Selects the monitor in the given (cyclic) direction relative to the active monitor.
 
-primary::
-       Selects the primary monitor.
-
 last::
        Selects the previously focused monitor.
 
-focused::
-       Selects the currently focused monitor.
-
 older::
        Selects the monitor older than the focused monitor in the history.
 
 newer::
        Selects the monitor newer than the focused monitor in the history.
 
+focused::
+       Selects the currently focused monitor.
+
+primary::
+       Selects the primary monitor.
+
+^<n>::
+       Selects the nth monitor.
+
+<monitor_id>::
+       Selects the monitor with the given ID.
+
+<monitor_name>::
+       Selects the monitor with the given name.
+
+
 Modifiers
 ^^^^^^^^^
 
diff --git a/parse.c b/parse.c
index 5387b0284c704b20703aafb8c543d8e5e517d981..69cf876933da6279b68f8a65db1744600efadff6 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -204,7 +204,7 @@ bool parse_id(char *s, uint32_t *id)
        char *end;
        errno = 0;
        uint32_t v = strtol(s, &end, 0);
-       if (errno != 0 || *end != '\0' || v < resource_id_base) {
+       if (errno != 0 || *end != '\0') {
                return false;
        }
        *id = v;
diff --git a/query.c b/query.c
index db2f60269f23aa0152a5b4ce66d6605733259a88..136f53f539994d6faf00b15ef466f9c55441fc8c 100644 (file)
--- a/query.c
+++ b/query.c
@@ -463,14 +463,10 @@ bool desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
                                }
                        }
                }
-       } else if (parse_index(desc, &idx)) {
-               if (desktop_from_index(idx, dst, NULL)) {
-                       return desktop_matches(dst, ref, sel);
-               }
-       } else if (parse_id(desc, &id)) {
-               if (desktop_from_id(id, dst, NULL)) {
-                       return desktop_matches(dst, ref, sel);
-               }
+       } else if (parse_index(desc, &idx) && desktop_from_index(idx, dst, NULL)) {
+               return desktop_matches(dst, ref, sel);
+       } else if (parse_id(desc, &id) && desktop_from_id(id, dst, NULL)) {
+               return desktop_matches(dst, ref, sel);
        } else {
                if (locate_desktop(desc, dst)) {
                        return desktop_matches(dst, ref, sel);
@@ -515,14 +511,10 @@ bool monitor_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
                if (monitor_matches(&loc, ref, sel)) {
                        dst->monitor = mon;
                }
-       } else if (parse_index(desc, &idx)) {
-               if (monitor_from_index(idx, dst)) {
-                       return monitor_matches(dst, ref, sel);
-               }
-       } else if (parse_id(desc, &id)) {
-               if (monitor_from_id(id, dst)) {
-                       return monitor_matches(dst, ref, sel);
-               }
+       } else if (parse_index(desc, &idx) && monitor_from_index(idx, dst)) {
+               return monitor_matches(dst, ref, sel);
+       } else if (parse_id(desc, &id)&& monitor_from_id(id, dst)) {
+               return monitor_matches(dst, ref, sel);
        } else {
                if (locate_monitor(desc, dst)) {
                        return monitor_matches(dst, ref, sel);