From 762e1aad733c4d56edbb85c7b21b0951d8f759f2 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 6 Feb 2013 22:39:45 +0000 Subject: First pass at getting html forms to use textarea widget. (Input element types text & password, and textarea element.) Can edit and submit forms, but there are loads of issues. --- desktop/browser.h | 2 ++ desktop/textinput.c | 25 +++++++++++-------------- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'desktop') diff --git a/desktop/browser.h b/desktop/browser.h index f3c68fa09..1c7772d0d 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -57,6 +57,8 @@ typedef enum { DRAGGING_SCR_X, DRAGGING_SCR_Y, DRAGGING_CONTENT_SCROLLBAR, + DRAGGING_CONTENT_TEXTAREA_SCROLLBAR, + DRAGGING_CONTENT_TEXTAREA_SELECTION, DRAGGING_OTHER } browser_drag_type; diff --git a/desktop/textinput.c b/desktop/textinput.c index b4fda5eef..660708932 100644 --- a/desktop/textinput.c +++ b/desktop/textinput.c @@ -127,7 +127,13 @@ bool browser_window_key_press(struct browser_window *bw, uint32_t key) assert(bw->window != NULL); - /* safe keys that can be handled whether input claimed or not */ + if (focus->caret_callback) { + /* Pass keypress onto anything that has claimed input focus */ + return focus->caret_callback(focus, key, + focus->caret_p1, focus->caret_p2); + } + + /* TODO: pass these to content to deal with */ switch (key) { case KEY_COPY_SELECTION: selection_copy_to_clipboard(bw->cur_sel); @@ -137,6 +143,10 @@ bool browser_window_key_press(struct browser_window *bw, uint32_t key) selection_clear(bw->cur_sel, true); return true; + case KEY_SELECT_ALL: + selection_select_all(bw->cur_sel); + return true; + case KEY_ESCAPE: if (bw->cur_sel && selection_defined(bw->cur_sel)) { selection_clear(bw->cur_sel, true); @@ -147,19 +157,6 @@ bool browser_window_key_press(struct browser_window *bw, uint32_t key) return false; } - if (focus->caret_callback) { - /* Pass keypress onto anything that has claimed input focus */ - return focus->caret_callback(focus, key, - focus->caret_p1, focus->caret_p2); - } - - /* keys we can't handle here if cursor is in form */ - switch (key) { - case KEY_SELECT_ALL: - selection_select_all(bw->cur_sel); - return true; - } - return false; } -- cgit v1.2.3