1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 06:16:40 +02:00

core: add bar option "color_bg_inactive" (issue #732)

This commit is contained in:
Sébastien Helleu
2020-06-21 18:59:54 +02:00
parent 5b151d1639
commit b0ecbdbf1d
40 changed files with 473 additions and 148 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ buflist_add_bar ()
{
weechat_bar_new (BUFLIST_BAR_NAME, "off", "0", "root", "", "left",
"columns_vertical", "vertical", "0", "0",
"default", "default", "default", "on",
"default", "default", "default", "default", "on",
BUFLIST_BAR_ITEM_NAME);
}
+1 -1
View File
@@ -93,7 +93,7 @@ fset_add_bar ()
FSET_BAR_NAME, "off", "0", "window",
"${buffer.full_name} == " FSET_PLUGIN_NAME "." FSET_BAR_NAME,
"top", "horizontal", "vertical", "3", "3",
"default", "cyan", "default", "on",
"default", "cyan", "default", "default", "on",
FSET_BAR_ITEM_NAME);
}
+25 -21
View File
@@ -3973,12 +3973,12 @@ weechat_guile_api_bar_new (SCM args)
{
SCM name, hidden, priority, type, conditions, position, filling_top_bottom;
SCM filling_left_right, size, size_max, color_fg, color_delim, color_bg;
SCM separator, items;
SCM color_bg_inactive, separator, items;
const char *result;
SCM return_value;
API_INIT_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (!scm_list_p (args) || (scm_to_int (scm_length (args)) != 15))
if (!scm_list_p (args) || (scm_to_int (scm_length (args)) != 16))
API_WRONG_ARGS(API_RETURN_EMPTY);
name = scm_list_ref (args, scm_from_int (0));
@@ -3994,8 +3994,9 @@ weechat_guile_api_bar_new (SCM args)
color_fg = scm_list_ref (args, scm_from_int (10));
color_delim = scm_list_ref (args, scm_from_int (11));
color_bg = scm_list_ref (args, scm_from_int (12));
separator = scm_list_ref (args, scm_from_int (13));
items = scm_list_ref (args, scm_from_int (14));
color_bg_inactive = scm_list_ref (args, scm_from_int (13));
separator = scm_list_ref (args, scm_from_int (14));
items = scm_list_ref (args, scm_from_int (15));
if (!scm_is_string (name) || !scm_is_string (hidden)
|| !scm_is_string (priority) || !scm_is_string (type)
@@ -4003,25 +4004,28 @@ weechat_guile_api_bar_new (SCM args)
|| !scm_is_string (filling_top_bottom) || !scm_is_string (filling_left_right)
|| !scm_is_string (size) || !scm_is_string (size_max)
|| !scm_is_string (color_fg) || !scm_is_string (color_delim)
|| !scm_is_string (color_bg) || !scm_is_string (separator)
|| !scm_is_string (items))
|| !scm_is_string (color_bg) || !scm_is_string (color_bg_inactive)
|| !scm_is_string (separator) || !scm_is_string (items))
API_WRONG_ARGS(API_RETURN_EMPTY);
result = API_PTR2STR(weechat_bar_new (API_SCM_TO_STRING(name),
API_SCM_TO_STRING(hidden),
API_SCM_TO_STRING(priority),
API_SCM_TO_STRING(type),
API_SCM_TO_STRING(conditions),
API_SCM_TO_STRING(position),
API_SCM_TO_STRING(filling_top_bottom),
API_SCM_TO_STRING(filling_left_right),
API_SCM_TO_STRING(size),
API_SCM_TO_STRING(size_max),
API_SCM_TO_STRING(color_fg),
API_SCM_TO_STRING(color_delim),
API_SCM_TO_STRING(color_bg),
API_SCM_TO_STRING(separator),
API_SCM_TO_STRING(items)));
result = API_PTR2STR(
weechat_bar_new (
API_SCM_TO_STRING(name),
API_SCM_TO_STRING(hidden),
API_SCM_TO_STRING(priority),
API_SCM_TO_STRING(type),
API_SCM_TO_STRING(conditions),
API_SCM_TO_STRING(position),
API_SCM_TO_STRING(filling_top_bottom),
API_SCM_TO_STRING(filling_left_right),
API_SCM_TO_STRING(size),
API_SCM_TO_STRING(size_max),
API_SCM_TO_STRING(color_fg),
API_SCM_TO_STRING(color_delim),
API_SCM_TO_STRING(color_bg),
API_SCM_TO_STRING(color_bg_inactive),
API_SCM_TO_STRING(separator),
API_SCM_TO_STRING(items)));
API_RETURN_STRING(result);
}
+5 -3
View File
@@ -3888,7 +3888,7 @@ API_FUNC(bar_new)
{
const char *result;
API_INIT_FUNC(1, "bar_new", "sssssssssssssss", API_RETURN_EMPTY);
API_INIT_FUNC(1, "bar_new", "ssssssssssssssss", API_RETURN_EMPTY);
v8::String::Utf8Value name(args[0]);
v8::String::Utf8Value hidden(args[1]);
@@ -3903,8 +3903,9 @@ API_FUNC(bar_new)
v8::String::Utf8Value color_fg(args[10]);
v8::String::Utf8Value color_delim(args[11]);
v8::String::Utf8Value color_bg(args[12]);
v8::String::Utf8Value separator(args[13]);
v8::String::Utf8Value items(args[14]);
v8::String::Utf8Value color_bg_inactive(args[13]);
v8::String::Utf8Value separator(args[14]);
v8::String::Utf8Value items(args[15]);
result = API_PTR2STR(weechat_bar_new (*name,
*hidden,
@@ -3919,6 +3920,7 @@ API_FUNC(bar_new)
*color_fg,
*color_delim,
*color_bg,
*color_bg_inactive,
*separator,
*items));
+18 -15
View File
@@ -4208,26 +4208,28 @@ API_FUNC(bar_new)
{
const char *name, *hidden, *priority, *type, *conditions, *position;
const char *filling_top_bottom, *filling_left_right, *size, *size_max;
const char *color_fg, *color_delim, *color_bg, *separator, *items;
const char *color_fg, *color_delim, *color_bg, *color_bg_inactive;
const char *separator, *items;
const char *result;
API_INIT_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (lua_gettop (L) < 15)
if (lua_gettop (L) < 16)
API_WRONG_ARGS(API_RETURN_EMPTY);
name = lua_tostring (L, -15);
hidden = lua_tostring (L, -14);
priority = lua_tostring (L, -13);
type = lua_tostring (L, -12);
conditions = lua_tostring (L, -11);
position = lua_tostring (L, -10);
filling_top_bottom = lua_tostring (L, -9);
filling_left_right = lua_tostring (L, -8);
size = lua_tostring (L, -7);
size_max = lua_tostring (L, -6);
color_fg = lua_tostring (L, -5);
color_delim = lua_tostring (L, -4);
color_bg = lua_tostring (L, -3);
name = lua_tostring (L, -16);
hidden = lua_tostring (L, -15);
priority = lua_tostring (L, -14);
type = lua_tostring (L, -13);
conditions = lua_tostring (L, -12);
position = lua_tostring (L, -11);
filling_top_bottom = lua_tostring (L, -10);
filling_left_right = lua_tostring (L, -9);
size = lua_tostring (L, -8);
size_max = lua_tostring (L, -7);
color_fg = lua_tostring (L, -6);
color_delim = lua_tostring (L, -5);
color_bg = lua_tostring (L, -4);
color_bg_inactive = lua_tostring (L, -3);
separator = lua_tostring (L, -2);
items = lua_tostring (L, -1);
@@ -4244,6 +4246,7 @@ API_FUNC(bar_new)
color_fg,
color_delim,
color_bg,
color_bg_inactive,
separator,
items));
+6 -4
View File
@@ -4130,12 +4130,12 @@ API_FUNC(bar_new)
{
char *name, *hidden, *priority, *type, *conditions, *position;
char *filling_top_bottom, *filling_left_right, *size, *size_max, *color_fg;
char *color_delim, *color_bg, *separator, *bar_items;
char *color_delim, *color_bg, *color_bg_inactive, *separator, *bar_items;
const char *result;
dXSARGS;
API_INIT_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (items < 15)
if (items < 16)
API_WRONG_ARGS(API_RETURN_EMPTY);
name = SvPV_nolen (ST (0));
@@ -4151,8 +4151,9 @@ API_FUNC(bar_new)
color_fg = SvPV_nolen (ST (10));
color_delim = SvPV_nolen (ST (11));
color_bg = SvPV_nolen (ST (12));
separator = SvPV_nolen (ST (13));
bar_items = SvPV_nolen (ST (14));
color_bg_inactive = SvPV_nolen (ST (13));
separator = SvPV_nolen (ST (14));
bar_items = SvPV_nolen (ST (15));
result = API_PTR2STR(weechat_bar_new (name,
hidden,
@@ -4167,6 +4168,7 @@ API_FUNC(bar_new)
color_fg,
color_delim,
color_bg,
color_bg_inactive,
separator,
bar_items));
+7 -5
View File
@@ -4117,19 +4117,19 @@ API_FUNC(bar_new)
zend_string *z_name, *z_hidden, *z_priority, *z_type, *z_condition;
zend_string *z_position, *z_filling_top_bottom, *z_filling_left_right;
zend_string *z_size, *z_size_max, *z_color_fg, *z_color_delim, *z_color_bg;
zend_string *z_separator, *z_items;
zend_string *z_color_bg_inactive, *z_separator, *z_items;
char *name, *hidden, *priority, *type, *condition, *position;
char *filling_top_bottom, *filling_left_right, *size, *size_max, *color_fg;
char *color_delim, *color_bg, *separator, *items;
char *color_delim, *color_bg, *color_bg_inactive, *separator, *items;
const char *result;
API_INIT_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (zend_parse_parameters (
ZEND_NUM_ARGS(), "SSSSSSSSSSSSSSS", &z_name, &z_hidden,
ZEND_NUM_ARGS(), "SSSSSSSSSSSSSSSS", &z_name, &z_hidden,
&z_priority, &z_type, &z_condition, &z_position,
&z_filling_top_bottom, &z_filling_left_right, &z_size, &z_size_max,
&z_color_fg, &z_color_delim, &z_color_bg, &z_separator,
&z_items) == FAILURE)
&z_color_fg, &z_color_delim, &z_color_bg, &z_color_bg_inactive,
&z_separator, &z_items) == FAILURE)
API_WRONG_ARGS(API_RETURN_EMPTY);
name = ZSTR_VAL(z_name);
@@ -4145,6 +4145,7 @@ API_FUNC(bar_new)
color_fg = ZSTR_VAL(z_color_fg);
color_delim = ZSTR_VAL(z_color_delim);
color_bg = ZSTR_VAL(z_color_bg);
color_bg_inactive = ZSTR_VAL(z_color_bg_inactive);
separator = ZSTR_VAL(z_separator);
items = ZSTR_VAL(z_items);
@@ -4163,6 +4164,7 @@ API_FUNC(bar_new)
(const char *)color_fg,
(const char *)color_delim,
(const char *)color_bg,
(const char *)color_bg_inactive,
(const char *)separator,
(const char *)items));
+7 -3
View File
@@ -4145,7 +4145,8 @@ API_FUNC(bar_new)
{
char *name, *hidden, *priority, *type, *conditions, *position;
char *filling_top_bottom, *filling_left_right, *size, *size_max;
char *color_fg, *color_delim, *color_bg, *separator, *items;
char *color_fg, *color_delim, *color_bg, *color_bg_inactive, *separator;
char *items;
const char *result;
API_INIT_FUNC(1, "bar_new", API_RETURN_EMPTY);
@@ -4162,12 +4163,14 @@ API_FUNC(bar_new)
color_fg = NULL;
color_delim = NULL;
color_bg = NULL;
color_bg_inactive = NULL;
separator = NULL;
items = NULL;
if (!PyArg_ParseTuple (args, "sssssssssssssss", &name, &hidden, &priority,
if (!PyArg_ParseTuple (args, "ssssssssssssssss", &name, &hidden, &priority,
&type, &conditions, &position, &filling_top_bottom,
&filling_left_right, &size, &size_max, &color_fg,
&color_delim, &color_bg, &separator, &items))
&color_delim, &color_bg, &color_bg_inactive,
&separator, &items))
API_WRONG_ARGS(API_RETURN_EMPTY);
result = API_PTR2STR(weechat_bar_new (name,
@@ -4183,6 +4186,7 @@ API_FUNC(bar_new)
color_fg,
color_delim,
color_bg,
color_bg_inactive,
separator,
items));
+22 -9
View File
@@ -4975,20 +4975,21 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
VALUE priority, VALUE type, VALUE conditions,
VALUE position, VALUE filling_top_bottom,
VALUE filling_left_right, VALUE size,
VALUE size_max, VALUE color_fg, VALUE color_delim,
VALUE color_bg, VALUE separator, VALUE items)
VALUE size_max, VALUE colors, VALUE separator,
VALUE items)
{
char *c_name, *c_hidden, *c_priority, *c_type, *c_conditions, *c_position;
char *c_filling_top_bottom, *c_filling_left_right, *c_size, *c_size_max;
char *c_color_fg, *c_color_delim, *c_color_bg, *c_separator, *c_items;
char *c_color_fg, *c_color_delim, *c_color_bg, *c_color_bg_inactive;
char *c_separator, *c_items;
const char *result;
VALUE color_fg, color_delim, color_bg, color_bg_inactive;
API_INIT_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (NIL_P (name) || NIL_P (hidden) || NIL_P (priority) || NIL_P (type)
|| NIL_P (conditions) || NIL_P (position) || NIL_P (filling_top_bottom)
|| NIL_P (filling_left_right) || NIL_P (size) || NIL_P (size_max)
|| NIL_P (color_fg) || NIL_P (color_delim) || NIL_P (color_bg)
|| NIL_P (separator) || NIL_P (items))
|| NIL_P (colors) || NIL_P (separator) || NIL_P (items))
API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (name, T_STRING);
@@ -5001,12 +5002,22 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
Check_Type (filling_left_right, T_STRING);
Check_Type (size, T_STRING);
Check_Type (size_max, T_STRING);
Check_Type (color_fg, T_STRING);
Check_Type (color_delim, T_STRING);
Check_Type (color_bg, T_STRING);
Check_Type (colors, T_ARRAY);
Check_Type (separator, T_STRING);
Check_Type (items, T_STRING);
/*
* due to a Ruby limitation (15 arguments max by function), we receive the
* colors in an array of 4 strings (fg, delim, bg, bg_inactive)
*/
if (RARRAY_LEN(colors) != 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
color_fg = rb_ary_entry (colors, 0);
color_delim = rb_ary_entry (colors, 1);
color_bg = rb_ary_entry (colors, 2);
color_bg_inactive = rb_ary_entry (colors, 3);
c_name = StringValuePtr (name);
c_hidden = StringValuePtr (hidden);
c_priority = StringValuePtr (priority);
@@ -5020,6 +5031,7 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
c_color_fg = StringValuePtr (color_fg);
c_color_delim = StringValuePtr (color_delim);
c_color_bg = StringValuePtr (color_bg);
c_color_bg_inactive = StringValuePtr (color_bg_inactive);
c_separator = StringValuePtr (separator);
c_items = StringValuePtr (items);
@@ -5036,6 +5048,7 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
c_color_fg,
c_color_delim,
c_color_bg,
c_color_bg_inactive,
c_separator,
c_items));
@@ -6544,7 +6557,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
API_DEF_FUNC(bar_item_update, 1);
API_DEF_FUNC(bar_item_remove, 1);
API_DEF_FUNC(bar_search, 1);
API_DEF_FUNC(bar_new, 15);
API_DEF_FUNC(bar_new, 13);
API_DEF_FUNC(bar_set, 3);
API_DEF_FUNC(bar_update, 1);
API_DEF_FUNC(bar_remove, 1);
+6 -4
View File
@@ -4493,12 +4493,12 @@ API_FUNC(bar_new)
Tcl_Obj *objp;
char *name, *hidden, *priority, *type, *conditions, *position;
char *filling_top_bottom, *filling_left_right, *size, *size_max, *color_fg;
char *color_delim, *color_bg, *separator, *bar_items;
char *color_delim, *color_bg, *color_bg_inactive, *separator, *bar_items;
const char *result;
int i;
API_INIT_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (objc < 16)
if (objc < 17)
API_WRONG_ARGS(API_RETURN_EMPTY);
name = Tcl_GetStringFromObj (objv[1], &i);
@@ -4514,8 +4514,9 @@ API_FUNC(bar_new)
color_fg = Tcl_GetStringFromObj (objv[11], &i);
color_delim = Tcl_GetStringFromObj (objv[12], &i);
color_bg = Tcl_GetStringFromObj (objv[13], &i);
separator = Tcl_GetStringFromObj (objv[14], &i);
bar_items = Tcl_GetStringFromObj (objv[15], &i);
color_bg_inactive = Tcl_GetStringFromObj (objv[14], &i);
separator = Tcl_GetStringFromObj (objv[15], &i);
bar_items = Tcl_GetStringFromObj (objv[16], &i);
result = API_PTR2STR(weechat_bar_new (name,
hidden,
@@ -4530,6 +4531,7 @@ API_FUNC(bar_new)
color_fg,
color_delim,
color_bg,
color_bg_inactive,
separator,
bar_items));
+5 -3
View File
@@ -67,7 +67,7 @@ struct timeval;
* please change the date with current one; for a second change at same
* date, increment the 01, otherwise please keep 01.
*/
#define WEECHAT_PLUGIN_API_VERSION "20200508-01"
#define WEECHAT_PLUGIN_API_VERSION "20200621-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -995,6 +995,7 @@ struct t_weechat_plugin
const char *color_fg,
const char *color_delim,
const char *color_bg,
const char *color_bg_inactive,
const char *separator,
const char *items);
int (*bar_set) (struct t_gui_bar *bar, const char *property,
@@ -1933,13 +1934,14 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__condition, __position, __filling_top_bottom, \
__filling_left_right, __size, __size_max, \
__color_fg, __color_delim, __color_bg, \
__separator, __items) \
__color_bg_inactive, __separator, __items) \
(weechat_plugin->bar_new)(__name, __hidden, __priority, __type, \
__condition, __position, \
__filling_top_bottom, \
__filling_left_right, \
__size, __size_max, __color_fg, \
__color_delim, __color_bg, __separator, \
__color_delim, __color_bg, \
__color_bg_inactive, __separator, \
__items)
#define weechat_bar_set(__bar, __property, __value) \
(weechat_plugin->bar_set)(__bar, __property, __value)