diff options
author | Richard Wilson <rjw@netsurf-browser.org> | 2006-09-05 17:34:30 +0000 |
---|---|---|
committer | Richard Wilson <rjw@netsurf-browser.org> | 2006-09-05 17:34:30 +0000 |
commit | 4994441579b1deb8952ab57d1d649462d7ef0dff (patch) | |
tree | 3eeb88c94282bc14ef2a000df3948838112cd488 /riscos | |
parent | 610a31dd97925fd0bd7589a919284171c019d419 (diff) | |
download | netsurf-4994441579b1deb8952ab57d1d649462d7ef0dff.tar.gz netsurf-4994441579b1deb8952ab57d1d649462d7ef0dff.tar.bz2 |
Improve caret handling.
svn path=/trunk/netsurf/; revision=2917
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/window.c | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/riscos/window.c b/riscos/window.c index df9c49ab7..9acb05ccd 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -339,25 +339,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, } ro_gui_window_open(g, (wimp_open*)&state); - /* Set the caret position to the URL bar - */ - if (g->toolbar && g->toolbar->display_url) { - error = xwimp_set_caret_position( - g->toolbar->toolbar_handle, - ICON_TOOLBAR_URL, -1, -1, -1, 0); - ro_gui_url_complete_start(g); - } else - error = xwimp_set_caret_position(g->window, - wimp_ICON_WINDOW, -100, -100, 32, -1); - - if (error) { - LOG(("xwimp_set_caret_position: 0x%x: %s", - error->errnum, error->errmess)); - warn_user("WimpError", error->errmess); - return g; - } - - /* and register event handlers */ + /* Register event handlers */ ro_gui_wimp_event_register_keypress(g->window, ro_gui_window_keypress); if (g->toolbar) @@ -366,6 +348,21 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, ro_gui_wimp_event_register_mouse_click(g->window, ro_gui_window_click); + /* Claim the caret position for top-level windows */ + if (bw->browser_window_type == BROWSER_WINDOW_NORMAL) { + if (g->toolbar && g->toolbar->display_url) { + error = xwimp_set_caret_position( + g->toolbar->toolbar_handle, + ICON_TOOLBAR_URL, -1, -1, -1, 0); + ro_gui_url_complete_start(g); + if (error) { + LOG(("xwimp_set_caret_position: 0x%x: %s", + error->errnum, error->errmess)); + warn_user("WimpError", error->errmess); + } + } else + gui_window_place_caret(g, -100, -100, 0); + } return g; } @@ -1878,16 +1875,8 @@ bool ro_gui_window_click(wimp_pointer *pointer) /* set input focus */ if (pointer->buttons == wimp_CLICK_SELECT || - pointer->buttons == wimp_CLICK_ADJUST) { - error = xwimp_set_caret_position(state.w, -1, - -100, -100, 32, -1); - if (error) { - LOG(("xwimp_set_caret_position: 0x%x: %s", - error->errnum, error->errmess)); - warn_user("WimpError", error->errmess); - return false; - } - } + pointer->buttons == wimp_CLICK_ADJUST) + gui_window_place_caret(g, -100, -100, 0); if (pointer->buttons == wimp_CLICK_MENU) ro_gui_menu_create(browser_menu, pointer->pos.x, @@ -1987,14 +1976,7 @@ void gui_window_remove_caret(struct gui_window *g) return; /* hide caret, but keep input focus */ - error = xwimp_set_caret_position(g->window, -1, - -100, -100, 32, -1); - if (error) { - LOG(("xwimp_set_caret_position: 0x%x: %s", - error->errnum, error->errmess)); - warn_user("WimpError", error->errmess); - return; - } + gui_window_place_caret(g, -100, -100, 0); } |