summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/curses/gui-curses-window.c6
-rw-r--r--src/gui/gui-buffer.c28
-rw-r--r--src/gui/gui-buffer.h3
-rw-r--r--src/gui/gui-input.c15
4 files changed, 40 insertions, 12 deletions
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index aaf7b2d28..4d393bb3e 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -1219,7 +1219,9 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
}
window->buffer = buffer;
- gui_buffer_add_value_num_displayed (buffer, 1);
+
+ gui_buffer_set_active_buffer (buffer);
+ gui_buffer_compute_num_displayed ();
if (!weechat_upgrading && (old_buffer != buffer))
gui_hotlist_remove_buffer (buffer);
@@ -1263,8 +1265,6 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
window->scroll->lines_after = 0;
}
- gui_buffer_set_active_buffer (buffer);
-
for (ptr_bar_window = window->bar_windows; ptr_bar_window;
ptr_bar_window = ptr_bar_window->next_bar_window)
{
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index b0570b71c..81567bc5b 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -76,14 +76,14 @@ char *gui_buffer_notify_string[GUI_BUFFER_NUM_NOTIFY] =
char *gui_buffer_properties_get_integer[] =
{ "number", "layout_number", "layout_number_merge_order", "type", "notify",
- "num_displayed", "active", "print_hooks_enabled", "day_change", "clear",
- "lines_hidden", "prefix_max_length", "time_for_each_line", "nicklist",
- "nicklist_case_sensitive", "nicklist_max_length", "nicklist_display_groups",
- "nicklist_count", "nicklist_groups_count", "nicklist_nicks_count",
- "nicklist_visible_count", "input", "input_get_unknown_commands",
- "input_size", "input_length", "input_pos", "input_1st_display",
- "num_history", "text_search", "text_search_exact", "text_search_regex",
- "text_search_where", "text_search_found",
+ "num_displayed", "active", "zoomed", "print_hooks_enabled", "day_change",
+ "clear", "lines_hidden", "prefix_max_length", "time_for_each_line",
+ "nicklist", "nicklist_case_sensitive", "nicklist_max_length",
+ "nicklist_display_groups", "nicklist_count", "nicklist_groups_count",
+ "nicklist_nicks_count", "nicklist_visible_count", "input",
+ "input_get_unknown_commands", "input_size", "input_length", "input_pos",
+ "input_1st_display", "num_history", "text_search", "text_search_exact",
+ "text_search_regex", "text_search_where", "text_search_found",
NULL
};
char *gui_buffer_properties_get_string[] =
@@ -591,6 +591,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->notify = CONFIG_INTEGER(config_look_buffer_notify_default);
new_buffer->num_displayed = 0;
new_buffer->active = 1;
+ new_buffer->zoomed = 0;
new_buffer->print_hooks_enabled = 1;
new_buffer->day_change = 1;
new_buffer->clear = 1;
@@ -978,6 +979,8 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property)
return buffer->num_displayed;
else if (string_strcasecmp (property, "active") == 0)
return buffer->active;
+ else if (string_strcasecmp (property, "zoomed") == 0)
+ return buffer->zoomed;
else if (string_strcasecmp (property, "print_hooks_enabled") == 0)
return buffer->print_hooks_enabled;
else if (string_strcasecmp (property, "day_change") == 0)
@@ -1976,8 +1979,11 @@ gui_buffer_compute_num_displayed ()
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
- if (ptr_buffer->number == ptr_window->buffer->number)
+ if ((ptr_buffer->number == ptr_window->buffer->number)
+ && (!ptr_buffer->zoomed || (ptr_buffer->active == 2)))
+ {
ptr_buffer->num_displayed++;
+ }
}
}
}
@@ -3821,6 +3827,7 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
HDATA_VAR(struct t_gui_buffer, notify, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, num_displayed, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, active, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, zoomed, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, print_hooks_enabled, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, day_change, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, clear, INTEGER, 0, NULL, NULL);
@@ -3996,6 +4003,8 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_integer (ptr_item, "active", buffer->active))
return 0;
+ if (!infolist_new_var_integer (ptr_item, "zoomed", buffer->zoomed))
+ return 0;
if (!infolist_new_var_integer (ptr_item, "print_hooks_enabled", buffer->print_hooks_enabled))
return 0;
if (!infolist_new_var_integer (ptr_item, "day_change", buffer->day_change))
@@ -4206,6 +4215,7 @@ gui_buffer_print_log ()
log_printf (" notify. . . . . . . . . : %d", ptr_buffer->notify);
log_printf (" num_displayed . . . . . : %d", ptr_buffer->num_displayed);
log_printf (" active. . . . . . . . . : %d", ptr_buffer->active);
+ log_printf (" zoomed. . . . . . . . . : %d", ptr_buffer->zoomed);
log_printf (" print_hooks_enabled . . : %d", ptr_buffer->print_hooks_enabled);
log_printf (" day_change. . . . . . . : %d", ptr_buffer->day_change);
log_printf (" clear . . . . . . . . . : %d", ptr_buffer->clear);
diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h
index 25298bba7..98e6629f6 100644
--- a/src/gui/gui-buffer.h
+++ b/src/gui/gui-buffer.h
@@ -96,6 +96,8 @@ struct t_gui_buffer
int active; /* 0 = buffer merged and not active */
/* 1 = active (merged or not) */
/* 2 = the only active (merged) */
+ int zoomed; /* 1 if a merged buffer is zoomed */
+ /* (it can be another buffer) */
int print_hooks_enabled; /* 1 if print hooks are enabled */
int day_change; /* 1 if "day change" displayed */
int clear; /* 1 if clear of buffer is allowed */
@@ -278,6 +280,7 @@ extern void gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
const char *value);
extern void gui_buffer_set_pointer (struct t_gui_buffer *buffer,
const char *property, void *pointer);
+extern void gui_buffer_compute_num_displayed ();
extern void gui_buffer_add_value_num_displayed (struct t_gui_buffer *buffer,
int value);
extern int gui_buffer_is_main (const char *plugin_name, const char *name);
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index 237548efc..fa49eafef 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -1617,6 +1617,7 @@ void
gui_input_zoom_merged_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_window *ptr_window;
+ struct t_gui_buffer *ptr_buffer;
int buffer_was_zoomed;
/* do nothing if current buffer is not merged with another buffer */
@@ -1660,6 +1661,20 @@ gui_input_zoom_merged_buffer (struct t_gui_buffer *buffer)
buffer->lines = buffer->mixed_lines;
}
+ /* set "zoomed" in merged buffers */
+ for (ptr_buffer = gui_buffers; ptr_buffer;
+ ptr_buffer = ptr_buffer->next_buffer)
+ {
+ if (ptr_buffer->number > buffer->number)
+ break;
+ if (ptr_buffer->number == buffer->number)
+ {
+ ptr_buffer->zoomed = (buffer->active == 2) ? 1 : 0;
+ }
+ }
+
+ gui_buffer_compute_num_displayed ();
+
gui_buffer_ask_chat_refresh (buffer, 2);
(void) hook_signal_send ((buffer_was_zoomed) ?