mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-30 11:42:54 +03:00
Merge branch '3566_msg_notify'
* 3566_msg_notify: Clarify send of MSG_NOTIFY. Split MSG_ACTION into MSG_ACTION and MSG_NOTIFY. Ticket #3566: Split MSG_ACTION into MSG_ACTION and MSG_NOTIFY.
This commit is contained in:
commit
2623258322
@ -148,9 +148,12 @@ buttonbar_call (WButtonBar * bb, int i)
|
||||
{
|
||||
cb_ret_t ret = MSG_NOT_HANDLED;
|
||||
Widget *w = WIDGET (bb);
|
||||
Widget *target;
|
||||
|
||||
target = (bb->labels[i].receiver != NULL) ? bb->labels[i].receiver : WIDGET (w->owner);
|
||||
|
||||
if ((bb != NULL) && (bb->labels[i].command != CK_IgnoreKey))
|
||||
ret = send_message (w->owner, w, MSG_ACTION, bb->labels[i].command, bb->labels[i].receiver);
|
||||
ret = send_message (target, w, MSG_ACTION, bb->labels[i].command, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,8 @@ check_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
||||
return MSG_NOT_HANDLED;
|
||||
c->state ^= C_BOOL;
|
||||
c->state ^= C_CHANGE;
|
||||
send_message (WIDGET (w)->owner, w, MSG_ACTION, 0, NULL);
|
||||
send_message (w, sender, MSG_FOCUS, ' ', data);
|
||||
send_message (WIDGET (w)->owner, w, MSG_NOTIFY, 0, NULL);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_CURSOR:
|
||||
|
@ -391,7 +391,7 @@ static void
|
||||
listbox_on_change (WListbox * l)
|
||||
{
|
||||
listbox_draw (l, TRUE);
|
||||
send_message (WIDGET (l)->owner, l, MSG_ACTION, l->pos, NULL);
|
||||
send_message (WIDGET (l)->owner, l, MSG_NOTIFY, l->pos, NULL);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -85,8 +85,8 @@ radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
||||
{
|
||||
case ' ':
|
||||
r->sel = r->pos;
|
||||
send_message (w->owner, w, MSG_ACTION, 0, NULL);
|
||||
send_message (w, sender, MSG_FOCUS, ' ', data);
|
||||
send_message (w->owner, w, MSG_NOTIFY, 0, NULL);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case KEY_UP:
|
||||
@ -110,9 +110,9 @@ radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
||||
}
|
||||
|
||||
case MSG_CURSOR:
|
||||
send_message (w->owner, w, MSG_ACTION, 0, NULL);
|
||||
send_message (w, sender, MSG_FOCUS, ' ', data);
|
||||
widget_move (r, r->pos, 1);
|
||||
send_message (w->owner, w, MSG_NOTIFY, 0, NULL);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_UNFOCUS:
|
||||
|
@ -33,9 +33,9 @@ typedef enum
|
||||
MSG_HOTKEY_HANDLED, /* A widget has got the hotkey */
|
||||
MSG_UNHANDLED_KEY, /* Key that no widget handled */
|
||||
MSG_POST_KEY, /* The key has been handled */
|
||||
MSG_ACTION, /* Send to widget to handle command or
|
||||
* state of check- and radiobuttons has changed
|
||||
* and listbox current entry has changed */
|
||||
MSG_ACTION, /* Send to widget to handle command */
|
||||
MSG_NOTIFY, /* Typically sent to dialog to inform it of state-change
|
||||
* of listboxes, check- and radiobuttons. */
|
||||
MSG_CURSOR, /* Sent to widget to position the cursor */
|
||||
MSG_IDLE, /* The idle state is active */
|
||||
MSG_RESIZE, /* Screen size has changed */
|
||||
|
@ -3406,19 +3406,11 @@ dview_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_ACTION:
|
||||
/* shortcut */
|
||||
if (sender == NULL)
|
||||
return dview_execute_cmd (NULL, parm);
|
||||
/* message from buttonbar */
|
||||
if (sender == WIDGET (find_buttonbar (h)))
|
||||
{
|
||||
if (data != NULL)
|
||||
return send_message (data, NULL, MSG_ACTION, parm, NULL);
|
||||
/* Handle shortcuts. */
|
||||
|
||||
dview = (WDiff *) find_widget_type (h, dview_callback);
|
||||
return dview_execute_cmd (dview, parm);
|
||||
}
|
||||
return MSG_NOT_HANDLED;
|
||||
/* Note: the buttonbar sends messages directly to the the WDiff, not to
|
||||
* here, which is why we can pass NULL in the following call. */
|
||||
return dview_execute_cmd (NULL, parm);
|
||||
|
||||
case MSG_VALIDATE:
|
||||
dview = (WDiff *) find_widget_type (h, dview_callback);
|
||||
|
@ -160,7 +160,7 @@ edit_save_mode_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_ACTION:
|
||||
case MSG_NOTIFY:
|
||||
if (sender != NULL && sender->id == edit_save_mode_radio_id)
|
||||
{
|
||||
Widget *ww;
|
||||
|
@ -1021,27 +1021,20 @@ edit_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, v
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_ACTION:
|
||||
/* shortcut */
|
||||
if (sender == NULL)
|
||||
return edit_dialog_command_execute (h, parm);
|
||||
/* message from menu */
|
||||
menubar = find_menubar (h);
|
||||
if (sender == WIDGET (menubar))
|
||||
{
|
||||
if (edit_dialog_command_execute (h, parm) == MSG_HANDLED)
|
||||
return MSG_HANDLED;
|
||||
/* try send command to the current window */
|
||||
return send_message (h->current->data, NULL, MSG_ACTION, parm, NULL);
|
||||
/* Handle shortcuts, menu, and buttonbar. */
|
||||
|
||||
cb_ret_t result;
|
||||
|
||||
result = edit_dialog_command_execute (h, parm);
|
||||
|
||||
/* We forward any commands coming from the menu, and which haven't been
|
||||
handled by the dialog, to the focused WEdit window. */
|
||||
if (result == MSG_NOT_HANDLED && sender == WIDGET (find_menubar (h)))
|
||||
result = send_message (h->current->data, NULL, MSG_ACTION, parm, NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
/* message from buttonbar */
|
||||
buttonbar = find_buttonbar (h);
|
||||
if (sender == WIDGET (buttonbar))
|
||||
{
|
||||
if (data != NULL)
|
||||
return send_message (data, NULL, MSG_ACTION, parm, NULL);
|
||||
return edit_dialog_command_execute (h, parm);
|
||||
}
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
case MSG_KEY:
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ configure_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_ACTION:
|
||||
case MSG_NOTIFY:
|
||||
/* message from "Single press" checkbutton */
|
||||
if (sender != NULL && sender->id == configure_old_esc_mode_id)
|
||||
{
|
||||
@ -250,7 +250,7 @@ panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_ACTION:
|
||||
case MSG_NOTIFY:
|
||||
if (sender != NULL && sender->id == panel_listing_types_id)
|
||||
{
|
||||
WCheck *ch;
|
||||
@ -371,7 +371,7 @@ confvfs_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_ACTION:
|
||||
case MSG_NOTIFY:
|
||||
/* message from "Always use ftp proxy" checkbutton */
|
||||
if (sender != NULL && sender->id == ftpfs_always_use_proxy_id)
|
||||
{
|
||||
|
@ -220,16 +220,12 @@ chmod_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_ACTION:
|
||||
case MSG_NOTIFY:
|
||||
{
|
||||
/* handle checkboxes */
|
||||
int i;
|
||||
|
||||
/* close dialog due to SIGINT (ctrl-g) */
|
||||
if (sender == NULL && parm == CK_Cancel)
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
/* whether action was sent by checkbox? */
|
||||
/* whether notification was sent by checkbox? */
|
||||
for (i = 0; i < check_perm_num; i++)
|
||||
if (sender == WIDGET (check_perm[i].check))
|
||||
break;
|
||||
|
@ -470,7 +470,7 @@ find_parm_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi
|
||||
first_draw = TRUE;
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_ACTION:
|
||||
case MSG_NOTIFY:
|
||||
if (sender == WIDGET (ignore_dirs_cbox))
|
||||
{
|
||||
gboolean disable = !(ignore_dirs_cbox->state & C_BOOL);
|
||||
|
@ -577,6 +577,7 @@ hotlist_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_INIT:
|
||||
case MSG_NOTIFY: /* MSG_NOTIFY is fired by the listbox to tell us the item has changed. */
|
||||
update_path_name ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
@ -593,14 +594,6 @@ hotlist_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
|
||||
dlg_set_size (h, LINES - (h == hotlist_dlg ? 2 : 6), COLS - 6);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_ACTION:
|
||||
if (sender == NULL)
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
/* The listbox tells us the item has changed. */
|
||||
update_path_name ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
default:
|
||||
return dlg_default_callback (w, sender, msg, parm, data);
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ layout_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
|
||||
}
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_ACTION:
|
||||
case MSG_NOTIFY:
|
||||
if (sender == WIDGET (radio_widget))
|
||||
{
|
||||
if (panels_layout.horizontal_split != radio_widget->sel)
|
||||
|
@ -1566,20 +1566,8 @@ midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_ACTION:
|
||||
/* shortcut */
|
||||
if (sender == NULL)
|
||||
return midnight_execute_cmd (NULL, parm);
|
||||
/* message from menu */
|
||||
if (sender == WIDGET (the_menubar))
|
||||
return midnight_execute_cmd (sender, parm);
|
||||
/* message from buttonbar */
|
||||
if (sender == WIDGET (the_bar))
|
||||
{
|
||||
if (data != NULL)
|
||||
return send_message (data, NULL, MSG_ACTION, parm, NULL);
|
||||
return midnight_execute_cmd (sender, parm);
|
||||
}
|
||||
return MSG_NOT_HANDLED;
|
||||
/* Handle shortcuts, menu, and buttonbar. */
|
||||
return midnight_execute_cmd (sender, parm);
|
||||
|
||||
case MSG_END:
|
||||
panel_deinit ();
|
||||
|
@ -113,14 +113,7 @@ panelize_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_INIT:
|
||||
update_command ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_ACTION:
|
||||
if (sender == NULL)
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
/* The listbox tells us the item has changed. */
|
||||
case MSG_NOTIFY: /* MSG_NOTIFY is fired by the listbox to tell us the item has changed. */
|
||||
update_command ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
|
13
src/help.c
13
src/help.c
@ -966,17 +966,8 @@ help_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da
|
||||
return help_handle_key (h, parm);
|
||||
|
||||
case MSG_ACTION:
|
||||
/* shortcut */
|
||||
if (sender == NULL)
|
||||
return help_execute_cmd (parm);
|
||||
/* message from buttonbar */
|
||||
if (sender == WIDGET (find_buttonbar (h)))
|
||||
{
|
||||
if (data != NULL)
|
||||
return send_message (data, NULL, MSG_ACTION, parm, NULL);
|
||||
return help_execute_cmd (parm);
|
||||
}
|
||||
return MSG_NOT_HANDLED;
|
||||
/* Handle shortcuts and buttonbar. */
|
||||
return help_execute_cmd (parm);
|
||||
|
||||
default:
|
||||
return dlg_default_callback (w, sender, msg, parm, data);
|
||||
|
@ -724,19 +724,11 @@ mcview_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_ACTION:
|
||||
/* shortcut */
|
||||
if (sender == NULL)
|
||||
return mcview_execute_cmd (NULL, parm);
|
||||
/* message from buttonbar */
|
||||
if (sender == WIDGET (find_buttonbar (h)))
|
||||
{
|
||||
if (data != NULL)
|
||||
return send_message (data, NULL, MSG_ACTION, parm, NULL);
|
||||
/* Handle shortcuts. */
|
||||
|
||||
view = (WView *) find_widget_type (h, mcview_callback);
|
||||
return mcview_execute_cmd (view, parm);
|
||||
}
|
||||
return MSG_NOT_HANDLED;
|
||||
/* Note: the buttonbar sends messages directly to the the WView, not to
|
||||
* here, which is why we can pass NULL in the following call. */
|
||||
return mcview_execute_cmd (NULL, parm);
|
||||
|
||||
case MSG_VALIDATE:
|
||||
view = (WView *) find_widget_type (h, mcview_callback);
|
||||
|
Loading…
x
Reference in New Issue
Block a user