Unification of widget and dialog callback functions.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-06-26 11:52:21 +04:00
parent 05d7f3c84e
commit c6ddd28366
36 changed files with 134 additions and 133 deletions

View File

@ -55,7 +55,7 @@
/*** file scope functions ************************************************************************/
static cb_ret_t
button_callback (Widget * w, widget_msg_t msg, int parm)
button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WButton *b = (WButton *) w;
int stop = 0;
@ -73,19 +73,19 @@ button_callback (Widget * w, widget_msg_t msg, int parm)
*/
if (parm == '\n' && WIDGET (h->current->data) == WIDGET (b))
{
button_callback (w, WIDGET_KEY, ' ');
send_message (w, sender, WIDGET_KEY, ' ', data);
return MSG_HANDLED;
}
if (parm == '\n' && b->flags == DEFPUSH_BUTTON)
{
button_callback (w, WIDGET_KEY, ' ');
send_message (w, sender, WIDGET_KEY, ' ', data);
return MSG_HANDLED;
}
if (b->text.hotkey != NULL && g_ascii_tolower ((gchar) b->text.hotkey[0]) == parm)
{
button_callback (w, WIDGET_KEY, ' ');
send_message (w, sender, WIDGET_KEY, ' ', data);
return MSG_HANDLED;
}
return MSG_NOT_HANDLED;
@ -173,7 +173,7 @@ button_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}
@ -192,7 +192,7 @@ button_event (Gpm_Event * event, void *data)
dlg_select_widget (w);
if ((event->type & GPM_UP) != 0)
{
button_callback (w, WIDGET_KEY, ' ');
send_message (w, NULL, WIDGET_KEY, ' ', NULL);
w->owner->callback (w->owner, w, DLG_POST_KEY, ' ', NULL);
}
}

View File

@ -159,7 +159,7 @@ buttonbar_call (WButtonBar * bb, int i)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
buttonbar_callback (Widget * w, widget_msg_t msg, int parm)
buttonbar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WButtonBar *bb = (WButtonBar *) w;
int i;
@ -209,7 +209,7 @@ buttonbar_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}

View File

@ -49,7 +49,7 @@ static inline void
buttonbar_redraw (WButtonBar * bb)
{
if (bb != NULL)
send_message (WIDGET (bb), WIDGET_DRAW, 0);
send_message (WIDGET (bb), NULL, WIDGET_DRAW, 0, NULL);
}
static inline void

View File

@ -54,7 +54,7 @@
/*** file scope functions ************************************************************************/
static cb_ret_t
check_callback (Widget * w, widget_msg_t msg, int parm)
check_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WCheck *c = (WCheck *) w;
Dlg_head *h = w->owner;
@ -66,7 +66,7 @@ check_callback (Widget * w, widget_msg_t msg, int parm)
{
if (g_ascii_tolower ((gchar) c->text.hotkey[0]) == parm)
{
check_callback (w, WIDGET_KEY, ' '); /* make action */
send_message (w, sender, WIDGET_KEY, ' ', data); /* make action */
return MSG_HANDLED;
}
}
@ -78,7 +78,7 @@ check_callback (Widget * w, widget_msg_t msg, int parm)
c->state ^= C_BOOL;
c->state ^= C_CHANGE;
h->callback (h, w, DLG_ACTION, 0, NULL);
check_callback (w, WIDGET_FOCUS, ' ');
send_message (w, sender, WIDGET_FOCUS, ' ', data);
return MSG_HANDLED;
case WIDGET_CURSOR:
@ -99,7 +99,7 @@ check_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}
@ -118,8 +118,8 @@ check_event (Gpm_Event * event, void *data)
dlg_select_widget (w);
if ((event->type & GPM_UP) != 0)
{
check_callback (w, WIDGET_KEY, ' ');
check_callback (w, WIDGET_FOCUS, 0);
send_message (w, NULL, WIDGET_KEY, ' ', NULL);
send_message (w, NULL, WIDGET_FOCUS, 0, NULL);
w->owner->callback (w->owner, w, DLG_POST_KEY, ' ', NULL);
}
}

View File

@ -145,7 +145,7 @@ dlg_broadcast_msg_to (Dlg_head * h, widget_msg_t msg, gboolean reverse, int flag
p = dlg_widget_next (h, p);
if ((flags == 0) || ((flags & w->options) != 0))
send_message (w, msg, 0);
send_message (w, NULL, msg, 0, NULL);
}
while (first != p);
}
@ -185,7 +185,7 @@ dlg_unfocus (Dlg_head * h)
{
Widget *current = WIDGET (h->current->data);
if (send_message (current, WIDGET_UNFOCUS, 0) == MSG_HANDLED)
if (send_message (current, NULL, WIDGET_UNFOCUS, 0, NULL) == MSG_HANDLED)
{
h->callback (h, current, DLG_UNFOCUS, 0, NULL);
return TRUE;
@ -200,8 +200,8 @@ dlg_unfocus (Dlg_head * h)
static int
dlg_find_widget_callback (const void *a, const void *b)
{
const Widget *w = (const Widget *) a;
callback_fn f = (callback_fn) b;
const Widget *w = WIDGET (a);
widget_cb_fn f = (widget_cb_fn) b;
return (w->callback == f) ? 0 : 1;
}
@ -248,8 +248,8 @@ do_select_widget (Dlg_head * h, GList * w, select_dir_t dir)
if (dlg_overlap (w0, WIDGET (h->current->data)))
{
send_message (WIDGET (h->current->data), WIDGET_DRAW, 0);
send_message (WIDGET (h->current->data), WIDGET_FOCUS, 0);
send_message (WIDGET (h->current->data), NULL, WIDGET_DRAW, 0, NULL);
send_message (WIDGET (h->current->data), NULL, WIDGET_FOCUS, 0, NULL);
}
}
@ -450,7 +450,7 @@ dlg_try_hotkey (Dlg_head * h, int d_key)
handled = MSG_NOT_HANDLED;
if ((current->options & W_WANT_HOTKEY) != 0)
handled = send_message (current, WIDGET_HOTKEY, d_key);
handled = send_message (current, NULL, WIDGET_HOTKEY, d_key, NULL);
/* If not used, send hotkey to other widgets */
if (handled == MSG_HANDLED)
@ -464,7 +464,7 @@ dlg_try_hotkey (Dlg_head * h, int d_key)
current = WIDGET (hot_cur->data);
if ((current->options & W_WANT_HOTKEY) != 0 && (current->options & W_DISABLED) == 0)
handled = send_message (current, WIDGET_HOTKEY, d_key);
handled = send_message (current, NULL, WIDGET_HOTKEY, d_key, NULL);
if (handled == MSG_NOT_HANDLED)
hot_cur = dlg_widget_next (h, hot_cur);
@ -515,7 +515,7 @@ dlg_key_event (Dlg_head * h, int d_key)
h->callback (h, NULL, DLG_HOTKEY_HANDLED, 0, NULL);
else
/* not used - then try widget_callback */
handled = send_message (WIDGET (h->current->data), WIDGET_KEY, d_key);
handled = send_message (WIDGET (h->current->data), NULL, WIDGET_KEY, d_key, NULL);
/* not used- try to use the unhandled case */
if (handled == MSG_NOT_HANDLED)
@ -927,9 +927,9 @@ add_widget_autopos (Dlg_head * h, void *w, widget_pos_flags_t pos_flags, const v
/* widget has been added in runtime */
if (h->state == DLG_ACTIVE)
{
send_message (widget, WIDGET_INIT, 0);
send_message (widget, WIDGET_DRAW, 0);
send_message (widget, WIDGET_FOCUS, 0);
send_message (widget, NULL, WIDGET_INIT, 0, NULL);
send_message (widget, NULL, WIDGET_DRAW, 0, NULL);
send_message (widget, NULL, WIDGET_FOCUS, 0, NULL);
}
return widget->id;
@ -976,7 +976,7 @@ del_widget (void *w)
}
h->widgets = g_list_remove_link (h->widgets, d);
send_message (d->data, WIDGET_DESTROY, 0);
send_message (d->data, NULL, WIDGET_DESTROY, 0, NULL);
g_list_free_1 (d);
/* widget has been deleted in runtime */
@ -1032,7 +1032,7 @@ dlg_focus (Dlg_head * h)
Widget *current = WIDGET (h->current->data);
if (((current->options & W_DISABLED) == 0)
&& (send_message (current, WIDGET_FOCUS, 0) == MSG_HANDLED))
&& (send_message (current, NULL, WIDGET_FOCUS, 0, NULL) == MSG_HANDLED))
{
h->callback (h, current, DLG_FOCUS, 0, NULL);
return TRUE;
@ -1057,7 +1057,7 @@ dlg_overlap (Widget * a, Widget * b)
/** Find the widget with the given callback in the dialog h */
Widget *
find_widget_type (const Dlg_head * h, callback_fn callback)
find_widget_type (const Dlg_head * h, widget_cb_fn callback)
{
GList *w;
@ -1169,7 +1169,7 @@ update_cursor (Dlg_head * h)
w = WIDGET (p->data);
if (((w->options & W_DISABLED) == 0) && ((w->options & W_WANT_CURSOR) != 0))
send_message (w, WIDGET_CURSOR, 0);
send_message (w, NULL, WIDGET_CURSOR, 0, NULL);
else
do
{
@ -1180,7 +1180,7 @@ update_cursor (Dlg_head * h)
w = WIDGET (p->data);
if (((w->options & W_DISABLED) == 0) && ((w->options & W_WANT_CURSOR) != 0))
if (send_message (w, WIDGET_CURSOR, 0) == MSG_HANDLED)
if (send_message (w, NULL, WIDGET_CURSOR, 0, NULL) == MSG_HANDLED)
break;
}
while (TRUE);
@ -1405,14 +1405,14 @@ dlg_replace_widget (Widget * old_w, Widget * new_w)
else
g_list_find (h->widgets, old_w)->data = new_w;
send_message (old_w, WIDGET_DESTROY, 0);
send_message (new_w, WIDGET_INIT, 0);
send_message (old_w, NULL, WIDGET_DESTROY, 0, NULL);
send_message (new_w, NULL, WIDGET_INIT, 0, NULL);
if (should_focus)
dlg_select_widget (new_w);
if (new_w->owner->state == DLG_ACTIVE)
send_message (new_w, WIDGET_DRAW, 0);
send_message (new_w, NULL, WIDGET_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -203,7 +203,7 @@ void dlg_set_top_widget (void *w);
void dlg_one_up (Dlg_head * h);
void dlg_one_down (Dlg_head * h);
gboolean dlg_focus (Dlg_head * h);
Widget *find_widget_type (const Dlg_head * h, callback_fn callback);
Widget *find_widget_type (const Dlg_head * h, widget_cb_fn callback);
Widget *dlg_find_by_id (const Dlg_head * h, unsigned long id);
void dlg_select_by_id (const Dlg_head * h, unsigned long id);

View File

@ -59,7 +59,7 @@
/*** file scope functions ************************************************************************/
static cb_ret_t
gauge_callback (Widget * w, widget_msg_t msg, int parm)
gauge_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WGauge *g = (WGauge *) w;
Dlg_head *h = w->owner;
@ -118,7 +118,7 @@ gauge_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
}
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
/* --------------------------------------------------------------------------------------------- */
@ -160,7 +160,7 @@ gauge_set_value (WGauge * g, int max, int current)
max = 1; /* I do not like division by zero :) */
g->current = current;
g->max = max;
gauge_callback (WIDGET (g), WIDGET_DRAW, 0);
gauge_callback (WIDGET (g), NULL, WIDGET_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */
@ -171,7 +171,7 @@ gauge_show (WGauge * g, gboolean shown)
if (g->shown != shown)
{
g->shown = shown;
gauge_callback (WIDGET (g), WIDGET_DRAW, 0);
gauge_callback (WIDGET (g), NULL, WIDGET_DRAW, 0, NULL);
}
}

View File

@ -53,7 +53,7 @@
/*** file scope functions ************************************************************************/
static cb_ret_t
groupbox_callback (Widget * w, widget_msg_t msg, int parm)
groupbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WGroupbox *g = (WGroupbox *) w;
@ -87,7 +87,7 @@ groupbox_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}

View File

@ -54,7 +54,7 @@
/*** file scope functions ************************************************************************/
static cb_ret_t
hline_callback (Widget * w, widget_msg_t msg, int parm)
hline_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WHLine *l = (WHLine *) w;
Dlg_head *h = w->owner;
@ -101,7 +101,7 @@ hline_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}

View File

@ -1036,7 +1036,7 @@ input_new (int y, int x, const int *input_colors, int width, const char *def_tex
/* --------------------------------------------------------------------------------------------- */
cb_ret_t
input_callback (Widget * w, widget_msg_t msg, int parm)
input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WInput *in = (WInput *) w;
cb_ret_t v;
@ -1097,7 +1097,7 @@ input_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}

View File

@ -82,7 +82,7 @@ WInput *input_new (int y, int x, const int *input_colors,
int len, const char *text, const char *histname,
input_complete_t completion_flags);
/* callbac is public; needed for command line */
cb_ret_t input_callback (Widget * w, widget_msg_t msg, int parm);
cb_ret_t input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data);
const int *input_get_default_colors (void);
void input_set_origin (WInput * i, int x, int field_width);
cb_ret_t input_handle_char (WInput * in, int key);

View File

@ -1100,7 +1100,7 @@ query_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *da
listbox_select_entry ((WListbox *) h->current->data, i);
end = new_end;
input_handle_char (input, parm);
send_message (WIDGET (h->current->data), WIDGET_DRAW, 0);
send_message (WIDGET (h->current->data), NULL, WIDGET_DRAW, 0, NULL);
break;
}
}
@ -1203,7 +1203,7 @@ query_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *da
if (need_redraw == 2)
{
insert_text (input, last_text, low);
send_message (WIDGET (h->current->data), WIDGET_DRAW, 0);
send_message (WIDGET (h->current->data), NULL, WIDGET_DRAW, 0, NULL);
}
else if (need_redraw == 1)
{

View File

@ -57,7 +57,7 @@
/*** file scope functions ************************************************************************/
static cb_ret_t
label_callback (Widget * w, widget_msg_t msg, int parm)
label_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WLabel *l = (WLabel *) w;
Dlg_head *h = w->owner;
@ -115,7 +115,7 @@ label_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}
@ -177,7 +177,7 @@ label_set_text (WLabel * label, const char *text)
}
if (w->owner != NULL)
label_callback (w, WIDGET_DRAW, 0);
send_message (w, NULL, WIDGET_DRAW, 0, NULL);
if (newcols < w->cols)
w->cols = newcols;

View File

@ -365,7 +365,7 @@ listbox_destroy (WListbox * l)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
listbox_callback (Widget * w, widget_msg_t msg, int parm)
listbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WListbox *l = (WListbox *) w;
Dlg_head *h = w->owner;
@ -432,7 +432,7 @@ listbox_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}

View File

@ -53,8 +53,6 @@
/*** file scope variables ************************************************************************/
static cb_ret_t menubar_callback (Widget * w, widget_msg_t msg, int parm);
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
@ -544,7 +542,7 @@ menubar_handle_key (WMenuBar * menubar, int key)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
menubar_callback (Widget * w, widget_msg_t msg, int parm)
menubar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WMenuBar *menubar = (WMenuBar *) w;
@ -590,7 +588,7 @@ menubar_callback (Widget * w, widget_msg_t msg, int parm)
case WIDGET_RESIZED:
/* try show menu after screen resize */
send_message (w, WIDGET_FOCUS, 0);
send_message (w, sender, WIDGET_FOCUS, 0, data);
return MSG_HANDLED;
@ -599,7 +597,7 @@ menubar_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}

View File

@ -54,7 +54,7 @@
/*** file scope functions ************************************************************************/
static cb_ret_t
radio_callback (Widget * w, widget_msg_t msg, int parm)
radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WRadio *r = (WRadio *) w;
int i;
@ -75,7 +75,7 @@ radio_callback (Widget * w, widget_msg_t msg, int parm)
r->pos = i;
/* Take action */
radio_callback (w, WIDGET_KEY, ' ');
send_message (w, sender, WIDGET_KEY, ' ', data);
return MSG_HANDLED;
}
}
@ -88,7 +88,7 @@ radio_callback (Widget * w, widget_msg_t msg, int parm)
case ' ':
r->sel = r->pos;
h->callback (h, w, DLG_ACTION, 0, NULL);
radio_callback (w, WIDGET_FOCUS, ' ');
send_message (w, sender, WIDGET_FOCUS, ' ', data);
return MSG_HANDLED;
case KEY_UP:
@ -112,7 +112,7 @@ radio_callback (Widget * w, widget_msg_t msg, int parm)
case WIDGET_CURSOR:
h->callback (h, w, DLG_ACTION, 0, NULL);
radio_callback (w, WIDGET_FOCUS, ' ');
send_message (w, sender, WIDGET_FOCUS, ' ', data);
widget_move (r, r->pos, 1);
return MSG_HANDLED;
@ -138,7 +138,7 @@ radio_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}
@ -163,7 +163,7 @@ radio_event (Gpm_Event * event, void *data)
dlg_select_widget (w);
if ((event->type & GPM_UP) != 0)
{
radio_callback (w, WIDGET_KEY, ' ');
radio_callback (w, NULL, WIDGET_KEY, ' ', NULL);
w->owner->callback (w->owner, w, DLG_POST_KEY, ' ', NULL);
}
}

View File

@ -139,7 +139,7 @@ hotkey_draw (Widget * w, const hotkey_t hotkey, gboolean focused)
void
init_widget (Widget * w, int y, int x, int lines, int cols,
callback_fn callback, mouse_h mouse_handler)
widget_cb_fn callback, mouse_h mouse_handler)
{
w->x = x;
w->y = y;
@ -157,9 +157,11 @@ init_widget (Widget * w, int y, int x, int lines, int cols,
/* Default callback for widgets */
cb_ret_t
default_proc (widget_msg_t msg, int parm)
default_widget_callback (Widget * sender, widget_msg_t msg, int parm, void *data)
{
(void) sender;
(void) parm;
(void) data;
switch (msg)
{
@ -186,7 +188,7 @@ widget_set_size (Widget * widget, int y, int x, int lines, int cols)
widget->y = y;
widget->cols = cols;
widget->lines = lines;
send_message (widget, WIDGET_RESIZED, 0 /* unused */ );
send_message (widget, NULL, WIDGET_RESIZED, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -77,7 +77,7 @@ typedef enum
/*** structures declarations (and typedefs of structures)*****************************************/
/* Widget callback */
typedef cb_ret_t (*callback_fn) (struct Widget * widget, widget_msg_t msg, int parm);
typedef cb_ret_t (*widget_cb_fn) (struct Widget * widget, Widget * sender, widget_msg_t msg, int parm, void *data);
/* Every Widget must have this as its first element */
struct Widget
@ -87,7 +87,7 @@ struct Widget
widget_options_t options;
widget_pos_flags_t pos_flags; /* repositioning flags */
unsigned int id; /* Number of the widget, starting with 0 */
callback_fn callback;
widget_cb_fn callback;
mouse_h mouse;
struct Dlg_head *owner;
};
@ -118,9 +118,9 @@ void hotkey_draw (struct Widget *w, const hotkey_t hotkey, gboolean focused);
/* widget initialization */
void init_widget (Widget * w, int y, int x, int lines, int cols,
callback_fn callback, mouse_h mouse_handler);
widget_cb_fn callback, mouse_h mouse_handler);
/* Default callback for widgets */
cb_ret_t default_proc (widget_msg_t msg, int parm);
cb_ret_t default_widget_callback (Widget * sender, widget_msg_t msg, int parm, void *data);
void widget_set_size (Widget * widget, int y, int x, int lines, int cols);
/* select color for widget in dependance of state */
void widget_selectcolor (struct Widget *w, gboolean focused, gboolean hotkey);
@ -133,9 +133,9 @@ gboolean mouse_global_in_widget (const Gpm_Event * event, const Widget * w);
/*** inline functions ****************************************************************************/
static inline cb_ret_t
send_message (Widget * w, widget_msg_t msg, int parm)
send_message (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
return w->callback (w, msg, parm);
return w->callback (w, sender, msg, parm, data);
}
#endif /* MC__WIDGET_INTERNAL_H */

View File

@ -3311,7 +3311,7 @@ dview_handle_key (WDiff * dview, int key)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
dview_callback (Widget * w, widget_msg_t msg, int parm)
dview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDiff *dview = (WDiff *) w;
Dlg_head *h = w->owner;
@ -3352,7 +3352,7 @@ dview_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}
@ -3394,7 +3394,7 @@ dview_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, v
if (sender == WIDGET (find_buttonbar (h)))
{
if (data != NULL)
return send_message (WIDGET (data), WIDGET_COMMAND, parm);
return send_message (WIDGET (data), NULL, WIDGET_COMMAND, parm, NULL);
dview = (WDiff *) find_widget_type (h, dview_callback);
return dview_execute_cmd (dview, parm);
@ -3455,7 +3455,7 @@ diff_view (const char *file1, const char *file2, const char *label1, const char
dview = g_new0 (WDiff, 1);
w = WIDGET (dview);
init_widget (w, 0, 0, LINES - 1, COLS, (callback_fn) dview_callback, (mouse_h) dview_event);
init_widget (w, 0, 0, LINES - 1, COLS, dview_callback, dview_event);
widget_want_cursor (w, FALSE);
add_widget (dview_dlg, dview);

View File

@ -1807,7 +1807,7 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry)
edit_cursor_move (edit, curs - edit->curs1);
edit->force |= REDRAW_PAGE;
send_message (WIDGET (edit), WIDGET_DRAW, 0);
send_message (WIDGET (edit), NULL, WIDGET_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -3409,7 +3409,7 @@ edit_select_codepage_cmd (WEdit * edit)
edit_set_codeset (edit);
edit->force = REDRAW_PAGE;
send_message (WIDGET (edit), WIDGET_DRAW, 0);
send_message (WIDGET (edit), NULL, WIDGET_DRAW, 0, NULL);
}
#endif

View File

@ -84,7 +84,6 @@ static unsigned int edit_dlg_init_refcounter = 0;
/*** file scope functions ************************************************************************/
static cb_ret_t edit_callback (Widget * w, widget_msg_t msg, int parm);
static cb_ret_t edit_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm,
void *data);
@ -925,14 +924,14 @@ edit_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, vo
if (edit_dialog_command_execute (h, parm) == MSG_HANDLED)
return MSG_HANDLED;
/* try send command to the current window */
return send_message (WIDGET (h->current->data), WIDGET_COMMAND, parm);
return send_message (WIDGET (h->current->data), NULL, WIDGET_COMMAND, parm, NULL);
}
/* message from buttonbar */
buttonbar = find_buttonbar (h);
if (sender == WIDGET (buttonbar))
{
if (data != NULL)
return send_message (WIDGET (data), WIDGET_COMMAND, parm);
return send_message (WIDGET (data), NULL, WIDGET_COMMAND, parm, NULL);
return edit_dialog_command_execute (h, parm);
}
return MSG_NOT_HANDLED;
@ -982,7 +981,7 @@ edit_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, vo
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
edit_callback (Widget * w, widget_msg_t msg, int parm)
edit_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WEdit *e = (WEdit *) w;
@ -1046,7 +1045,7 @@ edit_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}

View File

@ -269,7 +269,7 @@ update_mode (Dlg_head * h)
tty_setcolor (COLOR_NORMAL);
widget_move (h, BY + 2, 9);
tty_printf ("%12o", get_mode ());
send_message (WIDGET (h->current->data), WIDGET_FOCUS, 0);
send_message (WIDGET (h->current->data), NULL, WIDGET_FOCUS, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */
@ -545,7 +545,7 @@ advanced_chown_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm,
x_toggle ^= (1 << parm);
update_mode (h);
dlg_broadcast_msg (h, WIDGET_DRAW, FALSE);
send_message (WIDGET (h->current->data), WIDGET_FOCUS, 0);
send_message (WIDGET (h->current->data), NULL, WIDGET_FOCUS, 0, NULL);
break;
case XCTRL ('x'):
@ -561,7 +561,7 @@ advanced_chown_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm,
x_toggle ^= (1 << parm);
update_mode (h);
dlg_broadcast_msg (h, WIDGET_DRAW, FALSE);
send_message (WIDGET (h->current->data), WIDGET_FOCUS, 0);
send_message (WIDGET (h->current->data), NULL, WIDGET_FOCUS, 0, NULL);
break;
case 'x':

View File

@ -411,7 +411,7 @@ tree_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *dat
return MSG_HANDLED;
case DLG_ACTION:
return send_message (WIDGET (find_tree (h)), WIDGET_COMMAND, parm);
return send_message (WIDGET (find_tree (h)), NULL, WIDGET_COMMAND, parm, NULL);
default:
return default_dlg_callback (h, sender, msg, parm, data);
@ -438,7 +438,7 @@ confvfs_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *
/* input */
w = dlg_find_by_id (h, sender->id - 1);
widget_disable (w, not_use);
send_message (w, WIDGET_DRAW, 0);
send_message (w, NULL, WIDGET_DRAW, 0, NULL);
return MSG_HANDLED;
}

View File

@ -1579,7 +1579,7 @@ single_dirsize_cmd (void)
}
if (panels_options.mark_moves_down)
send_message (WIDGET (panel), WIDGET_COMMAND, CK_Down);
send_message (WIDGET (panel), NULL, WIDGET_COMMAND, CK_Down, NULL);
recalculate_panel_summary (panel);

View File

@ -335,7 +335,7 @@ enter (WInput * lc_cmdline)
*/
static cb_ret_t
command_callback (Widget * w, widget_msg_t msg, int parm)
command_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WInput *cmd = (WInput *) w;
@ -352,7 +352,7 @@ command_callback (Widget * w, widget_msg_t msg, int parm)
/* fall through */
default:
return input_callback (w, msg, parm);
return input_callback (w, sender, msg, parm, data);
}
}

View File

@ -406,21 +406,21 @@ find_parm_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
gboolean disable = !(content_use_cbox->state & C_BOOL);
widget_disable (WIDGET (content_label), disable);
send_message (WIDGET (content_label), WIDGET_DRAW, 0);
send_message (WIDGET (content_label), NULL, WIDGET_DRAW, 0, NULL);
widget_disable (WIDGET (in_with), disable);
send_message (WIDGET (in_with), WIDGET_DRAW, 0);
send_message (WIDGET (in_with), NULL, WIDGET_DRAW, 0, NULL);
widget_disable (WIDGET (content_first_hit_cbox), disable);
send_message (WIDGET (content_first_hit_cbox), WIDGET_DRAW, 0);
send_message (WIDGET (content_first_hit_cbox), NULL, WIDGET_DRAW, 0, NULL);
widget_disable (WIDGET (content_regexp_cbox), disable);
send_message (WIDGET (content_regexp_cbox), WIDGET_DRAW, 0);
send_message (WIDGET (content_regexp_cbox), NULL, WIDGET_DRAW, 0, NULL);
widget_disable (WIDGET (content_case_sens_cbox), disable);
send_message (WIDGET (content_case_sens_cbox), WIDGET_DRAW, 0);
send_message (WIDGET (content_case_sens_cbox), NULL, WIDGET_DRAW, 0, NULL);
#ifdef HAVE_CHARSET
widget_disable (WIDGET (content_all_charsets_cbox), disable);
send_message (WIDGET (content_all_charsets_cbox), WIDGET_DRAW, 0);
send_message (WIDGET (content_all_charsets_cbox), NULL, WIDGET_DRAW, 0, NULL);
#endif
widget_disable (WIDGET (content_whole_words_cbox), disable);
send_message (WIDGET (content_whole_words_cbox), WIDGET_DRAW, 0);
send_message (WIDGET (content_whole_words_cbox), NULL, WIDGET_DRAW, 0, NULL);
return MSG_HANDLED;
}
@ -430,7 +430,7 @@ find_parm_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
gboolean disable = !(ignore_dirs_cbox->state & C_BOOL);
widget_disable (WIDGET (in_ignore), disable);
send_message (WIDGET (in_ignore), WIDGET_DRAW, 0);
send_message (WIDGET (in_ignore), NULL, WIDGET_DRAW, 0, NULL);
return MSG_HANDLED;
}
@ -868,7 +868,7 @@ find_add_match (const char *dir, const char *file)
/* Don't scroll */
if (matches == 0)
listbox_select_first (find_list);
send_message (WIDGET (find_list), WIDGET_DRAW, 0);
send_message (WIDGET (find_list), NULL, WIDGET_DRAW, 0, NULL);
matches++;
found_num_update ();

View File

@ -288,13 +288,15 @@ info_hook (void *data)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
info_callback (Widget * w, widget_msg_t msg, int parm)
info_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
struct WInfo *info = (struct WInfo *) w;
(void) sender;
(void) data;
switch (msg)
{
case WIDGET_INIT:
init_my_statfs ();
add_hook (&select_file_hook, info_hook, info);
@ -314,7 +316,7 @@ info_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}

View File

@ -233,7 +233,7 @@ update_split (const Dlg_head * h)
check_options[6].widget->state = _panels_layout.horizontal_equal ? 1 : 0;
else
check_options[6].widget->state = _panels_layout.vertical_equal ? 1 : 0;
send_message (WIDGET (check_options[6].widget), WIDGET_DRAW, 0);
send_message (WIDGET (check_options[6].widget), NULL, WIDGET_DRAW, 0, NULL);
tty_setcolor (check_options[6].widget->state & C_BOOL ? DISABLED_COLOR : COLOR_NORMAL);
@ -412,9 +412,9 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
}
widget_disable (WIDGET (bleft_widget), eq);
send_message (WIDGET (bleft_widget), WIDGET_DRAW, 0);
send_message (WIDGET (bleft_widget), NULL, WIDGET_DRAW, 0, NULL);
widget_disable (WIDGET (bright_widget), eq);
send_message (WIDGET (bright_widget), WIDGET_DRAW, 0);
send_message (WIDGET (bright_widget), NULL, WIDGET_DRAW, 0, NULL);
update_split (h);

View File

@ -1094,10 +1094,10 @@ static void
update_dirty_panels (void)
{
if (get_current_type () == view_listing && current_panel->dirty)
send_message (WIDGET (current_panel), WIDGET_DRAW, 0);
send_message (WIDGET (current_panel), NULL, WIDGET_DRAW, 0, NULL);
if (get_other_type () == view_listing && other_panel->dirty)
send_message (WIDGET (other_panel), WIDGET_DRAW, 0);
send_message (WIDGET (other_panel), NULL, WIDGET_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */
@ -1110,7 +1110,7 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
(void) sender;
/* stop quick search before executing any command */
send_message (WIDGET (current_panel), WIDGET_COMMAND, CK_SearchStop);
send_message (WIDGET (current_panel), NULL, WIDGET_COMMAND, CK_SearchStop, NULL);
switch (command)
{
@ -1238,7 +1238,7 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
break;
case CK_History:
/* show the history of command line widget */
send_message (WIDGET (cmdline), WIDGET_COMMAND, CK_History);
send_message (WIDGET (cmdline), NULL, WIDGET_COMMAND, CK_History, NULL);
break;
case CK_PanelInfo:
if (sender == WIDGET (the_menubar))
@ -1465,7 +1465,7 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
if (cmdline->buffer[i] != '\0')
{
send_message (WIDGET (cmdline), WIDGET_KEY, parm);
send_message (WIDGET (cmdline), NULL, WIDGET_KEY, parm, NULL);
return MSG_HANDLED;
}
@ -1544,7 +1544,7 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
if ((get_current_type () == view_listing) && current_panel->searching)
{
current_panel->dirty = 1; /* FIXME: unneeded? */
send_message (WIDGET (current_panel), WIDGET_COMMAND, CK_SearchStop);
send_message (WIDGET (current_panel), NULL, WIDGET_COMMAND, CK_SearchStop, NULL);
}
return MSG_HANDLED;
@ -1564,7 +1564,7 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
v = midnight_execute_cmd (NULL, command);
if (v == MSG_NOT_HANDLED && command_prompt)
v = send_message (WIDGET (cmdline), WIDGET_KEY, parm);
v = send_message (WIDGET (cmdline), NULL, WIDGET_KEY, parm, NULL);
return v;
}
@ -1585,7 +1585,7 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
if (sender == WIDGET (the_bar))
{
if (data != NULL)
return send_message (WIDGET (data), WIDGET_COMMAND, parm);
return send_message (WIDGET (data), NULL, WIDGET_COMMAND, parm, NULL);
return midnight_execute_cmd (sender, parm);
}
return MSG_NOT_HANDLED;

View File

@ -84,11 +84,11 @@ configure_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
/* label */
w = dlg_find_by_id (h, sender->id - 1);
widget_disable (w, not_single);
send_message (w, WIDGET_DRAW, 0);
send_message (w, NULL, WIDGET_DRAW, 0, NULL);
/* input */
w = dlg_find_by_id (h, sender->id - 2);
widget_disable (w, not_single);
send_message (w, WIDGET_DRAW, 0);
send_message (w, NULL, WIDGET_DRAW, 0, NULL);
return MSG_HANDLED;
}

View File

@ -2498,7 +2498,7 @@ do_search (WPanel * panel, int c_code)
unselect_item (panel);
panel->selected = sel;
select_item (panel);
send_message (WIDGET (panel), WIDGET_DRAW, 0);
send_message (WIDGET (panel), NULL, WIDGET_DRAW, 0, NULL);
}
else if (c_code != KEY_BACKSPACE)
{
@ -3416,7 +3416,7 @@ panel_key (WPanel * panel, int key)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
panel_callback (Widget * w, widget_msg_t msg, int parm)
panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WPanel *panel = (WPanel *) w;
WButtonBar *bb;
@ -3490,7 +3490,7 @@ panel_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}
@ -3719,7 +3719,8 @@ panel_event (Gpm_Event * event, void *data)
finish:
if (panel->dirty)
send_message (w, WIDGET_DRAW, 0);
send_message (w, NULL, WIDGET_DRAW, 0, NULL);
return MOU_NORMAL;
}

View File

@ -1203,7 +1203,7 @@ tree_frame (Dlg_head * h, WTree * tree)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
tree_callback (Widget * w, widget_msg_t msg, int parm)
tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WTree *tree = (WTree *) w;
Dlg_head *h = w->owner;
@ -1260,7 +1260,7 @@ tree_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}

View File

@ -970,7 +970,7 @@ help_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *dat
if (sender == WIDGET (find_buttonbar (h)))
{
if (data != NULL)
return send_message (WIDGET (data), WIDGET_COMMAND, parm);
return send_message (WIDGET (data), NULL, WIDGET_COMMAND, parm, NULL);
return help_execute_cmd (parm);
}
return MSG_NOT_HANDLED;
@ -1022,7 +1022,7 @@ translate_file (char *filedata)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
md_callback (Widget * w, widget_msg_t msg, int parm)
md_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
@ -1031,7 +1031,7 @@ md_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}

View File

@ -573,7 +573,7 @@ mcview_adjust_size (Dlg_head * h)
/* --------------------------------------------------------------------------------------------- */
cb_ret_t
mcview_callback (Widget * w, widget_msg_t msg, int parm)
mcview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
mcview_t *view = (mcview_t *) w;
cb_ret_t i;
@ -626,7 +626,7 @@ mcview_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
default:
return default_proc (msg, parm);
return default_widget_callback (sender, msg, parm, data);
}
}
@ -651,7 +651,7 @@ mcview_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm,
if (sender == WIDGET (find_buttonbar (h)))
{
if (data != NULL)
return send_message (WIDGET (data), WIDGET_COMMAND, parm);
return send_message (WIDGET (data), NULL, WIDGET_COMMAND, parm, NULL);
view = (mcview_t *) find_widget_type (h, mcview_callback);
return mcview_execute_cmd (view, parm);

View File

@ -214,9 +214,8 @@ extern mcview_search_options_t mcview_search_options;
/*** declarations of public functions ************************************************************/
/* actions_cmd.c: */
cb_ret_t mcview_callback (Widget * w, widget_msg_t msg, int parm);
cb_ret_t mcview_dialog_callback (Dlg_head * h, Widget * sender,
dlg_msg_t msg, int parm, void *data);
cb_ret_t mcview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data);
cb_ret_t mcview_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data);
/* coord_cache.c: */
coord_cache_t *coord_cache_new (void);