diff options
author | Nils Görs <weechatter@arcor.de> | 2014-11-02 18:01:33 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2014-11-06 08:06:00 +0100 |
commit | ee7c280d7e8acd5ec255da6e12959d812b5897f3 (patch) | |
tree | 066f0464e304d845623b78ef38e7b33b5a5a37c6 /src/gui | |
parent | 7baec91874a2eb041da41dbc906c8937dbad3306 (diff) | |
download | weechat-ee7c280d7e8acd5ec255da6e12959d812b5897f3.zip |
core: add bar item "mouse_status", new options weechat.look.item_mouse_status and weechat.color.status_mouse
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-bar-item.c | 41 | ||||
-rw-r--r-- | src/gui/gui-bar-item.h | 1 |
2 files changed, 41 insertions, 1 deletions
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index 9fddb9658..ed78db4bc 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -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, @@ -1726,6 +1727,35 @@ gui_bar_item_default_window_number (void *data, struct t_gui_bar_item *item, } /* + * 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]); } /* diff --git a/src/gui/gui-bar-item.h b/src/gui/gui-bar-item.h index 1ea670009..005a799c6 100644 --- a/src/gui/gui-bar-item.h +++ b/src/gui/gui-bar-item.h @@ -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, }; |