summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-06-26 19:30:42 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-06-26 21:21:12 +0200
commit5e0ca4740bd7df4746b5187c74696dc5e1c42396 (patch)
tree1381492dc274dcdf41bf8503e990a87f6b451844
parent70c41f614ad57613a1ff9642fb78fb889aa990f3 (diff)
downloadweechat-5e0ca4740bd7df4746b5187c74696dc5e1c42396.zip
core: display actual key name and command with key Alt+k
Key Alt+K (upper K) is removed as well as commands `/input grab_raw_key` and `/input grab_raw_key_command`.
-rw-r--r--ChangeLog.adoc1
-rw-r--r--ReleaseNotes.adoc12
-rw-r--r--src/core/wee-command.c18
-rw-r--r--src/gui/curses/gui-curses-key.c1
-rw-r--r--src/gui/gui-input.c5
-rw-r--r--src/gui/gui-input.h4
-rw-r--r--src/gui/gui-key.c33
-rw-r--r--src/gui/gui-key.h3
8 files changed, 34 insertions, 43 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 012a06aa5..24cdb514f 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -16,6 +16,7 @@ For a list of important changes that require manual actions, please look at rele
Bug fixes::
* core: force key "return" to command "/input return" when migrating legacy keys
+ * core: display actual key name and command with key kbd:[Alt+k], remove key kbd:[Alt+K] (grab raw key) and associated commands `/input grab_raw_key` and `/input grab_raw_key_command`
* irc: reply to a CTCP request sent to self nick (issue #1966)
[[v4.0.0]]
diff --git a/ReleaseNotes.adoc b/ReleaseNotes.adoc
index 12ceedacd..eb86c3309 100644
--- a/ReleaseNotes.adoc
+++ b/ReleaseNotes.adoc
@@ -11,6 +11,18 @@ It is recommended to read it when upgrading to a new stable version. +
For a complete list of changes, please look at ChangeLog.
+[[v4.1.0]]
+== Version 4.1.0 (under dev)
+
+[[v4.1.0_grab_raw_key]]
+==== Grab raw key and command
+
+Key kbd:[Alt+K] (upper case) has been removed, as well as commands
+`/input grab_raw_key` and `/input grab_raw_key_command`.
+
+Now the key kbd:[Alt+k] displays the actual key name and command, possibly
+raw key.
+
[[v4.0.0]]
== Version 4.0.0 (2023-06-24)
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 2d6431ed3..6dd52aa3f 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -3534,28 +3534,12 @@ COMMAND_CALLBACK(input)
else if (string_strcmp (argv[1], "grab_key") == 0)
{
gui_input_grab_key (buffer,
- 0, /* raw_key */
- 0, /* command */
- (argc > 2) ? argv[2] : NULL);
- }
- else if (string_strcmp (argv[1], "grab_raw_key") == 0)
- {
- gui_input_grab_key (buffer,
- 1, /* raw_key */
0, /* command */
(argc > 2) ? argv[2] : NULL);
}
else if (string_strcmp (argv[1], "grab_key_command") == 0)
{
gui_input_grab_key (buffer,
- 0, /* raw_key */
- 1, /* command */
- (argc > 2) ? argv[2] : NULL);
- }
- else if (string_strcmp (argv[1], "grab_raw_key_command") == 0)
- {
- gui_input_grab_key (buffer,
- 1, /* raw_key */
1, /* command */
(argc > 2) ? argv[2] : NULL);
}
@@ -8433,7 +8417,7 @@ command_init ()
"move_next_word || move_previous_line || move_next_line || "
"history_previous || history_next || history_global_previous || "
"history_global_next || "
- "grab_key || grab_raw_key || grab_raw_key_command || grab_key_command || "
+ "grab_key || grab_key_command || "
"grab_mouse || grab_mouse_area || "
"insert || send",
&command_input, NULL, NULL);
diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c
index e249277a4..eeedbb27b 100644
--- a/src/gui/curses/gui-curses-key.c
+++ b/src/gui/curses/gui-curses-key.c
@@ -134,7 +134,6 @@ gui_key_default_bindings (int context, int create_option)
BIND("meta-h,meta-r", "/hotlist restore");
BIND("meta-h,meta-R", "/hotlist restore -all");
BIND("meta-k", "/input grab_key_command");
- BIND("meta-K", "/input grab_raw_key_command");
BIND("meta-s", "/mute spell toggle");
BIND("meta-u", "/window scroll_unread");
BIND("ctrl-s,ctrl-u", "/allbuf /buffer set unread");
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index bbe27dd30..29f89bf32 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -1729,11 +1729,10 @@ gui_input_history_global_next (struct t_gui_buffer *buffer)
*/
void
-gui_input_grab_key (struct t_gui_buffer *buffer, int raw_key, int command,
- const char *delay)
+gui_input_grab_key (struct t_gui_buffer *buffer, int command, const char *delay)
{
if (buffer->input)
- gui_key_grab_init (raw_key, command, delay);
+ gui_key_grab_init (command, delay);
}
/*
diff --git a/src/gui/gui-input.h b/src/gui/gui-input.h
index a75459f3b..b176ea424 100644
--- a/src/gui/gui-input.h
+++ b/src/gui/gui-input.h
@@ -78,8 +78,8 @@ extern void gui_input_history_local_previous (struct t_gui_buffer *buffer);
extern void gui_input_history_local_next (struct t_gui_buffer *buffer);
extern void gui_input_history_global_previous (struct t_gui_buffer *buffer);
extern void gui_input_history_global_next (struct t_gui_buffer *buffer);
-extern void gui_input_grab_key (struct t_gui_buffer *buffer, int raw_key,
- int command, const char *delay);
+extern void gui_input_grab_key (struct t_gui_buffer *buffer, int command,
+ const char *delay);
extern void gui_input_grab_mouse (struct t_gui_buffer *buffer, int area);
extern void gui_input_insert (struct t_gui_buffer *buffer, const char *args);
extern void gui_input_undo (struct t_gui_buffer *buffer);
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c
index 1737d2bad..19aa00f0f 100644
--- a/src/gui/gui-key.c
+++ b/src/gui/gui-key.c
@@ -87,7 +87,6 @@ int gui_key_verbose = 0; /* 1 to see some messages */
char gui_key_combo[1024]; /* buffer used for combos */
int gui_key_grab = 0; /* 1 if grab mode enabled (alt-k) */
-int gui_key_grab_raw = 0; /* grab raw key code? */
int gui_key_grab_count = 0; /* number of keys pressed in grab mode */
int gui_key_grab_command = 0; /* grab command bound to key? */
int gui_key_grab_delay = 0; /* delay for grab (default is 500) */
@@ -185,13 +184,12 @@ gui_key_get_current_context ()
*/
void
-gui_key_grab_init (int grab_raw_key, int grab_command, const char *delay)
+gui_key_grab_init (int grab_command, const char *delay)
{
long milliseconds;
char *error;
gui_key_grab = 1;
- gui_key_grab_raw = grab_raw_key;
gui_key_grab_count = 0;
gui_key_grab_command = grab_command;
@@ -217,8 +215,7 @@ int
gui_key_grab_end_timer_cb (const void *pointer, void *data, int remaining_calls)
{
char *key_name, *key_name_alias, *key_utf8;
- const char *ptr_key_name;
- struct t_gui_key *ptr_key;
+ struct t_gui_key *ptr_key_raw, *ptr_key;
int rc;
/* make C compiler happy */
@@ -264,23 +261,23 @@ gui_key_grab_end_timer_cb (const void *pointer, void *data, int remaining_calls)
}
}
- ptr_key_name = (gui_key_grab_raw) ? key_name : key_name_alias;
-
/* add expanded key to input buffer */
if (gui_current_window->buffer->input)
{
- gui_input_insert_string (gui_current_window->buffer, ptr_key_name);
- if (gui_key_grab_command)
+ ptr_key_raw = gui_key_search (gui_keys[GUI_KEY_CONTEXT_DEFAULT],
+ key_name);
+ ptr_key = gui_key_search (gui_keys[GUI_KEY_CONTEXT_DEFAULT],
+ key_name_alias);
+ gui_input_insert_string (gui_current_window->buffer,
+ (ptr_key_raw) ? key_name : key_name_alias);
+ /* add command bound to key (if found) */
+ if (gui_key_grab_command && (ptr_key_raw || ptr_key))
{
- /* add command bound to key (if found) */
- ptr_key = gui_key_search (gui_keys[GUI_KEY_CONTEXT_DEFAULT],
- ptr_key_name);
- if (ptr_key)
- {
- gui_input_insert_string (gui_current_window->buffer, " ");
- gui_input_insert_string (gui_current_window->buffer,
- ptr_key->command);
- }
+ gui_input_insert_string (gui_current_window->buffer, " ");
+ gui_input_insert_string (
+ gui_current_window->buffer,
+ (ptr_key_raw) ?
+ ptr_key_raw->command : ptr_key->command);
}
gui_input_text_changed_modifier_and_signal (
gui_current_window->buffer,
diff --git a/src/gui/gui-key.h b/src/gui/gui-key.h
index e767c6150..b0aeb2ad8 100644
--- a/src/gui/gui-key.h
+++ b/src/gui/gui-key.h
@@ -90,8 +90,7 @@ extern time_t gui_key_last_activity_time;
extern void gui_key_init ();
extern int gui_key_search_context (const char *context);
-extern void gui_key_grab_init (int grab_raw_key, int grab_command,
- const char *delay);
+extern void gui_key_grab_init (int grab_command, const char *delay);
extern int gui_key_expand (const char *key,
char **key_name, char **key_name_alias);
extern char *gui_key_legacy_to_alias (const char *key);