diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | doc/en/weechat_plugin_api.en.txt | 15 | ||||
-rw-r--r-- | doc/fr/weechat_plugin_api.fr.txt | 15 | ||||
-rw-r--r-- | doc/it/weechat_plugin_api.it.txt | 18 | ||||
-rw-r--r-- | doc/ja/weechat_plugin_api.ja.txt | 18 | ||||
-rw-r--r-- | src/gui/gui-key.c | 37 |
6 files changed, 101 insertions, 3 deletions
@@ -11,6 +11,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] == Version 0.4.4 (under dev!) +* core: add signals "key_combo_{default|search|cursor}" * core: display a warning in case of inconsistency between the options weechat.look.save_{config|layout}_on_exit * api: add integer return code for functions hook_{signal|hsignal}_send diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index a4663b962..c3f6ddedd 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -7854,6 +7854,21 @@ List of signals sent by WeeChat and plugins: String: key pressed | Key pressed +| weechat | key_combo_default + + _(WeeChat ≥ 0.4.4)_ | + String: key combo | + Key combo in 'default' context + +| weechat | key_combo_search + + _(WeeChat ≥ 0.4.4)_ | + String: key combo | + Key combo in 'search' context + +| weechat | key_combo_cursor + + _(WeeChat ≥ 0.4.4)_ | + String: key combo | + Key combo in 'cursor' context + | weechat | nicklist_group_added + _(WeeChat ≥ 0.3.2)_ | String: buffer pointer + "," + group name | diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt index 8c833b32f..49e244ebb 100644 --- a/doc/fr/weechat_plugin_api.fr.txt +++ b/doc/fr/weechat_plugin_api.fr.txt @@ -7984,6 +7984,21 @@ Liste des signaux envoyés par WeeChat et les extensions : Chaîne : touche appuyée | Touche appuyée +| weechat | key_combo_default + + _(WeeChat ≥ 0.4.4)_ | + Chaîne : combinaison de touches | + Combinaison de touches dans le contexte 'default' + +| weechat | key_combo_search + + _(WeeChat ≥ 0.4.4)_ | + Chaîne : combinaison de touches | + Combinaison de touches dans le contexte 'search' + +| weechat | key_combo_cursor + + _(WeeChat ≥ 0.4.4)_ | + Chaîne : combinaison de touches | + Combinaison de touches dans le contexte 'cursor' + | weechat | nicklist_group_added + _(WeeChat ≥ 0.3.2)_ | Chaîne : pointeur tampon + "," + nom du groupe | diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index 80c4aa9cd..9b7118dcd 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -8010,6 +8010,24 @@ List of signals sent by WeeChat and plugins: Tasto digitato // TRANSLATION MISSING +| weechat | key_combo_default + + _(WeeChat ≥ 0.4.4)_ | + String: key combo | + Key combo in 'default' context + +// TRANSLATION MISSING +| weechat | key_combo_search + + _(WeeChat ≥ 0.4.4)_ | + String: key combo | + Key combo in 'search' context + +// TRANSLATION MISSING +| weechat | key_combo_cursor + + _(WeeChat ≥ 0.4.4)_ | + String: key combo | + Key combo in 'cursor' context + +// TRANSLATION MISSING | weechat | nicklist_group_added + _(WeeChat ≥ 0.3.2)_ | String: buffer pointer + "," + group name | diff --git a/doc/ja/weechat_plugin_api.ja.txt b/doc/ja/weechat_plugin_api.ja.txt index 977d63120..f2c86c22b 100644 --- a/doc/ja/weechat_plugin_api.ja.txt +++ b/doc/ja/weechat_plugin_api.ja.txt @@ -7849,6 +7849,24 @@ WeeChat とプラグインが送信するシグナルのリスト: String: 押されたキー | キーが押された +// TRANSLATION MISSING +| weechat | key_combo_default + + _(WeeChat ≥ 0.4.4)_ | + String: key combo | + Key combo in 'default' context + +// TRANSLATION MISSING +| weechat | key_combo_search + + _(WeeChat ≥ 0.4.4)_ | + String: key combo | + Key combo in 'search' context + +// TRANSLATION MISSING +| weechat | key_combo_cursor + + _(WeeChat ≥ 0.4.4)_ | + String: key combo | + Key combo in 'cursor' context + | weechat | nicklist_group_added + _(WeeChat バージョン 0.3.2 以上で利用可)_ | String: バッファポインタ + "," + グループ名 | diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index 915c001d2..0b77179c9 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -1246,9 +1246,11 @@ end: int gui_key_pressed (const char *key_str) { - int i, first_key, context, length, length_key; + int i, first_key, context, length, length_key, rc, signal_sent; struct t_gui_key *ptr_key; - char *pos; + char *pos, signal_name[128]; + + signal_sent = 0; /* add key to buffer */ first_key = (gui_key_combo_buffer[0] == '\0'); @@ -1329,8 +1331,14 @@ gui_key_pressed (const char *key_str) if (strcmp (ptr_key->key, gui_key_combo_buffer) == 0) { /* exact combo found => execute command */ + signal_sent = 1; + snprintf (signal_name, sizeof (signal_name), + "key_combo_%s", gui_key_context_string[context]); + rc = hook_signal_send (signal_name, + WEECHAT_HOOK_SIGNAL_STRING, + gui_key_combo_buffer); gui_key_combo_buffer[0] = '\0'; - if (ptr_key->commands) + if ((rc != WEECHAT_RC_OK_EAT) && ptr_key->commands) { for (i = 0; ptr_key->commands[i]; i++) { @@ -1343,6 +1351,16 @@ gui_key_pressed (const char *key_str) } else if (context == GUI_KEY_CONTEXT_CURSOR) { + signal_sent = 1; + snprintf (signal_name, sizeof (signal_name), + "key_combo_%s", gui_key_context_string[context]); + if (hook_signal_send (signal_name, + WEECHAT_HOOK_SIGNAL_STRING, + gui_key_combo_buffer) == WEECHAT_RC_OK_EAT) + { + gui_key_combo_buffer[0] = '\0'; + return 0; + } if (gui_key_focus (gui_key_combo_buffer, GUI_KEY_CONTEXT_CURSOR)) { gui_key_combo_buffer[0] = '\0'; @@ -1350,6 +1368,19 @@ gui_key_pressed (const char *key_str) } } + if (!signal_sent && first_key) + { + snprintf (signal_name, sizeof (signal_name), + "key_combo_%s", gui_key_context_string[context]); + if (hook_signal_send (signal_name, + WEECHAT_HOOK_SIGNAL_STRING, + gui_key_combo_buffer) == WEECHAT_RC_OK_EAT) + { + gui_key_combo_buffer[0] = '\0'; + return 0; + } + } + gui_key_combo_buffer[0] = '\0'; /* |