summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2006-07-13 22:50:48 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2006-07-13 22:50:48 +0000
commit1decf851aaeb7b4b34f6a999884edee8bba3c0d6 (patch)
treeb5b1a699e5424b57277ffd3f2a1ee8a3eb052658
parent752634a8107f815aa76716b6d5ab5a78564afce3 (diff)
downloadnetsurf-1decf851aaeb7b4b34f6a999884edee8bba3c0d6.tar.gz
netsurf-1decf851aaeb7b4b34f6a999884edee8bba3c0d6.tar.bz2
Fix URL completion keypress handling
svn path=/trunk/netsurf/; revision=2748
-rw-r--r--riscos/url_complete.c24
-rw-r--r--riscos/url_complete.h3
2 files changed, 15 insertions, 12 deletions
diff --git a/riscos/url_complete.c b/riscos/url_complete.c
index e23d8cdbf..f0edcb8f6 100644
--- a/riscos/url_complete.c
+++ b/riscos/url_complete.c
@@ -14,6 +14,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <wchar.h>
#include "oslib/wimp.h"
#include "netsurf/content/urldb.h"
#include "netsurf/utils/log.h"
@@ -23,6 +24,7 @@
#include "netsurf/riscos/theme.h"
#include "netsurf/riscos/url_complete.h"
#include "netsurf/riscos/wimp.h"
+#include "netsurf/riscos/wimp_event.h"
#include "netsurf/utils/utils.h"
#define MAXIMUM_VISIBLE_LINES 7
@@ -76,10 +78,10 @@ void ro_gui_url_complete_start(struct gui_window *g)
* Handles a keypress for URL completion
*
* \param g the gui_window to update
- * \param key the key pressed
+ * \param key the key pressed (as UTF32 code or wimp key + bit31 set)
* \return true to indicate keypress handled, false otherwise
*/
-bool ro_gui_url_complete_keypress(struct gui_window *g, int key)
+bool ro_gui_url_complete_keypress(struct gui_window *g, wchar_t key)
{
wimp_window_state state;
char *match_url;
@@ -106,9 +108,9 @@ bool ro_gui_url_complete_keypress(struct gui_window *g, int key)
/* forcibly open on down keys */
if ((!currently_open) && (url_complete_matched_string)) {
switch (key) {
- case wimp_KEY_DOWN:
- case wimp_KEY_PAGE_DOWN:
- case wimp_KEY_CONTROL | wimp_KEY_DOWN:
+ case IS_WIMP_KEY | wimp_KEY_DOWN:
+ case IS_WIMP_KEY | wimp_KEY_PAGE_DOWN:
+ case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_DOWN:
free(url_complete_matched_string);
url_complete_matched_string = NULL;
}
@@ -222,24 +224,24 @@ bool ro_gui_url_complete_keypress(struct gui_window *g, int key)
old_selection = url_complete_matches_selection;
switch (key) {
- case wimp_KEY_UP:
+ case IS_WIMP_KEY | wimp_KEY_UP:
url_complete_matches_selection--;
break;
- case wimp_KEY_DOWN:
+ case IS_WIMP_KEY | wimp_KEY_DOWN:
url_complete_matches_selection++;
break;
- case wimp_KEY_PAGE_UP:
+ case IS_WIMP_KEY | wimp_KEY_PAGE_UP:
url_complete_matches_selection -=
MAXIMUM_VISIBLE_LINES;
break;
- case wimp_KEY_PAGE_DOWN:
+ case IS_WIMP_KEY | wimp_KEY_PAGE_DOWN:
url_complete_matches_selection +=
MAXIMUM_VISIBLE_LINES;
break;
- case wimp_KEY_CONTROL | wimp_KEY_UP:
+ case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_UP:
url_complete_matches_selection = 0;
break;
- case wimp_KEY_CONTROL | wimp_KEY_DOWN:
+ case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_DOWN:
url_complete_matches_selection = 65536;
break;
}
diff --git a/riscos/url_complete.h b/riscos/url_complete.h
index 03d101bca..3d79edca5 100644
--- a/riscos/url_complete.h
+++ b/riscos/url_complete.h
@@ -13,12 +13,13 @@
#define _NETSURF_RISCOS_URLCOMPLETE_H_
#include <stdbool.h>
+#include <wchar.h>
#include "oslib/wimp.h"
struct gui_window;
void ro_gui_url_complete_start(struct gui_window *g);
-bool ro_gui_url_complete_keypress(struct gui_window *g, int key);
+bool ro_gui_url_complete_keypress(struct gui_window *g, wchar_t key);
void ro_gui_url_complete_resize(struct gui_window *g, wimp_open *open);
bool ro_gui_url_complete_close(struct gui_window *g, wimp_i i);
void ro_gui_url_complete_redraw(wimp_draw *redraw);