mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-23 23:09:39 +03:00
For now selection clear and selection copy are handled by the bw. Select all is only handled by the bw if nothing has claimed input. This stops the crash when select all is used in textarea.
TODO: The special keys should not be handled by the bw, they should be handled by the content with focus.
This commit is contained in:
parent
4aadb5237a
commit
131b4cdda1
@ -127,18 +127,8 @@ bool browser_window_key_press(struct browser_window *bw, uint32_t key)
|
||||
|
||||
assert(bw->window != NULL);
|
||||
|
||||
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 that take effect wherever the caret is positioned */
|
||||
/* safe keys that can be handled whether input claimed or not */
|
||||
switch (key) {
|
||||
case KEY_SELECT_ALL:
|
||||
selection_select_all(bw->cur_sel);
|
||||
return true;
|
||||
|
||||
case KEY_COPY_SELECTION:
|
||||
gui_copy_to_clipboard(bw->cur_sel);
|
||||
return true;
|
||||
@ -157,6 +147,19 @@ 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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user