core: add bar item "mouse_status", new options weechat.look.item_mouse_status and weechat.color.status_mouse
This commit is contained in:
parent
7baec91874
commit
ee7c280d7e
@ -135,6 +135,7 @@ struct t_config_option *config_look_input_undo_max;
|
||||
struct t_config_option *config_look_item_time_format;
|
||||
struct t_config_option *config_look_item_buffer_filter;
|
||||
struct t_config_option *config_look_item_buffer_zoom;
|
||||
struct t_config_option *config_look_item_mouse_status;
|
||||
struct t_config_option *config_look_jump_current_to_previous_buffer;
|
||||
struct t_config_option *config_look_jump_previous_buffer_when_closing;
|
||||
struct t_config_option *config_look_jump_smart_back_to_buffer;
|
||||
@ -229,6 +230,7 @@ struct t_config_option *config_color_status_data_msg;
|
||||
struct t_config_option *config_color_status_data_other;
|
||||
struct t_config_option *config_color_status_data_private;
|
||||
struct t_config_option *config_color_status_filter;
|
||||
struct t_config_option *config_color_status_mouse;
|
||||
struct t_config_option *config_color_status_name;
|
||||
struct t_config_option *config_color_status_name_ssl;
|
||||
struct t_config_option *config_color_status_nicklist_count;
|
||||
@ -2437,6 +2439,12 @@ config_weechat_init_options ()
|
||||
N_("string used to show zoom on merged buffer "
|
||||
"(bar item \"buffer_zoom\")"),
|
||||
NULL, 0, 0, "!", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_item_mouse_status = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"item_mouse_status", "string",
|
||||
N_("string used to show if mouse is enabled/disabled"
|
||||
"(bar item \"mouse_status\")"),
|
||||
NULL, 0, 0, "M", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_jump_current_to_previous_buffer = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"jump_current_to_previous_buffer", "boolean",
|
||||
@ -3104,6 +3112,12 @@ config_weechat_init_options ()
|
||||
N_("text color for filter indicator in status bar"),
|
||||
NULL, -1, 0, "green", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_status_mouse = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"status_mouse", "color",
|
||||
N_("text color for mouse indicator in status bar"),
|
||||
NULL, -1, 0, "green", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_status_name = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"status_name", "color",
|
||||
|
@ -172,6 +172,7 @@ extern struct t_config_option *config_look_input_undo_max;
|
||||
extern struct t_config_option *config_look_item_time_format;
|
||||
extern struct t_config_option *config_look_item_buffer_filter;
|
||||
extern struct t_config_option *config_look_item_buffer_zoom;
|
||||
extern struct t_config_option *config_look_item_mouse_status;
|
||||
extern struct t_config_option *config_look_jump_current_to_previous_buffer;
|
||||
extern struct t_config_option *config_look_jump_previous_buffer_when_closing;
|
||||
extern struct t_config_option *config_look_jump_smart_back_to_buffer;
|
||||
@ -264,6 +265,7 @@ extern struct t_config_option *config_color_status_data_msg;
|
||||
extern struct t_config_option *config_color_status_data_other;
|
||||
extern struct t_config_option *config_color_status_data_private;
|
||||
extern struct t_config_option *config_color_status_filter;
|
||||
extern struct t_config_option *config_color_status_mouse;
|
||||
extern struct t_config_option *config_color_status_name;
|
||||
extern struct t_config_option *config_color_status_name_ssl;
|
||||
extern struct t_config_option *config_color_status_nicklist_count;
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "gui-line.h"
|
||||
#include "gui-nicklist.h"
|
||||
#include "gui-window.h"
|
||||
#include "gui-mouse.h"
|
||||
|
||||
|
||||
struct t_gui_bar_item *gui_bar_items = NULL; /* first bar item */
|
||||
@ -62,7 +63,7 @@ char *gui_bar_item_names[GUI_BAR_NUM_ITEMS] =
|
||||
"buffer_count", "buffer_last_number", "buffer_plugin", "buffer_number",
|
||||
"buffer_name", "buffer_short_name", "buffer_modes", "buffer_filter",
|
||||
"buffer_zoom", "buffer_nicklist_count", "scroll", "hotlist", "completion",
|
||||
"buffer_title", "buffer_nicklist", "window_number"
|
||||
"buffer_title", "buffer_nicklist", "window_number", "mouse_status"
|
||||
};
|
||||
char *gui_bar_items_default_for_bars[][2] =
|
||||
{ { GUI_BAR_DEFAULT_NAME_INPUT,
|
||||
@ -1725,6 +1726,35 @@ gui_bar_item_default_window_number (void *data, struct t_gui_bar_item *item,
|
||||
return strdup (str_number);
|
||||
}
|
||||
|
||||
/*
|
||||
* Default item for mouse status.
|
||||
*/
|
||||
|
||||
char *
|
||||
gui_bar_item_default_mouse_status (void *data, struct t_gui_bar_item *item,
|
||||
struct t_gui_window *window,
|
||||
struct t_gui_buffer *buffer,
|
||||
struct t_hashtable *extra_info)
|
||||
{
|
||||
char str_mouse[512];
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) item;
|
||||
(void) window;
|
||||
(void) extra_info;
|
||||
|
||||
if (!buffer || !gui_mouse_enabled)
|
||||
return NULL;
|
||||
|
||||
snprintf (str_mouse, sizeof (str_mouse),
|
||||
"%s%s",
|
||||
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_mouse))),
|
||||
CONFIG_STRING(config_look_item_mouse_status));
|
||||
|
||||
return strdup (str_mouse);
|
||||
}
|
||||
|
||||
/*
|
||||
* Focus on nicklist.
|
||||
*/
|
||||
@ -2134,6 +2164,15 @@ gui_bar_item_init ()
|
||||
gui_bar_item_names[GUI_BAR_ITEM_WINDOW_NUMBER]);
|
||||
gui_bar_item_hook_signal ("window_closed",
|
||||
gui_bar_item_names[GUI_BAR_ITEM_WINDOW_NUMBER]);
|
||||
|
||||
/* mouse status */
|
||||
gui_bar_item_new (NULL,
|
||||
gui_bar_item_names[GUI_BAR_ITEM_MOUSE_STATUS],
|
||||
&gui_bar_item_default_mouse_status, NULL);
|
||||
gui_bar_item_hook_signal ("mouse_enabled",
|
||||
gui_bar_item_names[GUI_BAR_ITEM_MOUSE_STATUS]);
|
||||
gui_bar_item_hook_signal ("mouse_disabled",
|
||||
gui_bar_item_names[GUI_BAR_ITEM_MOUSE_STATUS]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -43,6 +43,7 @@ enum t_gui_bar_item_weechat
|
||||
GUI_BAR_ITEM_BUFFER_TITLE,
|
||||
GUI_BAR_ITEM_BUFFER_NICKLIST,
|
||||
GUI_BAR_ITEM_WINDOW_NUMBER,
|
||||
GUI_BAR_ITEM_MOUSE_STATUS,
|
||||
/* number of bar items */
|
||||
GUI_BAR_NUM_ITEMS,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user