diff options
Diffstat (limited to 'desktop/textinput.c')
-rw-r--r-- | desktop/textinput.c | 25 |
1 files changed, 11 insertions, 14 deletions
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; } |