mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 09:43:13 +02:00
Added conditions for bar display and bar max size
This commit is contained in:
@@ -304,15 +304,8 @@ gui_bar_window_new (struct t_gui_bar *bar, struct t_gui_window *window)
|
||||
|
||||
if (window)
|
||||
{
|
||||
/* bar is type "window_active" and window is not active */
|
||||
if ((CONFIG_INTEGER(bar->type) == GUI_BAR_TYPE_WINDOW_ACTIVE)
|
||||
&& gui_current_window
|
||||
&& (gui_current_window != window))
|
||||
return 1;
|
||||
|
||||
/* bar is type "window_inactive" and window is active */
|
||||
if ((CONFIG_INTEGER(bar->type) == GUI_BAR_TYPE_WINDOW_INACTIVE)
|
||||
&& (!gui_current_window || (gui_current_window == window)))
|
||||
if ((CONFIG_INTEGER(bar->type) == GUI_BAR_TYPE_WINDOW)
|
||||
&& (!gui_bar_check_conditions_for_window (bar, window)))
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -488,10 +481,8 @@ gui_bar_window_remove_unused_bars (struct t_gui_window *window)
|
||||
{
|
||||
next_bar_win = ptr_bar_win->next_bar_window;
|
||||
|
||||
if (((CONFIG_INTEGER(ptr_bar_win->bar->type) == GUI_BAR_TYPE_WINDOW_ACTIVE)
|
||||
&& (window != gui_current_window))
|
||||
|| ((CONFIG_INTEGER(ptr_bar_win->bar->type) == GUI_BAR_TYPE_WINDOW_INACTIVE)
|
||||
&& (window == gui_current_window)))
|
||||
if ((CONFIG_INTEGER(ptr_bar_win->bar->type) == GUI_BAR_TYPE_WINDOW)
|
||||
&& (!gui_bar_check_conditions_for_window (ptr_bar_win->bar, window)))
|
||||
{
|
||||
gui_bar_window_free (ptr_bar_win, window);
|
||||
rc = 1;
|
||||
@@ -519,10 +510,8 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window)
|
||||
|
||||
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
|
||||
{
|
||||
if (((CONFIG_INTEGER(ptr_bar->type) == GUI_BAR_TYPE_WINDOW_ACTIVE)
|
||||
&& (window == gui_current_window))
|
||||
|| ((CONFIG_INTEGER(ptr_bar->type) == GUI_BAR_TYPE_WINDOW_INACTIVE)
|
||||
&& (window != gui_current_window)))
|
||||
if ((CONFIG_INTEGER(ptr_bar->type) == GUI_BAR_TYPE_WINDOW)
|
||||
&& gui_bar_check_conditions_for_window (ptr_bar, window))
|
||||
{
|
||||
if (!gui_bar_window_search_bar (window, ptr_bar))
|
||||
{
|
||||
|
||||
@@ -317,6 +317,8 @@ gui_chat_draw_title (struct t_gui_buffer *buffer, int erase)
|
||||
|
||||
if (title_decoded)
|
||||
free (title_decoded);
|
||||
|
||||
buffer->title_refresh_needed = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1276,6 +1278,8 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
|
||||
ptr_line->refresh_needed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
buffer->chat_refresh_needed = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -423,4 +423,6 @@ gui_input_draw (struct t_gui_buffer *buffer, int erase)
|
||||
refresh ();
|
||||
}
|
||||
}
|
||||
|
||||
buffer->input_refresh_needed = 0;
|
||||
}
|
||||
|
||||
@@ -206,14 +206,11 @@ gui_main_loop ()
|
||||
|
||||
/* refresh window if needed */
|
||||
if (gui_window_refresh_needed)
|
||||
gui_window_refresh_screen (0);
|
||||
gui_window_refresh_screen ();
|
||||
|
||||
/* refresh status bar if needed */
|
||||
if (gui_status_refresh_needed)
|
||||
{
|
||||
gui_status_draw (1);
|
||||
gui_status_refresh_needed = 0;
|
||||
}
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
@@ -230,29 +227,22 @@ gui_main_loop ()
|
||||
{
|
||||
/* refresh title if needed */
|
||||
if (ptr_buffer->title_refresh_needed)
|
||||
{
|
||||
gui_chat_draw_title (ptr_buffer, 1);
|
||||
ptr_buffer->title_refresh_needed = 0;
|
||||
}
|
||||
|
||||
/* refresh chat if needed */
|
||||
if (ptr_buffer->chat_refresh_needed)
|
||||
{
|
||||
gui_chat_draw (ptr_buffer,
|
||||
(ptr_buffer->chat_refresh_needed) > 1 ? 1 : 0);
|
||||
ptr_buffer->chat_refresh_needed = 0;
|
||||
}
|
||||
|
||||
/* refresh nicklist if needed */
|
||||
if (ptr_buffer->nicklist_refresh_needed)
|
||||
{
|
||||
gui_nicklist_draw (ptr_buffer, 1);
|
||||
ptr_buffer->nicklist_refresh_needed = 0;
|
||||
}
|
||||
|
||||
/* refresh input if needed */
|
||||
if (ptr_buffer->input_refresh_needed)
|
||||
{
|
||||
gui_input_draw (ptr_buffer, 1);
|
||||
ptr_buffer->input_refresh_needed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* wait for keyboard or network activity */
|
||||
|
||||
@@ -316,4 +316,6 @@ gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
|
||||
refresh ();
|
||||
}
|
||||
}
|
||||
|
||||
buffer->nicklist_refresh_needed = 0;
|
||||
}
|
||||
|
||||
@@ -249,4 +249,6 @@ gui_status_draw (int erase)
|
||||
wnoutrefresh (GUI_CURSES(ptr_win)->win_status);
|
||||
refresh ();
|
||||
}
|
||||
|
||||
gui_status_refresh_needed = 0;
|
||||
}
|
||||
|
||||
@@ -501,40 +501,6 @@ gui_window_redraw_all_buffers ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_switch: switch to another window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_switch (struct t_gui_window *window)
|
||||
{
|
||||
struct t_gui_window *old_window;
|
||||
int changes;
|
||||
|
||||
if (gui_current_window == window)
|
||||
return;
|
||||
|
||||
old_window = gui_current_window;
|
||||
|
||||
gui_current_window = window;
|
||||
changes = gui_bar_window_remove_unused_bars (old_window)
|
||||
|| gui_bar_window_add_missing_bars (old_window);
|
||||
if (changes)
|
||||
{
|
||||
gui_current_window = old_window;
|
||||
gui_window_switch_to_buffer (gui_current_window,
|
||||
gui_current_window->buffer);
|
||||
gui_current_window = window;
|
||||
}
|
||||
|
||||
gui_bar_window_remove_unused_bars (gui_current_window);
|
||||
gui_bar_window_add_missing_bars (gui_current_window);
|
||||
gui_window_switch_to_buffer (gui_current_window,
|
||||
gui_current_window->buffer);
|
||||
|
||||
gui_window_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_switch_to_buffer: switch to another buffer in a window
|
||||
*/
|
||||
@@ -544,6 +510,7 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
|
||||
struct t_gui_buffer *buffer)
|
||||
{
|
||||
struct t_gui_bar_window *ptr_bar_win;
|
||||
struct t_gui_buffer *old_buffer;
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
@@ -551,6 +518,8 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
|
||||
if (window->buffer->num_displayed > 0)
|
||||
window->buffer->num_displayed--;
|
||||
|
||||
old_buffer = window->buffer;
|
||||
|
||||
if (window->buffer != buffer)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
@@ -565,8 +534,14 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
|
||||
window->win_title_start = 0;
|
||||
window->win_nick_start = 0;
|
||||
|
||||
if (old_buffer == buffer)
|
||||
{
|
||||
gui_bar_window_remove_unused_bars (window);
|
||||
gui_bar_window_add_missing_bars (window);
|
||||
}
|
||||
|
||||
gui_window_calculate_pos_size (window, 1);
|
||||
|
||||
|
||||
/* create bar windows */
|
||||
for (ptr_bar_win = GUI_CURSES(window)->bar_windows; ptr_bar_win;
|
||||
ptr_bar_win = ptr_bar_win->next_bar_window)
|
||||
@@ -624,6 +599,12 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
|
||||
buffer->num_displayed++;
|
||||
|
||||
gui_hotlist_remove_buffer (buffer);
|
||||
|
||||
if (buffer != old_buffer)
|
||||
{
|
||||
gui_bar_window_remove_unused_bars (window);
|
||||
gui_bar_window_add_missing_bars (window);
|
||||
}
|
||||
|
||||
/* redraw bars in window */
|
||||
for (ptr_bar_win = GUI_CURSES(window)->bar_windows; ptr_bar_win;
|
||||
@@ -636,6 +617,38 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_switch: switch to another window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_switch (struct t_gui_window *window)
|
||||
{
|
||||
struct t_gui_window *old_window;
|
||||
int changes;
|
||||
|
||||
if (gui_current_window == window)
|
||||
return;
|
||||
|
||||
old_window = gui_current_window;
|
||||
|
||||
gui_current_window = window;
|
||||
changes = gui_bar_window_remove_unused_bars (old_window)
|
||||
|| gui_bar_window_add_missing_bars (old_window);
|
||||
if (changes)
|
||||
{
|
||||
gui_current_window = old_window;
|
||||
gui_window_switch_to_buffer (gui_current_window,
|
||||
gui_current_window->buffer);
|
||||
gui_current_window = window;
|
||||
}
|
||||
|
||||
gui_window_switch_to_buffer (gui_current_window,
|
||||
gui_current_window->buffer);
|
||||
|
||||
gui_window_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_page_up: display previous page on buffer
|
||||
*/
|
||||
@@ -1548,29 +1561,25 @@ gui_window_switch_right (struct t_gui_window *window)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_refresh_screen (int force)
|
||||
gui_window_refresh_screen ()
|
||||
{
|
||||
int new_height, new_width;
|
||||
|
||||
if (force || (gui_window_refresh_needed == 1))
|
||||
endwin ();
|
||||
refresh ();
|
||||
|
||||
getmaxyx (stdscr, new_height, new_width);
|
||||
|
||||
gui_ok = ((new_width >= GUI_WINDOW_MIN_WIDTH)
|
||||
&& (new_height >= GUI_WINDOW_MIN_HEIGHT));
|
||||
|
||||
if (gui_ok)
|
||||
{
|
||||
endwin ();
|
||||
refresh ();
|
||||
|
||||
getmaxyx (stdscr, new_height, new_width);
|
||||
|
||||
gui_ok = ((new_width >= GUI_WINDOW_MIN_WIDTH)
|
||||
&& (new_height >= GUI_WINDOW_MIN_HEIGHT));
|
||||
|
||||
if (gui_ok)
|
||||
{
|
||||
refresh ();
|
||||
gui_window_refresh_windows ();
|
||||
}
|
||||
gui_window_refresh_windows ();
|
||||
}
|
||||
|
||||
if (gui_window_refresh_needed > 0)
|
||||
gui_window_refresh_needed = 0;
|
||||
gui_window_refresh_needed = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1581,7 +1590,6 @@ void
|
||||
gui_window_refresh_screen_sigwinch ()
|
||||
{
|
||||
gui_window_refresh_needed = 1;
|
||||
//gui_window_refresh_screen (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user