summaryrefslogtreecommitdiff
path: root/src/gui/gtk/gui-gtk-window.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-10-02 18:03:27 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-10-02 18:03:27 +0200
commit2ffd141cf497e4c9e4953d302a0eae4c9592c0c3 (patch)
treea915d45786268a28f00c19a800cbb3033fa1c12f /src/gui/gtk/gui-gtk-window.c
parentf51f02547eb3b1491c3bcc201927efd778c044b4 (diff)
downloadweechat-2ffd141cf497e4c9e4953d302a0eae4c9592c0c3.zip
Add new /layout command and save_layout_on_exit config option, to save/restore windows and buffers order (task #5453)
Diffstat (limited to 'src/gui/gtk/gui-gtk-window.c')
-rw-r--r--src/gui/gtk/gui-gtk-window.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c
index 9c7cbd564..ede8ccf33 100644
--- a/src/gui/gtk/gui-gtk-window.c
+++ b/src/gui/gtk/gui-gtk-window.c
@@ -610,24 +610,27 @@ gui_window_refresh_windows ()
* gui_window_split_horiz: split a window horizontally
*/
-void
+struct t_gui_window *
gui_window_split_horiz (struct t_gui_window *window, int percentage)
{
struct t_gui_window *new_window;
int height1, height2;
if (!gui_ok)
- return;
+ return NULL;
+
+ new_window = NULL;
height1 = (window->win_height * percentage) / 100;
height2 = window->win_height - height1;
if ((percentage > 0) && (percentage <= 100))
{
- if ((new_window = gui_window_new (window,
- window->win_x, window->win_y,
- window->win_width, height1,
- 100, percentage)))
+ new_window = gui_window_new (window,
+ window->win_x, window->win_y,
+ window->win_width, height1,
+ 100, percentage);
+ if (new_window)
{
/* reduce old window height (bottom window) */
window->win_y = new_window->win_y + new_window->win_height;
@@ -645,30 +648,35 @@ gui_window_split_horiz (struct t_gui_window *window, int percentage)
gui_window_redraw_buffer (gui_current_window->buffer);
}
}
+
+ return new_window;
}
/*
* gui_window_split_vertic: split a window vertically
*/
-void
+struct t_gui_window *
gui_window_split_vertic (struct t_gui_window *window, int percentage)
{
struct t_gui_window *new_window;
int width1, width2;
if (!gui_ok)
- return;
+ return NULL;
+
+ new_window = NULL;
width1 = (window->win_width * percentage) / 100;
width2 = window->win_width - width1 - 1;
if ((percentage > 0) && (percentage <= 100))
{
- if ((new_window = gui_window_new (window,
- window->win_x + width1 + 1, window->win_y,
- width2, window->win_height,
- percentage, 100)))
+ new_window = gui_window_new (window,
+ window->win_x + width1 + 1, window->win_y,
+ width2, window->win_height,
+ percentage, 100);
+ if (new_window)
{
/* reduce old window height (left window) */
window->win_width = width1;
@@ -688,6 +696,8 @@ gui_window_split_vertic (struct t_gui_window *window, int percentage)
gui_window_draw_separator (gui_current_window);
}
}
+
+ return new_window;
}
/*