summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/box.c5
-rw-r--r--render/form.c5
-rw-r--r--render/form.h7
3 files changed, 5 insertions, 12 deletions
diff --git a/render/box.c b/render/box.c
index 656b9923f..d763ed8a1 100644
--- a/render/box.c
+++ b/render/box.c
@@ -1134,10 +1134,7 @@ struct box_result box_input(xmlNode *n, struct box_status *status,
gadget->type = GADGET_CHECKBOX;
if ((s = (char *) xmlGetProp(n, (const xmlChar *) "checked"))) {
- if (gadget->type == GADGET_CHECKBOX)
- gadget->data.checkbox.selected = -1;
- else
- gadget->data.radio.selected = -1;
+ gadget->selected = true;
xmlFree(s);
}
diff --git a/render/form.c b/render/form.c
index a9714b78d..6b1b247df 100644
--- a/render/form.c
+++ b/render/form.c
@@ -43,6 +43,7 @@ struct form_control *form_new_control(form_control_type type)
control->disabled = false;
control->form = 0;
control->box = 0;
+ control->selected = false;
control->prev = 0;
control->next = 0;
return control;
@@ -124,9 +125,9 @@ struct form_successful_control *form_successful_controls(struct form *form,
continue;
/* ignore checkboxes and radio buttons which aren't selected */
- if (control->type == GADGET_CHECKBOX && !control->data.checkbox.selected)
+ if (control->type == GADGET_CHECKBOX && !control->selected)
continue;
- if (control->type == GADGET_RADIO && !control->data.radio.selected)
+ if (control->type == GADGET_RADIO && !control->selected)
continue;
/* select */
diff --git a/render/form.h b/render/form.h
index 48801f9a9..2de0e38e5 100644
--- a/render/form.h
+++ b/render/form.h
@@ -60,6 +60,7 @@ struct form_control {
struct box *caret_text_box;
int caret_char_offset;
unsigned int maxlength;
+ bool selected;
union {
struct {
int mx, my;
@@ -72,12 +73,6 @@ struct form_control {
/** Currently selected item, if num_selected == 1. */
struct form_option *current;
} select;
- struct {
- int selected;
- } checkbox;
- struct {
- int selected;
- } radio;
} data;
struct form_control *prev; /**< Previous control in this form */
struct form_control *next; /**< Next control in this form. */