summaryrefslogtreecommitdiff
path: root/riscos/textarea.c
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2006-07-12 15:07:37 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2006-07-12 15:07:37 +0000
commit82dd81b859cfefe2a5d3537f0145b35af2f10548 (patch)
tree68401c4099a1b79ba71391138cde3883b1a36b45 /riscos/textarea.c
parent1bf15f1e1516da8dca3bae60605cc291300a875b (diff)
downloadnetsurf-82dd81b859cfefe2a5d3537f0145b35af2f10548.tar.gz
netsurf-82dd81b859cfefe2a5d3537f0145b35af2f10548.tar.bz2
Pass on RETURN and ESCAPE events to WIMP icon.
svn path=/trunk/netsurf/; revision=2734
Diffstat (limited to 'riscos/textarea.c')
-rw-r--r--riscos/textarea.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/riscos/textarea.c b/riscos/textarea.c
index 57c61076f..2a8d84efa 100644
--- a/riscos/textarea.c
+++ b/riscos/textarea.c
@@ -57,6 +57,9 @@ static struct text_area {
// unsigned int selection_start; /**< Character index of sel start */
// unsigned int selection_end; /**< Character index of sel end */
+ wimp_w parent; /**< Parent window handle */
+ wimp_i icon; /**< Parent icon handle */
+
char *font_family; /**< Font family of text */
unsigned int font_size; /**< Font size (16ths/pt) */
int line_height; /**< Total height of a line, given font size */
@@ -127,7 +130,9 @@ uintptr_t textarea_create(wimp_w parent, wimp_i icon, unsigned int flags,
LOG(("malloc failed"));
return 0;
}
-
+
+ ret->parent = parent;
+ ret->icon = icon;
ret->magic = MAGIC;
ret->flags = flags;
ret->text = malloc(64);
@@ -934,7 +939,7 @@ bool textarea_key_press(wimp_key *key)
static int alphabet = 0;
static wchar_t wc = 0; /* buffer for UTF8 alphabet */
static int shift = 0;
-
+ wimp_key keypress;
struct text_area *ta;
wchar_t c = (wchar_t)key->c;
int t_alphabet;
@@ -1076,6 +1081,28 @@ bool textarea_key_press(wimp_key *key)
}
}
+ /** \todo handle command keys */
+ switch (c) {
+ /** pass on RETURN and ESCAPE to the parent icon */
+ case wimp_KEY_RETURN:
+ if (ta->flags & TEXTAREA_MULTILINE)
+ break;
+ /* fall through */
+ case wimp_KEY_ESCAPE:
+ keypress = *key;
+ keypress.w = ta->parent;
+ keypress.i = ta->icon;
+ keypress.index = 0; /* undefined if not in an icon */
+ error = xwimp_send_message_to_window(wimp_KEY_PRESSED,
+ (wimp_message*)&keypress, ta->parent,
+ ta->icon, 0);
+ if (error) {
+ LOG(("xwimp_send_message: 0x%x:%s",
+ error->errnum, error->errmess));
+ }
+ return true;
+ }
+
utf8_len = utf8_from_ucs4(c, utf8);
utf8[utf8_len] = '\0';
@@ -1094,9 +1121,6 @@ bool textarea_key_press(wimp_key *key)
textarea_redraw_internal(&update, true);
}
}
-
- /** \todo handle command keys */
-
return true;
}