diff --git a/config.c b/config.c index 01d58abd..c4c932a9 100644 --- a/config.c +++ b/config.c @@ -16,7 +16,7 @@ #define HOST_BOX_TITLE "Host Name (or IP address)" #define PORT_BOX_TITLE "Port" -void conf_radiobutton_handler(union control *ctrl, dlgparam *dlg, +void conf_radiobutton_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { int button; @@ -44,7 +44,7 @@ void conf_radiobutton_handler(union control *ctrl, dlgparam *dlg, } } -void conf_radiobutton_bool_handler(union control *ctrl, dlgparam *dlg, +void conf_radiobutton_bool_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { int button; @@ -72,7 +72,7 @@ void conf_radiobutton_bool_handler(union control *ctrl, dlgparam *dlg, } #define CHECKBOX_INVERT (1<<30) -void conf_checkbox_handler(union control *ctrl, dlgparam *dlg, +void conf_checkbox_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { int key; @@ -104,7 +104,7 @@ void conf_checkbox_handler(union control *ctrl, dlgparam *dlg, } } -void conf_editbox_handler(union control *ctrl, dlgparam *dlg, +void conf_editbox_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { /* @@ -153,7 +153,7 @@ void conf_editbox_handler(union control *ctrl, dlgparam *dlg, } } -void conf_filesel_handler(union control *ctrl, dlgparam *dlg, +void conf_filesel_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { int key = ctrl->fileselect.context.i; @@ -169,7 +169,7 @@ void conf_filesel_handler(union control *ctrl, dlgparam *dlg, } } -void conf_fontsel_handler(union control *ctrl, dlgparam *dlg, +void conf_fontsel_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { int key = ctrl->fontselect.context.i; @@ -185,7 +185,7 @@ void conf_fontsel_handler(union control *ctrl, dlgparam *dlg, } } -static void config_host_handler(union control *ctrl, dlgparam *dlg, +static void config_host_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -217,7 +217,7 @@ static void config_host_handler(union control *ctrl, dlgparam *dlg, } } -static void config_port_handler(union control *ctrl, dlgparam *dlg, +static void config_port_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -258,7 +258,7 @@ static void config_port_handler(union control *ctrl, dlgparam *dlg, } struct hostport { - union control *host, *port, *protradio, *protlist; + dlgcontrol *host, *port, *protradio, *protlist; bool mid_refresh; }; @@ -269,7 +269,7 @@ struct hostport { * and refreshes both host and port boxes when switching to/from the * serial backend. */ -static void config_protocols_handler(union control *ctrl, dlgparam *dlg, +static void config_protocols_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -422,7 +422,7 @@ static void config_protocols_handler(union control *ctrl, dlgparam *dlg, } } -static void loggingbuttons_handler(union control *ctrl, dlgparam *dlg, +static void loggingbuttons_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { int button; @@ -451,7 +451,7 @@ static void loggingbuttons_handler(union control *ctrl, dlgparam *dlg, } } -static void numeric_keypad_handler(union control *ctrl, dlgparam *dlg, +static void numeric_keypad_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { int button; @@ -482,7 +482,7 @@ static void numeric_keypad_handler(union control *ctrl, dlgparam *dlg, } } -static void cipherlist_handler(union control *ctrl, dlgparam *dlg, +static void cipherlist_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -528,7 +528,7 @@ static void cipherlist_handler(union control *ctrl, dlgparam *dlg, } #ifndef NO_GSSAPI -static void gsslist_handler(union control *ctrl, dlgparam *dlg, +static void gsslist_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -555,7 +555,7 @@ static void gsslist_handler(union control *ctrl, dlgparam *dlg, } #endif -static void kexlist_handler(union control *ctrl, dlgparam *dlg, +static void kexlist_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -601,7 +601,7 @@ static void kexlist_handler(union control *ctrl, dlgparam *dlg, } } -static void hklist_handler(union control *ctrl, dlgparam *dlg, +static void hklist_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -645,7 +645,7 @@ static void hklist_handler(union control *ctrl, dlgparam *dlg, } } -static void printerbox_handler(union control *ctrl, dlgparam *dlg, +static void printerbox_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -681,7 +681,7 @@ static void printerbox_handler(union control *ctrl, dlgparam *dlg, } } -static void codepage_handler(union control *ctrl, dlgparam *dlg, +static void codepage_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -705,7 +705,7 @@ static void codepage_handler(union control *ctrl, dlgparam *dlg, } } -static void sshbug_handler(union control *ctrl, dlgparam *dlg, +static void sshbug_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -738,7 +738,7 @@ static void sshbug_handler(union control *ctrl, dlgparam *dlg, } } -static void sshbug_handler_manual_only(union control *ctrl, dlgparam *dlg, +static void sshbug_handler_manual_only(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { /* @@ -770,8 +770,8 @@ static void sshbug_handler_manual_only(union control *ctrl, dlgparam *dlg, } struct sessionsaver_data { - union control *editbox, *listbox, *loadbutton, *savebutton, *delbutton; - union control *okbutton, *cancelbutton; + dlgcontrol *editbox, *listbox, *loadbutton, *savebutton, *delbutton; + dlgcontrol *okbutton, *cancelbutton; struct sesslist sesslist; bool midsession; char *savedsession; /* the current contents of ssd->editbox */ @@ -813,7 +813,7 @@ static bool load_selected_session( return true; } -static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, +static void sessionsaver_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -951,10 +951,10 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, } struct charclass_data { - union control *listbox, *editbox, *button; + dlgcontrol *listbox, *editbox, *button; }; -static void charclass_handler(union control *ctrl, dlgparam *dlg, +static void charclass_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -992,7 +992,7 @@ static void charclass_handler(union control *ctrl, dlgparam *dlg, } struct colour_data { - union control *listbox, *redit, *gedit, *bedit, *button; + dlgcontrol *listbox, *redit, *gedit, *bedit, *button; }; /* Array of the user-visible colour names defined in the list macro in @@ -1003,7 +1003,7 @@ static const char *const colours[] = { #undef CONF_COLOUR_NAME_DECL }; -static void colour_handler(union control *ctrl, dlgparam *dlg, +static void colour_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -1109,10 +1109,10 @@ static void colour_handler(union control *ctrl, dlgparam *dlg, } struct ttymodes_data { - union control *valradio, *valbox, *setbutton, *listbox; + dlgcontrol *valradio, *valbox, *setbutton, *listbox; }; -static void ttymodes_handler(union control *ctrl, dlgparam *dlg, +static void ttymodes_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -1194,10 +1194,10 @@ static void ttymodes_handler(union control *ctrl, dlgparam *dlg, } struct environ_data { - union control *varbox, *valbox, *addbutton, *rembutton, *listbox; + dlgcontrol *varbox, *valbox, *addbutton, *rembutton, *listbox; }; -static void environ_handler(union control *ctrl, dlgparam *dlg, +static void environ_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -1266,14 +1266,14 @@ static void environ_handler(union control *ctrl, dlgparam *dlg, } struct portfwd_data { - union control *addbutton, *rembutton, *listbox; - union control *sourcebox, *destbox, *direction; + dlgcontrol *addbutton, *rembutton, *listbox; + dlgcontrol *sourcebox, *destbox, *direction; #ifndef NO_IPV6 - union control *addressfamily; + dlgcontrol *addressfamily; #endif }; -static void portfwd_handler(union control *ctrl, dlgparam *dlg, +static void portfwd_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -1434,10 +1434,10 @@ static void portfwd_handler(union control *ctrl, dlgparam *dlg, } struct manual_hostkey_data { - union control *addbutton, *rembutton, *listbox, *keybox; + dlgcontrol *addbutton, *rembutton, *listbox, *keybox; }; -static void manual_hostkey_handler(union control *ctrl, dlgparam *dlg, +static void manual_hostkey_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -1500,7 +1500,7 @@ static void manual_hostkey_handler(union control *ctrl, dlgparam *dlg, } } -static void clipboard_selector_handler(union control *ctrl, dlgparam *dlg, +static void clipboard_selector_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -1601,7 +1601,7 @@ static void clipboard_control(struct controlset *s, const char *label, #endif } -static void serial_parity_handler(union control *ctrl, dlgparam *dlg, +static void serial_parity_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { static const struct { @@ -1656,7 +1656,7 @@ static void serial_parity_handler(union control *ctrl, dlgparam *dlg, } } -static void serial_flow_handler(union control *ctrl, dlgparam *dlg, +static void serial_flow_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { static const struct { @@ -1709,7 +1709,7 @@ static void serial_flow_handler(union control *ctrl, dlgparam *dlg, } } -void proxy_type_handler(union control *ctrl, dlgparam *dlg, +void proxy_type_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { Conf *conf = (Conf *)data; @@ -1763,7 +1763,7 @@ void proxy_type_handler(union control *ctrl, dlgparam *dlg, } } -static void host_ca_button_handler(union control *ctrl, dlgparam *dp, +static void host_ca_button_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { if (event == EVENT_ACTION) @@ -1782,7 +1782,7 @@ void setup_config_box(struct controlbox *b, bool midsession, struct environ_data *ed; struct portfwd_data *pfd; struct manual_hostkey_data *mh; - union control *c; + dlgcontrol *c; bool resize_forbidden = false; char *str; @@ -3318,11 +3318,11 @@ void setup_config_box(struct controlbox *b, bool midsession, } struct ca_state { - union control *ca_name_edit; - union control *ca_reclist; - union control *ca_pubkey_edit; - union control *ca_wclist; - union control *ca_wc_edit; + dlgcontrol *ca_name_edit; + dlgcontrol *ca_reclist; + dlgcontrol *ca_pubkey_edit; + dlgcontrol *ca_wclist; + dlgcontrol *ca_wc_edit; char *name, *pubkey, *wc; tree234 *ca_names; /* stores plain 'char *' */ tree234 *host_wcs; /* stores plain 'char *' */ @@ -3416,14 +3416,14 @@ static void ca_load_selected_record(struct ca_state *st, dlgparam *dp) dlg_refresh(st->ca_wclist, dp); } -static void ca_ok_handler(union control *ctrl, dlgparam *dp, +static void ca_ok_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { if (event == EVENT_ACTION) dlg_end(dp, 0); } -static void ca_name_handler(union control *ctrl, dlgparam *dp, +static void ca_name_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { struct ca_state *st = (struct ca_state *)ctrl->generic.context.p; @@ -3444,7 +3444,7 @@ static void ca_name_handler(union control *ctrl, dlgparam *dp, } } -static void ca_reclist_handler(union control *ctrl, dlgparam *dp, +static void ca_reclist_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { struct ca_state *st = (struct ca_state *)ctrl->generic.context.p; @@ -3461,7 +3461,7 @@ static void ca_reclist_handler(union control *ctrl, dlgparam *dp, } } -static void ca_load_handler(union control *ctrl, dlgparam *dp, +static void ca_load_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { struct ca_state *st = (struct ca_state *)ctrl->generic.context.p; @@ -3470,7 +3470,7 @@ static void ca_load_handler(union control *ctrl, dlgparam *dp, } } -static void ca_save_handler(union control *ctrl, dlgparam *dp, +static void ca_save_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { struct ca_state *st = (struct ca_state *)ctrl->generic.context.p; @@ -3496,7 +3496,7 @@ static void ca_save_handler(union control *ctrl, dlgparam *dp, } } -static void ca_delete_handler(union control *ctrl, dlgparam *dp, +static void ca_delete_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { struct ca_state *st = (struct ca_state *)ctrl->generic.context.p; @@ -3523,7 +3523,7 @@ static void ca_delete_handler(union control *ctrl, dlgparam *dp, } } -static void ca_pubkey_handler(union control *ctrl, dlgparam *dp, +static void ca_pubkey_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { struct ca_state *st = (struct ca_state *)ctrl->generic.context.p; @@ -3535,7 +3535,7 @@ static void ca_pubkey_handler(union control *ctrl, dlgparam *dp, } } -static void ca_wclist_handler(union control *ctrl, dlgparam *dp, +static void ca_wclist_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { struct ca_state *st = (struct ca_state *)ctrl->generic.context.p; @@ -3549,7 +3549,7 @@ static void ca_wclist_handler(union control *ctrl, dlgparam *dp, } } -static void ca_wc_edit_handler(union control *ctrl, dlgparam *dp, +static void ca_wc_edit_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { struct ca_state *st = (struct ca_state *)ctrl->generic.context.p; @@ -3561,7 +3561,7 @@ static void ca_wc_edit_handler(union control *ctrl, dlgparam *dp, } } -static void ca_wc_add_handler(union control *ctrl, dlgparam *dp, +static void ca_wc_add_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { struct ca_state *st = (struct ca_state *)ctrl->generic.context.p; @@ -3582,7 +3582,7 @@ static void ca_wc_add_handler(union control *ctrl, dlgparam *dp, } } -static void ca_wc_rem_handler(union control *ctrl, dlgparam *dp, +static void ca_wc_rem_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { struct ca_state *st = (struct ca_state *)ctrl->generic.context.p; @@ -3608,7 +3608,7 @@ static void ca_wc_rem_handler(union control *ctrl, dlgparam *dp, void setup_ca_config_box(struct controlbox *b) { struct controlset *s; - union control *c; + dlgcontrol *c; /* Internal state for manipulating the host CA system */ struct ca_state *st = (struct ca_state *)ctrl_alloc_with_free( diff --git a/defs.h b/defs.h index d9f2e355..063c05cd 100644 --- a/defs.h +++ b/defs.h @@ -172,6 +172,7 @@ typedef struct NTRUKeyPair NTRUKeyPair; typedef struct NTRUEncodeSchedule NTRUEncodeSchedule; typedef struct dlgparam dlgparam; +typedef union control dlgcontrol; typedef struct settings_w settings_w; typedef struct settings_r settings_r; diff --git a/dialog.c b/dialog.c index 7409daaa..79ef7a10 100644 --- a/dialog.c +++ b/dialog.c @@ -204,11 +204,11 @@ void *ctrl_alloc(struct controlbox *b, size_t size) return ctrl_alloc_with_free(b, size, ctrl_default_free); } -static union control *ctrl_new(struct controlset *s, int type, - intorptr helpctx, handler_fn handler, - intorptr context) +static dlgcontrol *ctrl_new(struct controlset *s, int type, + intorptr helpctx, handler_fn handler, + intorptr context) { - union control *c = snew(union control); + dlgcontrol *c = snew(dlgcontrol); sgrowarray(s->ctrls, s->ctrlsize, s->ncontrols); s->ctrls[s->ncontrols++] = c; /* @@ -226,9 +226,9 @@ static union control *ctrl_new(struct controlset *s, int type, } /* `ncolumns' is followed by that many percentages, as integers. */ -union control *ctrl_columns(struct controlset *s, int ncolumns, ...) +dlgcontrol *ctrl_columns(struct controlset *s, int ncolumns, ...) { - union control *c = ctrl_new(s, CTRL_COLUMNS, P(NULL), NULL, P(NULL)); + dlgcontrol *c = ctrl_new(s, CTRL_COLUMNS, P(NULL), NULL, P(NULL)); assert(s->ncolumns == 1 || ncolumns == 1); c->columns.ncols = ncolumns; s->ncolumns = ncolumns; @@ -246,12 +246,12 @@ union control *ctrl_columns(struct controlset *s, int ncolumns, ...) return c; } -union control *ctrl_editbox(struct controlset *s, const char *label, - char shortcut, int percentage, - intorptr helpctx, handler_fn handler, - intorptr context, intorptr context2) +dlgcontrol *ctrl_editbox(struct controlset *s, const char *label, + char shortcut, int percentage, + intorptr helpctx, handler_fn handler, + intorptr context, intorptr context2) { - union control *c = ctrl_new(s, CTRL_EDITBOX, helpctx, handler, context); + dlgcontrol *c = ctrl_new(s, CTRL_EDITBOX, helpctx, handler, context); c->editbox.label = label ? dupstr(label) : NULL; c->editbox.shortcut = shortcut; c->editbox.percentwidth = percentage; @@ -261,12 +261,12 @@ union control *ctrl_editbox(struct controlset *s, const char *label, return c; } -union control *ctrl_combobox(struct controlset *s, const char *label, - char shortcut, int percentage, - intorptr helpctx, handler_fn handler, - intorptr context, intorptr context2) +dlgcontrol *ctrl_combobox(struct controlset *s, const char *label, + char shortcut, int percentage, + intorptr helpctx, handler_fn handler, + intorptr context, intorptr context2) { - union control *c = ctrl_new(s, CTRL_EDITBOX, helpctx, handler, context); + dlgcontrol *c = ctrl_new(s, CTRL_EDITBOX, helpctx, handler, context); c->editbox.label = label ? dupstr(label) : NULL; c->editbox.shortcut = shortcut; c->editbox.percentwidth = percentage; @@ -282,13 +282,13 @@ union control *ctrl_combobox(struct controlset *s, const char *label, * title is expected to be followed by a shortcut _iff_ `shortcut' * is NO_SHORTCUT. */ -union control *ctrl_radiobuttons(struct controlset *s, const char *label, - char shortcut, int ncolumns, intorptr helpctx, - handler_fn handler, intorptr context, ...) +dlgcontrol *ctrl_radiobuttons(struct controlset *s, const char *label, + char shortcut, int ncolumns, intorptr helpctx, + handler_fn handler, intorptr context, ...) { va_list ap; int i; - union control *c = ctrl_new(s, CTRL_RADIO, helpctx, handler, context); + dlgcontrol *c = ctrl_new(s, CTRL_RADIO, helpctx, handler, context); c->radio.label = label ? dupstr(label) : NULL; c->radio.shortcut = shortcut; c->radio.ncolumns = ncolumns; @@ -328,11 +328,11 @@ union control *ctrl_radiobuttons(struct controlset *s, const char *label, return c; } -union control *ctrl_pushbutton(struct controlset *s, const char *label, - char shortcut, intorptr helpctx, - handler_fn handler, intorptr context) +dlgcontrol *ctrl_pushbutton(struct controlset *s, const char *label, + char shortcut, intorptr helpctx, + handler_fn handler, intorptr context) { - union control *c = ctrl_new(s, CTRL_BUTTON, helpctx, handler, context); + dlgcontrol *c = ctrl_new(s, CTRL_BUTTON, helpctx, handler, context); c->button.label = label ? dupstr(label) : NULL; c->button.shortcut = shortcut; c->button.isdefault = false; @@ -340,11 +340,11 @@ union control *ctrl_pushbutton(struct controlset *s, const char *label, return c; } -union control *ctrl_listbox(struct controlset *s, const char *label, - char shortcut, intorptr helpctx, - handler_fn handler, intorptr context) +dlgcontrol *ctrl_listbox(struct controlset *s, const char *label, + char shortcut, intorptr helpctx, + handler_fn handler, intorptr context) { - union control *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context); + dlgcontrol *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context); c->listbox.label = label ? dupstr(label) : NULL; c->listbox.shortcut = shortcut; c->listbox.height = 5; /* *shrug* a plausible default */ @@ -357,11 +357,11 @@ union control *ctrl_listbox(struct controlset *s, const char *label, return c; } -union control *ctrl_droplist(struct controlset *s, const char *label, - char shortcut, int percentage, intorptr helpctx, - handler_fn handler, intorptr context) +dlgcontrol *ctrl_droplist(struct controlset *s, const char *label, + char shortcut, int percentage, intorptr helpctx, + handler_fn handler, intorptr context) { - union control *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context); + dlgcontrol *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context); c->listbox.label = label ? dupstr(label) : NULL; c->listbox.shortcut = shortcut; c->listbox.height = 0; /* means it's a drop-down list */ @@ -374,11 +374,11 @@ union control *ctrl_droplist(struct controlset *s, const char *label, return c; } -union control *ctrl_draglist(struct controlset *s, const char *label, - char shortcut, intorptr helpctx, - handler_fn handler, intorptr context) +dlgcontrol *ctrl_draglist(struct controlset *s, const char *label, + char shortcut, intorptr helpctx, + handler_fn handler, intorptr context) { - union control *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context); + dlgcontrol *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context); c->listbox.label = label ? dupstr(label) : NULL; c->listbox.shortcut = shortcut; c->listbox.height = 5; /* *shrug* a plausible default */ @@ -391,12 +391,12 @@ union control *ctrl_draglist(struct controlset *s, const char *label, return c; } -union control *ctrl_filesel(struct controlset *s, const char *label, - char shortcut, const char *filter, bool write, - const char *title, intorptr helpctx, - handler_fn handler, intorptr context) +dlgcontrol *ctrl_filesel(struct controlset *s, const char *label, + char shortcut, const char *filter, bool write, + const char *title, intorptr helpctx, + handler_fn handler, intorptr context) { - union control *c = ctrl_new(s, CTRL_FILESELECT, helpctx, handler, context); + dlgcontrol *c = ctrl_new(s, CTRL_FILESELECT, helpctx, handler, context); c->fileselect.label = label ? dupstr(label) : NULL; c->fileselect.shortcut = shortcut; c->fileselect.filter = filter; @@ -405,42 +405,42 @@ union control *ctrl_filesel(struct controlset *s, const char *label, return c; } -union control *ctrl_fontsel(struct controlset *s, const char *label, - char shortcut, intorptr helpctx, - handler_fn handler, intorptr context) +dlgcontrol *ctrl_fontsel(struct controlset *s, const char *label, + char shortcut, intorptr helpctx, + handler_fn handler, intorptr context) { - union control *c = ctrl_new(s, CTRL_FONTSELECT, helpctx, handler, context); + dlgcontrol *c = ctrl_new(s, CTRL_FONTSELECT, helpctx, handler, context); c->fontselect.label = label ? dupstr(label) : NULL; c->fontselect.shortcut = shortcut; return c; } -union control *ctrl_tabdelay(struct controlset *s, union control *ctrl) +dlgcontrol *ctrl_tabdelay(struct controlset *s, dlgcontrol *ctrl) { - union control *c = ctrl_new(s, CTRL_TABDELAY, P(NULL), NULL, P(NULL)); + dlgcontrol *c = ctrl_new(s, CTRL_TABDELAY, P(NULL), NULL, P(NULL)); c->tabdelay.ctrl = ctrl; return c; } -union control *ctrl_text(struct controlset *s, const char *text, - intorptr helpctx) +dlgcontrol *ctrl_text(struct controlset *s, const char *text, + intorptr helpctx) { - union control *c = ctrl_new(s, CTRL_TEXT, helpctx, NULL, P(NULL)); + dlgcontrol *c = ctrl_new(s, CTRL_TEXT, helpctx, NULL, P(NULL)); c->text.label = dupstr(text); return c; } -union control *ctrl_checkbox(struct controlset *s, const char *label, - char shortcut, intorptr helpctx, - handler_fn handler, intorptr context) +dlgcontrol *ctrl_checkbox(struct controlset *s, const char *label, + char shortcut, intorptr helpctx, + handler_fn handler, intorptr context) { - union control *c = ctrl_new(s, CTRL_CHECKBOX, helpctx, handler, context); + dlgcontrol *c = ctrl_new(s, CTRL_CHECKBOX, helpctx, handler, context); c->checkbox.label = label ? dupstr(label) : NULL; c->checkbox.shortcut = shortcut; return c; } -void ctrl_free(union control *ctrl) +void ctrl_free(dlgcontrol *ctrl) { int i; diff --git a/dialog.h b/dialog.h index 86ebfc20..28d0916c 100644 --- a/dialog.h +++ b/dialog.h @@ -73,8 +73,6 @@ PREFIX intorptr P(void *p) { intorptr ret; ret.p = p; return ret; } #define COLUMN_START(field) ( (field) & 0xFFFF ) #define COLUMN_SPAN(field) ( (((field) >> 16) & 0xFFFF) + 1 ) -union control; - /* * The number of event types is being deliberately kept small, on * the grounds that not all platforms might be able to report a @@ -103,7 +101,7 @@ enum { EVENT_SELCHANGE, EVENT_CALLBACK }; -typedef void (*handler_fn)(union control *ctrl, dlgparam *dp, +typedef void (*handler_fn)(dlgcontrol *ctrl, dlgparam *dp, void *data, int event); #define STANDARD_PREFIX \ @@ -114,7 +112,7 @@ typedef void (*handler_fn)(union control *ctrl, dlgparam *dp, handler_fn handler; \ intorptr context; \ intorptr helpctx; \ - union control *align_next_to + dlgcontrol *align_next_to union control { /* @@ -191,11 +189,11 @@ union control { * instantiated, the first one is already there to be referred * to. */ - union control *align_next_to; + dlgcontrol *align_next_to; } generic; struct { STANDARD_PREFIX; - union control *ctrl; + dlgcontrol *ctrl; } tabdelay; struct { STANDARD_PREFIX; @@ -422,7 +420,7 @@ union control { #undef STANDARD_PREFIX /* - * `controlset' is a container holding an array of `union control' + * `controlset' is a container holding an array of `dlgcontrol' * structures, together with a panel name and a title for the whole * set. In Windows and any similar-looking GUI, each `controlset' * in the config will be a container box within a panel. @@ -435,9 +433,9 @@ struct controlset { char *boxname; /* internal short name of controlset */ char *boxtitle; /* title of container box */ int ncolumns; /* current no. of columns at bottom */ - size_t ncontrols; /* number of `union control' in array */ + size_t ncontrols; /* number of `dlgcontrol' in array */ size_t ctrlsize; /* allocated size of array */ - union control **ctrls; /* actual array */ + dlgcontrol **ctrls; /* actual array */ }; typedef void (*ctrl_freefn_t)(void *); /* used by ctrl_alloc_with_free */ @@ -471,7 +469,7 @@ struct controlset *ctrl_getset(struct controlbox *, const char *path, const char *name, const char *boxtitle); void ctrl_free_set(struct controlset *); -void ctrl_free(union control *); +void ctrl_free(dlgcontrol *); /* * This function works like `malloc', but the memory it returns @@ -490,73 +488,73 @@ void *ctrl_alloc_with_free(struct controlbox *b, size_t size, ctrl_freefn_t freefunc); /* - * Individual routines to create `union control' structures in a controlset. + * Individual routines to create `dlgcontrol' structures in a controlset. * * Most of these routines allow the most common fields to be set * directly, and put default values in the rest. Each one returns a - * pointer to the `union control' it created, so that final tweaks + * pointer to the `dlgcontrol' it created, so that final tweaks * can be made. */ /* `ncolumns' is followed by that many percentages, as integers. */ -union control *ctrl_columns(struct controlset *, int ncolumns, ...); -union control *ctrl_editbox(struct controlset *, const char *label, - char shortcut, int percentage, intorptr helpctx, - handler_fn handler, - intorptr context, intorptr context2); -union control *ctrl_combobox(struct controlset *, const char *label, - char shortcut, int percentage, intorptr helpctx, - handler_fn handler, - intorptr context, intorptr context2); +dlgcontrol *ctrl_columns(struct controlset *, int ncolumns, ...); +dlgcontrol *ctrl_editbox(struct controlset *, const char *label, + char shortcut, int percentage, intorptr helpctx, + handler_fn handler, + intorptr context, intorptr context2); +dlgcontrol *ctrl_combobox(struct controlset *, const char *label, + char shortcut, int percentage, intorptr helpctx, + handler_fn handler, + intorptr context, intorptr context2); /* * `ncolumns' is followed by (alternately) radio button titles and * intorptrs, until a NULL in place of a title string is seen. Each * title is expected to be followed by a shortcut _iff_ `shortcut' * is NO_SHORTCUT. */ -union control *ctrl_radiobuttons(struct controlset *, const char *label, - char shortcut, int ncolumns, intorptr helpctx, - handler_fn handler, intorptr context, ...); -union control *ctrl_pushbutton(struct controlset *, const char *label, - char shortcut, intorptr helpctx, - handler_fn handler, intorptr context); -union control *ctrl_listbox(struct controlset *, const char *label, +dlgcontrol *ctrl_radiobuttons(struct controlset *, const char *label, + char shortcut, int ncolumns, intorptr helpctx, + handler_fn handler, intorptr context, ...); +dlgcontrol *ctrl_pushbutton(struct controlset *, const char *label, char shortcut, intorptr helpctx, handler_fn handler, intorptr context); -union control *ctrl_droplist(struct controlset *, const char *label, - char shortcut, int percentage, intorptr helpctx, - handler_fn handler, intorptr context); -union control *ctrl_draglist(struct controlset *, const char *label, - char shortcut, intorptr helpctx, - handler_fn handler, intorptr context); -union control *ctrl_filesel(struct controlset *, const char *label, - char shortcut, const char *filter, bool write, - const char *title, intorptr helpctx, - handler_fn handler, intorptr context); -union control *ctrl_fontsel(struct controlset *, const char *label, - char shortcut, intorptr helpctx, - handler_fn handler, intorptr context); -union control *ctrl_text(struct controlset *, const char *text, - intorptr helpctx); -union control *ctrl_checkbox(struct controlset *, const char *label, - char shortcut, intorptr helpctx, - handler_fn handler, intorptr context); -union control *ctrl_tabdelay(struct controlset *, union control *); +dlgcontrol *ctrl_listbox(struct controlset *, const char *label, + char shortcut, intorptr helpctx, + handler_fn handler, intorptr context); +dlgcontrol *ctrl_droplist(struct controlset *, const char *label, + char shortcut, int percentage, intorptr helpctx, + handler_fn handler, intorptr context); +dlgcontrol *ctrl_draglist(struct controlset *, const char *label, + char shortcut, intorptr helpctx, + handler_fn handler, intorptr context); +dlgcontrol *ctrl_filesel(struct controlset *, const char *label, + char shortcut, const char *filter, bool write, + const char *title, intorptr helpctx, + handler_fn handler, intorptr context); +dlgcontrol *ctrl_fontsel(struct controlset *, const char *label, + char shortcut, intorptr helpctx, + handler_fn handler, intorptr context); +dlgcontrol *ctrl_text(struct controlset *, const char *text, + intorptr helpctx); +dlgcontrol *ctrl_checkbox(struct controlset *, const char *label, + char shortcut, intorptr helpctx, + handler_fn handler, intorptr context); +dlgcontrol *ctrl_tabdelay(struct controlset *, dlgcontrol *); /* * Routines the platform-independent dialog code can call to read * and write the values of controls. */ -void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int whichbutton); -int dlg_radiobutton_get(union control *ctrl, dlgparam *dp); -void dlg_checkbox_set(union control *ctrl, dlgparam *dp, bool checked); -bool dlg_checkbox_get(union control *ctrl, dlgparam *dp); -void dlg_editbox_set(union control *ctrl, dlgparam *dp, char const *text); -char *dlg_editbox_get(union control *ctrl, dlgparam *dp); /* result must be freed by caller */ +void dlg_radiobutton_set(dlgcontrol *ctrl, dlgparam *dp, int whichbutton); +int dlg_radiobutton_get(dlgcontrol *ctrl, dlgparam *dp); +void dlg_checkbox_set(dlgcontrol *ctrl, dlgparam *dp, bool checked); +bool dlg_checkbox_get(dlgcontrol *ctrl, dlgparam *dp); +void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text); +char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp); /* result must be freed by caller */ /* The `listbox' functions can also apply to combo boxes. */ -void dlg_listbox_clear(union control *ctrl, dlgparam *dp); -void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index); -void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text); +void dlg_listbox_clear(dlgcontrol *ctrl, dlgparam *dp); +void dlg_listbox_del(dlgcontrol *ctrl, dlgparam *dp, int index); +void dlg_listbox_add(dlgcontrol *ctrl, dlgparam *dp, char const *text); /* * Each listbox entry may have a numeric id associated with it. * Note that some front ends only permit a string to be stored at @@ -564,44 +562,44 @@ void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text); * strings in any listbox then you MUST not assign them different * IDs and expect to get meaningful results back. */ -void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp, +void dlg_listbox_addwithid(dlgcontrol *ctrl, dlgparam *dp, char const *text, int id); -int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index); +int dlg_listbox_getid(dlgcontrol *ctrl, dlgparam *dp, int index); /* dlg_listbox_index returns <0 if no single element is selected. */ -int dlg_listbox_index(union control *ctrl, dlgparam *dp); -bool dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index); -void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index); -void dlg_text_set(union control *ctrl, dlgparam *dp, char const *text); -void dlg_filesel_set(union control *ctrl, dlgparam *dp, Filename *fn); -Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp); -void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fn); -FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp); +int dlg_listbox_index(dlgcontrol *ctrl, dlgparam *dp); +bool dlg_listbox_issel(dlgcontrol *ctrl, dlgparam *dp, int index); +void dlg_listbox_select(dlgcontrol *ctrl, dlgparam *dp, int index); +void dlg_text_set(dlgcontrol *ctrl, dlgparam *dp, char const *text); +void dlg_filesel_set(dlgcontrol *ctrl, dlgparam *dp, Filename *fn); +Filename *dlg_filesel_get(dlgcontrol *ctrl, dlgparam *dp); +void dlg_fontsel_set(dlgcontrol *ctrl, dlgparam *dp, FontSpec *fn); +FontSpec *dlg_fontsel_get(dlgcontrol *ctrl, dlgparam *dp); /* * Bracketing a large set of updates in these two functions will * cause the front end (if possible) to delay updating the screen * until it's all complete, thus avoiding flicker. */ -void dlg_update_start(union control *ctrl, dlgparam *dp); -void dlg_update_done(union control *ctrl, dlgparam *dp); +void dlg_update_start(dlgcontrol *ctrl, dlgparam *dp); +void dlg_update_done(dlgcontrol *ctrl, dlgparam *dp); /* * Set input focus into a particular control. */ -void dlg_set_focus(union control *ctrl, dlgparam *dp); +void dlg_set_focus(dlgcontrol *ctrl, dlgparam *dp); /* * Change the label text on a control. */ -void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text); +void dlg_label_change(dlgcontrol *ctrl, dlgparam *dp, char const *text); /* * Return the `ctrl' structure for the most recent control that had * the input focus apart from the one mentioned. This is NOT * GUARANTEED to work on all platforms, so don't base any critical * functionality on it! */ -union control *dlg_last_focused(union control *ctrl, dlgparam *dp); +dlgcontrol *dlg_last_focused(dlgcontrol *ctrl, dlgparam *dp); /* * Find out whether a particular control is currently visible. */ -bool dlg_is_visible(union control *ctrl, dlgparam *dp); +bool dlg_is_visible(dlgcontrol *ctrl, dlgparam *dp); /* * During event processing, you might well want to give an error * indication to the user. dlg_beep() is a quick and easy generic @@ -629,9 +627,9 @@ void dlg_end(dlgparam *dp, int value); * dlg_coloursel_start() accepts an RGB triple which is used to * initialise the colour selector to its starting value. */ -void dlg_coloursel_start(union control *ctrl, dlgparam *dp, +void dlg_coloursel_start(dlgcontrol *ctrl, dlgparam *dp, int r, int g, int b); -bool dlg_coloursel_results(union control *ctrl, dlgparam *dp, +bool dlg_coloursel_results(dlgcontrol *ctrl, dlgparam *dp, int *r, int *g, int *b); /* @@ -643,7 +641,7 @@ bool dlg_coloursel_results(union control *ctrl, dlgparam *dp, * If `ctrl' is NULL, _all_ controls in the dialog get refreshed * (for loading or saving entire sets of settings). */ -void dlg_refresh(union control *ctrl, dlgparam *dp); +void dlg_refresh(dlgcontrol *ctrl, dlgparam *dp); /* * Standard helper functions for reading a controlbox structure. diff --git a/putty.h b/putty.h index 5ceedbe1..fd5eea44 100644 --- a/putty.h +++ b/putty.h @@ -2570,17 +2570,16 @@ void cmdline_error(const char *, ...) PRINTF_LIKE(1, 2); * Exports from config.c. */ struct controlbox; -union control; -void conf_radiobutton_handler(union control *ctrl, dlgparam *dlg, +void conf_radiobutton_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event); #define CHECKBOX_INVERT (1<<30) -void conf_checkbox_handler(union control *ctrl, dlgparam *dlg, +void conf_checkbox_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event); -void conf_editbox_handler(union control *ctrl, dlgparam *dlg, +void conf_editbox_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event); -void conf_filesel_handler(union control *ctrl, dlgparam *dlg, +void conf_filesel_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event); -void conf_fontsel_handler(union control *ctrl, dlgparam *dlg, +void conf_fontsel_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event); void setup_config_box(struct controlbox *b, bool midsession, @@ -2593,7 +2592,7 @@ void show_ca_config_box(dlgparam *dlg); /* Visible outside config.c so that platforms can use it to recognise * the proxy type control */ -void proxy_type_handler(union control *ctrl, dlgparam *dlg, +void proxy_type_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event); /* And then they'll set this flag in its generic.context.i */ #define PROXY_UI_FLAG_LOCAL 1 /* has a local proxy */ diff --git a/test/fuzzterm.c b/test/fuzzterm.c index faea2dd7..8d20bef9 100644 --- a/test/fuzzterm.c +++ b/test/fuzzterm.c @@ -134,44 +134,44 @@ void timer_change_notify(unsigned long next) { } /* needed by config.c */ -void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int whichbutton) { } -int dlg_radiobutton_get(union control *ctrl, dlgparam *dp) { return 0; } -void dlg_checkbox_set(union control *ctrl, dlgparam *dp, bool checked) { } -bool dlg_checkbox_get(union control *ctrl, dlgparam *dp) { return false; } -void dlg_editbox_set(union control *ctrl, dlgparam *dp, char const *text) { } -char *dlg_editbox_get(union control *ctrl, dlgparam *dp) +void dlg_radiobutton_set(dlgcontrol *ctrl, dlgparam *dp, int whichbutton) { } +int dlg_radiobutton_get(dlgcontrol *ctrl, dlgparam *dp) { return 0; } +void dlg_checkbox_set(dlgcontrol *ctrl, dlgparam *dp, bool checked) { } +bool dlg_checkbox_get(dlgcontrol *ctrl, dlgparam *dp) { return false; } +void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text) { } +char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp) { return dupstr("moo"); } -void dlg_listbox_clear(union control *ctrl, dlgparam *dp) { } -void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index) { } -void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text) { } -void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp, +void dlg_listbox_clear(dlgcontrol *ctrl, dlgparam *dp) { } +void dlg_listbox_del(dlgcontrol *ctrl, dlgparam *dp, int index) { } +void dlg_listbox_add(dlgcontrol *ctrl, dlgparam *dp, char const *text) { } +void dlg_listbox_addwithid(dlgcontrol *ctrl, dlgparam *dp, char const *text, int id) { } -int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index) +int dlg_listbox_getid(dlgcontrol *ctrl, dlgparam *dp, int index) { return 0; } -int dlg_listbox_index(union control *ctrl, dlgparam *dp) { return -1; } -bool dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index) +int dlg_listbox_index(dlgcontrol *ctrl, dlgparam *dp) { return -1; } +bool dlg_listbox_issel(dlgcontrol *ctrl, dlgparam *dp, int index) { return false; } -void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index) { } -void dlg_text_set(union control *ctrl, dlgparam *dp, char const *text) { } -void dlg_filesel_set(union control *ctrl, dlgparam *dp, Filename *fn) { } -Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp) { return NULL; } -void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fn) { } -FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp) { return NULL; } -void dlg_update_start(union control *ctrl, dlgparam *dp) { } -void dlg_update_done(union control *ctrl, dlgparam *dp) { } -void dlg_set_focus(union control *ctrl, dlgparam *dp) { } -void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text) { } -union control *dlg_last_focused(union control *ctrl, dlgparam *dp) +void dlg_listbox_select(dlgcontrol *ctrl, dlgparam *dp, int index) { } +void dlg_text_set(dlgcontrol *ctrl, dlgparam *dp, char const *text) { } +void dlg_filesel_set(dlgcontrol *ctrl, dlgparam *dp, Filename *fn) { } +Filename *dlg_filesel_get(dlgcontrol *ctrl, dlgparam *dp) { return NULL; } +void dlg_fontsel_set(dlgcontrol *ctrl, dlgparam *dp, FontSpec *fn) { } +FontSpec *dlg_fontsel_get(dlgcontrol *ctrl, dlgparam *dp) { return NULL; } +void dlg_update_start(dlgcontrol *ctrl, dlgparam *dp) { } +void dlg_update_done(dlgcontrol *ctrl, dlgparam *dp) { } +void dlg_set_focus(dlgcontrol *ctrl, dlgparam *dp) { } +void dlg_label_change(dlgcontrol *ctrl, dlgparam *dp, char const *text) { } +dlgcontrol *dlg_last_focused(dlgcontrol *ctrl, dlgparam *dp) { return NULL; } void dlg_beep(dlgparam *dp) { } void dlg_error_msg(dlgparam *dp, const char *msg) { } void dlg_end(dlgparam *dp, int value) { } -void dlg_coloursel_start(union control *ctrl, dlgparam *dp, +void dlg_coloursel_start(dlgcontrol *ctrl, dlgparam *dp, int r, int g, int b) { } -bool dlg_coloursel_results(union control *ctrl, dlgparam *dp, +bool dlg_coloursel_results(dlgcontrol *ctrl, dlgparam *dp, int *r, int *g, int *b) { return false; } -void dlg_refresh(union control *ctrl, dlgparam *dp) { } -bool dlg_is_visible(union control *ctrl, dlgparam *dp) { return false; } +void dlg_refresh(dlgcontrol *ctrl, dlgparam *dp) { } +bool dlg_is_visible(dlgcontrol *ctrl, dlgparam *dp) { return false; } const int ngsslibs = 0; const char *const gsslibnames[0] = { }; diff --git a/unix/config-gtk.c b/unix/config-gtk.c index 52e6e181..5f3d7e0b 100644 --- a/unix/config-gtk.c +++ b/unix/config-gtk.c @@ -10,7 +10,7 @@ #include "dialog.h" #include "storage.h" -static void about_handler(union control *ctrl, dlgparam *dlg, +static void about_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { if (event == EVENT_ACTION) { @@ -21,7 +21,7 @@ static void about_handler(union control *ctrl, dlgparam *dlg, void gtk_setup_config_box(struct controlbox *b, bool midsession, void *win) { struct controlset *s, *s2; - union control *c; + dlgcontrol *c; int i; if (!midsession) { @@ -59,7 +59,7 @@ void gtk_setup_config_box(struct controlbox *b, bool midsession, void *win) if (i < s->ncontrols-2) { c = s->ctrls[s->ncontrols-1]; memmove(s->ctrls+i+2, s->ctrls+i+1, - (s->ncontrols-i-2)*sizeof(union control *)); + (s->ncontrols-i-2)*sizeof(dlgcontrol *)); s->ctrls[i+1] = c; } break; diff --git a/unix/config-unix.c b/unix/config-unix.c index d832a18b..43d43bbd 100644 --- a/unix/config-unix.c +++ b/unix/config-unix.c @@ -13,7 +13,7 @@ void unix_setup_config_box(struct controlbox *b, bool midsession, int protocol) { struct controlset *s; - union control *c; + dlgcontrol *c; /* * The Conf structure contains two Unix-specific elements which diff --git a/unix/dialog.c b/unix/dialog.c index edd08314..08572297 100644 --- a/unix/dialog.c +++ b/unix/dialog.c @@ -51,7 +51,7 @@ struct Shortcuts { struct selparam; struct uctrl { - union control *ctrl; + dlgcontrol *ctrl; GtkWidget *toplevel; GtkWidget **buttons; int nbuttons; /* for radio buttons */ GtkWidget *entry; /* for editbox, filesel, fontsel */ @@ -88,7 +88,7 @@ struct dlgparam { int flags; struct Shortcuts *shortcuts; GtkWidget *window, *cancelbutton; - union control *currfocus, *lastfocus; + dlgcontrol *currfocus, *lastfocus; #if !GTK_CHECK_VERSION(2,0,0) GtkWidget *currtreeitem, **treeitems; int ntreeitems; @@ -166,7 +166,7 @@ static int uctrl_cmp_byctrl(void *av, void *bv) static int uctrl_cmp_byctrl_find(void *av, void *bv) { - union control *a = (union control *)av; + dlgcontrol *a = (dlgcontrol *)av; struct uctrl *b = (struct uctrl *)bv; if (a < b->ctrl) return -1; @@ -236,7 +236,7 @@ static void dlg_add_uctrl(struct dlgparam *dp, struct uctrl *uc) add234(dp->bywidget, uc); } -static struct uctrl *dlg_find_byctrl(struct dlgparam *dp, union control *ctrl) +static struct uctrl *dlg_find_byctrl(struct dlgparam *dp, dlgcontrol *ctrl) { if (!dp->byctrl) return NULL; @@ -257,7 +257,7 @@ static struct uctrl *dlg_find_bywidget(struct dlgparam *dp, GtkWidget *w) return ret; } -union control *dlg_last_focused(union control *ctrl, dlgparam *dp) +dlgcontrol *dlg_last_focused(dlgcontrol *ctrl, dlgparam *dp) { if (dp->currfocus != ctrl) return dp->currfocus; @@ -265,7 +265,7 @@ union control *dlg_last_focused(union control *ctrl, dlgparam *dp) return dp->lastfocus; } -void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int which) +void dlg_radiobutton_set(dlgcontrol *ctrl, dlgparam *dp, int which) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); assert(uc->ctrl->generic.type == CTRL_RADIO); @@ -273,7 +273,7 @@ void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int which) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(uc->buttons[which]), true); } -int dlg_radiobutton_get(union control *ctrl, dlgparam *dp) +int dlg_radiobutton_get(dlgcontrol *ctrl, dlgparam *dp) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); int i; @@ -286,21 +286,21 @@ int dlg_radiobutton_get(union control *ctrl, dlgparam *dp) return 0; /* got to return something */ } -void dlg_checkbox_set(union control *ctrl, dlgparam *dp, bool checked) +void dlg_checkbox_set(dlgcontrol *ctrl, dlgparam *dp, bool checked) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); assert(uc->ctrl->generic.type == CTRL_CHECKBOX); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(uc->toplevel), checked); } -bool dlg_checkbox_get(union control *ctrl, dlgparam *dp) +bool dlg_checkbox_get(dlgcontrol *ctrl, dlgparam *dp) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); assert(uc->ctrl->generic.type == CTRL_CHECKBOX); return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(uc->toplevel)); } -void dlg_editbox_set(union control *ctrl, dlgparam *dp, char const *text) +void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); GtkWidget *entry; @@ -338,7 +338,7 @@ void dlg_editbox_set(union control *ctrl, dlgparam *dp, char const *text) sfree(tmpstring); } -char *dlg_editbox_get(union control *ctrl, dlgparam *dp) +char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); assert(uc->ctrl->generic.type == CTRL_EDITBOX); @@ -367,7 +367,7 @@ static void container_remove_and_destroy(GtkWidget *w, gpointer data) #endif /* The `listbox' functions can also apply to combo boxes. */ -void dlg_listbox_clear(union control *ctrl, dlgparam *dp) +void dlg_listbox_clear(dlgcontrol *ctrl, dlgparam *dp) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -395,7 +395,7 @@ void dlg_listbox_clear(union control *ctrl, dlgparam *dp) unreachable("bad control type in listbox_clear"); } -void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index) +void dlg_listbox_del(dlgcontrol *ctrl, dlgparam *dp, int index) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -429,7 +429,7 @@ void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index) unreachable("bad control type in listbox_del"); } -void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text) +void dlg_listbox_add(dlgcontrol *ctrl, dlgparam *dp, char const *text) { dlg_listbox_addwithid(ctrl, dp, text, 0); } @@ -441,7 +441,7 @@ void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text) * strings in any listbox then you MUST not assign them different * IDs and expect to get meaningful results back. */ -void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp, +void dlg_listbox_addwithid(dlgcontrol *ctrl, dlgparam *dp, char const *text, int id) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -589,7 +589,7 @@ void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp, dp->flags &= ~FLAG_UPDATING_COMBO_LIST; } -int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index) +int dlg_listbox_getid(dlgcontrol *ctrl, dlgparam *dp, int index) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -628,7 +628,7 @@ int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index) } /* dlg_listbox_index returns <0 if no single element is selected. */ -int dlg_listbox_index(union control *ctrl, dlgparam *dp) +int dlg_listbox_index(dlgcontrol *ctrl, dlgparam *dp) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -712,7 +712,7 @@ int dlg_listbox_index(union control *ctrl, dlgparam *dp) return -1; /* placate dataflow analysis */ } -bool dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index) +bool dlg_listbox_issel(dlgcontrol *ctrl, dlgparam *dp, int index) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -769,7 +769,7 @@ bool dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index) return false; /* placate dataflow analysis */ } -void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index) +void dlg_listbox_select(dlgcontrol *ctrl, dlgparam *dp, int index) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -837,7 +837,7 @@ void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index) unreachable("bad control type in listbox_select"); } -void dlg_text_set(union control *ctrl, dlgparam *dp, char const *text) +void dlg_text_set(dlgcontrol *ctrl, dlgparam *dp, char const *text) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -847,7 +847,7 @@ void dlg_text_set(union control *ctrl, dlgparam *dp, char const *text) gtk_label_set_text(GTK_LABEL(uc->text), text); } -void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text) +void dlg_label_change(dlgcontrol *ctrl, dlgparam *dp, char const *text) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -885,7 +885,7 @@ void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text) } } -void dlg_filesel_set(union control *ctrl, dlgparam *dp, Filename *fn) +void dlg_filesel_set(dlgcontrol *ctrl, dlgparam *dp, Filename *fn) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); /* We must copy fn->path before passing it to gtk_entry_set_text. @@ -897,7 +897,7 @@ void dlg_filesel_set(union control *ctrl, dlgparam *dp, Filename *fn) sfree(duppath); } -Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp) +Filename *dlg_filesel_get(dlgcontrol *ctrl, dlgparam *dp) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); assert(uc->ctrl->generic.type == CTRL_FILESELECT); @@ -905,7 +905,7 @@ Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp) return filename_from_str(gtk_entry_get_text(GTK_ENTRY(uc->entry))); } -void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fs) +void dlg_fontsel_set(dlgcontrol *ctrl, dlgparam *dp, FontSpec *fs) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); /* We must copy fs->name before passing it to gtk_entry_set_text. @@ -917,7 +917,7 @@ void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fs) sfree(dupname); } -FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp) +FontSpec *dlg_fontsel_get(dlgcontrol *ctrl, dlgparam *dp) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); assert(uc->ctrl->generic.type == CTRL_FONTSELECT); @@ -930,7 +930,7 @@ FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp) * cause the front end (if possible) to delay updating the screen * until it's all complete, thus avoiding flicker. */ -void dlg_update_start(union control *ctrl, dlgparam *dp) +void dlg_update_start(dlgcontrol *ctrl, dlgparam *dp) { /* * Apparently we can't do this at all in GTK. GtkCList supports @@ -938,7 +938,7 @@ void dlg_update_start(union control *ctrl, dlgparam *dp) */ } -void dlg_update_done(union control *ctrl, dlgparam *dp) +void dlg_update_done(dlgcontrol *ctrl, dlgparam *dp) { /* * Apparently we can't do this at all in GTK. GtkCList supports @@ -946,7 +946,7 @@ void dlg_update_done(union control *ctrl, dlgparam *dp) */ } -void dlg_set_focus(union control *ctrl, dlgparam *dp) +void dlg_set_focus(dlgcontrol *ctrl, dlgparam *dp) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -1077,7 +1077,7 @@ void dlg_end(dlgparam *dp, int value) gtk_widget_destroy(dp->window); } -void dlg_refresh(union control *ctrl, dlgparam *dp) +void dlg_refresh(dlgcontrol *ctrl, dlgparam *dp) { struct uctrl *uc; @@ -1096,7 +1096,7 @@ void dlg_refresh(union control *ctrl, dlgparam *dp) } } -void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b) +void dlg_coloursel_start(dlgcontrol *ctrl, dlgparam *dp, int r, int g, int b) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); @@ -1181,7 +1181,7 @@ void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b) gtk_widget_show(coloursel); } -bool dlg_coloursel_results(union control *ctrl, dlgparam *dp, +bool dlg_coloursel_results(dlgcontrol *ctrl, dlgparam *dp, int *r, int *g, int *b) { if (dp->coloursel_result.ok) { @@ -1202,7 +1202,7 @@ static gboolean widget_focus(GtkWidget *widget, GdkEventFocus *event, { struct dlgparam *dp = (struct dlgparam *)data; struct uctrl *uc = dlg_find_bywidget(dp, widget); - union control *focus; + dlgcontrol *focus; if (uc && uc->ctrl) focus = uc->ctrl; @@ -1877,7 +1877,7 @@ GtkWidget *layout_ctrls( * and add them to the Columns. */ for (i = 0; i < s->ncontrols; i++) { - union control *ctrl = s->ctrls[i]; + dlgcontrol *ctrl = s->ctrls[i]; struct uctrl *uc; bool left = false; GtkWidget *w = NULL; @@ -2576,7 +2576,7 @@ static void treeitem_sel(GtkItem *item, gpointer data) } #endif -bool dlg_is_visible(union control *ctrl, dlgparam *dp) +bool dlg_is_visible(dlgcontrol *ctrl, dlgparam *dp) { struct uctrl *uc = dlg_find_byctrl(dp, ctrl); /* @@ -3283,7 +3283,7 @@ static void dlgparam_destroy(GtkWidget *widget, gpointer data) sfree(dp); } -static void messagebox_handler(union control *ctrl, dlgparam *dp, +static void messagebox_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { if (event == EVENT_ACTION) @@ -3312,7 +3312,7 @@ static GtkWidget *create_message_box_general( { GtkWidget *window, *w0, *w1; struct controlset *s0, *s1; - union control *c, *textctrl; + dlgcontrol *c, *textctrl; struct dlgparam *dp; struct Shortcuts scs; int i, index, ncols, min_type; @@ -3888,7 +3888,7 @@ struct eventlog_stuff { struct controlbox *eventbox; struct Shortcuts scs; struct dlgparam dp; - union control *listctrl; + dlgcontrol *listctrl; char **events_initial; char **events_circular; int ninitial, ncircular, circular_first; @@ -3905,13 +3905,13 @@ static void eventlog_destroy(GtkWidget *widget, gpointer data) dlg_cleanup(&es->dp); ctrl_free_box(es->eventbox); } -static void eventlog_ok_handler(union control *ctrl, dlgparam *dp, +static void eventlog_ok_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { if (event == EVENT_ACTION) dlg_end(dp, 0); } -static void eventlog_list_handler(union control *ctrl, dlgparam *dp, +static void eventlog_list_handler(dlgcontrol *ctrl, dlgparam *dp, void *data, int event) { eventlog_stuff *es = (eventlog_stuff *)data; @@ -4004,7 +4004,7 @@ void showeventlog(eventlog_stuff *es, void *parentwin) GtkWidget *window, *w0, *w1; GtkWidget *parent = GTK_WIDGET(parentwin); struct controlset *s0, *s1; - union control *c; + dlgcontrol *c; int index; char *title; diff --git a/windows/config.c b/windows/config.c index 17448260..4f6e6c5c 100644 --- a/windows/config.c +++ b/windows/config.c @@ -10,7 +10,7 @@ #include "dialog.h" #include "storage.h" -static void about_handler(union control *ctrl, dlgparam *dlg, +static void about_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { HWND *hwndp = (HWND *)ctrl->generic.context.p; @@ -20,7 +20,7 @@ static void about_handler(union control *ctrl, dlgparam *dlg, } } -static void help_handler(union control *ctrl, dlgparam *dlg, +static void help_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { HWND *hwndp = (HWND *)ctrl->generic.context.p; @@ -30,7 +30,7 @@ static void help_handler(union control *ctrl, dlgparam *dlg, } } -static void variable_pitch_handler(union control *ctrl, dlgparam *dlg, +static void variable_pitch_handler(dlgcontrol *ctrl, dlgparam *dlg, void *data, int event) { if (event == EVENT_REFRESH) { @@ -46,7 +46,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help, const struct BackendVtable *backvt; bool resize_forbidden = false; struct controlset *s; - union control *c; + dlgcontrol *c; char *str; if (!midsession) { @@ -91,7 +91,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help, if (i < s->ncontrols-2) { c = s->ctrls[s->ncontrols-1]; memmove(s->ctrls+i+2, s->ctrls+i+1, - (s->ncontrols-i-2)*sizeof(union control *)); + (s->ncontrols-i-2)*sizeof(dlgcontrol *)); s->ctrls[i+1] = c; } break; @@ -296,7 +296,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help, * up... */ c = s->ctrls[s->ncontrols-1]; /* this should be the new control */ - memmove(s->ctrls+1, s->ctrls, (s->ncontrols-1)*sizeof(union control *)); + memmove(s->ctrls+1, s->ctrls, (s->ncontrols-1)*sizeof(dlgcontrol *)); s->ctrls[0] = c; /* diff --git a/windows/controls.c b/windows/controls.c index 51d0921b..7543eb13 100644 --- a/windows/controls.c +++ b/windows/controls.c @@ -1250,7 +1250,7 @@ static int winctrl_cmp_byid(void *av, void *bv) } static int winctrl_cmp_byctrl_find(void *av, void *bv) { - union control *a = (union control *)av; + dlgcontrol *a = (dlgcontrol *)av; struct winctrl *b = (struct winctrl *)bv; if (a < b->ctrl) return -1; @@ -1310,7 +1310,7 @@ void winctrl_remove(struct winctrls *wc, struct winctrl *c) assert(ret == c); } -struct winctrl *winctrl_findbyctrl(struct winctrls *wc, union control *ctrl) +struct winctrl *winctrl_findbyctrl(struct winctrls *wc, dlgcontrol *ctrl) { return find234(wc->byctrl, ctrl, winctrl_cmp_byctrl_find); } @@ -1354,7 +1354,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, int ncols, colstart, colspan; struct ctlpos tabdelays[16]; - union control *tabdelayed[16]; + dlgcontrol *tabdelayed[16]; int ntabdelays; struct ctlpos pos; @@ -1402,7 +1402,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, /* Loop over each control in the controlset. */ for (i = 0; i < s->ncontrols; i++) { - union control *ctrl = s->ctrls[i]; + dlgcontrol *ctrl = s->ctrls[i]; /* * Generic processing that pertains to all control types. @@ -1761,7 +1761,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, endbox(cp); } -static void winctrl_set_focus(union control *ctrl, struct dlgparam *dp, +static void winctrl_set_focus(dlgcontrol *ctrl, struct dlgparam *dp, bool has_focus) { if (has_focus) { @@ -1774,7 +1774,7 @@ static void winctrl_set_focus(union control *ctrl, struct dlgparam *dp, } } -union control *dlg_last_focused(union control *ctrl, dlgparam *dp) +dlgcontrol *dlg_last_focused(dlgcontrol *ctrl, dlgparam *dp) { return dp->focused == ctrl ? dp->lastfocused : dp->focused; } @@ -1787,7 +1787,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg, WPARAM wParam, LPARAM lParam) { struct winctrl *c; - union control *ctrl; + dlgcontrol *ctrl; int i, id; bool ret; static UINT draglistmsg = WM_NULL; @@ -2107,7 +2107,7 @@ bool winctrl_context_help(struct dlgparam *dp, HWND hwnd, int id) * mechanism can call to access the dialog box entries. */ -static struct winctrl *dlg_findbyctrl(struct dlgparam *dp, union control *ctrl) +static struct winctrl *dlg_findbyctrl(struct dlgparam *dp, dlgcontrol *ctrl) { int i; @@ -2119,7 +2119,7 @@ static struct winctrl *dlg_findbyctrl(struct dlgparam *dp, union control *ctrl) return NULL; } -bool dlg_is_visible(union control *ctrl, dlgparam *dp) +bool dlg_is_visible(dlgcontrol *ctrl, dlgparam *dp) { /* * In this implementation of the dialog box, we physically @@ -2130,7 +2130,7 @@ bool dlg_is_visible(union control *ctrl, dlgparam *dp) return dlg_findbyctrl(dp, ctrl) != NULL; } -void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int whichbutton) +void dlg_radiobutton_set(dlgcontrol *ctrl, dlgparam *dp, int whichbutton) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); assert(c && c->ctrl->generic.type == CTRL_RADIO); @@ -2140,7 +2140,7 @@ void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int whichbutton) c->base_id + 1 + whichbutton); } -int dlg_radiobutton_get(union control *ctrl, dlgparam *dp) +int dlg_radiobutton_get(dlgcontrol *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); int i; @@ -2151,28 +2151,28 @@ int dlg_radiobutton_get(union control *ctrl, dlgparam *dp) unreachable("no radio button was checked"); } -void dlg_checkbox_set(union control *ctrl, dlgparam *dp, bool checked) +void dlg_checkbox_set(dlgcontrol *ctrl, dlgparam *dp, bool checked) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); assert(c && c->ctrl->generic.type == CTRL_CHECKBOX); CheckDlgButton(dp->hwnd, c->base_id, checked); } -bool dlg_checkbox_get(union control *ctrl, dlgparam *dp) +bool dlg_checkbox_get(dlgcontrol *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); assert(c && c->ctrl->generic.type == CTRL_CHECKBOX); return 0 != IsDlgButtonChecked(dp->hwnd, c->base_id); } -void dlg_editbox_set(union control *ctrl, dlgparam *dp, char const *text) +void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); assert(c && c->ctrl->generic.type == CTRL_EDITBOX); SetDlgItemText(dp->hwnd, c->base_id+1, text); } -char *dlg_editbox_get(union control *ctrl, dlgparam *dp) +char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); assert(c && c->ctrl->generic.type == CTRL_EDITBOX); @@ -2180,7 +2180,7 @@ char *dlg_editbox_get(union control *ctrl, dlgparam *dp) } /* The `listbox' functions can also apply to combo boxes. */ -void dlg_listbox_clear(union control *ctrl, dlgparam *dp) +void dlg_listbox_clear(dlgcontrol *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); int msg; @@ -2193,7 +2193,7 @@ void dlg_listbox_clear(union control *ctrl, dlgparam *dp) SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, 0); } -void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index) +void dlg_listbox_del(dlgcontrol *ctrl, dlgparam *dp, int index) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); int msg; @@ -2206,7 +2206,7 @@ void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index) SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0); } -void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text) +void dlg_listbox_add(dlgcontrol *ctrl, dlgparam *dp, char const *text) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); int msg; @@ -2226,7 +2226,7 @@ void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text) * strings in any listbox then you MUST not assign them different * IDs and expect to get meaningful results back. */ -void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp, +void dlg_listbox_addwithid(dlgcontrol *ctrl, dlgparam *dp, char const *text, int id) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); @@ -2243,7 +2243,7 @@ void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp, SendDlgItemMessage(dp->hwnd, c->base_id+1, msg2, index, (LPARAM)id); } -int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index) +int dlg_listbox_getid(dlgcontrol *ctrl, dlgparam *dp, int index) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); int msg; @@ -2254,7 +2254,7 @@ int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index) } /* dlg_listbox_index returns <0 if no single element is selected. */ -int dlg_listbox_index(union control *ctrl, dlgparam *dp) +int dlg_listbox_index(dlgcontrol *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); int msg, ret; @@ -2273,7 +2273,7 @@ int dlg_listbox_index(union control *ctrl, dlgparam *dp) return ret; } -bool dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index) +bool dlg_listbox_issel(dlgcontrol *ctrl, dlgparam *dp, int index) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); assert(c && c->ctrl->generic.type == CTRL_LISTBOX && @@ -2283,7 +2283,7 @@ bool dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index) SendDlgItemMessage(dp->hwnd, c->base_id+1, LB_GETSEL, index, 0); } -void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index) +void dlg_listbox_select(dlgcontrol *ctrl, dlgparam *dp, int index) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); int msg; @@ -2293,14 +2293,14 @@ void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index) SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0); } -void dlg_text_set(union control *ctrl, dlgparam *dp, char const *text) +void dlg_text_set(dlgcontrol *ctrl, dlgparam *dp, char const *text) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); assert(c && c->ctrl->generic.type == CTRL_TEXT); SetDlgItemText(dp->hwnd, c->base_id, text); } -void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text) +void dlg_label_change(dlgcontrol *ctrl, dlgparam *dp, char const *text) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); char *escaped = NULL; @@ -2345,14 +2345,14 @@ void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text) } } -void dlg_filesel_set(union control *ctrl, dlgparam *dp, Filename *fn) +void dlg_filesel_set(dlgcontrol *ctrl, dlgparam *dp, Filename *fn) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); assert(c && c->ctrl->generic.type == CTRL_FILESELECT); SetDlgItemText(dp->hwnd, c->base_id+1, fn->path); } -Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp) +Filename *dlg_filesel_get(dlgcontrol *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); char *tmp; @@ -2364,7 +2364,7 @@ Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp) return ret; } -void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fs) +void dlg_fontsel_set(dlgcontrol *ctrl, dlgparam *dp, FontSpec *fs) { char *buf, *boldstr; struct winctrl *c = dlg_findbyctrl(dp, ctrl); @@ -2386,7 +2386,7 @@ void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fs) dlg_auto_set_fixed_pitch_flag(dp); } -FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp) +FontSpec *dlg_fontsel_get(dlgcontrol *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); assert(c && c->ctrl->generic.type == CTRL_FONTSELECT); @@ -2398,7 +2398,7 @@ FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp) * cause the front end (if possible) to delay updating the screen * until it's all complete, thus avoiding flicker. */ -void dlg_update_start(union control *ctrl, dlgparam *dp) +void dlg_update_start(dlgcontrol *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); if (c && c->ctrl->generic.type == CTRL_LISTBOX) { @@ -2406,7 +2406,7 @@ void dlg_update_start(union control *ctrl, dlgparam *dp) } } -void dlg_update_done(union control *ctrl, dlgparam *dp) +void dlg_update_done(dlgcontrol *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); if (c && c->ctrl->generic.type == CTRL_LISTBOX) { @@ -2416,7 +2416,7 @@ void dlg_update_done(union control *ctrl, dlgparam *dp) } } -void dlg_set_focus(union control *ctrl, dlgparam *dp) +void dlg_set_focus(dlgcontrol *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); int id; @@ -2474,7 +2474,7 @@ void dlg_end(dlgparam *dp, int value) dp->endresult = value; } -void dlg_refresh(union control *ctrl, dlgparam *dp) +void dlg_refresh(dlgcontrol *ctrl, dlgparam *dp) { int i, j; struct winctrl *c; @@ -2501,7 +2501,7 @@ void dlg_refresh(union control *ctrl, dlgparam *dp) } } -void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b) +void dlg_coloursel_start(dlgcontrol *ctrl, dlgparam *dp, int r, int g, int b) { dp->coloursel_wanted = true; dp->coloursel_result.r = r; @@ -2509,7 +2509,7 @@ void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b) dp->coloursel_result.b = b; } -bool dlg_coloursel_results(union control *ctrl, dlgparam *dp, +bool dlg_coloursel_results(dlgcontrol *ctrl, dlgparam *dp, int *r, int *g, int *b) { if (dp->coloursel_result.ok) { diff --git a/windows/platform.h b/windows/platform.h index 25de278f..11103511 100644 --- a/windows/platform.h +++ b/windows/platform.h @@ -413,7 +413,7 @@ struct dlgparam { char *wintitle; /* title of actual window */ char *errtitle; /* title of error sub-messageboxes */ void *data; /* data to pass in refresh events */ - union control *focused, *lastfocused; /* which ctrl has focus now/before */ + dlgcontrol *focused, *lastfocused; /* which ctrl has focus now/before */ bool shortcuts[128]; /* track which shortcuts in use */ bool coloursel_wanted; /* has an event handler asked for * a colour selector? */ @@ -490,11 +490,11 @@ void dlg_set_fixed_pitch_flag(dlgparam *dlg, bool flag); #define MAX_SHORTCUTS_PER_CTRL 16 /* - * This structure is what's stored for each `union control' in the + * This structure is what's stored for each `dlgcontrol' in the * portable-dialog interface. */ struct winctrl { - union control *ctrl; + dlgcontrol *ctrl; /* * The control may have several components at the Windows * level, with different dialog IDs. To avoid needing N @@ -525,7 +525,7 @@ struct winctrl { }; /* * And this structure holds a set of the above, in two separate - * tree234s so that it can find an item by `union control' or by + * tree234s so that it can find an item by `dlgcontrol' or by * dialog ID. */ struct winctrls { @@ -538,7 +538,7 @@ void winctrl_init(struct winctrls *); void winctrl_cleanup(struct winctrls *); void winctrl_add(struct winctrls *, struct winctrl *); void winctrl_remove(struct winctrls *, struct winctrl *); -struct winctrl *winctrl_findbyctrl(struct winctrls *, union control *); +struct winctrl *winctrl_findbyctrl(struct winctrls *, dlgcontrol *); struct winctrl *winctrl_findbyid(struct winctrls *, int); struct winctrl *winctrl_findbyindex(struct winctrls *, int); void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,