summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/curses/gui-curses-keyboard.c1
-rw-r--r--src/gui/curses/gui-curses-window.c25
-rw-r--r--src/gui/gtk/gui-gtk-window.c15
-rw-r--r--src/gui/gui-window.h1
4 files changed, 42 insertions, 0 deletions
diff --git a/src/gui/curses/gui-curses-keyboard.c b/src/gui/curses/gui-curses-keyboard.c
index f7467937c..8331bf4c2 100644
--- a/src/gui/curses/gui-curses-keyboard.c
+++ b/src/gui/curses/gui-curses-keyboard.c
@@ -185,6 +185,7 @@ gui_keyboard_default_bindings ()
BIND(/* m-w,m-right */ "meta-wmeta2-1;3C", "/window right");
BIND(/* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
BIND(/* m-w,m-left */ "meta-wmeta2-1;3D", "/window left");
+ BIND(/* m-w,m-b */ "meta-wmeta-b", "/window balance");
BIND(/* m-w,m-s */ "meta-wmeta-s", "/window swap");
BIND(/* m-z */ "meta-z", "/window zoom");
BIND(/* m-= */ "meta-=", "/filter toggle");
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index 2fc3208ab..0c229ef91 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -1955,6 +1955,31 @@ gui_window_switch_right (struct t_gui_window *window)
}
/*
+ * gui_window_balance: balance windows (set all splits to 50%)
+ * return 1 if some windows have been balanced
+ * 0 if nothing was changed
+ */
+
+int
+gui_window_balance (struct t_gui_window_tree *tree)
+{
+ int balanced;
+
+ balanced = 0;
+ if (tree && tree->child1 && tree->child2)
+ {
+ if (tree->split_pct != 50)
+ {
+ tree->split_pct = 50;
+ balanced = 1;
+ }
+ balanced |= gui_window_balance (tree->child1);
+ balanced |= gui_window_balance (tree->child2);
+ }
+ return balanced;
+}
+
+/*
* gui_window_swap: swap buffers of two windows
* direction can be: 0 = auto (swap with sister)
* 1 = window above
diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c
index ba64b7d38..c7bd94041 100644
--- a/src/gui/gtk/gui-gtk-window.c
+++ b/src/gui/gtk/gui-gtk-window.c
@@ -792,6 +792,21 @@ gui_window_switch_right (struct t_gui_window *window)
}
/*
+ * gui_window_balance: balance windows (set all splits to 50%)
+ * return 1 if some windows have been balanced
+ * 0 if nothing was changed
+ */
+
+int
+gui_window_balance (struct t_gui_window_tree *tree)
+{
+ (void) tree;
+
+ /* TODO: write this function for Gtk */
+ return 0;
+}
+
+/*
* gui_window_swap: swap buffer of two windows
* direction can be: 0 = auto (swap with sister)
* 1 = window above
diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h
index 06acca662..8e82e5686 100644
--- a/src/gui/gui-window.h
+++ b/src/gui/gui-window.h
@@ -187,6 +187,7 @@ extern void gui_window_switch_up (struct t_gui_window *window);
extern void gui_window_switch_down (struct t_gui_window *window);
extern void gui_window_switch_left (struct t_gui_window *window);
extern void gui_window_switch_right (struct t_gui_window *window);
+extern int gui_window_balance (struct t_gui_window_tree *tree);
extern void gui_window_swap (struct t_gui_window *window, int direction);
extern void gui_window_refresh_screen (int full_refresh);
extern void gui_window_set_title (const char *title);