From 78f9b20b3e093ec515f31242cd1eb76c08bb3a12 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 26 Dec 2003 18:18:17 +0000 Subject: [PATCH] [project @ 2003-12-26 18:18:17 by jmb] Keypress handling in dialog boxes. svn path=/import/netsurf/; revision=446 --- riscos/401login.c | 12 ++++++++++++ riscos/dialog.c | 10 ++++++++++ riscos/gui.c | 4 +++- riscos/gui.h | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/riscos/401login.c b/riscos/401login.c index 82a18df81..c5693d2e3 100644 --- a/riscos/401login.c +++ b/riscos/401login.c @@ -104,6 +104,18 @@ void ro_gui_401login_open(char *host, char* realm, char *fetchurl) -1, -1, -1, 0); } +bool ro_gui_401login_keypress(wimp_key *key) { + + if (key->c == wimp_KEY_RETURN) { + get_unamepwd(); + ro_gui_dialog_close(dialog_401li); + browser_window_open_location(bwin, url); + return true; + } + + return false; +} + /* Login Clicked -> create a new fetch request, specifying uname & pwd * CURLOPT_USERPWD takes a string "username:password" */ diff --git a/riscos/dialog.c b/riscos/dialog.c index 965901c2a..31ca9f6c8 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -144,6 +144,16 @@ void ro_gui_dialog_open(wimp_w w) wimp_open_window((wimp_open *) &open); } +/** + * Handle key presses in one of the dialog boxes. + */ + +bool ro_gui_dialog_keypress(wimp_key *key) +{ + if (key->w == dialog_401li) + return ro_gui_401login_keypress(key); + return false; +} /** * Handle clicks in one of the dialog boxes. diff --git a/riscos/gui.c b/riscos/gui.c index 96c80a42a..ceca684cd 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -596,7 +596,9 @@ void ro_gui_keypress(wimp_key *key) gui_window *g = ro_gui_window_lookup(key->w); if (!g) { - wimp_process_key(key->c); + handled = ro_gui_dialog_keypress(key); + if (!handled) + wimp_process_key(key->c); return; } diff --git a/riscos/gui.h b/riscos/gui.h index 6def3bc2b..c0a5db322 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -110,6 +110,7 @@ void ro_gui_dialog_init(void); wimp_w ro_gui_dialog_create(const char *template_name); void ro_gui_dialog_open(wimp_w w); void ro_gui_dialog_click(wimp_pointer *pointer); +bool ro_gui_dialog_keypress(wimp_key *key); void ro_gui_dialog_close(wimp_w close); void ro_gui_redraw_config_th(wimp_draw* redraw); void ro_gui_theme_menu_selection(char *theme); @@ -133,6 +134,7 @@ void ro_gui_drag_end(wimp_dragged* drag); void ro_gui_401login_init(void); void ro_gui_401login_open(char* host, char * realm, char* fetchurl); void ro_gui_401login_click(wimp_pointer *pointer); +bool ro_gui_401login_keypress(wimp_key *key); /* in window.c */ void ro_gui_window_click(gui_window* g, wimp_pointer* mouse);