mirror of https://github.com/MidnightCommander/mc
Change WDialog::data from void* to union{void*, int}
...to use data of type other than pointer w/o extra type cast. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
c5466cd494
commit
584fb9815c
|
@ -427,7 +427,7 @@ dlg_create (gboolean modal, int y1, int x1, int lines, int cols, widget_pos_flag
|
|||
new_d->colors = colors;
|
||||
new_d->help_ctx = help_ctx;
|
||||
new_d->compact = compact;
|
||||
new_d->data = NULL;
|
||||
new_d->data.p = NULL;
|
||||
|
||||
if (modal)
|
||||
{
|
||||
|
|
|
@ -69,10 +69,16 @@ struct WDialog
|
|||
int ret_value; /* Result of dlg_run() */
|
||||
|
||||
/* Internal variables */
|
||||
void *data; /* Data can be passed to dialog */
|
||||
char *event_group; /* Name of event group for this dialog */
|
||||
Widget *bg; /* WFrame or WBackground */
|
||||
|
||||
/* Data can be passed to dialog */
|
||||
union
|
||||
{
|
||||
void *p;
|
||||
int i;
|
||||
} data;
|
||||
|
||||
dlg_shortcut_str get_shortcut; /* Shortcut string */
|
||||
dlg_title_str get_title; /* useless for modal dialogs */
|
||||
};
|
||||
|
|
|
@ -73,10 +73,10 @@ history_dlg_reposition (WDialog * dlg_head)
|
|||
WRect r;
|
||||
|
||||
/* guard checks */
|
||||
if ((dlg_head == NULL) || (dlg_head->data == NULL))
|
||||
if (dlg_head == NULL || dlg_head->data.p == NULL)
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
data = (history_dlg_data *) dlg_head->data;
|
||||
data = (history_dlg_data *) dlg_head->data.p;
|
||||
|
||||
y = data->y;
|
||||
he = data->count + 2;
|
||||
|
@ -227,7 +227,7 @@ history_show (history_descriptor_t * hd)
|
|||
query_dlg =
|
||||
dlg_create (TRUE, 0, 0, 4, 4, WPOS_KEEP_DEFAULT, TRUE, dialog_colors, history_dlg_callback,
|
||||
NULL, "[History-query]", _("History"));
|
||||
query_dlg->data = &hist_data;
|
||||
query_dlg->data.p = &hist_data;
|
||||
|
||||
/* this call makes list stick to all sides of dialog, effectively make
|
||||
it be resized with dialog */
|
||||
|
|
|
@ -189,7 +189,7 @@ skin_dlg_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
|
|||
case MSG_RESIZE:
|
||||
{
|
||||
WDialog *d = DIALOG (w);
|
||||
const WRect *wd = &WIDGET (d->data)->rect;
|
||||
const WRect *wd = &WIDGET (d->data.p)->rect;
|
||||
WRect r = w->rect;
|
||||
|
||||
r.y = wd->y + (wd->lines - r.lines) / 2;
|
||||
|
@ -221,7 +221,7 @@ sel_skin_button (WButton * button, int action)
|
|||
dlg_create (TRUE, 0, 0, 13, 24, WPOS_KEEP_DEFAULT, TRUE, dialog_colors, skin_dlg_callback,
|
||||
NULL, "[Appearance]", _("Skins"));
|
||||
/* use Appearance dialog for positioning */
|
||||
skin_dlg->data = WIDGET (button)->owner;
|
||||
skin_dlg->data.p = WIDGET (button)->owner;
|
||||
|
||||
/* set dialog location before all */
|
||||
send_message (skin_dlg, NULL, MSG_RESIZE, 0, NULL);
|
||||
|
|
Loading…
Reference in New Issue