From e0deceb36661dfe01b57606b7decfb45fb4aa4d8 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 14 Jan 2013 12:16:25 +0100 Subject: [PATCH] core: fix click in item "buffer_nicklist" when nicklist is a root bar (bug #38080) Argument "*" is now silently ignored in command /window. When item "buffer_nicklist" is in a root bar, we use current window/buffer to find which nick has been clicked (same behaviour as callback used to display bar item "buffer_nicklist"). --- ChangeLog | 4 +++- src/core/wee-command.c | 4 ++++ src/gui/gui-bar-item.c | 23 ++++++++++++++--------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7cfd45b4a..fc287d4f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,14 @@ WeeChat ChangeLog ================= Sébastien Helleu -v0.4.0-rc2, 2013-01-12 +v0.4.0-rc2, 2013-01-14 Version 0.4.0 (under dev!) -------------------------- +* core: fix click in item "buffer_nicklist" when nicklist is a root bar + (bug #38080) * core: fix line returned when clicking on a bar (according to position and filling) (bug #38069) * core: fix refresh of bars when applying layout (bug #37944, bug #37952) diff --git a/src/core/wee-command.c b/src/core/wee-command.c index d77632f0c..4fa359745 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -5376,6 +5376,10 @@ COMMAND_CALLBACK(window) return WEECHAT_RC_OK; } + /* silently ignore argument "*" (can heppen when clicking in a root bar) */ + if (strcmp (argv_eol[1], "*") == 0) + return WEECHAT_RC_OK; + /* refresh screen */ if (string_strcasecmp (argv[1], "refresh") == 0) { diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index 7e75f78bc..a203a5e3c 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -1539,18 +1539,23 @@ gui_bar_item_focus_buffer_nicklist (void *data, /* make C compiler happy */ (void) data; - str_window = hashtable_get (info, "_window"); str_bar_item_line = hashtable_get (info, "_bar_item_line"); - - if (!str_window || !str_window[0] - || !str_bar_item_line || !str_bar_item_line[0]) + if (!str_bar_item_line || !str_bar_item_line[0]) return NULL; - rc = sscanf (str_window, "%lx", &value); - if ((rc == EOF) || (rc == 0)) - return NULL; - - window = (struct t_gui_window *)value; + str_window = hashtable_get (info, "_window"); + if (str_window && str_window[0]) + { + rc = sscanf (str_window, "%lx", &value); + if ((rc == EOF) || (rc == 0)) + return NULL; + window = (struct t_gui_window *)value; + } + else + { + /* no window, is it a root bar? then use current window */ + window = gui_current_window; + } if (!window) return NULL;