[PATCH 02/10] Refactor smart window surrounding check.
Simon Ruderich
simon at ruderich.org
Sat Feb 1 21:55:49 CET 2014
This modifies the second check in client_resize_tiling() to the state
before cde1a2c ("Do not apply window_gap to pseudotiled clients"). I
assume the change of meaning was not intentional because it was applied
in only a single location.
---
src/clientlist.c | 11 ++---------
src/layout.c | 10 +++++++---
src/layout.h | 2 ++
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/clientlist.c b/src/clientlist.c
index 36dde75..06a9649 100644
--- a/src/clientlist.c
+++ b/src/clientlist.c
@@ -36,7 +36,6 @@ int* g_window_border_width;
int* g_window_border_inner_width;
int* g_raise_on_focus;
int* g_snap_gap;
-int* g_smart_window_surroundings;
int* g_pseudotile_center_threshold;
unsigned long g_window_border_active_color;
unsigned long g_window_border_normal_color;
@@ -76,7 +75,6 @@ static void fetch_colors(void) {
g_window_border_inner_width = &(settings_find("window_border_inner_width")->value.i);
g_window_gap = &(settings_find("window_gap")->value.i);
g_snap_gap = &(settings_find("snap_gap")->value.i);
- g_smart_window_surroundings = &(settings_find("smart_window_surroundings")->value.i);
g_raise_on_focus = &(settings_find("raise_on_focus")->value.i);
char* str = settings_find("window_border_normal_color")->value.s;
g_window_border_normal_color = getcolor(str);
@@ -493,17 +491,12 @@ void client_resize_tiling(HSClient* client, Rectangle rect, HSFrame* frame) {
}
Window win = client->window;
int border_width = *g_window_border_width;
- if (*g_smart_window_surroundings && !client->pseudotile
- && (frame->content.clients.count == 1
- || frame->content.clients.layout == LAYOUT_MAX)) {
+ if (!client->pseudotile && smart_window_surroundings_active(frame)) {
border_width = 0;
}
// apply border width
- bool is_max_layout = frame->content.clients.layout != LAYOUT_MAX;
- bool only_one_client = frame->content.clients.count != 1;
- bool smart_surroundings_are_applied = *g_smart_window_surroundings && is_max_layout && only_one_client;
- if (!client->pseudotile && !smart_surroundings_are_applied) {
+ if (!client->pseudotile && !smart_window_surroundings_active(frame)) {
// apply window gap
rect.width -= *g_window_gap;
rect.height -= *g_window_gap;
diff --git a/src/layout.c b/src/layout.c
index c7e8ffe..bee6853 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -847,9 +847,7 @@ void frame_apply_layout(HSFrame* frame, Rectangle rect) {
return;
}
- if (!*g_smart_window_surroundings
- || (frame->content.clients.count != 1
- && frame->content.clients.layout != LAYOUT_MAX)) {
+ if (!smart_window_surroundings_active(frame)) {
// apply window gap
rect.x += *g_window_gap;
rect.y += *g_window_gap;
@@ -1953,3 +1951,9 @@ int frame_move_window_edge(int argc, char** argv, GString* output) {
return 0;
}
+bool smart_window_surroundings_active(HSFrame* frame) {
+ return *g_smart_window_surroundings
+ && (frame->content.clients.count == 1
+ || frame->content.clients.layout == LAYOUT_MAX);
+}
+
diff --git a/src/layout.h b/src/layout.h
index 964a646..0f7bbed 100644
--- a/src/layout.h
+++ b/src/layout.h
@@ -183,5 +183,7 @@ void frame_update_border(Window window, unsigned long color);
int frame_focus_edge(int argc, char** argv, GString* output);
int frame_move_window_edge(int argc, char** argv, GString* output);
+bool smart_window_surroundings_active(HSFrame* frame);
+
#endif
--
1.8.5.3
--
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://listi.jpberlin.de/pipermail/hlwm/attachments/20140201/5c9051cc/attachment.asc>
More information about the hlwm
mailing list