mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 14:26:39 +02:00
Added hotlist option for buffer in plugins API, improved buffer refreshs
This commit is contained in:
@@ -39,6 +39,7 @@ lib_weechat_gui_common_a_SOURCES = gui-action.c \
|
||||
gui-keyboard.c \
|
||||
gui-keyboard.h \
|
||||
gui-main.h \
|
||||
gui-status.c \
|
||||
gui-status.h \
|
||||
gui-window.c \
|
||||
gui-window.h \
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "../gui-input.h"
|
||||
#include "../gui-history.h"
|
||||
#include "../gui-nicklist.h"
|
||||
#include "../gui-status.h"
|
||||
#include "../gui-window.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
@@ -161,23 +162,44 @@ gui_main_loop ()
|
||||
/* execute hook timers */
|
||||
hook_timer_exec ();
|
||||
|
||||
/* refresh needed ? */
|
||||
if (gui_refresh_screen_needed)
|
||||
/* refresh window if needed */
|
||||
if (gui_window_refresh_needed)
|
||||
gui_window_refresh_screen (0);
|
||||
|
||||
/* refresh status bar if needed */
|
||||
if (gui_status_refresh_needed)
|
||||
{
|
||||
gui_status_draw (1);
|
||||
gui_status_refresh_needed = 0;
|
||||
}
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
/* 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, 0);
|
||||
ptr_buffer->chat_refresh_needed = 0;
|
||||
}
|
||||
/* refresh nicklist if needed */
|
||||
if (ptr_buffer->nicklist_refresh_needed)
|
||||
{
|
||||
gui_nicklist_draw (ptr_buffer, 0);
|
||||
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 */
|
||||
|
||||
@@ -40,11 +40,11 @@
|
||||
|
||||
|
||||
/*
|
||||
* gui_status_draw: draw status window for a buffer
|
||||
* gui_status_draw: draw status window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_status_draw (struct t_gui_buffer *buffer, int erase)
|
||||
gui_status_draw (int erase)
|
||||
{
|
||||
struct t_gui_window *ptr_win;
|
||||
struct t_gui_hotlist *ptr_hotlist;
|
||||
@@ -52,9 +52,6 @@ gui_status_draw (struct t_gui_buffer *buffer, int erase)
|
||||
int x;
|
||||
int display_name, names_count;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) buffer;
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
|
||||
@@ -139,7 +136,7 @@ gui_status_draw (struct t_gui_buffer *buffer, int erase)
|
||||
GUI_COLOR_STATUS_DATA_OTHER);
|
||||
display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 1) != 0);
|
||||
break;
|
||||
case GUI_HOTLIST_MSG:
|
||||
case GUI_HOTLIST_MESSAGE:
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
|
||||
GUI_COLOR_STATUS_DATA_MSG);
|
||||
display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 2) != 0);
|
||||
|
||||
@@ -46,9 +46,6 @@
|
||||
#include "gui-curses.h"
|
||||
|
||||
|
||||
int gui_refresh_screen_needed = 0;
|
||||
|
||||
|
||||
/*
|
||||
* gui_window_get_width: get screen width (terminal width in chars for Curses)
|
||||
*/
|
||||
@@ -444,7 +441,7 @@ gui_window_redraw_buffer (struct t_gui_buffer *buffer)
|
||||
gui_chat_draw (buffer, 1);
|
||||
if (GUI_CURSES(ptr_win)->win_nick)
|
||||
gui_nicklist_draw (buffer, 1);
|
||||
gui_status_draw (buffer, 1);
|
||||
gui_status_draw (1);
|
||||
if (CONFIG_BOOLEAN(config_look_infobar))
|
||||
gui_infobar_draw (buffer, 1);
|
||||
gui_input_draw (buffer, 1);
|
||||
@@ -576,7 +573,7 @@ gui_window_page_up (struct t_gui_window *window)
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,7 +615,7 @@ gui_window_page_down (struct t_gui_window *window)
|
||||
window->start_line_pos = 0;
|
||||
gui_hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,7 +643,7 @@ gui_window_scroll_up (struct t_gui_window *window)
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -689,7 +686,7 @@ gui_window_scroll_down (struct t_gui_window *window)
|
||||
window->start_line_pos = 0;
|
||||
gui_hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,7 +710,7 @@ gui_window_scroll_top (struct t_gui_window *window)
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -738,7 +735,7 @@ gui_window_scroll_bottom (struct t_gui_window *window)
|
||||
window->start_line_pos = 0;
|
||||
gui_hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1308,7 +1305,7 @@ gui_window_refresh_screen (int force)
|
||||
{
|
||||
int new_height, new_width;
|
||||
|
||||
if (force || (gui_refresh_screen_needed == 1))
|
||||
if (force || (gui_window_refresh_needed == 1))
|
||||
{
|
||||
endwin ();
|
||||
refresh ();
|
||||
@@ -1324,8 +1321,8 @@ gui_window_refresh_screen (int force)
|
||||
}
|
||||
}
|
||||
|
||||
if (!force && (gui_refresh_screen_needed > 0))
|
||||
gui_refresh_screen_needed--;
|
||||
if (!force && (gui_window_refresh_needed > 0))
|
||||
gui_window_refresh_needed--;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1335,7 +1332,7 @@ gui_window_refresh_screen (int force)
|
||||
void
|
||||
gui_window_refresh_screen_sigwinch ()
|
||||
{
|
||||
gui_refresh_screen_needed = 1;
|
||||
gui_window_refresh_needed = 1;
|
||||
//gui_window_refresh_screen (0);
|
||||
signal (SIGWINCH, &gui_window_refresh_screen_sigwinch);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ struct t_gui_curses_objects
|
||||
};
|
||||
|
||||
extern struct t_gui_color gui_weechat_colors[];
|
||||
extern int gui_refresh_screen_needed;
|
||||
|
||||
/* color functions */
|
||||
extern int gui_color_get_pair (int num_color);
|
||||
|
||||
@@ -33,13 +33,12 @@
|
||||
|
||||
|
||||
/*
|
||||
* gui_status_draw: draw status window for a buffer
|
||||
* gui_status_draw: draw status window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_status_draw (struct t_gui_buffer *buffer, int erase)
|
||||
gui_status_draw (int erase)
|
||||
{
|
||||
/* TODO: write this function for Gtk */
|
||||
(void) buffer;
|
||||
(void) erase;
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ gui_window_page_up (struct t_gui_window *window)
|
||||
(-1) * (window->win_chat_height - 1) :
|
||||
(-1) * ((window->win_chat_height - 1) * 2));
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ gui_window_page_down (struct t_gui_window *window)
|
||||
}
|
||||
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ gui_window_scroll_up (struct t_gui_window *window)
|
||||
(-1) * ( (window->win_chat_height - 1) +
|
||||
CONFIG_INTEGER(config_look_scroll_amount)));
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ gui_window_scroll_down (struct t_gui_window *window)
|
||||
}
|
||||
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ gui_window_scroll_top (struct t_gui_window *window)
|
||||
window->start_line = window->buffer->lines;
|
||||
window->start_line_pos = 0;
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ gui_window_scroll_bottom (struct t_gui_window *window)
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -684,8 +684,8 @@ gui_action_up (char *args)
|
||||
((t_irc_dcc *)(window->dcc_first))->prev_dcc;
|
||||
window->dcc_selected =
|
||||
((t_irc_dcc *)(window->dcc_selected))->prev_dcc;
|
||||
gui_chat_draw (gui_current_window->buffer, 1);
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
gui_current_window->buffer->chat_refresh_needed = 1;
|
||||
gui_current_window->buffer->input_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -824,8 +824,8 @@ gui_action_down (char *args)
|
||||
else
|
||||
window->dcc_selected =
|
||||
irc_dcc_list->next_dcc;
|
||||
gui_chat_draw (gui_current_window->buffer, 1);
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
gui_current_window->buffer->chat_refresh_needed = 1;
|
||||
gui_current_window->buffer->input_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1329,8 +1329,8 @@ gui_action_scroll_previous_highlight (char *args)
|
||||
window->start_line_pos = 0;
|
||||
window->first_line_displayed =
|
||||
(window->start_line == gui_current_window->buffer->lines);
|
||||
gui_chat_draw (gui_current_window->buffer, 1);
|
||||
gui_status_draw (gui_current_window->buffer, 0);
|
||||
gui_current_window->buffer->chat_refresh_needed = 1;
|
||||
gui_current_window->buffer->input_refresh_needed = 1;
|
||||
return;
|
||||
}
|
||||
ptr_line = ptr_line->prev_line;
|
||||
@@ -1366,8 +1366,8 @@ gui_action_scroll_next_highlight (char *args)
|
||||
window->start_line_pos = 0;
|
||||
window->first_line_displayed =
|
||||
(window->start_line == gui_current_window->buffer->lines);
|
||||
gui_chat_draw (gui_current_window->buffer, 1);
|
||||
gui_status_draw (gui_current_window->buffer, 0);
|
||||
gui_current_window->buffer->chat_refresh_needed = 1;
|
||||
gui_current_window->buffer->input_refresh_needed = 1;
|
||||
return;
|
||||
}
|
||||
ptr_line = ptr_line->next_line;
|
||||
@@ -1399,8 +1399,8 @@ gui_action_scroll_unread (char *args)
|
||||
gui_current_window->start_line_pos = 0;
|
||||
gui_current_window->first_line_displayed =
|
||||
(gui_current_window->start_line == gui_current_window->buffer->lines);
|
||||
gui_chat_draw (gui_current_window->buffer, 1);
|
||||
gui_status_draw (gui_current_window->buffer, 0);
|
||||
gui_current_window->buffer->chat_refresh_needed = 1;
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
-11
@@ -102,6 +102,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
|
||||
|
||||
/* title */
|
||||
new_buffer->title = NULL;
|
||||
new_buffer->title_refresh_needed = 1;
|
||||
|
||||
/* chat lines */
|
||||
new_buffer->lines = NULL;
|
||||
@@ -118,7 +119,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
|
||||
new_buffer->nicklist_max_length = -1;
|
||||
new_buffer->nicklist_display_groups = 1;
|
||||
new_buffer->nicklist_visible_count = 0;
|
||||
new_buffer->nicklist_refresh_needed = 0;
|
||||
new_buffer->nicklist_refresh_needed = 1;
|
||||
gui_nicklist_add_group (new_buffer, NULL, "root", NULL, 0);
|
||||
|
||||
/* input */
|
||||
@@ -134,6 +135,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
|
||||
new_buffer->input_buffer_length = 0;
|
||||
new_buffer->input_buffer_pos = 0;
|
||||
new_buffer->input_buffer_1st_display = 0;
|
||||
new_buffer->input_refresh_needed = 1;
|
||||
|
||||
/* init completion */
|
||||
new_completion = (struct t_gui_completion *)malloc (sizeof (struct t_gui_completion));
|
||||
@@ -244,6 +246,7 @@ gui_buffer_set_category (struct t_gui_buffer *buffer, char *category)
|
||||
free (buffer->category);
|
||||
buffer->category = strdup (category);
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -259,6 +262,7 @@ gui_buffer_set_name (struct t_gui_buffer *buffer, char *name)
|
||||
free (buffer->name);
|
||||
buffer->name = strdup (name);
|
||||
}
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -271,6 +275,7 @@ gui_buffer_set_title (struct t_gui_buffer *buffer, char *new_title)
|
||||
if (buffer->title)
|
||||
free (buffer->title);
|
||||
buffer->title = (new_title && new_title[0]) ? strdup (new_title) : NULL;
|
||||
buffer->title_refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -281,6 +286,7 @@ void
|
||||
gui_buffer_set_nicklist (struct t_gui_buffer *buffer, int nicklist)
|
||||
{
|
||||
buffer->nicklist = (nicklist) ? 1 : 0;
|
||||
gui_window_refresh_windows ();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -305,6 +311,7 @@ gui_buffer_set_nicklist_display_groups (struct t_gui_buffer *buffer,
|
||||
buffer->nicklist_display_groups = (display_groups) ? 1 : 0;
|
||||
buffer->nicklist_visible_count = 0;
|
||||
gui_nicklist_compute_visible_count (buffer, buffer->nicklist_root);
|
||||
buffer->nicklist_refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -317,6 +324,7 @@ gui_buffer_set_nick (struct t_gui_buffer *buffer, char *new_nick)
|
||||
if (buffer->input_nick)
|
||||
free (buffer->input_nick);
|
||||
buffer->input_nick = (new_nick && new_nick[0]) ? strdup (new_nick) : NULL;
|
||||
buffer->input_refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -337,27 +345,21 @@ gui_buffer_set (struct t_gui_buffer *buffer, char *property, char *value)
|
||||
else if (string_strcasecmp (property, "category") == 0)
|
||||
{
|
||||
gui_buffer_set_category (buffer, value);
|
||||
gui_status_draw (buffer, 1);
|
||||
}
|
||||
else if (string_strcasecmp (property, "name") == 0)
|
||||
{
|
||||
gui_buffer_set_name (buffer, value);
|
||||
gui_status_draw (buffer, 1);
|
||||
}
|
||||
else if (string_strcasecmp (property, "title") == 0)
|
||||
{
|
||||
gui_buffer_set_title (buffer, value);
|
||||
gui_chat_draw_title (buffer, 1);
|
||||
}
|
||||
else if (string_strcasecmp (property, "nicklist") == 0)
|
||||
{
|
||||
error = NULL;
|
||||
number = strtol (value, &error, 10);
|
||||
if (error && (error[0] == '\0'))
|
||||
{
|
||||
gui_buffer_set_nicklist (buffer, number);
|
||||
gui_window_refresh_windows ();
|
||||
}
|
||||
}
|
||||
else if (string_strcasecmp (property, "nicklist_case_sensitive") == 0)
|
||||
{
|
||||
@@ -376,7 +378,20 @@ gui_buffer_set (struct t_gui_buffer *buffer, char *property, char *value)
|
||||
else if (string_strcasecmp (property, "nick") == 0)
|
||||
{
|
||||
gui_buffer_set_nick (buffer, value);
|
||||
gui_input_draw (buffer, 1);
|
||||
}
|
||||
else if (string_strcasecmp (property, "hotlist") == 0)
|
||||
{
|
||||
if (strcmp (value, "-") == 0)
|
||||
gui_add_hotlist = 0;
|
||||
else if (strcmp (value, "+") == 0)
|
||||
gui_add_hotlist = 1;
|
||||
else
|
||||
{
|
||||
error = NULL;
|
||||
number = strtol (value, &error, 10);
|
||||
if (error && (error[0] == '\0'))
|
||||
gui_hotlist_add (buffer, number, NULL, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,8 +591,8 @@ gui_buffer_clear (struct t_gui_buffer *buffer)
|
||||
}
|
||||
}
|
||||
|
||||
gui_chat_draw (buffer, 1);
|
||||
gui_status_draw (buffer, 1);
|
||||
buffer->chat_refresh_needed = 1;
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -685,7 +700,7 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another)
|
||||
free (buffer);
|
||||
|
||||
if (gui_windows && gui_current_window && gui_current_window->buffer)
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -66,6 +66,7 @@ struct t_gui_buffer
|
||||
|
||||
/* buffer title */
|
||||
char *title; /* buffer title */
|
||||
int title_refresh_needed; /* refresh for title is needed ? */
|
||||
|
||||
/* chat content */
|
||||
struct t_gui_line *lines; /* lines of chat window */
|
||||
@@ -97,6 +98,7 @@ struct t_gui_buffer
|
||||
int input_buffer_length; /* number of chars in buffer */
|
||||
int input_buffer_pos; /* position into buffer */
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
int input_refresh_needed; /* refresh for input is needed ? */
|
||||
|
||||
/* completion */
|
||||
struct t_gui_completion *completion; /* completion */
|
||||
|
||||
+3
-3
@@ -404,8 +404,8 @@ gui_chat_line_free (struct t_gui_line *line)
|
||||
{
|
||||
ptr_win->start_line = ptr_win->start_line->next_line;
|
||||
ptr_win->start_line_pos = 0;
|
||||
gui_chat_draw (ptr_win->buffer, 0);
|
||||
gui_status_draw (ptr_win->buffer, 0);
|
||||
ptr_win->buffer->chat_refresh_needed = 1;
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
if (line->str_time)
|
||||
@@ -566,7 +566,7 @@ gui_chat_printf_date (struct t_gui_buffer *buffer, time_t date,
|
||||
|| (gui_buffer_is_scrolled (buffer))))
|
||||
{
|
||||
gui_hotlist_add (buffer, 0, NULL, 1);
|
||||
gui_status_draw (buffer, 0);
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "../core/wee-util.h"
|
||||
#include "gui-hotlist.h"
|
||||
#include "gui-buffer.h"
|
||||
#include "gui-status.h"
|
||||
#include "gui-window.h"
|
||||
|
||||
|
||||
@@ -190,7 +191,7 @@ gui_hotlist_add (struct t_gui_buffer *buffer, int priority,
|
||||
{
|
||||
struct t_gui_hotlist *new_hotlist, *ptr_hotlist;
|
||||
|
||||
if (!buffer)
|
||||
if (!buffer || !gui_add_hotlist)
|
||||
return;
|
||||
|
||||
/* do not highlight current buffer */
|
||||
@@ -198,6 +199,11 @@ gui_hotlist_add (struct t_gui_buffer *buffer, int priority,
|
||||
&& (!allow_current_buffer) && (!gui_buffer_is_scrolled (buffer)))
|
||||
return;
|
||||
|
||||
if (priority < GUI_HOTLIST_MIN)
|
||||
priority = GUI_HOTLIST_MIN;
|
||||
else if (priority > GUI_HOTLIST_MAX)
|
||||
priority = GUI_HOTLIST_MAX;
|
||||
|
||||
if ((ptr_hotlist = gui_hotlist_search (gui_hotlist, buffer)))
|
||||
{
|
||||
/* return if priority is greater or equal than the one to add */
|
||||
@@ -226,6 +232,8 @@ gui_hotlist_add (struct t_gui_buffer *buffer, int priority,
|
||||
new_hotlist->prev_hotlist = NULL;
|
||||
|
||||
gui_hotlist_add_hotlist (&gui_hotlist, &last_gui_hotlist, new_hotlist);
|
||||
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -21,10 +21,13 @@
|
||||
#define __WEECHAT_GUI_HOTLIST_H 1
|
||||
|
||||
#define GUI_HOTLIST_LOW 0
|
||||
#define GUI_HOTLIST_MSG 1
|
||||
#define GUI_HOTLIST_MESSAGE 1
|
||||
#define GUI_HOTLIST_PRIVATE 2
|
||||
#define GUI_HOTLIST_HIGHLIGHT 3
|
||||
|
||||
#define GUI_HOTLIST_MIN 0
|
||||
#define GUI_HOTLIST_MAX 3
|
||||
|
||||
struct t_gui_hotlist
|
||||
{
|
||||
int priority; /* 0=crappy msg (join/part), 1=msg, */
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "gui-nicklist.h"
|
||||
#include "gui-buffer.h"
|
||||
#include "gui-color.h"
|
||||
#include "gui-status.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -196,6 +197,7 @@ gui_nicklist_add_group (struct t_gui_buffer *buffer,
|
||||
{
|
||||
buffer->nicklist_refresh_needed = 1;
|
||||
buffer->nicklist_visible_count++;
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
return new_group;
|
||||
@@ -337,6 +339,7 @@ gui_nicklist_add_nick (struct t_gui_buffer *buffer,
|
||||
{
|
||||
buffer->nicklist_refresh_needed = 1;
|
||||
buffer->nicklist_visible_count++;
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
return new_nick;
|
||||
@@ -372,6 +375,7 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer,
|
||||
buffer->nicklist_refresh_needed = 1;
|
||||
if (buffer->nicklist_visible_count > 0)
|
||||
buffer->nicklist_visible_count--;
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
free (nick);
|
||||
@@ -427,6 +431,7 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer,
|
||||
if (buffer->nicklist_display_groups
|
||||
&& (buffer->nicklist_visible_count > 0))
|
||||
buffer->nicklist_visible_count--;
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
free (group);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* gui-status.c: status functions, used by all GUI */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
int gui_status_refresh_needed = 0; /* refresh needed for status bar ? */
|
||||
@@ -20,10 +20,10 @@
|
||||
#ifndef __WEECHAT_GUI_STATUS_H
|
||||
#define __WEECHAT_GUI_STATUS_H 1
|
||||
|
||||
struct t_gui_buffer;
|
||||
extern int gui_status_refresh_needed;
|
||||
|
||||
/* statusbar functions (GUI dependent) */
|
||||
|
||||
extern void gui_status_draw (struct t_gui_buffer *buffer, int erase);
|
||||
extern void gui_status_draw (int erase);
|
||||
|
||||
#endif /* gui-status.h */
|
||||
|
||||
+14
-13
@@ -47,6 +47,7 @@
|
||||
int gui_init_ok = 0; /* = 1 if GUI is initialized*/
|
||||
int gui_ok = 0; /* = 1 if GUI is ok */
|
||||
/* (0 when size too small) */
|
||||
int gui_window_refresh_needed = 0; /* = 1 if refresh needed */
|
||||
|
||||
struct t_gui_window *gui_windows = NULL; /* first window */
|
||||
struct t_gui_window *last_gui_window = NULL; /* last window */
|
||||
@@ -617,8 +618,8 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
|
||||
window->start_line_pos = 0;
|
||||
window->first_line_displayed =
|
||||
(window->start_line == window->buffer->lines);
|
||||
gui_chat_draw (window->buffer, 1);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
window->buffer->chat_refresh_needed = 1;
|
||||
gui_status_refresh_needed = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -656,8 +657,8 @@ gui_window_search_text (struct t_gui_window *window)
|
||||
window->start_line_pos = 0;
|
||||
window->first_line_displayed =
|
||||
(window->start_line == window->buffer->lines);
|
||||
gui_chat_draw (window->buffer, 1);
|
||||
gui_status_draw (window->buffer, 1);
|
||||
window->buffer->chat_refresh_needed = 1;
|
||||
gui_status_refresh_needed = 1;
|
||||
return 1;
|
||||
}
|
||||
ptr_line = ptr_line->prev_line;
|
||||
@@ -681,8 +682,8 @@ gui_window_search_text (struct t_gui_window *window)
|
||||
window->start_line_pos = 0;
|
||||
window->first_line_displayed =
|
||||
(window->start_line == window->buffer->lines);
|
||||
gui_chat_draw (window->buffer, 1);
|
||||
gui_status_draw (window->buffer, 1);
|
||||
window->buffer->chat_refresh_needed = 1;
|
||||
gui_status_refresh_needed = 1;
|
||||
return 1;
|
||||
}
|
||||
ptr_line = ptr_line->next_line;
|
||||
@@ -711,8 +712,8 @@ gui_window_search_start (struct t_gui_window *window)
|
||||
window->buffer->text_search_input =
|
||||
strdup (window->buffer->input_buffer);
|
||||
gui_input_delete_line (window->buffer);
|
||||
gui_status_draw (window->buffer, 1);
|
||||
gui_input_draw (window->buffer, 1);
|
||||
gui_status_refresh_needed = 1;
|
||||
window->buffer->input_refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -731,8 +732,8 @@ gui_window_search_restart (struct t_gui_window *window)
|
||||
window->buffer->text_search_found = 1;
|
||||
else
|
||||
{
|
||||
gui_chat_draw (window->buffer, 1);
|
||||
gui_status_draw (window->buffer, 1);
|
||||
window->buffer->chat_refresh_needed = 1;
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,9 +757,9 @@ gui_window_search_stop (struct t_gui_window *window)
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_hotlist_remove_buffer (window->buffer);
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 1);
|
||||
gui_input_draw (window->buffer, 1);
|
||||
window->buffer->chat_refresh_needed = 1;
|
||||
gui_status_refresh_needed = 1;
|
||||
window->buffer->input_refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
extern int gui_init_ok;
|
||||
extern int gui_ok;
|
||||
extern int gui_window_refresh_needed;
|
||||
|
||||
/* window structures */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user