1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 14:56:39 +02:00

Fix refresh of bar item when it is used more than one time in a bar

This commit is contained in:
Sebastien Helleu
2010-06-11 17:00:07 +02:00
parent b54af6af0b
commit 63bc14e805
3 changed files with 23 additions and 57 deletions
+23 -15
View File
@@ -452,30 +452,38 @@ gui_bar_item_update (const char *item_name)
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
gui_bar_get_item_index (ptr_bar, item_name, &index_item, &index_subitem);
if ((index_item >= 0) && (index_subitem >= 0))
for (index_item = 0; index_item < ptr_bar->items_count; index_item++)
{
if (ptr_bar->bar_window)
for (index_subitem = 0;
index_subitem < ptr_bar->items_subcount[index_item];
index_subitem++)
{
ptr_bar->bar_window->items_refresh_needed[index_item][index_subitem] = 1;
}
else
{
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
if (gui_bar_item_string_is_item (ptr_bar->items_array[index_item][index_subitem],
item_name))
{
for (ptr_bar_window = ptr_window->bar_windows;
ptr_bar_window;
ptr_bar_window = ptr_bar_window->next_bar_window)
if (ptr_bar->bar_window)
{
if (ptr_bar_window->bar == ptr_bar)
ptr_bar->bar_window->items_refresh_needed[index_item][index_subitem] = 1;
}
else
{
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
ptr_bar_window->items_refresh_needed[index_item][index_subitem] = 1;
for (ptr_bar_window = ptr_window->bar_windows;
ptr_bar_window;
ptr_bar_window = ptr_bar_window->next_bar_window)
{
if (ptr_bar_window->bar == ptr_bar)
{
ptr_bar_window->items_refresh_needed[index_item][index_subitem] = 1;
}
}
}
}
gui_bar_ask_refresh (ptr_bar);
}
}
gui_bar_ask_refresh (ptr_bar);
}
}
}
-39
View File
@@ -298,45 +298,6 @@ gui_bar_get_filling (struct t_gui_bar *bar)
return CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT]);
}
/*
* gui_bar_get_item_index: return index of item and sub item in bar (position
* of item in items list)
* for example, if items are:
* item1,sub1+sub2+sub3,item3
* index of sub3 is 1, sub index is 2
* return -1 for index and sub index if item is not
* found in bar
*/
void
gui_bar_get_item_index (struct t_gui_bar *bar, const char *item_name,
int *index_item, int *index_subitem)
{
int i, j;
*index_item = -1;
*index_subitem = -1;
if (!bar || !item_name || !item_name[0])
return;
for (i = 0; i < bar->items_count; i++)
{
for (j = 0; j < bar->items_subcount[i]; j++)
{
/* skip non letters chars at beginning (prefix) */
if (gui_bar_item_string_is_item (bar->items_array[i][j], item_name))
{
*index_item = i;
*index_subitem = j;
return;
}
}
}
/* item is not in bar */
}
/*
* gui_bar_find_pos: find position for a bar in list (keeping list sorted
* by priority)
-3
View File
@@ -114,9 +114,6 @@ extern int gui_bar_search_option (const char *option_name);
extern int gui_bar_search_type (const char *type);
extern int gui_bar_search_position (const char *position);
extern enum t_gui_bar_filling gui_bar_get_filling (struct t_gui_bar *bar);
extern void gui_bar_get_item_index (struct t_gui_bar *bar,
const char *item_name,
int *index_item, int *index_subitem);
extern int gui_bar_check_conditions_for_window (struct t_gui_bar *bar,
struct t_gui_window *window);
extern int gui_bar_root_get_size (struct t_gui_bar *bar,