Pressing <right> and <left> in hotlist dialog doesn't refresh it.

Signed-off-by: Mooffie <mooffie@gmail.com>
This commit is contained in:
Mooffie 2017-02-25 23:16:04 +02:00
parent 1878f49114
commit ac23a4807c
2 changed files with 31 additions and 2 deletions

View File

@ -471,6 +471,9 @@ widget_replace (Widget * old_w, Widget * new_w)
/** /**
* Select specified widget in it's owner. * Select specified widget in it's owner.
* *
* Note: this function (and widget_focus(), which it calls) is a no-op
* if the widget is already selected.
*
* @param w widget to be selected * @param w widget to be selected
*/ */

View File

@ -581,8 +581,34 @@ hotlist_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
return hotlist_handle_key (h, parm); return hotlist_handle_key (h, parm);
case MSG_POST_KEY: case MSG_POST_KEY:
/* always stay on hotlist */ /*
widget_select (h == hotlist_dlg ? WIDGET (l_hotlist) : WIDGET (l_movelist)); * The code here has two purposes:
*
* (1) Always stay on the hotlist.
*
* Activating a button using its hotkey (and even pressing ENTER, as
* there's a "default button") moves the focus to the button. But we
* want to stay on the hotlist, to be able to use the usual keys (up,
* down, etc.). So we do `widget_select (lst)`.
*
* (2) Refresh the hotlist.
*
* We may have run a command that changed the contents of the list.
* We therefore need to refresh it. So we do `widget_redraw (lst)`.
*/
{
Widget *lst;
lst = WIDGET (h == hotlist_dlg ? l_hotlist : l_movelist);
/* widget_select() already redraws the widget, but since it's a
* no-op if the widget is already selected ("focused"), we have
* to call widget_redraw() separately. */
if (!widget_get_state (lst, WST_FOCUSED))
widget_select (lst);
else
widget_redraw (lst);
}
return MSG_HANDLED; return MSG_HANDLED;
case MSG_RESIZE: case MSG_RESIZE: