Separate border width for floating windows
Patch status: superseded
Patch by Aleksi Blinnikka
Long description:
Floating windows already had their own border style, but the width was
the same for all windows.
The configuration directives 'new_window' and 'new_float' can now be
used simultaneously to have different border widths for floating and
tiled windows.
fixes #1244
To apply this patch, use:
curl http://cr.i3wm.org/patch/544/raw.patch | git am
b/include/config.h
25 |
@@ -98,6 +98,7 @@ struct Config {
|
26 |
int container_stack_limit;
|
27 |
int container_stack_limit_value;
|
28 |
int default_border_width;
|
29 |
+ int default_floating_border_width;
|
30 |
|
31 |
/** Default orientation for new containers */
|
32 |
int default_orientation;
|
b/src/con.c
37 |
@@ -1090,8 +1090,13 @@ Rect con_border_style_rect(Con *con) {
|
38 |
int border_width = con->current_border_width;
|
39 |
DLOG("The border width for con is set to: %d\n", con->current_border_width);
|
40 |
Rect result;
|
41 |
- if (con->current_border_width < 0)
|
42 |
- border_width = config.default_border_width;
|
43 |
+ if (con->current_border_width < 0) {
|
44 |
+ if (con->floating >= FLOATING_AUTO_ON) {
|
45 |
+ border_width = config.default_floating_border_width;
|
46 |
+ } else {
|
47 |
+ border_width = config.default_border_width;
|
48 |
+ }
|
49 |
+ }
|
50 |
DLOG("Effective border width is set to: %d\n", border_width);
|
51 |
/* Shortcut to avoid calling con_adjacent_borders() on dock containers. */
|
52 |
int border_style = con_border_style(con);
|
b/src/config.c
57 |
@@ -255,6 +255,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
|
58 |
config.default_border = BS_NORMAL;
|
59 |
config.default_floating_border = BS_NORMAL;
|
60 |
config.default_border_width = logical_px(2);
|
61 |
+ config.default_floating_border_width = logical_px(2);
|
62 |
/* Set default_orientation to NO_ORIENTATION for auto orientation. */
|
63 |
config.default_orientation = NO_ORIENTATION;
|
64 |
|
b/src/config_directives.c
69 |
@@ -252,9 +252,6 @@ CFGFUN(workspace_layout, const char *layout) {
|
70 |
}
|
71 |
|
72 |
CFGFUN(new_window, const char *windowtype, const char *border, const long width) {
|
73 |
- // FIXME: when using new_float *and* new_window with different border
|
74 |
- // types, this breaks because default_border_width gets overwritten.
|
75 |
-
|
76 |
int border_style;
|
77 |
int border_width;
|
78 |
|
79 |
@@ -274,11 +271,11 @@ CFGFUN(new_window, const char *windowtype, const char *border, const long width)
|
80 |
|
81 |
if (strcmp(windowtype, "new_window") == 0) {
|
82 |
config.default_border = border_style;
|
83 |
+ config.default_border_width = border_width;
|
84 |
} else {
|
85 |
config.default_floating_border = border_style;
|
86 |
+ config.default_floating_border_width = border_width;
|
87 |
}
|
88 |
-
|
89 |
- config.default_border_width = border_width;
|
90 |
}
|
91 |
|
92 |
CFGFUN(hide_edge_borders, const char *borders) {
|
b/src/manage.c
97 |
@@ -430,7 +430,11 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
98 |
|
99 |
if (motif_border_style != BS_NORMAL) {
|
100 |
DLOG("MOTIF_WM_HINTS specifies decorations (border_style = %d)\n", motif_border_style);
|
101 |
- con_set_border_style(nc, motif_border_style, config.default_border_width);
|
102 |
+ if (want_floating) {
|
103 |
+ con_set_border_style(nc, motif_border_style, config.default_floating_border_width);
|
104 |
+ } else {
|
105 |
+ con_set_border_style(nc, motif_border_style, config.default_border_width);
|
106 |
+ }
|
107 |
}
|
108 |
|
109 |
/* to avoid getting an UnmapNotify event due to reparenting, we temporarily
|