[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Window Gaps



Hi Bastien,

thanks for you patches. If you have later fixes for you previous commits
that aren't merged yet, then please send a *new* patch. You can achieve
that by using git commit --amend and git rebase.

About your patches: I modified your 4 patches and merged them into 2
patches:

> -    SET_INT(    "window_gap",                      5,           RELAYOUT    ),
> +    SET_INT(    "frame_gap",                      5,           RELAYOUT    ),

You already noticed that the alignment was broken here and you fixed it
later. You also didn't add a message in the NEWS file. I modified both
these to things and merged the typo-patch into it. You can find attached
in 0001-Rename-setting-window_gap-to-frame_gap.patch.

About the *new* window_gap: Here I also added a line to the NEWS file,
changed the default window_gap value to 0 and extended the description
in the man page and merged the fix-pseudotile-patch into it:
0002-New-setting-window_gap.patch

If I don't notice any protest I'll merge them in master in 6 hours.

BTW: I somehow couldn't git-am your patches but only could apply them
using patch directly. (But I don't know by what this was caused)

Thorsten
>From 14e335f11ab2061f30e1fa70f9148d2428bf074b Mon Sep 17 00:00:00 2001
From: Bastien Dejean <nihilhill _at_ gmail _dot_ com>
Date: Tue, 17 Jul 2012 13:43:45 +0200
Subject: [PATCH 1/2] Rename setting window_gap to frame_gap

---
 BUGS                 |  1 -
 NEWS                 |  1 +
 doc/herbstluftwm.txt |  4 ++--
 share/autostart      |  2 +-
 src/layout.c         |  8 ++++----
 src/layout.h         |  2 +-
 src/monitor.c        | 10 +++++-----
 src/settings.c       |  2 +-
 8 Dateien geändert, 15 Zeilen hinzugefügt(+), 15 Zeilen entfernt(-)

diff --git a/BUGS b/BUGS
index 6aa1cb4..3c91bb1 100644
--- a/BUGS
+++ b/BUGS
@@ -26,7 +26,6 @@ Some BUGS:
 
     - raise_on_click doesn't work if raise_on_click and numlock is enabled
     - raise_on_click doesn't work with gnome-settings-daemon
-    - window_gap actually should be called frame_gap
     - window_focus is called twice when switching desktops (before mapping
       windows and after mapping them). TODO: only do it once.
     - also update window title if *only* the _NET_WM_NAME changes
diff --git a/NEWS b/NEWS
index 1f7ed1b..fd8cda8 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Next release: 0.4
 
 Changes:
 
+    * the setting window_gap is now called frame_gap
     * new command: close_or_remove
     * new flags '-' and '%' for tag_status for multi monitor handling
     * toggle default panel on hook togglehidepanel
diff --git a/doc/herbstluftwm.txt b/doc/herbstluftwm.txt
index c4270fb..49acdff 100644
--- a/doc/herbstluftwm.txt
+++ b/doc/herbstluftwm.txt
@@ -329,7 +329,7 @@ cycle_value 'NAME' 'VALUES' ...::
     the next in the list or to the first one if the end is reached or current
     value wasn't found. Example:
 
-        * cycle_value window_gap 0 5 10 15
+        * cycle_value frame_gap 0 5 10 15
         * cycle_value frame_bg_normal_color red green blue
 
 cycle_monitor ['DELTA']::
@@ -536,7 +536,7 @@ Settings configure the behaviour of herbstluftwm and can be controlled via the
 integer values. An integer value is set, if its value is 1 or another value
 unequal to 0. An integer value is unset, if its value is 0.
 
-window_gap (Integer)::
+frame_gap (Integer)::
     The gap between frames in the tiling mode.
 
 snap_distance (Integer)::
diff --git a/share/autostart b/share/autostart
index 63de29c..1208087 100755
--- a/share/autostart
+++ b/share/autostart
@@ -88,7 +88,7 @@ hc set window_border_width 2
 hc set window_border_normal_color '#454545'
 hc set window_border_active_color '#9fbc00'
 hc set always_show_frame 1
-hc set window_gap 4
+hc set frame_gap 4
 
 # rules
 hc unrule -F
diff --git a/src/layout.c b/src/layout.c
index bca2fd1..e426fed 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -58,7 +58,7 @@ char* g_layout_names[] = {
 
 static void fetch_frame_colors() {
     // load settings
-    g_window_gap = &(settings_find("window_gap")->value.i);
+    g_frame_gap = &(settings_find("frame_gap")->value.i);
     g_focus_follows_shift = &(settings_find("focus_follows_shift")->value.i);
     g_frame_border_width = &(settings_find("frame_border_width")->value.i);
     g_always_show_frame = &(settings_find("always_show_frame")->value.i);
@@ -740,9 +740,9 @@ void frame_apply_layout(HSFrame* frame, XRectangle rect) {
     if (frame->type == TYPE_CLIENTS) {
         size_t count = frame->content.clients.count;
         if (!*g_smart_frame_surroundings || frame->parent) {
-            // frame only -> apply window_gap
-            rect.height -= *g_window_gap;
-            rect.width -= *g_window_gap;
+            // frame only -> apply frame_gap
+            rect.height -= *g_frame_gap;
+            rect.width -= *g_frame_gap;
             // apply frame width
             rect.x += *g_frame_border_width;
             rect.y += *g_frame_border_width;
diff --git a/src/layout.h b/src/layout.h
index 8975589..35b5e14 100644
--- a/src/layout.h
+++ b/src/layout.h
@@ -85,7 +85,7 @@ typedef struct HSFrame {
 
 // globals
 HSFrame*    g_cur_frame; // currently selected frame
-int* g_window_gap;
+int* g_frame_gap;
 
 // functions
 void layout_init();
diff --git a/src/monitor.c b/src/monitor.c
index 2261252..e2da4e6 100644
--- a/src/monitor.c
+++ b/src/monitor.c
@@ -58,11 +58,11 @@ void monitor_apply_layout(HSMonitor* monitor) {
         rect.y += monitor->pad_up;
         rect.height -= (monitor->pad_up + monitor->pad_down);
         if (!*g_smart_frame_surroundings || monitor->tag->frame->type == TYPE_FRAMES ) {
-            // apply window gap
-            rect.x += *g_window_gap;
-            rect.y += *g_window_gap;
-            rect.height -= *g_window_gap;
-            rect.width -= *g_window_gap;
+            // apply frame gap
+            rect.x += *g_frame_gap;
+            rect.y += *g_frame_gap;
+            rect.height -= *g_frame_gap;
+            rect.width -= *g_frame_gap;
         }
         if (monitor->tag->floating) {
             frame_apply_floating_layout(monitor->tag->frame, monitor);
diff --git a/src/settings.c b/src/settings.c
index 846ba99..742e59a 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -36,7 +36,7 @@
 
 // default settings:
 SettingsPair g_settings[] = {
-    SET_INT(    "window_gap",                      5,           RELAYOUT    ),
+    SET_INT(    "frame_gap",                       5,           RELAYOUT    ),
     SET_INT(    "snap_distance",                   10,          NULL        ),
     SET_INT(    "snap_gap",                        5,           NULL        ),
     SET_STRING( "frame_border_active_color",       "red",       FR_COLORS   ),
-- 
1.7.11.1

>From 824fb01770638fe12b9dbc3d3992b0bdb5b22131 Mon Sep 17 00:00:00 2001
From: Bastien Dejean <nihilhill _at_ gmail _dot_ com>
Date: Tue, 17 Jul 2012 13:52:20 +0200
Subject: [PATCH 2/2] New setting: window_gap

---
 NEWS                 | 2 ++
 doc/herbstluftwm.txt | 3 +++
 src/clientlist.c     | 5 +++++
 src/layout.c         | 9 +++++++++
 src/layout.h         | 1 +
 src/settings.c       | 1 +
 6 Dateien geändert, 21 Zeilen hinzugefügt(+)

diff --git a/NEWS b/NEWS
index fd8cda8..ca2662c 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ Next release: 0.4
 Changes:
 
     * the setting window_gap is now called frame_gap
+    * new setting window_gap which controlls the gap between windows within one
+      frame
     * new command: close_or_remove
     * new flags '-' and '%' for tag_status for multi monitor handling
     * toggle default panel on hook togglehidepanel
diff --git a/doc/herbstluftwm.txt b/doc/herbstluftwm.txt
index 49acdff..79e3dc2 100644
--- a/doc/herbstluftwm.txt
+++ b/doc/herbstluftwm.txt
@@ -539,6 +539,9 @@ unequal to 0. An integer value is unset, if its value is 0.
 frame_gap (Integer)::
     The gap between frames in the tiling mode.
 
+window_gap (Integer)::
+    The gap between windows within one frame in the tiling mode.
+
 snap_distance (Integer)::
     If a client is dragged in floating mode, then it snaps to neighbour clients
     if the distance between them is smaller then snap_distance.
diff --git a/src/clientlist.c b/src/clientlist.c
index 6635f95..daf55ed 100644
--- a/src/clientlist.c
+++ b/src/clientlist.c
@@ -58,6 +58,7 @@ static HSClient* create_client() {
 
 static void fetch_colors() {
     g_window_border_width = &(settings_find("window_border_width")->value.i);
+    g_window_gap = &(settings_find("window_gap")->value.i);
     g_snap_gap = &(settings_find("snap_gap")->value.i);
     g_smart_window_borders = &(settings_find("smart_window_borders")->value.i);
     g_raise_on_focus = &(settings_find("raise_on_focus")->value.i);
@@ -342,6 +343,10 @@ void client_resize(HSClient* client, XRectangle rect, HSFrame* frame) {
     // apply border width
     rect.width -= border_width * 2;
     rect.height -= border_width * 2;
+    // apply window gap
+    rect.width -= *g_window_gap;
+    rect.height -= *g_window_gap;
+
     XSetWindowBorderWidth(g_display, win, border_width);
     XMoveResizeWindow(g_display, win, rect.x, rect.y, rect.width, rect.height);
     //// send new size to client
diff --git a/src/layout.c b/src/layout.c
index e426fed..baf3558 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -59,6 +59,7 @@ char* g_layout_names[] = {
 static void fetch_frame_colors() {
     // load settings
     g_frame_gap = &(settings_find("frame_gap")->value.i);
+    g_window_gap = &(settings_find("window_gap")->value.i);
     g_focus_follows_shift = &(settings_find("focus_follows_shift")->value.i);
     g_frame_border_width = &(settings_find("frame_border_width")->value.i);
     g_always_show_frame = &(settings_find("always_show_frame")->value.i);
@@ -749,6 +750,7 @@ void frame_apply_layout(HSFrame* frame, XRectangle rect) {
             rect.height -= *g_frame_border_width * 2;
             rect.width -= *g_frame_border_width * 2;
         }
+
         if (rect.width <= WINDOW_MIN_WIDTH || rect.height <= WINDOW_MIN_HEIGHT) {
             // do nothing on invalid size
             return;
@@ -790,6 +792,13 @@ void frame_apply_layout(HSFrame* frame, XRectangle rect) {
         if (count == 0) {
             return;
         }
+
+        // apply window gap
+        rect.x += *g_window_gap;
+        rect.y += *g_window_gap;
+        rect.width -= *g_window_gap;
+        rect.height -= *g_window_gap;
+
         if (frame->content.clients.layout == LAYOUT_MAX) {
             frame_apply_client_layout_max(frame, rect);
         } else if (frame->content.clients.layout == LAYOUT_GRID) {
diff --git a/src/layout.h b/src/layout.h
index 35b5e14..a63407f 100644
--- a/src/layout.h
+++ b/src/layout.h
@@ -86,6 +86,7 @@ typedef struct HSFrame {
 // globals
 HSFrame*    g_cur_frame; // currently selected frame
 int* g_frame_gap;
+int* g_window_gap;
 
 // functions
 void layout_init();
diff --git a/src/settings.c b/src/settings.c
index 742e59a..602320c 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -37,6 +37,7 @@
 // default settings:
 SettingsPair g_settings[] = {
     SET_INT(    "frame_gap",                       5,           RELAYOUT    ),
+    SET_INT(    "window_gap",                      0,           RELAYOUT    ),
     SET_INT(    "snap_distance",                   10,          NULL        ),
     SET_INT(    "snap_gap",                        5,           NULL        ),
     SET_STRING( "frame_border_active_color",       "red",       FR_COLORS   ),
-- 
1.7.11.1

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Herbstluftwm-devel mailing list
Herbstluftwm _minus_ devel _at_ lists _dot_ sourceforge _dot_ net
https://lists.sourceforge.net/lists/listinfo/herbstluftwm-devel