summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'desktop')
-rw-r--r--desktop/textarea.c11
-rw-r--r--desktop/textarea.h5
-rw-r--r--desktop/tree.c6
3 files changed, 12 insertions, 10 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c
index a048058f5..3fe284497 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -948,14 +948,15 @@ static bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse,
/* exported interface, documented in textarea.h */
-struct textarea *textarea_create(const textarea_setup *setup,
+struct textarea *textarea_create(const textarea_flags flags,
+ const textarea_setup *setup,
textarea_client_callback callback, void *data)
{
struct textarea *ret;
/* Sanity check flags */
- assert(!(setup->flags & TEXTAREA_MULTILINE &&
- setup->flags & TEXTAREA_PASSWORD));
+ assert(!(flags & TEXTAREA_MULTILINE &&
+ flags & TEXTAREA_PASSWORD));
if (callback == NULL) {
LOG(("no callback provided"));
@@ -971,7 +972,7 @@ struct textarea *textarea_create(const textarea_setup *setup,
ret->callback = callback;
ret->data = data;
- ret->flags = setup->flags;
+ ret->flags = flags;
ret->vis_width = setup->width;
ret->vis_height = setup->height;
@@ -1008,7 +1009,7 @@ struct textarea *textarea_create(const textarea_setup *setup,
ret->text.len = 1;
ret->text.utf8_len = 0;
- if (setup->flags & TEXTAREA_PASSWORD) {
+ if (flags & TEXTAREA_PASSWORD) {
ret->password.data = malloc(64);
if (ret->password.data == NULL) {
LOG(("malloc failed"));
diff --git a/desktop/textarea.h b/desktop/textarea.h
index d8e720bae..c54b08345 100644
--- a/desktop/textarea.h
+++ b/desktop/textarea.h
@@ -70,8 +70,6 @@ struct textarea_msg {
};
typedef struct textarea_setup {
- textarea_flags flags; /**< Setup flags */
-
int width; /**< Textarea width */
int height; /**< Textarea height */
@@ -105,7 +103,8 @@ typedef void(*textarea_client_callback)(void *data, struct textarea_msg *msg);
* \param data user specified data which will be passed to callbacks
* \return Opaque handle for textarea or 0 on error
*/
-struct textarea *textarea_create(const textarea_setup *setup,
+struct textarea *textarea_create(const textarea_flags flags,
+ const textarea_setup *setup,
textarea_client_callback callback, void *data);
/**
diff --git a/desktop/tree.c b/desktop/tree.c
index 959b9870a..4201de03b 100644
--- a/desktop/tree.c
+++ b/desktop/tree.c
@@ -2946,6 +2946,7 @@ void tree_start_edit(struct tree *tree, struct node_element *element)
struct node *parent;
int width, height;
textarea_setup ta_setup;
+ textarea_flags ta_flags;
assert(tree != NULL);
assert(element != NULL);
@@ -2972,7 +2973,8 @@ void tree_start_edit(struct tree *tree, struct node_element *element)
tree->ta_height = height;
- ta_setup.flags = TEXTAREA_INTERNAL_CARET;
+ ta_flags = TEXTAREA_INTERNAL_CARET;
+
ta_setup.width = width;
ta_setup.height = tree->ta_height;
ta_setup.pad_top = 0;
@@ -2987,7 +2989,7 @@ void tree_start_edit(struct tree *tree, struct node_element *element)
ta_setup.text.foreground = 0x000000;
ta_setup.text.background = 0xffffff;
- tree->textarea = textarea_create(&ta_setup,
+ tree->textarea = textarea_create(ta_flags, &ta_setup,
tree_textarea_callback, tree);
if (tree->textarea == NULL) {
tree_stop_edit(tree, false);