From 1decf851aaeb7b4b34f6a999884edee8bba3c0d6 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 13 Jul 2006 22:50:48 +0000 Subject: Fix URL completion keypress handling svn path=/trunk/netsurf/; revision=2748 --- riscos/url_complete.c | 24 +++++++++++++----------- riscos/url_complete.h | 3 ++- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'riscos') 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 #include #include +#include #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 +#include #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); -- cgit v1.2.3