Don't focus widget that doesn't have the WOP_SELECTABLE option.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-06-07 16:11:30 +03:00
parent a64a7ba2fa
commit c90b806728
8 changed files with 7 additions and 28 deletions

View File

@ -166,9 +166,6 @@ buttonbar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi
switch (msg)
{
case MSG_FOCUS:
return MSG_NOT_HANDLED;
case MSG_HOTKEY:
for (i = 0; i < BUTTONBAR_LABELS_NUM; i++)
if (parm == KEY_F (i + 1) && buttonbar_call (bb, i))

View File

@ -1079,7 +1079,8 @@ dlg_focus (WDialog * h)
{
Widget *current = WIDGET (h->current->data);
if (!widget_get_state (current, WST_DISABLED)
if (widget_get_options (current, WOP_SELECTABLE)
&& !widget_get_state (current, WST_DISABLED)
&& (send_message (current, NULL, MSG_FOCUS, 0, NULL) == MSG_HANDLED))
{
send_message (h, current, MSG_FOCUS, 0, NULL);

View File

@ -65,10 +65,6 @@ gauge_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
case MSG_INIT:
return MSG_HANDLED;
/* We don't want to get the focus */
case MSG_FOCUS:
return MSG_NOT_HANDLED;
case MSG_DRAW:
widget_move (w, 0, 0);
if (!g->shown)

View File

@ -62,9 +62,6 @@ groupbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
case MSG_INIT:
return MSG_HANDLED;
case MSG_FOCUS:
return MSG_NOT_HANDLED;
case MSG_DRAW:
{
WDialog *h = w->owner;

View File

@ -80,10 +80,6 @@ hline_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
}
return MSG_HANDLED;
case MSG_FOCUS:
/* We don't want to get the focus */
return MSG_NOT_HANDLED;
case MSG_DRAW:
if (l->transparent)
tty_setcolor (DEFAULT_COLOR);

View File

@ -67,10 +67,6 @@ label_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
case MSG_INIT:
return MSG_HANDLED;
/* We don't want to get the focus */
case MSG_FOCUS:
return MSG_NOT_HANDLED;
case MSG_DRAW:
{
char *p = l->text;

View File

@ -347,10 +347,6 @@ command_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
{
switch (msg)
{
case MSG_FOCUS:
/* Never accept focus, otherwise panels will be unselected */
return MSG_NOT_HANDLED;
case MSG_KEY:
/* Special case: we handle the enter key */
if (parm == '\n')
@ -473,14 +469,17 @@ WInput *
command_new (int y, int x, int cols)
{
WInput *cmd;
Widget *w;
cmd = input_new (y, x, command_colors, cols, "", "cmdline",
INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_VARIABLES | INPUT_COMPLETE_USERNAMES
| INPUT_COMPLETE_HOSTNAMES | INPUT_COMPLETE_CD | INPUT_COMPLETE_COMMANDS |
INPUT_COMPLETE_SHELL_ESC);
w = WIDGET (cmd);
/* Don't set WOP_SELECTABLE up, otherwise panels will be unselected */
widget_set_options (w, WOP_SELECTABLE, FALSE);
/* Add our hooks */
WIDGET (cmd)->callback = command_callback;
w->callback = command_callback;
return cmd;
}

View File

@ -313,9 +313,6 @@ info_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da
info_hook (info);
return MSG_HANDLED;
case MSG_FOCUS:
return MSG_NOT_HANDLED;
case MSG_DESTROY:
delete_hook (&select_file_hook, info_hook);
free_my_statfs ();