2005-02-03 16:18:22 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2005 Richard Wilson <info@tinct.net>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-02-03 16:18:22 +03:00
|
|
|
*/
|
|
|
|
|
2016-05-30 19:32:57 +03:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* GUI URL auto-completion implementation.
|
2005-02-03 16:18:22 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2014-06-05 18:14:49 +04:00
|
|
|
#include <oslib/wimp.h>
|
|
|
|
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "utils/log.h"
|
2014-06-05 18:14:49 +04:00
|
|
|
#include "utils/nsoption.h"
|
2016-06-14 01:34:45 +03:00
|
|
|
#include "utils/nsurl.h"
|
|
|
|
#include "netsurf/url_db.h"
|
2016-05-30 19:32:57 +03:00
|
|
|
#include "netsurf/browser_window.h"
|
2014-06-05 18:14:49 +04:00
|
|
|
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/global_history.h"
|
|
|
|
#include "riscos/gui.h"
|
2013-09-08 14:55:21 +04:00
|
|
|
#include "riscos/mouse.h"
|
2011-02-21 02:16:33 +03:00
|
|
|
#include "riscos/toolbar.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/url_complete.h"
|
|
|
|
#include "riscos/wimp.h"
|
|
|
|
#include "riscos/wimp_event.h"
|
2009-03-27 20:55:58 +03:00
|
|
|
#include "riscos/wimputils.h"
|
2014-06-04 19:44:29 +04:00
|
|
|
#include "riscos/filetype.h"
|
2005-02-03 16:18:22 +03:00
|
|
|
|
|
|
|
#define MAXIMUM_VISIBLE_LINES 7
|
|
|
|
|
2012-10-11 14:20:02 +04:00
|
|
|
static nsurl **url_complete_matches = NULL;
|
2005-02-03 16:18:22 +03:00
|
|
|
static int url_complete_matches_allocated = 0;
|
|
|
|
static int url_complete_matches_available = 0;
|
|
|
|
static char *url_complete_matched_string = NULL;
|
|
|
|
static int url_complete_matches_selection = -1;
|
|
|
|
static int url_complete_keypress_selection = -1;
|
|
|
|
static wimp_w url_complete_parent = 0;
|
|
|
|
static bool url_complete_matches_reset = false;
|
|
|
|
static char *url_complete_original_url = NULL;
|
2006-04-10 03:21:13 +04:00
|
|
|
static bool url_complete_memory_exhausted = false;
|
2005-02-03 16:18:22 +03:00
|
|
|
|
2012-10-11 14:20:02 +04:00
|
|
|
static nsurl *url_complete_redraw[MAXIMUM_VISIBLE_LINES];
|
2009-02-01 16:37:32 +03:00
|
|
|
static char url_complete_icon_null[] = "";
|
2006-03-04 23:46:35 +03:00
|
|
|
static char url_complete_icon_sprite[12];
|
2005-02-03 16:18:22 +03:00
|
|
|
static wimp_icon url_complete_icon;
|
2006-03-04 23:46:35 +03:00
|
|
|
static wimp_icon url_complete_sprite;
|
2005-02-03 16:18:22 +03:00
|
|
|
static int mouse_x;
|
|
|
|
static int mouse_y;
|
|
|
|
|
2012-10-11 14:20:02 +04:00
|
|
|
static bool url_complete_callback(nsurl *url,
|
2006-06-15 19:47:34 +04:00
|
|
|
const struct url_data *data);
|
2013-09-08 14:55:21 +04:00
|
|
|
static void ro_gui_url_complete_mouse_at(wimp_pointer *pointer, void *data);
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
|
|
|
|
/* This is an exported interface documented in url_complete.h */
|
|
|
|
|
|
|
|
void ro_gui_url_complete_start(struct toolbar *toolbar)
|
2006-04-10 03:21:13 +04:00
|
|
|
{
|
2011-02-21 02:16:33 +03:00
|
|
|
const char *url;
|
|
|
|
wimp_w parent;
|
|
|
|
|
|
|
|
assert(toolbar != NULL);
|
|
|
|
parent = ro_toolbar_get_parent_window(toolbar);
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
if (!ro_toolbar_get_display_url(toolbar) ||
|
|
|
|
(parent == url_complete_parent))
|
2005-02-04 06:02:15 +03:00
|
|
|
return;
|
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_gui_url_complete_close();
|
|
|
|
url = ro_toolbar_get_url(toolbar);
|
2015-07-19 01:29:51 +03:00
|
|
|
if (url != NULL) {
|
|
|
|
url_complete_matched_string = strdup(url);
|
|
|
|
if (url_complete_matched_string)
|
|
|
|
url_complete_parent = parent;
|
|
|
|
}
|
2005-02-04 06:02:15 +03:00
|
|
|
}
|
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
/* This is an exported interface documented in url_complete.h */
|
|
|
|
|
|
|
|
bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
|
2006-04-10 03:21:13 +04:00
|
|
|
{
|
2011-02-21 02:16:33 +03:00
|
|
|
wimp_w parent;
|
|
|
|
wimp_window_state state;
|
|
|
|
char *match_url;
|
|
|
|
const char *url;
|
|
|
|
int old_selection;
|
|
|
|
int height;
|
|
|
|
os_error *error;
|
|
|
|
bool currently_open;
|
|
|
|
|
|
|
|
assert(toolbar != NULL);
|
|
|
|
parent = ro_toolbar_get_parent_window(toolbar);
|
2005-02-03 16:18:22 +03:00
|
|
|
|
|
|
|
/* we must have a toolbar/url bar */
|
2011-02-21 02:16:33 +03:00
|
|
|
if (!ro_toolbar_get_display_url(toolbar) ||
|
2012-03-22 13:34:34 +04:00
|
|
|
(!nsoption_bool(url_suggestion))) {
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_gui_url_complete_close();
|
2005-02-03 16:18:22 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we are currently active elsewhere, remove the previous window */
|
2011-02-21 02:16:33 +03:00
|
|
|
currently_open = ((parent == url_complete_parent) &&
|
2005-02-04 06:02:15 +03:00
|
|
|
(url_complete_matches_available > 0));
|
2011-02-21 02:16:33 +03:00
|
|
|
if (parent != url_complete_parent)
|
|
|
|
ro_gui_url_complete_close();
|
2005-02-04 06:02:15 +03:00
|
|
|
|
|
|
|
/* forcibly open on down keys */
|
|
|
|
if ((!currently_open) && (url_complete_matched_string)) {
|
|
|
|
switch (key) {
|
2006-07-14 02:50:48 +04:00
|
|
|
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:
|
2005-02-04 06:02:15 +03:00
|
|
|
free(url_complete_matched_string);
|
|
|
|
url_complete_matched_string = NULL;
|
|
|
|
}
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
|
|
|
|
/* get the text to match */
|
2011-02-21 02:16:33 +03:00
|
|
|
url_complete_parent = parent;
|
|
|
|
url = ro_toolbar_get_url(toolbar);
|
|
|
|
match_url = (url != NULL) ? strdup(url) : NULL;
|
|
|
|
if (match_url == NULL) {
|
|
|
|
ro_gui_url_complete_close();
|
2005-02-03 16:18:22 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if the text to match has changed then update it */
|
2006-07-14 01:28:07 +04:00
|
|
|
if ((!url_complete_matched_string) ||
|
|
|
|
(strcmp(match_url, url_complete_matched_string))) {
|
2005-02-03 16:18:22 +03:00
|
|
|
|
|
|
|
/* memorize the current matches */
|
2014-05-31 16:06:52 +04:00
|
|
|
int i;
|
2014-05-31 02:30:44 +04:00
|
|
|
int lines = MAXIMUM_VISIBLE_LINES;
|
2005-02-03 16:18:22 +03:00
|
|
|
if (lines > url_complete_matches_available)
|
|
|
|
lines = url_complete_matches_available;
|
2009-05-30 03:23:02 +04:00
|
|
|
if (url_complete_matches) {
|
|
|
|
for (i = 0; i < MAXIMUM_VISIBLE_LINES; i++) {
|
|
|
|
if (i < lines) {
|
2010-10-05 23:14:46 +04:00
|
|
|
url_complete_redraw[i] =
|
2006-04-10 03:21:13 +04:00
|
|
|
url_complete_matches[i];
|
2009-05-30 03:23:02 +04:00
|
|
|
} else {
|
|
|
|
url_complete_redraw[i] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-02-03 16:18:22 +03:00
|
|
|
|
|
|
|
/* our selection gets wiped */
|
|
|
|
error = xwimp_force_redraw(dialog_url_complete,
|
2006-04-10 03:21:13 +04:00
|
|
|
0,
|
|
|
|
-(url_complete_matches_selection + 1) * 44,
|
2005-02-03 16:18:22 +03:00
|
|
|
65536, -url_complete_matches_selection * 44);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* clear our state */
|
|
|
|
free(url_complete_original_url);
|
|
|
|
free(url_complete_matched_string);
|
|
|
|
url_complete_matched_string = match_url;
|
|
|
|
url_complete_original_url = NULL;
|
2006-04-11 06:39:55 +04:00
|
|
|
url_complete_matches_available = 0;
|
2005-02-03 16:18:22 +03:00
|
|
|
url_complete_matches_selection = -1;
|
|
|
|
url_complete_keypress_selection = -1;
|
|
|
|
|
|
|
|
/* get some initial memory */
|
|
|
|
if (!url_complete_matches) {
|
|
|
|
url_complete_matches = malloc(64 * sizeof(char *));
|
|
|
|
if (!url_complete_matches) {
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_gui_url_complete_close();
|
2005-02-03 16:18:22 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
url_complete_matches_allocated = 64;
|
|
|
|
}
|
|
|
|
|
2006-04-10 03:21:13 +04:00
|
|
|
/* find matches */
|
|
|
|
url_complete_memory_exhausted = false;
|
2006-07-13 23:48:45 +04:00
|
|
|
if (strlen(match_url) == 0)
|
|
|
|
urldb_iterate_entries(url_complete_callback);
|
|
|
|
else
|
|
|
|
urldb_iterate_partial(match_url, url_complete_callback);
|
2006-07-14 01:28:07 +04:00
|
|
|
if ((url_complete_memory_exhausted) ||
|
|
|
|
(url_complete_matches_available == 0)) {
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_gui_url_complete_close();
|
2006-04-10 03:21:13 +04:00
|
|
|
return false;
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* update the window */
|
2011-02-21 02:16:33 +03:00
|
|
|
state.w = parent;
|
2005-02-03 16:18:22 +03:00
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
url_complete_matches_reset = true;
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_gui_url_complete_resize(toolbar, PTR_WIMP_OPEN(&state));
|
2005-02-03 16:18:22 +03:00
|
|
|
url_complete_matches_reset = false;
|
|
|
|
|
|
|
|
/* redraw the relevant bits of the window */
|
|
|
|
lines = MAXIMUM_VISIBLE_LINES;
|
|
|
|
if (lines > url_complete_matches_available)
|
|
|
|
lines = url_complete_matches_available;
|
2005-04-27 04:02:02 +04:00
|
|
|
for (i = 0; i < lines; i++) {
|
2006-04-10 03:21:13 +04:00
|
|
|
if (url_complete_redraw[i] !=
|
|
|
|
url_complete_matches[i]) {
|
2005-02-03 16:18:22 +03:00
|
|
|
error = xwimp_force_redraw(dialog_url_complete,
|
|
|
|
0, -(i + 1) * 44, 65536, -i * 44);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError",
|
2006-04-10 03:21:13 +04:00
|
|
|
error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
free(match_url);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* handle keypresses */
|
|
|
|
if (!currently_open)
|
|
|
|
return false;
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
old_selection = url_complete_matches_selection;
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
switch (key) {
|
2006-07-14 02:50:48 +04:00
|
|
|
case IS_WIMP_KEY | wimp_KEY_UP:
|
2005-02-03 16:18:22 +03:00
|
|
|
url_complete_matches_selection--;
|
|
|
|
break;
|
2006-07-14 02:50:48 +04:00
|
|
|
case IS_WIMP_KEY | wimp_KEY_DOWN:
|
2005-02-03 16:18:22 +03:00
|
|
|
url_complete_matches_selection++;
|
|
|
|
break;
|
2006-07-14 02:50:48 +04:00
|
|
|
case IS_WIMP_KEY | wimp_KEY_PAGE_UP:
|
2006-04-10 03:21:13 +04:00
|
|
|
url_complete_matches_selection -=
|
|
|
|
MAXIMUM_VISIBLE_LINES;
|
2005-02-03 16:18:22 +03:00
|
|
|
break;
|
2006-07-14 02:50:48 +04:00
|
|
|
case IS_WIMP_KEY | wimp_KEY_PAGE_DOWN:
|
2006-04-10 03:21:13 +04:00
|
|
|
url_complete_matches_selection +=
|
|
|
|
MAXIMUM_VISIBLE_LINES;
|
2005-02-03 16:18:22 +03:00
|
|
|
break;
|
2006-07-14 02:50:48 +04:00
|
|
|
case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_UP:
|
2005-02-03 16:18:22 +03:00
|
|
|
url_complete_matches_selection = 0;
|
|
|
|
break;
|
2006-07-14 02:50:48 +04:00
|
|
|
case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_DOWN:
|
2005-02-03 16:18:22 +03:00
|
|
|
url_complete_matches_selection = 65536;
|
|
|
|
break;
|
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
|
|
|
if (url_complete_matches_selection >
|
|
|
|
url_complete_matches_available - 1)
|
|
|
|
url_complete_matches_selection =
|
|
|
|
url_complete_matches_available - 1;
|
2005-02-03 16:18:22 +03:00
|
|
|
else if (url_complete_matches_selection < -1)
|
|
|
|
url_complete_matches_selection = -1;
|
|
|
|
|
|
|
|
if (old_selection == url_complete_matches_selection)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
error = xwimp_force_redraw(dialog_url_complete,
|
2006-04-10 03:21:13 +04:00
|
|
|
0, -(old_selection + 1) * 44,
|
|
|
|
65536, -old_selection * 44);
|
2005-02-03 16:18:22 +03:00
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
error = xwimp_force_redraw(dialog_url_complete,
|
|
|
|
0, -(url_complete_matches_selection + 1) * 44,
|
|
|
|
65536, -url_complete_matches_selection * 44);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
if (old_selection == -1) {
|
|
|
|
free(url_complete_original_url);
|
|
|
|
url_complete_original_url = malloc(strlen(url) + 1);
|
|
|
|
if (!url_complete_original_url)
|
|
|
|
return false;
|
|
|
|
strcpy(url_complete_original_url, url);
|
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
if (url_complete_matches_selection == -1) {
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_toolbar_set_url(toolbar,
|
|
|
|
url_complete_original_url, true, false);
|
2005-02-03 16:18:22 +03:00
|
|
|
} else {
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_toolbar_set_url(toolbar,
|
2012-10-11 14:20:02 +04:00
|
|
|
nsurl_access(url_complete_matches[
|
|
|
|
url_complete_matches_selection]),
|
2011-02-21 02:16:33 +03:00
|
|
|
true, false);
|
2006-07-14 01:28:07 +04:00
|
|
|
free(url_complete_matched_string);
|
2012-10-11 14:20:02 +04:00
|
|
|
url_complete_matched_string = strdup(nsurl_access(
|
|
|
|
url_complete_matches[
|
|
|
|
url_complete_matches_selection]));
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
|
|
|
url_complete_keypress_selection = url_complete_matches_selection;
|
|
|
|
|
|
|
|
/* auto-scroll */
|
|
|
|
state.w = dialog_url_complete;
|
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
return true;
|
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
if (state.yscroll < -(url_complete_matches_selection * 44))
|
|
|
|
state.yscroll = -(url_complete_matches_selection * 44);
|
|
|
|
height = state.visible.y1 - state.visible.y0;
|
2006-04-10 03:21:13 +04:00
|
|
|
if (state.yscroll - height >
|
|
|
|
-((url_complete_matches_selection + 1) * 44))
|
|
|
|
state.yscroll =
|
|
|
|
-((url_complete_matches_selection + 1) * 44) + height;
|
|
|
|
|
2009-03-27 20:55:58 +03:00
|
|
|
error = xwimp_open_window(PTR_WIMP_OPEN(&state));
|
2005-02-03 16:18:22 +03:00
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
|
2006-04-10 03:21:13 +04:00
|
|
|
/**
|
|
|
|
* Callback function for urldb_iterate_partial
|
|
|
|
*
|
|
|
|
* \param url URL which matches
|
2006-06-15 19:47:34 +04:00
|
|
|
* \param data Data associated with URL
|
2006-04-10 03:21:13 +04:00
|
|
|
* \return true to continue iteration, false otherwise
|
|
|
|
*/
|
2011-02-21 02:16:33 +03:00
|
|
|
|
2012-10-11 14:20:02 +04:00
|
|
|
bool url_complete_callback(nsurl *url, const struct url_data *data)
|
2006-04-10 03:21:13 +04:00
|
|
|
{
|
2012-10-11 14:20:02 +04:00
|
|
|
nsurl **array_extend;
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2006-06-15 19:47:34 +04:00
|
|
|
/* Ignore unvisited URLs */
|
|
|
|
if (data->visits == 0)
|
|
|
|
return true;
|
|
|
|
|
2006-04-10 03:21:13 +04:00
|
|
|
url_complete_matches_available++;
|
|
|
|
|
|
|
|
if (url_complete_matches_available >
|
|
|
|
url_complete_matches_allocated) {
|
|
|
|
|
2012-10-11 14:20:02 +04:00
|
|
|
array_extend = (nsurl **)realloc(url_complete_matches,
|
2006-04-10 03:21:13 +04:00
|
|
|
(url_complete_matches_allocated + 64) *
|
2012-10-11 14:20:02 +04:00
|
|
|
sizeof(nsurl *));
|
2006-04-10 03:21:13 +04:00
|
|
|
if (!array_extend) {
|
|
|
|
url_complete_memory_exhausted = true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
url_complete_matches = array_extend;
|
|
|
|
url_complete_matches_allocated += 64;
|
|
|
|
}
|
|
|
|
|
2006-04-11 06:39:55 +04:00
|
|
|
url_complete_matches[url_complete_matches_available - 1] = url;
|
2006-04-10 03:21:13 +04:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2005-02-03 16:18:22 +03:00
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
|
|
|
|
/* This is an exported interface documented in url_complete.h */
|
|
|
|
|
|
|
|
void ro_gui_url_complete_resize(struct toolbar *toolbar, wimp_open *open)
|
2006-04-10 03:21:13 +04:00
|
|
|
{
|
2011-02-21 02:16:33 +03:00
|
|
|
os_box extent = { 0, 0, 0, 0 };
|
|
|
|
os_box url_extent;
|
|
|
|
wimp_window_state toolbar_state;
|
|
|
|
wimp_window_state state;
|
|
|
|
os_error *error;
|
|
|
|
int lines;
|
|
|
|
int scroll_v = 0;
|
2005-02-03 16:18:22 +03:00
|
|
|
|
2005-04-28 00:48:55 +04:00
|
|
|
/* only react to our window */
|
|
|
|
if (open->w != url_complete_parent)
|
|
|
|
return;
|
2006-04-10 03:21:13 +04:00
|
|
|
|
|
|
|
/* if there is no toolbar, or there is no URL bar shown,
|
|
|
|
* or there are no URL matches, close it */
|
2011-02-21 02:16:33 +03:00
|
|
|
if (!ro_toolbar_get_display_url(toolbar) ||
|
2005-04-27 04:02:02 +04:00
|
|
|
(!url_complete_matches) ||
|
2005-02-03 16:18:22 +03:00
|
|
|
(url_complete_matches_available == 0)) {
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_gui_url_complete_close();
|
2005-02-03 16:18:22 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get our current auto-complete window state for the scroll values */
|
|
|
|
state.w = dialog_url_complete;
|
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
return;
|
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
if (url_complete_matches_reset)
|
|
|
|
state.yscroll = 0;
|
|
|
|
|
|
|
|
/* move the window to the correct position */
|
2011-02-21 02:16:33 +03:00
|
|
|
toolbar_state.w = ro_toolbar_get_window(toolbar);
|
2005-02-03 16:18:22 +03:00
|
|
|
error = xwimp_get_window_state(&toolbar_state);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
return;
|
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
if (!ro_toolbar_get_url_field_extent(toolbar, &url_extent)) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("Failed to read URL field extent.");
|
2005-02-03 16:18:22 +03:00
|
|
|
return;
|
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
lines = url_complete_matches_available;
|
|
|
|
extent.y0 = -(lines * 44);
|
|
|
|
extent.x1 = 65536;
|
|
|
|
error = xwimp_set_extent(dialog_url_complete, &extent);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
return;
|
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
state.next = open->next;
|
|
|
|
state.flags &= ~wimp_WINDOW_VSCROLL;
|
|
|
|
state.flags &= ~(4095 << 16); /* clear bits 16-27 */
|
|
|
|
if (lines > MAXIMUM_VISIBLE_LINES) {
|
|
|
|
lines = MAXIMUM_VISIBLE_LINES;
|
|
|
|
scroll_v = ro_get_vscroll_width(NULL) - 2;
|
|
|
|
state.flags |= wimp_WINDOW_VSCROLL;
|
|
|
|
}
|
2011-02-21 02:16:33 +03:00
|
|
|
state.visible.x0 = open->visible.x0 + 2 + url_extent.x0;
|
|
|
|
state.visible.x1 = open->visible.x0 - 2 + url_extent.x1 - scroll_v;
|
|
|
|
state.visible.y1 = open->visible.y1 - url_extent.y1 + 2;
|
2005-02-03 16:18:22 +03:00
|
|
|
state.visible.y0 = state.visible.y1 - (lines * 44);
|
2005-02-04 06:02:15 +03:00
|
|
|
if (state.visible.x1 + scroll_v > toolbar_state.visible.x1)
|
|
|
|
state.visible.x1 = toolbar_state.visible.x1 - scroll_v;
|
|
|
|
if (state.visible.x1 - state.visible.x0 < 0) {
|
2005-02-03 16:18:22 +03:00
|
|
|
error = xwimp_close_window(dialog_url_complete);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
|
|
|
} else {
|
2006-04-10 03:21:13 +04:00
|
|
|
error = xwimp_open_window_nested_with_flags(&state,
|
|
|
|
(wimp_w)-1, 0);
|
2005-02-03 16:18:22 +03:00
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
open->next = dialog_url_complete;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
/* This is an exported interface documented in url_complete.h */
|
|
|
|
|
|
|
|
bool ro_gui_url_complete_close(void)
|
2006-04-10 03:21:13 +04:00
|
|
|
{
|
2011-02-21 02:16:33 +03:00
|
|
|
os_error *error;
|
|
|
|
bool currently_open;
|
2005-02-03 16:18:22 +03:00
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
/* There used to be a check here to see if the icon clicked was the
|
|
|
|
* URL text field in the toolbar. Since this only applied to clicks
|
|
|
|
* originating from the toolbar module following the restructuring,
|
|
|
|
* and this check was better done within the toolbar, it has been
|
|
|
|
* removed from this function and the associated parameters removed.
|
|
|
|
*/
|
2005-02-03 16:18:22 +03:00
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
currently_open = ((url_complete_parent != NULL) &&
|
2005-02-04 06:02:15 +03:00
|
|
|
(url_complete_matches_available > 0));
|
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
free(url_complete_matches);
|
|
|
|
free(url_complete_matched_string);
|
|
|
|
free(url_complete_original_url);
|
|
|
|
url_complete_matches = NULL;
|
|
|
|
url_complete_matched_string = NULL;
|
|
|
|
url_complete_original_url = NULL;
|
|
|
|
url_complete_matches_allocated = 0;
|
|
|
|
url_complete_matches_available = 0;
|
|
|
|
url_complete_keypress_selection = -1;
|
|
|
|
url_complete_matches_selection = -1;
|
|
|
|
url_complete_parent = 0;
|
|
|
|
|
|
|
|
error = xwimp_close_window(dialog_url_complete);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-04 06:02:15 +03:00
|
|
|
return currently_open;
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
/* This is an exported interface documented in url_complete.h */
|
|
|
|
|
2006-04-10 03:21:13 +04:00
|
|
|
void ro_gui_url_complete_redraw(wimp_draw *redraw)
|
|
|
|
{
|
2005-02-03 16:18:22 +03:00
|
|
|
osbool more;
|
|
|
|
os_error *error;
|
2014-05-31 02:30:44 +04:00
|
|
|
int line;
|
2006-04-10 03:21:13 +04:00
|
|
|
const struct url_data *data;
|
|
|
|
int type;
|
2005-02-03 16:18:22 +03:00
|
|
|
|
|
|
|
/* initialise our icon */
|
|
|
|
url_complete_icon.flags = wimp_ICON_INDIRECTED | wimp_ICON_VCENTRED |
|
|
|
|
wimp_ICON_TEXT | wimp_ICON_FILLED |
|
|
|
|
(wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) |
|
|
|
|
(wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT);
|
2006-03-04 23:46:35 +03:00
|
|
|
url_complete_icon.extent.x0 = 50;
|
2005-02-03 16:18:22 +03:00
|
|
|
url_complete_icon.extent.x1 = 16384;
|
2006-04-10 03:21:13 +04:00
|
|
|
url_complete_icon.data.indirected_text.validation =
|
|
|
|
url_complete_icon_null;
|
2006-03-04 23:46:35 +03:00
|
|
|
url_complete_sprite.flags = wimp_ICON_TEXT | wimp_ICON_SPRITE |
|
|
|
|
wimp_ICON_INDIRECTED | wimp_ICON_FILLED |
|
|
|
|
wimp_ICON_HCENTRED | wimp_ICON_VCENTRED;
|
|
|
|
url_complete_sprite.extent.x0 = 0;
|
|
|
|
url_complete_sprite.extent.x1 = 50;
|
2006-04-10 03:21:13 +04:00
|
|
|
url_complete_sprite.data.indirected_text.text =
|
|
|
|
url_complete_icon_null;
|
|
|
|
url_complete_sprite.data.indirected_text.validation =
|
|
|
|
url_complete_icon_sprite;
|
2006-03-04 23:46:35 +03:00
|
|
|
url_complete_sprite.data.indirected_text.size = 1;
|
2005-02-03 16:18:22 +03:00
|
|
|
|
2005-04-28 00:48:55 +04:00
|
|
|
/* no matches? no redraw */
|
|
|
|
if (!url_complete_matches) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("Attempt to redraw with no matches made");
|
2009-03-27 04:19:02 +03:00
|
|
|
/* Fill is never used, so make it something obvious */
|
|
|
|
ro_gui_user_redraw(redraw, false, os_COLOUR_BLACK);
|
2005-04-28 00:48:55 +04:00
|
|
|
return;
|
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
/* redraw */
|
|
|
|
more = wimp_redraw_window(redraw);
|
|
|
|
while (more) {
|
2014-05-31 02:30:44 +04:00
|
|
|
int first_line, last_line;
|
|
|
|
int origin_y = redraw->box.y1 - redraw->yscroll;
|
|
|
|
int clip_y0 = redraw->clip.y0 - origin_y;
|
|
|
|
int clip_y1 = redraw->clip.y1 - origin_y;
|
2005-02-03 16:18:22 +03:00
|
|
|
|
|
|
|
first_line = (-clip_y1) / 44;
|
|
|
|
last_line = (-clip_y0 + 43) / 44;
|
|
|
|
|
|
|
|
for (line = first_line; line < last_line; line++) {
|
|
|
|
if (line == url_complete_matches_selection)
|
2006-04-10 03:21:13 +04:00
|
|
|
url_complete_icon.flags |=
|
|
|
|
wimp_ICON_SELECTED;
|
2005-02-03 16:18:22 +03:00
|
|
|
else
|
2006-04-10 03:21:13 +04:00
|
|
|
url_complete_icon.flags &=
|
|
|
|
~wimp_ICON_SELECTED;
|
2005-02-03 16:18:22 +03:00
|
|
|
url_complete_icon.extent.y1 = -line * 44;
|
|
|
|
url_complete_icon.extent.y0 = -(line + 1) * 44;
|
|
|
|
url_complete_icon.data.indirected_text.text =
|
2012-10-11 14:20:02 +04:00
|
|
|
(char *)nsurl_access(
|
|
|
|
url_complete_matches[line]);
|
2005-02-03 16:18:22 +03:00
|
|
|
url_complete_icon.data.indirected_text.size =
|
2012-10-11 14:20:02 +04:00
|
|
|
nsurl_length(
|
|
|
|
url_complete_matches[line]);
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
error = xwimp_plot_icon(&url_complete_icon);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_plot_icon: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
|
|
|
data = urldb_get_url_data(url_complete_matches[line]);
|
|
|
|
if (data)
|
|
|
|
type = ro_content_filetype_from_type(
|
|
|
|
data->type);
|
|
|
|
else
|
|
|
|
type = 0;
|
|
|
|
|
2006-03-04 23:46:35 +03:00
|
|
|
sprintf(url_complete_icon_sprite, "Ssmall_%.3x",
|
2006-04-10 03:21:13 +04:00
|
|
|
type);
|
|
|
|
|
|
|
|
if (!ro_gui_wimp_sprite_exists(
|
|
|
|
url_complete_icon_sprite + 1))
|
|
|
|
sprintf(url_complete_icon_sprite,
|
|
|
|
"Ssmall_xxx");
|
2006-03-04 23:46:35 +03:00
|
|
|
url_complete_sprite.extent.y1 = -line * 44;
|
|
|
|
url_complete_sprite.extent.y0 = -(line + 1) * 44;
|
|
|
|
error = xwimp_plot_icon(&url_complete_sprite);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_plot_icon: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2006-03-04 23:46:35 +03:00
|
|
|
}
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
|
|
|
more = wimp_get_rectangle(redraw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
/* This is an exported interface documented in url_complete.h */
|
|
|
|
|
2013-09-08 14:55:21 +04:00
|
|
|
void ro_gui_url_complete_entering(wimp_entering *entering)
|
|
|
|
{
|
|
|
|
ro_mouse_track_start(NULL, ro_gui_url_complete_mouse_at, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle mouse movement over the URL completion window.
|
|
|
|
*
|
|
|
|
* \param *pointer The pointer state
|
|
|
|
* \param *data NULL data pointer expected by mouse tracker
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_url_complete_mouse_at(wimp_pointer *pointer, void *data)
|
2006-04-10 03:21:13 +04:00
|
|
|
{
|
2006-01-01 16:58:31 +03:00
|
|
|
wimp_mouse_state current;
|
|
|
|
|
|
|
|
current = pointer->buttons;
|
|
|
|
pointer->buttons = 0;
|
|
|
|
ro_gui_url_complete_click(pointer);
|
|
|
|
pointer->buttons = current;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
/* This is an exported interface documented in url_complete.h */
|
|
|
|
|
2006-04-10 03:21:13 +04:00
|
|
|
bool ro_gui_url_complete_click(wimp_pointer *pointer)
|
|
|
|
{
|
2005-02-03 16:18:22 +03:00
|
|
|
wimp_window_state state;
|
|
|
|
os_error *error;
|
2014-05-31 02:30:44 +04:00
|
|
|
int selection;
|
2005-02-03 16:18:22 +03:00
|
|
|
struct gui_window *g;
|
|
|
|
|
|
|
|
if ((mouse_x == pointer->pos.x) && (mouse_y == pointer->pos.y) &&
|
2006-01-01 16:58:31 +03:00
|
|
|
(!pointer->buttons))
|
|
|
|
return false;
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
mouse_x = pointer->pos.x;
|
|
|
|
mouse_y = pointer->pos.y;
|
|
|
|
|
|
|
|
state.w = dialog_url_complete;
|
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2006-01-01 16:58:31 +03:00
|
|
|
return false;
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
selection = (state.visible.y1 - pointer->pos.y - state.yscroll) / 44;
|
|
|
|
if (selection != url_complete_matches_selection) {
|
2014-05-31 02:30:44 +04:00
|
|
|
int old_selection;
|
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
if (url_complete_matches_selection == -1) {
|
2014-05-31 02:30:44 +04:00
|
|
|
const char *url;
|
|
|
|
|
2005-02-03 16:18:22 +03:00
|
|
|
g = ro_gui_window_lookup(url_complete_parent);
|
|
|
|
if (!g)
|
2006-01-01 16:58:31 +03:00
|
|
|
return false;
|
2011-02-21 02:16:33 +03:00
|
|
|
url = ro_toolbar_get_url(g->toolbar);
|
2005-02-03 16:18:22 +03:00
|
|
|
free(url_complete_original_url);
|
2009-05-30 04:29:46 +04:00
|
|
|
url_complete_original_url = strdup(url);
|
2005-02-03 16:18:22 +03:00
|
|
|
if (!url_complete_original_url)
|
2006-01-01 16:58:31 +03:00
|
|
|
return false;
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
|
|
|
old_selection = url_complete_matches_selection;
|
|
|
|
url_complete_matches_selection = selection;
|
|
|
|
error = xwimp_force_redraw(dialog_url_complete,
|
2006-04-10 03:21:13 +04:00
|
|
|
0, -(old_selection + 1) * 44,
|
|
|
|
65536, -old_selection * 44);
|
2005-02-03 16:18:22 +03:00
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
|
|
|
error = xwimp_force_redraw(dialog_url_complete,
|
|
|
|
0, -(url_complete_matches_selection + 1) * 44,
|
|
|
|
65536, -url_complete_matches_selection * 44);
|
|
|
|
if (error) {
|
2015-05-28 18:08:46 +03:00
|
|
|
LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
|
|
|
}
|
2006-01-01 16:58:31 +03:00
|
|
|
if (!pointer->buttons)
|
|
|
|
return true;
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2006-01-01 16:58:31 +03:00
|
|
|
/* find owning window */
|
|
|
|
g = ro_gui_window_lookup(url_complete_parent);
|
|
|
|
if (!g)
|
|
|
|
return false;
|
|
|
|
|
2005-02-04 21:07:27 +03:00
|
|
|
/* Select sets the text and launches */
|
2006-01-01 16:58:31 +03:00
|
|
|
if (pointer->buttons == wimp_CLICK_SELECT) {
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_toolbar_set_url(g->toolbar,
|
2012-10-11 14:20:02 +04:00
|
|
|
nsurl_access(url_complete_matches[
|
|
|
|
url_complete_matches_selection]),
|
2011-02-21 02:16:33 +03:00
|
|
|
true, false);
|
2007-08-29 04:27:52 +04:00
|
|
|
|
|
|
|
/** \todo The interaction of components here is hideous */
|
|
|
|
/* Do NOT make any attempt to use any of the global url
|
2013-02-14 19:09:28 +04:00
|
|
|
* completion variables after this call to browser_window_navigate.
|
2007-08-29 04:27:52 +04:00
|
|
|
* They will be invalidated by (at least):
|
2014-11-12 14:45:07 +03:00
|
|
|
* + ro_gui_window_set_url
|
2010-10-05 23:14:46 +04:00
|
|
|
* + destruction of (i)frames within the current page
|
2007-08-29 04:27:52 +04:00
|
|
|
* Any attempt to use them will probably result in a crash.
|
|
|
|
*/
|
|
|
|
|
2013-02-14 19:09:28 +04:00
|
|
|
browser_window_navigate(g->bw,
|
|
|
|
url_complete_matches[url_complete_matches_selection],
|
|
|
|
NULL,
|
2014-02-11 02:40:04 +04:00
|
|
|
BW_NAVIGATE_HISTORY,
|
2013-02-14 19:09:28 +04:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_gui_url_complete_close();
|
2005-02-03 16:18:22 +03:00
|
|
|
|
2005-02-04 21:07:27 +03:00
|
|
|
/* Adjust just sets the text */
|
2006-01-01 16:58:31 +03:00
|
|
|
} else if (pointer->buttons == wimp_CLICK_ADJUST) {
|
2011-02-21 02:16:33 +03:00
|
|
|
ro_toolbar_set_url(g->toolbar,
|
2012-10-11 14:20:02 +04:00
|
|
|
nsurl_access(url_complete_matches[
|
|
|
|
url_complete_matches_selection]),
|
2011-02-21 02:16:33 +03:00
|
|
|
true, false);
|
|
|
|
ro_gui_url_complete_keypress(g->toolbar, 0);
|
2005-02-04 21:07:27 +03:00
|
|
|
}
|
2006-01-01 16:58:31 +03:00
|
|
|
return true;
|
2005-02-03 16:18:22 +03:00
|
|
|
}
|
2011-02-21 02:16:33 +03:00
|
|
|
|