mirror of
https://github.com/vale981/bspwm
synced 2025-03-05 09:51:38 -05:00
Fix handling of ID/name frictions
It seems that `resource_base_id` isn't the lower bound of the set of possible IDs.
This commit is contained in:
parent
9ae96ebdcd
commit
1e3b13465b
6 changed files with 120 additions and 130 deletions
4
bspwm.c
4
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");
|
||||
|
|
1
bspwm.h
1
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];
|
||||
|
|
136
doc/bspwm.1
136
doc/bspwm.1
|
@ -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,11 +136,6 @@ last
|
|||
Selects the previously focused node\&.
|
||||
.RE
|
||||
.PP
|
||||
focused
|
||||
.RS 4
|
||||
Selects the currently focused node\&.
|
||||
.RE
|
||||
.PP
|
||||
older
|
||||
.RS 4
|
||||
Selects the node older than the focused node in the history\&.
|
||||
|
@ -160,6 +145,21 @@ 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
|
||||
biggest
|
||||
.RS 4
|
||||
Selects the biggest window on the current desktop\&.
|
||||
.RE
|
||||
.PP
|
||||
<node_id>
|
||||
.RS 4
|
||||
Selects the node with the given ID\&.
|
||||
.RE
|
||||
.RE
|
||||
.sp
|
||||
.it 1 an-trap
|
||||
|
@ -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,21 +268,6 @@ DESKTOP_SEL := (<desktop_id>|<desktop_name>|[MONITOR_SEL:](focused|^<n>)|CYCLE_D
|
|||
\fBDescriptors\fR
|
||||
.RS 4
|
||||
.PP
|
||||
<desktop_id>
|
||||
.RS 4
|
||||
Selects the desktop with the given ID\&.
|
||||
.RE
|
||||
.PP
|
||||
<desktop_name>
|
||||
.RS 4
|
||||
Selects the desktop with the given name\&.
|
||||
.RE
|
||||
.PP
|
||||
^<n>
|
||||
.RS 4
|
||||
Selects the nth desktop\&.
|
||||
.RE
|
||||
.PP
|
||||
\fICYCLE_DIR\fR
|
||||
.RS 4
|
||||
Selects the desktop in the given direction relative to the active desktop\&.
|
||||
|
@ -293,11 +278,6 @@ last
|
|||
Selects the previously focused desktop\&.
|
||||
.RE
|
||||
.PP
|
||||
focused
|
||||
.RS 4
|
||||
Selects the currently focused desktop\&.
|
||||
.RE
|
||||
.PP
|
||||
older
|
||||
.RS 4
|
||||
Selects the desktop older than the focused desktop in the history\&.
|
||||
|
@ -307,6 +287,26 @@ newer
|
|||
.RS 4
|
||||
Selects the desktop newer than the focused desktop in the history\&.
|
||||
.RE
|
||||
.PP
|
||||
focused
|
||||
.RS 4
|
||||
Selects the currently focused desktop\&.
|
||||
.RE
|
||||
.PP
|
||||
^<n>
|
||||
.RS 4
|
||||
Selects the nth desktop\&.
|
||||
.RE
|
||||
.PP
|
||||
<desktop_id>
|
||||
.RS 4
|
||||
Selects the desktop with the given ID\&.
|
||||
.RE
|
||||
.PP
|
||||
<desktop_name>
|
||||
.RS 4
|
||||
Selects the desktop with the given name\&.
|
||||
.RE
|
||||
.RE
|
||||
.sp
|
||||
.it 1 an-trap
|
||||
|
@ -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,21 +359,6 @@ MONITOR_SEL := (<monitor_id>|<monitor_name>|^<n>|DIR|CYCLE_DIR|last|primary|focu
|
|||
\fBDescriptors\fR
|
||||
.RS 4
|
||||
.PP
|
||||
<monitor_id>
|
||||
.RS 4
|
||||
Selects the monitor with the given ID\&.
|
||||
.RE
|
||||
.PP
|
||||
<monitor_name>
|
||||
.RS 4
|
||||
Selects the monitor with the given name\&.
|
||||
.RE
|
||||
.PP
|
||||
^<n>
|
||||
.RS 4
|
||||
Selects the nth monitor\&.
|
||||
.RE
|
||||
.PP
|
||||
\fIDIR\fR
|
||||
.RS 4
|
||||
Selects the monitor in the given (spacial) direction relative to the active monitor\&.
|
||||
|
@ -384,21 +369,11 @@ Selects the monitor in the given (spacial) direction relative to the active moni
|
|||
Selects the monitor in the given (cyclic) direction relative to the active monitor\&.
|
||||
.RE
|
||||
.PP
|
||||
primary
|
||||
.RS 4
|
||||
Selects the primary monitor\&.
|
||||
.RE
|
||||
.PP
|
||||
last
|
||||
.RS 4
|
||||
Selects the previously focused monitor\&.
|
||||
.RE
|
||||
.PP
|
||||
focused
|
||||
.RS 4
|
||||
Selects the currently focused monitor\&.
|
||||
.RE
|
||||
.PP
|
||||
older
|
||||
.RS 4
|
||||
Selects the monitor older than the focused monitor in the history\&.
|
||||
|
@ -408,6 +383,31 @@ newer
|
|||
.RS 4
|
||||
Selects the monitor newer than the focused monitor in the history\&.
|
||||
.RE
|
||||
.PP
|
||||
focused
|
||||
.RS 4
|
||||
Selects the currently focused monitor\&.
|
||||
.RE
|
||||
.PP
|
||||
primary
|
||||
.RS 4
|
||||
Selects the primary monitor\&.
|
||||
.RE
|
||||
.PP
|
||||
^<n>
|
||||
.RS 4
|
||||
Selects the nth monitor\&.
|
||||
.RE
|
||||
.PP
|
||||
<monitor_id>
|
||||
.RS 4
|
||||
Selects the monitor with the given ID\&.
|
||||
.RE
|
||||
.PP
|
||||
<monitor_name>
|
||||
.RS 4
|
||||
Selects the monitor with the given name\&.
|
||||
.RE
|
||||
.RE
|
||||
.sp
|
||||
.it 1 an-trap
|
||||
|
|
|
@ -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
|
||||
^^^^^^^^^
|
||||
|
||||
|
|
2
parse.c
2
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;
|
||||
|
|
24
query.c
24
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue