diff options
Diffstat (limited to 'src/gui/gtk')
-rw-r--r-- | src/gui/gtk/gui-gtk-main.c | 50 | ||||
-rw-r--r-- | src/gui/gtk/gui-gtk-window.c | 6 |
2 files changed, 39 insertions, 17 deletions
diff --git a/src/gui/gtk/gui-gtk-main.c b/src/gui/gtk/gui-gtk-main.c index 8b12876aa..9633c49f2 100644 --- a/src/gui/gtk/gui-gtk-main.c +++ b/src/gui/gtk/gui-gtk-main.c @@ -35,6 +35,7 @@ #include "../../plugins/plugin.h" #include "../gui-bar.h" #include "../gui-bar-item.h" +#include "../gui-bar-window.h" #include "../gui-chat.h" #include "../gui-main.h" #include "../gui-buffer.h" @@ -84,6 +85,8 @@ void gui_main_init () { struct t_gui_buffer *ptr_buffer; + struct t_gui_bar *ptr_bar; + struct t_gui_bar_window *ptr_bar_win; GdkColor color_fg, color_bg; gui_color_init (); @@ -170,23 +173,44 @@ gui_main_init () gtk_widget_show_all (gui_gtk_main_window); - /* create new window/buffer */ - if (gui_window_new (NULL, 0, 0, 0, 0, 100, 100)) + gui_init_ok = 0; + + /* create core buffer */ + ptr_buffer = gui_buffer_new (NULL, "weechat", NULL, NULL, NULL, NULL); + if (ptr_buffer) { - gui_current_window = gui_windows; - ptr_buffer = gui_buffer_new (NULL, "weechat", NULL, NULL, NULL, NULL); - if (ptr_buffer) + gui_init_ok = 1; + + /* set title for core buffer */ + gui_buffer_set_title (ptr_buffer, + "WeeChat " WEECHAT_COPYRIGHT_DATE + " - " WEECHAT_WEBSITE); + + /* create main window (using full space) */ + if (gui_window_new (NULL, ptr_buffer, 0, 0, 0, 0, 100, 100)) { - gui_init_ok = 1; - gui_buffer_set_title (ptr_buffer, - PACKAGE_STRING " " WEECHAT_COPYRIGHT_DATE - " - " WEECHAT_WEBSITE); + gui_current_window = gui_windows; + + if (CONFIG_BOOLEAN(config_look_set_title)) + gui_window_title_set (); } - else - gui_init_ok = 0; - if (CONFIG_BOOLEAN(config_look_set_title)) - gui_window_title_set (); + /* create bar windows for root bars (they were read from config, + but no window was created (GUI was not initialized) */ + for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) + { + if ((CONFIG_INTEGER(ptr_bar->type) == GUI_BAR_TYPE_ROOT) + && (!ptr_bar->bar_window)) + { + gui_bar_window_new (ptr_bar, NULL); + } + } + for (ptr_bar_win = gui_windows->bar_windows; + ptr_bar_win; ptr_bar_win = ptr_bar_win->next_bar_window) + { + gui_bar_window_calculate_pos_size (ptr_bar_win, gui_windows); + gui_bar_window_create_win (ptr_bar_win); + } } } diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c index 81515d560..11c06479b 100644 --- a/src/gui/gtk/gui-gtk-window.c +++ b/src/gui/gtk/gui-gtk-window.c @@ -480,7 +480,7 @@ gui_window_split_horiz (struct t_gui_window *window, int percentage) if ((percentage > 0) && (percentage <= 100)) { - new_window = gui_window_new (window, + new_window = gui_window_new (window, window->buffer, window->win_x, window->win_y, window->win_width, height1, 100, percentage); @@ -492,7 +492,6 @@ gui_window_split_horiz (struct t_gui_window *window, int percentage) window->win_height_pct = 100 - percentage; /* assign same buffer for new window (top window) */ - new_window->buffer = window->buffer; new_window->buffer->num_displayed++; gui_window_switch_to_buffer (window, window->buffer, 1); @@ -526,7 +525,7 @@ gui_window_split_vertic (struct t_gui_window *window, int percentage) if ((percentage > 0) && (percentage <= 100)) { - new_window = gui_window_new (window, + new_window = gui_window_new (window, window->buffer, window->win_x + width1 + 1, window->win_y, width2, window->win_height, percentage, 100); @@ -537,7 +536,6 @@ gui_window_split_vertic (struct t_gui_window *window, int percentage) window->win_width_pct = 100 - percentage; /* assign same buffer for new window (right window) */ - new_window->buffer = window->buffer; new_window->buffer->num_displayed++; gui_window_switch_to_buffer (window, window->buffer, 1); |