From b0ecbdbf1da175802d3e2f82cf181060886247e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 21 Jun 2020 18:59:54 +0200 Subject: core: add bar option "color_bg_inactive" (issue #732) --- ChangeLog.adoc | 1 + ReleaseNotes.adoc | 41 ++++++++++++++++++++ doc/de/weechat_scripting.de.adoc | 11 ++++++ doc/en/weechat_plugin_api.en.adoc | 16 +++++++- doc/en/weechat_scripting.en.adoc | 10 +++++ doc/fr/weechat_plugin_api.fr.adoc | 17 +++++++- doc/fr/weechat_scripting.fr.adoc | 10 +++++ doc/it/weechat_plugin_api.it.adoc | 19 ++++++++- doc/it/weechat_scripting.it.adoc | 11 ++++++ doc/ja/weechat_plugin_api.ja.adoc | 18 ++++++++- doc/ja/weechat_scripting.ja.adoc | 11 ++++++ doc/pl/weechat_scripting.pl.adoc | 11 ++++++ po/cs.po | 11 ++++-- po/de.po | 11 ++++-- po/es.po | 11 ++++-- po/fr.po | 15 ++++++-- po/hu.po | 9 ++++- po/it.po | 11 ++++-- po/ja.po | 11 ++++-- po/pl.po | 11 ++++-- po/pt.po | 11 ++++-- po/pt_BR.po | 11 ++++-- po/ru.po | 9 ++++- po/tr.po | 9 ++++- po/weechat.pot | 9 ++++- src/core/wee-command.c | 26 +++++++++---- src/gui/curses/gui-curses-bar-window.c | 41 +++++++++++++------- src/gui/gui-bar.c | 64 ++++++++++++++++++++++++------- src/gui/gui-bar.h | 3 ++ src/plugins/buflist/buflist.c | 2 +- src/plugins/fset/fset.c | 2 +- src/plugins/guile/weechat-guile-api.c | 46 ++++++++++++---------- src/plugins/javascript/weechat-js-api.cpp | 8 ++-- src/plugins/lua/weechat-lua-api.c | 33 ++++++++-------- src/plugins/perl/weechat-perl-api.c | 10 +++-- src/plugins/php/weechat-php-api.c | 12 +++--- src/plugins/python/weechat-python-api.c | 10 +++-- src/plugins/ruby/weechat-ruby-api.c | 31 ++++++++++----- src/plugins/tcl/weechat-tcl-api.c | 10 +++-- src/plugins/weechat-plugin.h | 8 ++-- 40 files changed, 473 insertions(+), 148 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 85635d997..f2b287653 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] New features:: + * core: add bar option "color_bg_inactive": color for window bars in inactive window (issue #732) * core: add Alacritty title escape sequence support (issue #1517) * core: display notify level for current buffer with command /buffer notify (issue #1505) * core: count only visible nicks in bar item "buffer_nicklist_count", add bar items "buffer_nicklist_count_groups" and "buffer_nicklist_count_all" (issue #1506) diff --git a/ReleaseNotes.adoc b/ReleaseNotes.adoc index ded20da66..68a784ff1 100644 --- a/ReleaseNotes.adoc +++ b/ReleaseNotes.adoc @@ -20,6 +20,47 @@ https://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog] [[v2.9]] == Version 2.9 (under dev) +[[v2.9_bar_color_bg_inactive]] +=== New background color for inactive bars + +A new option has been added in bar: _color_bg_inactive_. It is used for window +bars, when the window is not the active window. + +By default this color is set to "default" for default bars, except for status +and title: the color is set to "darkgray". + +If you upgrade from a previous release, the color will be "default" for all +bars, so if you want to use the new default settings, you can do: + +---- +/set weechat.bar.title.color_bg_inactive darkgray +/set weechat.bar.status.color_bg_inactive darkgray +---- + +If you changed the option _color_bg_ in some bars, you should also adjust +the new option _color_bg_inactive_, depending on your needs. + +The function "bar_new" in API is updated, so this is an incompatible change: +all plugins and scripts calling this function must be updated. + +The following scripts are updated consequently to be compatible with all +WeeChat versions: + +* https://weechat.org/scripts/source/buddylist.pl/[buddylist.pl] 2.0 +* https://weechat.org/scripts/source/buffers.pl/[buffers.pl] 5.7 +* https://weechat.org/scripts/source/chanmon.pl/[chanmon.pl] 2.6 +* https://weechat.org/scripts/source/chanop.py/[chanop.py] 0.3.2 +* https://weechat.org/scripts/source/highmon.pl/[highmon.pl] 2.7 +* https://weechat.org/scripts/source/iset.pl/[iset.pl] 4.4 +* https://weechat.org/scripts/source/menu.pl/[menu.pl] 1.0 +* https://weechat.org/scripts/source/moc_control.py/[moc_control.py] 1.9 +* https://weechat.org/scripts/source/newsbar.pl/[newsbar.pl] 0.19 +* https://weechat.org/scripts/source/pv_info.pl/[pv_info.pl] 0.0.6 +* https://weechat.org/scripts/source/rssagg.pl/[rssagg.pl] 1.2 +* https://weechat.org/scripts/source/urlbar.py/[urlbar.py] 14 +* https://weechat.org/scripts/source/urlselect.lua/[urlselect.lua] 0.5 +* https://weechat.org/scripts/source/vimode.py/[vimode.py] 0.8 + [[v2.9_modifier_weechat_print]] === New modifier_data for modifier "weechat_print" diff --git a/doc/de/weechat_scripting.de.adoc b/doc/de/weechat_scripting.de.adoc index 815bb5e98..84dc3c572 100644 --- a/doc/de/weechat_scripting.de.adoc +++ b/doc/de/weechat_scripting.de.adoc @@ -168,6 +168,17 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt "value", "value", 0, ["check_cb", "", "change_cb", "", "delete_cb", ""]) ---- +// TRANSLATION MISSING +And the function `+Weechat.bar_new+` receives the colors in an array of 4 strings +(color_fg, color_delim, color_bg, color_bg_inactive), so a call to this function +looks like: + +[source,ruby] +---- +Weechat.bar_new("name", "off", "0", "window", "", "left", "vertical", "vertical", "0", "0", + ["default", "default", "default", "default"], "0", "items") +---- + ==== Lua ===== Funktionen diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index b6bbddb37..d60de708f 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -14615,6 +14615,8 @@ bar = weechat.bar_search("mybar") ==== bar_new +_Updated in 2.9._ + Create a new bar. Prototype: @@ -14634,6 +14636,7 @@ struct t_gui_bar *weechat_bar_new (const char *name, const char *color_fg, const char *color_delim, const char *color_bg, + const char *color_bg_inactive, const char *separator, const char *items); ---- @@ -14670,6 +14673,8 @@ Arguments: * _color_fg_: color for text in bar * _color_delim_: color for delimiters in bar * _color_bg_: background color for bar +* _color_bg_inactive_: background color for window bar which is not displayed + in active window * _separator_: ** _on_: bar has separator line with other windows/bars ** _off_: no separator @@ -14697,6 +14702,7 @@ struct t_gui_bar *my_bar = weechat_bar_new ("mybar", "default", "cyan", "blue", + "darkgray", "off", "time,buffer_number+buffer_name"); ---- @@ -14708,13 +14714,19 @@ Script (Python): # prototype bar = weechat.bar_new(name, hidden, priority, type, condition, position, filling_top_bottom, filling_left_right, size, size_max, - color_fg, color_delim, color_bg, separator, items) + color_fg, color_delim, color_bg, color_bg_inactive, separator, items) # example bar = weechat.bar_new("mybar", "off", "100", "window", "", "top", "horizontal", "vertical", - "0", "5", "default", "cyan", "blue", "off", "time,buffer_number+buffer_name") + "0", "5", "default", "cyan", "blue", "darkgray", "off", "time,buffer_number+buffer_name") ---- +[NOTE] +With WeeChat ≥ 2.9, in Ruby, the 4 colors (color_fg, color_delim, color_bg, +color_bg_inactive) must be given in an array of 4 strings (due to a Ruby +limitation of 15 arguments by function), see the +link:++weechat_scripting.en.html#_ruby++[WeeChat scripting guide] for more info. + ==== bar_set Set a new value for a bar property. diff --git a/doc/en/weechat_scripting.en.adoc b/doc/en/weechat_scripting.en.adoc index 2c9bbd330..1c57349f2 100644 --- a/doc/en/weechat_scripting.en.adoc +++ b/doc/en/weechat_scripting.en.adoc @@ -158,6 +158,16 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt "value", "value", 0, ["check_cb", "", "change_cb", "", "delete_cb", ""]) ---- +And the function `+Weechat.bar_new+` receives the colors in an array of 4 strings +(color_fg, color_delim, color_bg, color_bg_inactive), so a call to this function +looks like: + +[source,ruby] +---- +Weechat.bar_new("name", "off", "0", "window", "", "left", "vertical", "vertical", "0", "0", + ["default", "default", "default", "default"], "0", "items") +---- + ==== Lua ===== Functions diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc index bf62a10ae..6f0b3251b 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -14922,6 +14922,8 @@ bar = weechat.bar_search("mybar") ==== bar_new +_Mis à jour dans la 2.9._ + Créer une nouvelle barre. Prototype : @@ -14941,6 +14943,7 @@ struct t_gui_bar *weechat_bar_new (const char *name, const char *color_fg, const char *color_delim, const char *color_bg, + const char *color_bg_inactive, const char *separator, const char *items); ---- @@ -14987,6 +14990,8 @@ Paramètres : * _color_fg_ : couleur du texte dans la barre * _color_delim_ : couleur pour les délimiteurs dans la barre * _color_bg_ : couleur de fond pour la barre +* _color_bg_inactive_ : couleur de fond pour une barre de type "window" qui + n'est pas affichée dans la fenêtre active * _separator_ : ** _on_ : la barre a un séparateur avec les autres fenêtres/barres ** _off_ : pas de séparateur @@ -15014,6 +15019,7 @@ struct t_gui_bar *my_bar = weechat_bar_new ("mybar", "default", "cyan", "blue", + "darkgray", "off", "time,buffer_number+buffer_name"); ---- @@ -15025,13 +15031,20 @@ Script (Python) : # prototype bar = weechat.bar_new(name, hidden, priority, type, condition, position, filling_top_bottom, filling_left_right, size, size_max, - color_fg, color_delim, color_bg, separator, items) + color_fg, color_delim, color_bg, color_bg_inactive, separator, items) # exemple bar = weechat.bar_new("mybar", "off", "100", "window", "", "top", "horizontal", "vertical", - "0", "5", "default", "cyan", "blue", "off", "time,buffer_number+buffer_name") + "0", "5", "default", "cyan", "blue", "darkgray", "off", "time,buffer_number+buffer_name") ---- +[NOTE] +Avec WeeChat ≥ 2.9, en Ruby, les 4 couleurs (color_fg, color_delim, color_bg, +color_bg_inactive) doivent être données dans un tableau de 4 chaînes de caractères +(en raison d'une limitation de Ruby à 15 paramètres par fonction), voir le +link:++weechat_scripting.fr.html#_ruby++[Guide pour scripts WeeChat] pour plus +d'infos. + ==== bar_set Affecter une nouvelle valeur pour une propriété de la barre. diff --git a/doc/fr/weechat_scripting.fr.adoc b/doc/fr/weechat_scripting.fr.adoc index d7bbb10b7..b42e29d14 100644 --- a/doc/fr/weechat_scripting.fr.adoc +++ b/doc/fr/weechat_scripting.fr.adoc @@ -168,6 +168,16 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt "value", "value", 0, ["check_cb", "", "change_cb", "", "delete_cb", ""]) ---- +Et la fonction `+Weechat.bar_new+` reçoit les couleurs dans un tableau de 4 +chaînes de caractères (color_fg, color_delim, color_bg, color_bg_inactive), +donc un appel à cette fonction ressemble à ceci : + +[source,ruby] +---- +Weechat.bar_new("name", "off", "0", "window", "", "left", "vertical", "vertical", "0", "0", + ["default", "default", "default", "default"], "0", "items") +---- + ==== Lua ===== Fonctions diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index 9ebed0c14..b34bf0116 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -15197,6 +15197,9 @@ bar = weechat.bar_search("mybar") ==== bar_new +// TRANSLATION MISSING +_Updated in 2.9._ + Crea una nuova barra. Prototipo: @@ -15216,6 +15219,7 @@ struct t_gui_bar *weechat_bar_new (const char *name, const char *color_fg, const char *color_delim, const char *color_bg, + const char *color_bg_inactive, const char *separator, const char *items); ---- @@ -15263,6 +15267,9 @@ Argomenti: * _color_fg_: colore per il testo nella barra * _color_delim_: colore per i delimitatori nella barra * _color_bg_: colore di sfondo per la barra +// TRANSLATION MISSING +* _color_bg_inactive_: background color for window bar which is not displayed + in active window * _separator_: ** _on_: la barra ha una riga di separazione con altre finestre/barre ** _off_: nessun separatore @@ -15290,6 +15297,7 @@ struct t_gui_bar *my_bar = weechat_bar_new ("mybar", "default", "cyan", "blue", + "darkgray", "off", "time,buffer_number+buffer_name"); ---- @@ -15301,13 +15309,20 @@ Script (Python): # prototipo bar = weechat.bar_new(name, hidden, priority, type, condition, position, filling_top_bottom, filling_left_right, size, size_max, - color_fg, color_delim, color_bg, separator, items) + color_fg, color_delim, color_bg, color_bg_inactive, separator, items) # esempio bar = weechat.bar_new("mybar", "off", "100", "window", "", "top", "horizontal", "vertical", - "0", "5", "default", "cyan", "blue", "off", "time,buffer_number+buffer_name") + "0", "5", "default", "cyan", "blue", "darkgray", "off", "time,buffer_number+buffer_name") ---- +// TRANSLATION MISSING +[NOTE] +With WeeChat ≥ 2.9, in Ruby, the 4 colors (color_fg, color_delim, color_bg, +color_bg_inactive) must be given in an array of 4 strings (due to a Ruby +limitation of 15 arguments by function), see the +link:++weechat_scripting.en.html#_ruby++[WeeChat scripting guide] for more info. + ==== bar_set Imposta un nuovo valore per la proprietà di una barra. diff --git a/doc/it/weechat_scripting.it.adoc b/doc/it/weechat_scripting.it.adoc index b9e64a56f..21d8f5795 100644 --- a/doc/it/weechat_scripting.it.adoc +++ b/doc/it/weechat_scripting.it.adoc @@ -173,6 +173,17 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt "value", "value", 0, ["check_cb", "", "change_cb", "", "delete_cb", ""]) ---- +// TRANSLATION MISSING +And the function `+Weechat.bar_new+` receives the colors in an array of 4 strings +(color_fg, color_delim, color_bg, color_bg_inactive), so a call to this function +looks like: + +[source,ruby] +---- +Weechat.bar_new("name", "off", "0", "window", "", "left", "vertical", "vertical", "0", "0", + ["default", "default", "default", "default"], "0", "items") +---- + ==== Lua // TRANSLATION MISSING diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index cba0bc1cc..661303008 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -14612,6 +14612,8 @@ bar = weechat.bar_search("mybar") ==== bar_new +_WeeChat バージョン 2.9 で更新。_ + 新しいバーを作成。 プロトタイプ: @@ -14631,6 +14633,7 @@ struct t_gui_bar *weechat_bar_new (const char *name, const char *color_fg, const char *color_delim, const char *color_bg, + const char *color_bg_inactive, const char *separator, const char *items); ---- @@ -14665,6 +14668,9 @@ struct t_gui_bar *weechat_bar_new (const char *name, * _size_: バーのサイズ、文字単位 (0 は自動サイズ) * _size_max_: バーの最大サイズ (0 は最大サイズが指定されていない) * _color_fg_: バーのテキスト色 +// TRANSLATION MISSING +* _color_bg_inactive_: background color for window bar which is not displayed + in active window * _color_delim_: バーの区切り文字の色 * _color_bg_: バーの背景色 * _separator_: @@ -14694,6 +14700,7 @@ struct t_gui_bar *my_bar = weechat_bar_new ("mybar", "default", "cyan", "blue", + "darkgray", "off", "time,buffer_number+buffer_name"); ---- @@ -14705,13 +14712,20 @@ struct t_gui_bar *my_bar = weechat_bar_new ("mybar", # プロトタイプ bar = weechat.bar_new(name, hidden, priority, type, condition, position, filling_top_bottom, filling_left_right, size, size_max, - color_fg, color_delim, color_bg, separator, items) + color_fg, color_delim, color_bg, color_bg_inactive, separator, items) # 例 bar = weechat.bar_new("mybar", "off", "100", "window", "", "top", "horizontal", "vertical", - "0", "5", "default", "cyan", "blue", "off", "time,buffer_number+buffer_name") + "0", "5", "default", "cyan", "blue", "darkgray", "off", "time,buffer_number+buffer_name") ---- +// TRANSLATION MISSING +[NOTE] +With WeeChat ≥ 2.9, in Ruby, the 4 colors (color_fg, color_delim, color_bg, +color_bg_inactive) must be given in an array of 4 strings (due to a Ruby +limitation of 15 arguments by function), see the +link:++weechat_scripting.en.html#_ruby++[WeeChat scripting guide] for more info. + ==== bar_set バープロパティに新しい値を設定。 diff --git a/doc/ja/weechat_scripting.ja.adoc b/doc/ja/weechat_scripting.ja.adoc index 9e54c8e17..2527d2068 100644 --- a/doc/ja/weechat_scripting.ja.adoc +++ b/doc/ja/weechat_scripting.ja.adoc @@ -170,6 +170,17 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt "value", "value", 0, ["check_cb", "", "change_cb", "", "delete_cb", ""]) ---- +// TRANSLATION MISSING +And the function `+Weechat.bar_new+` receives the colors in an array of 4 strings +(color_fg, color_delim, color_bg, color_bg_inactive), so a call to this function +looks like: + +[source,ruby] +---- +Weechat.bar_new("name", "off", "0", "window", "", "left", "vertical", "vertical", "0", "0", + ["default", "default", "default", "default"], "0", "items") +---- + ==== Lua // TRANSLATION MISSING diff --git a/doc/pl/weechat_scripting.pl.adoc b/doc/pl/weechat_scripting.pl.adoc index 6dd45a854..abc2f2eb4 100644 --- a/doc/pl/weechat_scripting.pl.adoc +++ b/doc/pl/weechat_scripting.pl.adoc @@ -163,6 +163,17 @@ Weechat.config_new_option(config, section, "name", "string", "opis opcji", "", 0 "value", "wartość", 0, ["check_cb", "", "change_cb", "", "delete_cb", ""]) ---- +// TRANSLATION MISSING +And the function `+Weechat.bar_new+` receives the colors in an array of 4 strings +(color_fg, color_delim, color_bg, color_bg_inactive), so a call to this function +looks like: + +[source,ruby] +---- +Weechat.bar_new("name", "off", "0", "window", "", "left", "vertical", "vertical", "0", "0", + ["default", "default", "default", "default"], "0", "items") +---- + ==== Lua ===== Funkcje diff --git a/po/cs.po b/po/cs.po index f1d50b4ca..26bb5958e 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2020-04-28 16:40+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -333,8 +333,8 @@ msgstr "šířka" msgid "auto" msgstr "auto" -#, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +#, fuzzy, c-format +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr " priorita: %d, popředí: %s, pozadí: %s, položky: %s%s" msgid ", with separator" @@ -4659,6 +4659,11 @@ msgstr "výchozí barva děličů pro pole" msgid "default background color for bar" msgstr "výchozí barva pozadí pro pole" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + msgid "separator line between bar and other bars/windows" msgstr "oddělovací řádek mezi polem a ostatními poli/okny" diff --git a/po/de.po b/po/de.po index 6c8871444..f759df6ec 100644 --- a/po/de.po +++ b/po/de.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2020-06-16 18:32+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -371,8 +371,8 @@ msgstr "Breite" msgid "auto" msgstr "auto" -#, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +#, fuzzy, c-format +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr " Priorität: %d, fg: %s, bg: %s, Objekte: %s%s" msgid ", with separator" @@ -5623,6 +5623,11 @@ msgstr "Standardfarbe der Trennzeichen in der Infobar" msgid "default background color for bar" msgstr "Standardhintergrundfarbe der Infobar" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + msgid "separator line between bar and other bars/windows" msgstr "Trennzeichen zwischen verschieden Infobars und Fenstern" diff --git a/po/es.po b/po/es.po index a044ea2ad..eacfc3eaf 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2020-04-28 16:40+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -326,8 +326,8 @@ msgstr "ancho" msgid "auto" msgstr "auto" -#, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +#, fuzzy, c-format +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr " prioridad: %d, color: %s, fondo: %s, elementos: %s%s" msgid ", with separator" @@ -4853,6 +4853,11 @@ msgstr "color por defecto para los delimitadores de la barra" msgid "default background color for bar" msgstr "color de fondo por defecto para la barra" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + msgid "separator line between bar and other bars/windows" msgstr "línea separadora entre la barra y otras barras/ventanas" diff --git a/po/fr.po b/po/fr.po index c54f3f2f8..835fedcfb 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" -"PO-Revision-Date: 2020-06-20 17:05+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" +"PO-Revision-Date: 2020-06-21 18:57+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -358,8 +358,8 @@ msgid "auto" msgstr "auto" #, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" -msgstr " priorité : %d, fg : %s, bg : %s, objets : %s%s" +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" +msgstr " priorité : %d, fg : %s, bg : %s, bg_inactive : %s, objets : %s%s" msgid ", with separator" msgstr ", avec séparateur" @@ -5491,6 +5491,13 @@ msgstr "couleur du délimiteur par défaut pour la barre" msgid "default background color for bar" msgstr "couleur du fond par défaut pour la barre" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" +"couleur de fond pour une barre de type \"window\" qui n'est pas affichée " +"dans la fenêtre active" + msgid "separator line between bar and other bars/windows" msgstr "ligne de séparation entre la barre et les autres barres/fenêtres" diff --git a/po/hu.po b/po/hu.po index 06c81797f..de1b0b216 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2020-04-28 16:40+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -319,7 +319,7 @@ msgid "auto" msgstr "" #, fuzzy, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr "%s %s%s%s/%s%s%s:%s %s%s%s mellőzése a következő(k)től: %s%s\n" #, fuzzy @@ -4214,6 +4214,11 @@ msgstr "információs pult szövegének színe" msgid "default background color for bar" msgstr "információs pult szövegének színe" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + #, fuzzy msgid "separator line between bar and other bars/windows" msgstr "a névlista és a beszélgetőablak közti elválasztó" diff --git a/po/it.po b/po/it.po index f2ae6c7ab..6c4fe3efb 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2020-04-28 16:40+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -318,8 +318,8 @@ msgstr "larghezza" msgid "auto" msgstr "auto" -#, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +#, fuzzy, c-format +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr " priorità: %d, primo piano: %s, sfondo: %s, elementi :%s%s" msgid ", with separator" @@ -4987,6 +4987,11 @@ msgstr "colore predefinito del delimitatore per la barra" msgid "default background color for bar" msgstr "colore predefinito di sfondo per la barra" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + msgid "separator line between bar and other bars/windows" msgstr "riga di separazione tra la barra e le altre barre/finestre" diff --git a/po/ja.po b/po/ja.po index ff2355e08..3f601b500 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2020-04-28 16:40+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: Polish \n" @@ -351,8 +351,8 @@ msgstr "szerokość" msgid "auto" msgstr "automatycznie" -#, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +#, fuzzy, c-format +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr " priorytet: %d, fg: %s, tło: %s, elementy: %s%s" msgid ", with separator" @@ -5344,6 +5344,11 @@ msgstr "domyślny kolor separatorów na pasku" msgid "default background color for bar" msgstr "domyślny kolor tła paska" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + msgid "separator line between bar and other bars/windows" msgstr "separator pomiędzy paskiem a innymi paskami/oknami" diff --git a/po/pt.po b/po/pt.po index b94c8aadf..abad9b91a 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2020-04-28 16:40+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -336,8 +336,8 @@ msgstr "largura" msgid "auto" msgstr "auto" -#, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +#, fuzzy, c-format +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr " prioridade: %d, fg: %s, bg: %s, itens: %s%s" msgid ", with separator" @@ -5267,6 +5267,11 @@ msgstr "cor predefinida do delimitador da barra" msgid "default background color for bar" msgstr "cor de fundo predefinida da barra" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + msgid "separator line between bar and other bars/windows" msgstr "linha que separa a barra de outras barras/janelas" diff --git a/po/pt_BR.po b/po/pt_BR.po index 10a2d4a55..dd46300fa 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2020-04-18 11:34+0200\n" "Last-Translator: Eduardo Elias \n" "Language-Team: weechat-dev \n" @@ -350,8 +350,8 @@ msgstr "largura" msgid "auto" msgstr "automático" -#, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +#, fuzzy, c-format +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr " prioridade: %d, fg: %s, bg: %s, itens: %s%s" msgid ", with separator" @@ -4837,6 +4837,11 @@ msgstr "cor padrão do delimitador para a barra" msgid "default background color for bar" msgstr "cor padrão do fundo para a barra" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + msgid "separator line between bar and other bars/windows" msgstr "linha separadora entre a barra e outras barras/janelas" diff --git a/po/ru.po b/po/ru.po index efd6d1989..75d9233d1 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2020-04-28 16:40+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -328,7 +328,7 @@ msgid "auto" msgstr "авто" #, fuzzy, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr "%sна %s%s%s/%s%s%s:%s игнорирует %s%s%s с %s%s\n" #, fuzzy @@ -4249,6 +4249,11 @@ msgstr "цвет текста информационной панели" msgid "default background color for bar" msgstr "цвет текста информационной панели" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + #, fuzzy msgid "separator line between bar and other bars/windows" msgstr "разделитель чата и никлиста" diff --git a/po/tr.po b/po/tr.po index 6dccd8e84..abca47370 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2019-11-03 08:38+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -286,7 +286,7 @@ msgid "auto" msgstr "" #, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr "" msgid ", with separator" @@ -3841,6 +3841,11 @@ msgstr "" msgid "default background color for bar" msgstr "çubuk için varsayılan arkaplan rengi" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + msgid "separator line between bar and other bars/windows" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index bdd3cbba6..d6724e8f2 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-06-20 17:04+0200\n" +"POT-Creation-Date: 2020-06-21 18:56+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -284,7 +284,7 @@ msgid "auto" msgstr "" #, c-format -msgid " priority: %d, fg: %s, bg: %s, items: %s%s" +msgid " priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s" msgstr "" msgid ", with separator" @@ -3830,6 +3830,11 @@ msgstr "" msgid "default background color for bar" msgstr "" +msgid "" +"background color for a bar with type \"window\" which is not displayed in " +"the active window" +msgstr "" + msgid "separator line between bar and other bars/windows" msgstr "" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index acde2d3cc..0c0314c3f 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -137,10 +137,11 @@ command_bar_list (int full) _("height") : _("width"), (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]) == 0) ? _("auto") : str_size); gui_chat_printf (NULL, - _(" priority: %d, fg: %s, bg: %s, items: %s%s"), + _(" priority: %d, fg: %s, bg: %s, bg_inactive: %s, items: %s%s"), CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_PRIORITY]), gui_color_get_name (CONFIG_COLOR(ptr_bar->options[GUI_BAR_OPTION_COLOR_FG])), gui_color_get_name (CONFIG_COLOR(ptr_bar->options[GUI_BAR_OPTION_COLOR_BG])), + gui_color_get_name (CONFIG_COLOR(ptr_bar->options[GUI_BAR_OPTION_COLOR_BG_INACTIVE])), (CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_ITEMS]) && CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_ITEMS])[0]) ? CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_ITEMS]) : "-", @@ -275,12 +276,23 @@ COMMAND_CALLBACK(bar) if (error && !error[0]) { /* create bar */ - if (gui_bar_new (argv[2], "0", "0", str_type, - (pos_condition) ? pos_condition : "", - argv[4], - "horizontal", "vertical", - argv[5], "0", "default", "default", "default", - argv[6], argv_eol[7])) + if (gui_bar_new ( + argv[2], /* nane */ + "0", /* hidden */ + "0", /* priority */ + str_type, /* type */ + (pos_condition) ? pos_condition : "", /* conditions */ + argv[4], /* position */ + "horizontal", /* filling_top_bottom */ + "vertical", /* filling_left_right */ + argv[5], /* size */ + "0", /* size_max */ + "default", /* color fg */ + "default", /* color delim */ + "default", /* color bg */ + "default", /* color bg inactive */ + argv[6], /* separators */ + argv_eol[7])) /* items */ { gui_chat_printf (NULL, _("Bar \"%s\" created"), argv[2]); diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c index 2204a8755..7d8eb69a1 100644 --- a/src/gui/curses/gui-curses-bar-window.c +++ b/src/gui/curses/gui-curses-bar-window.c @@ -164,6 +164,7 @@ gui_bar_window_create_win (struct t_gui_bar_window *bar_window) int gui_bar_window_print_string (struct t_gui_bar_window *bar_window, + struct t_gui_window *window, enum t_gui_bar_filling filling, int *x, int *y, const char *string, @@ -171,7 +172,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window, int hide_chars_if_scrolling, int *index_item, int *index_subitem, int *index_line) { - int x_with_hidden, size_on_screen, low_char, hidden; + int x_with_hidden, size_on_screen, low_char, hidden, color_bg; char utf_char[16], *next_char, *output; if (!bar_window || !string || !string[0]) @@ -179,11 +180,15 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window, wmove (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, *y, *x); + color_bg = ((CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) + && (window != gui_current_window)) ? + GUI_BAR_OPTION_COLOR_BG_INACTIVE : GUI_BAR_OPTION_COLOR_BG; + if (reset_color_before_display) { gui_window_set_custom_color_fg_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]), - CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]), + CONFIG_COLOR(bar_window->bar->options[color_bg]), 1); } @@ -242,7 +247,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window, /* bar background */ string += 2; gui_window_set_custom_color_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, - CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG])); + CONFIG_COLOR(bar_window->bar->options[color_bg])); break; case GUI_COLOR_BAR_START_INPUT_CHAR: string += 2; @@ -304,7 +309,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window, string++; gui_window_set_custom_color_fg_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]), - CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]), + CONFIG_COLOR(bar_window->bar->options[color_bg]), 0); break; default: @@ -329,7 +334,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window, A_ALL_ATTR); gui_window_set_custom_color_fg_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]), - CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]), + CONFIG_COLOR(bar_window->bar->options[color_bg]), 1); break; default: @@ -409,7 +414,7 @@ void gui_bar_window_draw (struct t_gui_bar_window *bar_window, struct t_gui_window *window) { - int x, y, items_count, num_lines, line; + int x, y, items_count, num_lines, line, color_bg; enum t_gui_bar_filling filling; char *content, **items; static char str_start_input[16] = { '\0' }; @@ -434,6 +439,10 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, if (!bar_window || (bar_window->x < 0) || (bar_window->y < 0)) return; + color_bg = ((CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) + && (window != gui_current_window)) ? + GUI_BAR_OPTION_COLOR_BG_INACTIVE : GUI_BAR_OPTION_COLOR_BG; + if (!str_start_input[0]) { snprintf (str_start_input, sizeof (str_start_input), "%c%c%c", @@ -497,7 +506,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, gui_bar_window_set_current_size (bar_window, window, 1); gui_window_clear (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]), - CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG])); + CONFIG_COLOR(bar_window->bar->options[color_bg])); } else { @@ -552,7 +561,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, gui_window_clear (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]), - CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG])); + CONFIG_COLOR(bar_window->bar->options[color_bg])); x = 0; y = 0; some_data_not_displayed = 0; @@ -645,7 +654,9 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, if ((bar_window->scroll_y == 0) || (line >= bar_window->scroll_y)) { - if (!gui_bar_window_print_string (bar_window, filling, + if (!gui_bar_window_print_string (bar_window, + window, + filling, &x, &y, items[line], 1, 1, &index_item, @@ -661,7 +672,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, { gui_window_set_custom_color_fg_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]), - CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]), + CONFIG_COLOR(bar_window->bar->options[color_bg]), 1); gui_window_remove_color_style (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, A_ALL_ATTR); @@ -674,7 +685,9 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, } while (x < bar_window->width) { - gui_bar_window_print_string (bar_window, filling, + gui_bar_window_print_string (bar_window, + window, + filling, &x, &y, " ", 0, 0, &index_item, &index_subitem, @@ -706,7 +719,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, { gui_window_set_custom_color_fg_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(config_color_bar_more), - CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]), + CONFIG_COLOR(bar_window->bar->options[color_bg]), 1); mvwaddstr (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, y, x, ptr_string); @@ -726,7 +739,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, { gui_window_set_custom_color_fg_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(config_color_bar_more), - CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]), + CONFIG_COLOR(bar_window->bar->options[color_bg]), 1); mvwaddstr (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, y, x, ptr_string); @@ -743,7 +756,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, gui_bar_window_set_current_size (bar_window, window, 1); gui_window_clear (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]), - CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG])); + CONFIG_COLOR(bar_window->bar->options[color_bg])); } /* diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 7367de28a..f683ecc16 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -50,11 +50,11 @@ char *gui_bar_option_string[GUI_BAR_NUM_OPTIONS] = { "hidden", "priority", "type", "conditions", "position", "filling_top_bottom", "filling_left_right", "size", "size_max", "color_fg", "color_delim", - "color_bg", "separator", "items" }; + "color_bg", "color_bg_inactive", "separator", "items" }; char *gui_bar_option_default[GUI_BAR_NUM_OPTIONS] = { "0", "0", "0", "", "top", "horizontal", "vertical", "0", "0", "default", "default", - "default", "off", "" }; + "default", "default", "off", "" }; char *gui_bar_type_string[GUI_BAR_NUM_TYPES] = { "root", "window" }; char *gui_bar_position_string[GUI_BAR_NUM_POSITIONS] = @@ -1187,6 +1187,8 @@ gui_bar_set_name (struct t_gui_bar *bar, const char *name) config_file_option_rename (bar->options[GUI_BAR_OPTION_COLOR_DELIM], option_name); snprintf (option_name, length, "%s.color_bg", name); config_file_option_rename (bar->options[GUI_BAR_OPTION_COLOR_BG], option_name); + snprintf (option_name, length, "%s.color_bg_inactive", name); + config_file_option_rename (bar->options[GUI_BAR_OPTION_COLOR_BG_INACTIVE], option_name); snprintf (option_name, length, "%s.separator", name); config_file_option_rename (bar->options[GUI_BAR_OPTION_SEPARATOR], option_name); snprintf (option_name, length, "%s.items", name); @@ -1277,6 +1279,12 @@ gui_bar_set (struct t_gui_bar *bar, const char *property, const char *value) gui_bar_refresh (bar); return 1; } + else if (string_strcasecmp (property, "color_bg_inactive") == 0) + { + config_file_option_set (bar->options[GUI_BAR_OPTION_COLOR_BG_INACTIVE], value, 1); + gui_bar_refresh (bar); + return 1; + } else if (string_strcasecmp (property, "separator") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_SEPARATOR], @@ -1476,6 +1484,17 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value &gui_bar_config_change_color, NULL, NULL, NULL, NULL, NULL); break; + case GUI_BAR_OPTION_COLOR_BG_INACTIVE: + ptr_option = config_file_new_option ( + weechat_config_file, weechat_config_section_bar, + option_name, "color", + N_("background color for a bar with type \"window\" which is " + "not displayed in the active window"), + NULL, 0, 0, value, NULL, 0, + NULL, NULL, NULL, + &gui_bar_config_change_color, NULL, NULL, + NULL, NULL, NULL); + break; case GUI_BAR_OPTION_SEPARATOR: ptr_option = config_file_new_option ( weechat_config_file, weechat_config_section_bar, @@ -1583,6 +1602,7 @@ gui_bar_new_with_options (const char *name, struct t_config_option *color_fg, struct t_config_option *color_delim, struct t_config_option *color_bg, + struct t_config_option *color_bg_inactive, struct t_config_option *separator, struct t_config_option *items) { @@ -1606,6 +1626,7 @@ gui_bar_new_with_options (const char *name, new_bar->options[GUI_BAR_OPTION_COLOR_FG] = color_fg; new_bar->options[GUI_BAR_OPTION_COLOR_DELIM] = color_delim; new_bar->options[GUI_BAR_OPTION_COLOR_BG] = color_bg; + new_bar->options[GUI_BAR_OPTION_COLOR_BG_INACTIVE] = color_bg_inactive; new_bar->options[GUI_BAR_OPTION_SEPARATOR] = separator; new_bar->options[GUI_BAR_OPTION_ITEMS] = items; new_bar->items_count = 0; @@ -1654,15 +1675,16 @@ gui_bar_new (const char *name, const char *hidden, const char *priority, const char *filling_top_bottom, const char *filling_left_right, const char *size, const char *size_max, const char *color_fg, const char *color_delim, - const char *color_bg, const char *separators, const char *items) + const char *color_bg, const char *color_bg_inactive, + const char *separators, const char *items) { struct t_config_option *option_hidden, *option_priority, *option_type; struct t_config_option *option_conditions, *option_position; struct t_config_option *option_filling_top_bottom, *option_filling_left_right; struct t_config_option *option_size, *option_size_max; struct t_config_option *option_color_fg, *option_color_delim; - struct t_config_option *option_color_bg, *option_separator; - struct t_config_option *option_items; + struct t_config_option *option_color_bg, *option_color_bg_inactive; + struct t_config_option *option_separator, *option_items; struct t_gui_bar *new_bar; if (!name || !name[0]) @@ -1704,20 +1726,24 @@ gui_bar_new (const char *name, const char *hidden, const char *priority, color_delim); option_color_bg = gui_bar_create_option (name, GUI_BAR_OPTION_COLOR_BG, color_bg); + option_color_bg_inactive = gui_bar_create_option (name, GUI_BAR_OPTION_COLOR_BG_INACTIVE, + color_bg_inactive); option_separator = gui_bar_create_option (name, GUI_BAR_OPTION_SEPARATOR, (config_file_string_to_boolean (separators)) ? "on" : "off"); option_items = gui_bar_create_option (name, GUI_BAR_OPTION_ITEMS, items); - new_bar = gui_bar_new_with_options (name, option_hidden, - option_priority, option_type, - option_conditions, option_position, - option_filling_top_bottom, - option_filling_left_right, - option_size, option_size_max, - option_color_fg, option_color_delim, - option_color_bg, option_separator, - option_items); + new_bar = gui_bar_new_with_options ( + name, option_hidden, + option_priority, option_type, + option_conditions, option_position, + option_filling_top_bottom, + option_filling_left_right, + option_size, option_size_max, + option_color_fg, option_color_delim, + option_color_bg, option_color_bg_inactive, + option_separator, + option_items); if (!new_bar) { if (option_hidden) @@ -1794,6 +1820,7 @@ gui_bar_use_temp_bars () ptr_temp_bar->options[GUI_BAR_OPTION_COLOR_FG], ptr_temp_bar->options[GUI_BAR_OPTION_COLOR_DELIM], ptr_temp_bar->options[GUI_BAR_OPTION_COLOR_BG], + ptr_temp_bar->options[GUI_BAR_OPTION_COLOR_BG_INACTIVE], ptr_temp_bar->options[GUI_BAR_OPTION_SEPARATOR], ptr_temp_bar->options[GUI_BAR_OPTION_ITEMS]); } @@ -1878,6 +1905,7 @@ gui_bar_create_default_input () "default", /* color fg */ "cyan", /* color delim */ "default", /* color bg */ + "default", /* color bg inactive */ "0", /* separators */ gui_bar_default_items (GUI_BAR_DEFAULT_NAME_INPUT))) /* items */ { @@ -1915,6 +1943,7 @@ gui_bar_create_default_title () "default", /* color fg */ "cyan", /* color delim */ "blue", /* color bg */ + "darkgray", /* color bg inactive */ "0", /* separators */ gui_bar_default_items (GUI_BAR_DEFAULT_NAME_TITLE))) /* items */ { @@ -1951,6 +1980,7 @@ gui_bar_create_default_status () "default", /* color fg */ "cyan", /* color delim */ "blue", /* color bg */ + "darkgray", /* color bg inactive */ "0", /* separators */ gui_bar_default_items (GUI_BAR_DEFAULT_NAME_STATUS))) /* items */ { @@ -1987,6 +2017,7 @@ gui_bar_create_default_nicklist () "default", /* color fg */ "cyan", /* color delim */ "default", /* color bg */ + "default", /* color bg inactive */ "1", /* separators */ gui_bar_default_items (GUI_BAR_DEFAULT_NAME_NICKLIST))) /* items */ { @@ -2321,6 +2352,8 @@ gui_bar_add_to_infolist (struct t_infolist *infolist, return 0; if (!infolist_new_var_string (ptr_item, "color_bg", gui_color_get_name (CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_BG])))) return 0; + if (!infolist_new_var_string (ptr_item, "color_bg_inactive", gui_color_get_name (CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_BG_INACTIVE])))) + return 0; if (!infolist_new_var_integer (ptr_item, "separator", CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_SEPARATOR]))) return 0; if (!infolist_new_var_string (ptr_item, "items", CONFIG_STRING(bar->options[GUI_BAR_OPTION_ITEMS]))) @@ -2400,6 +2433,9 @@ gui_bar_print_log () log_printf (" color_bg . . . . . . . : %d (%s)", CONFIG_COLOR(ptr_bar->options[GUI_BAR_OPTION_COLOR_BG]), gui_color_get_name (CONFIG_COLOR(ptr_bar->options[GUI_BAR_OPTION_COLOR_BG]))); + log_printf (" color_bg_inactive. . . : %d (%s)", + CONFIG_COLOR(ptr_bar->options[GUI_BAR_OPTION_COLOR_BG_INACTIVE]), + gui_color_get_name (CONFIG_COLOR(ptr_bar->options[GUI_BAR_OPTION_COLOR_BG_INACTIVE]))); log_printf (" separator. . . . . . . : %d", CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SEPARATOR])); log_printf (" items. . . . . . . . . : '%s'", CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_ITEMS])); log_printf (" items_count. . . . . . : %d", ptr_bar->items_count); diff --git a/src/gui/gui-bar.h b/src/gui/gui-bar.h index 8d8447efc..5f42ca2d4 100644 --- a/src/gui/gui-bar.h +++ b/src/gui/gui-bar.h @@ -43,6 +43,8 @@ enum t_gui_bar_option GUI_BAR_OPTION_COLOR_FG, /* default text color for bar */ GUI_BAR_OPTION_COLOR_DELIM, /* default delimiter color for bar */ GUI_BAR_OPTION_COLOR_BG, /* default background color for bar */ + GUI_BAR_OPTION_COLOR_BG_INACTIVE, /* bg color for inactive window */ + /* (window bars only) */ GUI_BAR_OPTION_SEPARATOR, /* true if separator line displayed */ GUI_BAR_OPTION_ITEMS, /* bar items */ /* number of bar options */ @@ -140,6 +142,7 @@ extern struct t_gui_bar *gui_bar_new (const char *name, const char *color_fg, const char *color_delim, const char *color_bg, + const char *color_bg_inactive, const char *separator, const char *items); extern void gui_bar_use_temp_bars (); diff --git a/src/plugins/buflist/buflist.c b/src/plugins/buflist/buflist.c index 81f1d73a8..93c910250 100644 --- a/src/plugins/buflist/buflist.c +++ b/src/plugins/buflist/buflist.c @@ -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); } diff --git a/src/plugins/fset/fset.c b/src/plugins/fset/fset.c index e1d0a9ed8..478fdcb4b 100644 --- a/src/plugins/fset/fset.c +++ b/src/plugins/fset/fset.c @@ -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); } diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index ebe32dbab..8355c441c 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -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); } diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp index 19e33c431..67b3ef68f 100644 --- a/src/plugins/javascript/weechat-js-api.cpp +++ b/src/plugins/javascript/weechat-js-api.cpp @@ -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)); diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index 68ff70175..057c0c491 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -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)); diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index 62ad7961d..d9fc273af 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -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)); diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c index f974732b2..6b05825c4 100644 --- a/src/plugins/php/weechat-php-api.c +++ b/src/plugins/php/weechat-php-api.c @@ -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)); diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index d772b97c4..690c33d1f 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -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)); diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 8813693f3..20c003f1b 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -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); diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index 6589a65d0..528e501dc 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -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)); diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 27bcb3456..44c74ea2d 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -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) -- cgit v1.2.3