From c8dffad56c29ca090c5e83d02da66b77c510ac16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 16 Aug 2024 12:36:31 +0200 Subject: [PATCH] core: add signals "layout_buffers_applied" and "layout_windows_applied" (closes #2167) --- CHANGELOG.md | 1 + doc/en/weechat_plugin_api.en.adoc | 8 ++++++++ doc/fr/weechat_plugin_api.fr.adoc | 8 ++++++++ doc/it/weechat_plugin_api.it.adoc | 10 ++++++++++ doc/ja/weechat_plugin_api.ja.adoc | 10 ++++++++++ doc/sr/weechat_plugin_api.sr.adoc | 10 ++++++++++ src/gui/gui-layout.c | 7 +++++++ 7 files changed, 54 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4432b7e26..aa96b9035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ - core: add hdata count in evaluation of expressions with `hdata_count:name[list]` or `hdata_count:name[pointer]` - core: add info "window" ([#2141](https://github.com/weechat/weechat/issues/2141)) - core: add completion "bars_items" +- core: add signals "layout_buffers_applied" and "layout_windows_applied" ([#2167](https://github.com/weechat/weechat/issues/2167)) - core: add signal "buffer_time_for_each_line_changed" - api, relay: send new signal "buffer_line_data_changed" when a line is updated in a buffer via hdata, send event "buffer_line_data_changed" to clients of "api" and "weechat" protocols - api: add hashtable type "longlong" diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 8b252c7c5..0b825cd79 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -12286,6 +12286,14 @@ List of signals sent by WeeChat and plugins: | String: key combo. | Key combo in _cursor_ context. +| weechat | [[hook_signal_layout_buffers_applied]] layout_buffers_applied | 4.4.0 +| String: layout name. +| Layout applied for buffers. + +| weechat | [[hook_signal_layout_windows_applied]] layout_windows_applied | 4.4.0 +| String: layout name. +| Layout applied for windows. + | weechat | [[hook_signal_mouse_enabled]] mouse_enabled | 1.1 | - | Mouse enabled. diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc index 3d42fd704..cac633de7 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -12539,6 +12539,14 @@ Liste des signaux envoyés par WeeChat et les extensions : | Chaîne : combinaison de touches. | Combinaison de touches dans le contexte _cursor_. +| weechat | [[hook_signal_layout_buffers_applied]] layout_buffers_applied | 4.4.0 +| Chaîne : nom de la disposition. +| Disposition appliquée pour les tampons. + +| weechat | [[hook_signal_layout_windows_applied]] layout_windows_applied | 4.4.0 +| Chaîne : nom de la disposition. +| Disposition appliquée pour les fenêtres. + | weechat | [[hook_signal_mouse_enabled]] mouse_enabled | 1.1 | - | Souris activée. diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index f450c2e51..c6932bd04 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -12810,6 +12810,16 @@ List of signals sent by WeeChat and plugins: | String: key combo. | Key combo in _cursor_ context. +// TRANSLATION MISSING +| weechat | [[hook_signal_layout_buffers_applied]] layout_buffers_applied | 4.4.0 +| String: layout name. +| Layout applied for buffers. + +// TRANSLATION MISSING +| weechat | [[hook_signal_layout_windows_applied]] layout_windows_applied | 4.4.0 +| String: layout name. +| Layout applied for windows. + // TRANSLATION MISSING | weechat | [[hook_signal_mouse_enabled]] mouse_enabled | 1.1 | - diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index db22e3cec..50c7fe39a 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -12464,6 +12464,16 @@ WeeChat とプラグインが送信するシグナルのリスト: | String: キーの組み合わせ | _cursor_ コンテキスト内のキーの組み合わせ +// TRANSLATION MISSING +| weechat | [[hook_signal_layout_buffers_applied]] layout_buffers_applied | 4.4.0 +| String: layout name. +| Layout applied for buffers. + +// TRANSLATION MISSING +| weechat | [[hook_signal_layout_windows_applied]] layout_windows_applied | 4.4.0 +| String: layout name. +| Layout applied for windows. + | weechat | [[hook_signal_mouse_enabled]] mouse_enabled | 1.1 | - | マウスが有効化された diff --git a/doc/sr/weechat_plugin_api.sr.adoc b/doc/sr/weechat_plugin_api.sr.adoc index 4c096233f..6ea9d44eb 100644 --- a/doc/sr/weechat_plugin_api.sr.adoc +++ b/doc/sr/weechat_plugin_api.sr.adoc @@ -11967,6 +11967,16 @@ struct t_hook *weechat_hook_signal (const char *signal, | Стринг: комбинација тастера. | Комбинација тастера у _cursor_ контексту. +// TRANSLATION MISSING +| weechat | [[hook_signal_layout_buffers_applied]] layout_buffers_applied | 4.4.0 +| String: layout name. +| Layout applied for buffers. + +// TRANSLATION MISSING +| weechat | [[hook_signal_layout_windows_applied]] layout_windows_applied | 4.4.0 +| String: layout name. +| Layout applied for windows. + | weechat | [[hook_signal_mouse_enabled]] mouse_enabled | 1.1 | - | Укључен је миш. diff --git a/src/gui/gui-layout.c b/src/gui/gui-layout.c index 31774c0c5..85855b844 100644 --- a/src/gui/gui-layout.c +++ b/src/gui/gui-layout.c @@ -30,6 +30,7 @@ #include "../core/weechat.h" #include "../core/core-config.h" #include "../core/core-hdata.h" +#include "../core/core-hook.h" #include "../core/core-infolist.h" #include "../core/core-log.h" #include "../core/core-string.h" @@ -367,6 +368,9 @@ gui_layout_buffer_apply (struct t_gui_layout *layout) gui_buffer_set_active_buffer (ptr_buffer); } } + + (void) hook_signal_send ("layout_buffers_applied", + WEECHAT_HOOK_SIGNAL_STRING, layout->name); } /* @@ -754,6 +758,9 @@ gui_layout_window_apply (struct t_gui_layout *layout, gui_layout_window_assign_all_buffers (); gui_window_switch ((ptr_current_window) ? ptr_current_window : old_window); + + (void) hook_signal_send ("layout_windows_applied", + WEECHAT_HOOK_SIGNAL_STRING, layout->name); } /*