summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAdrian Lees <adrian@aemulor.com>2009-02-01 02:19:01 +0000
committerAdrian Lees <adrian@aemulor.com>2009-02-01 02:19:01 +0000
commitf46dd787188b662af08588414f4d2efc08220eae (patch)
tree847bc67c795304633a027f2ae0d07681411a0179 /desktop
parent4cf69357612dd4cd92e7af7ec32180412a21d1d7 (diff)
downloadnetsurf-f46dd787188b662af08588414f4d2efc08220eae.tar.gz
netsurf-f46dd787188b662af08588414f4d2efc08220eae.tar.bz2
Next batch of menu changes; clarify some key presses
svn path=/trunk/netsurf/; revision=6327
Diffstat (limited to 'desktop')
-rw-r--r--desktop/textinput.c32
-rw-r--r--desktop/textinput.h14
2 files changed, 30 insertions, 16 deletions
diff --git a/desktop/textinput.c b/desktop/textinput.c
index e48aafd70..2e41c35a2 100644
--- a/desktop/textinput.c
+++ b/desktop/textinput.c
@@ -467,8 +467,8 @@ bool browser_window_textarea_callback(struct browser_window *bw,
reflow = true;
break;
- case 10:
- case 13: /* paragraph break */
+ case KEY_NL:
+ case KEY_CR: /* paragraph break */
if (selection_exists) {
/* If we have a selection, then delete it,
* so it's replaced by the break */
@@ -486,7 +486,7 @@ bool browser_window_textarea_callback(struct browser_window *bw,
reflow = true;
break;
- case 21: /* Ctrl + U */
+ case KEY_CUT_LINE:
{
struct box *start_box = line_start(text_box);
struct box *end_box = line_end(text_box);
@@ -503,7 +503,7 @@ bool browser_window_textarea_callback(struct browser_window *bw,
}
break;
- case 22: /* Ctrl + V */
+ case KEY_PASTE:
gui_paste_from_clipboard(bw->window,
box_x + inline_container->x +
text_box->x + pixel_offset,
@@ -512,7 +512,7 @@ bool browser_window_textarea_callback(struct browser_window *bw,
/* screen updated and caret repositioned already */
return true;
- case 24: /* Ctrl + X */
+ case KEY_CUT_SELECTION:
{
size_t start_idx, end_idx;
struct box *start_box =
@@ -953,7 +953,7 @@ bool browser_window_input_callback(struct browser_window *bw,
}
break;
- case 9: /* Tab */
+ case KEY_TAB:
{
struct form_control *next_input;
/* Find next text entry field that is actually
@@ -976,15 +976,15 @@ bool browser_window_input_callback(struct browser_window *bw,
}
break;
- case 10:
- case 13: /* Return/Enter hit */
+ case KEY_NL:
+ case KEY_CR: /* Return/Enter hit */
selection_clear(bw->sel, true);
if (form)
browser_form_submit(bw, bw, form, 0);
return true;
- case 11: /* Shift + Tab */
+ case KEY_SHIFT_TAB:
{
struct form_control *prev_input;
/* Find previous text entry field that is actually
@@ -1007,7 +1007,7 @@ bool browser_window_input_callback(struct browser_window *bw,
}
break;
- case 21: /* Ctrl + U */
+ case KEY_CUT_LINE:
/* Clear the selection, if one exists */
if (selection_exists)
selection_clear(bw->sel, false);
@@ -1019,7 +1019,7 @@ bool browser_window_input_callback(struct browser_window *bw,
changed = true;
break;
- case 22: /* Ctrl + V */
+ case KEY_PASTE:
gui_paste_from_clipboard(bw->window,
box_x + input->children->x + text_box->x + pixel_offset,
box_y + input->children->y + text_box->y);
@@ -1027,7 +1027,7 @@ bool browser_window_input_callback(struct browser_window *bw,
/* screen updated and caret repositioned already */
return true;
- case 24: /* Ctrl + X */
+ case KEY_CUT_SELECTION:
{
size_t start_idx, end_idx;
struct box *start_box =
@@ -1232,19 +1232,19 @@ bool browser_window_key_press(struct browser_window *bw, uint32_t key)
{
/* keys that take effect wherever the caret is positioned */
switch (key) {
- case 1: /* Ctrl + A */
+ case KEY_SELECT_ALL:
selection_select_all(bw->sel);
return true;
- case 3: /* Ctrl + C */
+ case KEY_COPY_SELECTION:
gui_copy_to_clipboard(bw->sel);
return true;
- case 26: /* Ctrl + Z */
+ case KEY_CLEAR_SELECTION:
selection_clear(bw->sel, true);
return true;
- case 27: /** Escape */
+ case KEY_ESCAPE:
if (selection_defined(bw->sel)) {
selection_clear(bw->sel, true);
return true;
diff --git a/desktop/textinput.h b/desktop/textinput.h
index 3e2bec5d9..fb4d98b90 100644
--- a/desktop/textinput.h
+++ b/desktop/textinput.h
@@ -34,9 +34,23 @@ struct box;
enum input_key {
+ KEY_SELECT_ALL = 1,
+ KEY_COPY_SELECTION = 3,
+
KEY_DELETE_LEFT = 8,
KEY_TAB = 9,
+ KEY_NL = 10,
+ KEY_SHIFT_TAB = 11,
+ KEY_CR = 13,
+
+ KEY_CUT_LINE = 21,
+ KEY_PASTE = 22,
+ KEY_CUT_SELECTION = 24,
+ KEY_CLEAR_SELECTION = 26,
+
+ KEY_ESCAPE = 27,
+
/* cursor movement keys */
KEY_LEFT = 28,
KEY_RIGHT,