summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
Diffstat (limited to 'riscos')
-rw-r--r--riscos/gui.h30
-rw-r--r--riscos/theme.c192
-rw-r--r--riscos/theme.h33
-rw-r--r--riscos/url_complete.c56
-rw-r--r--riscos/wimp.h1
-rw-r--r--riscos/window.c2
6 files changed, 215 insertions, 99 deletions
diff --git a/riscos/gui.h b/riscos/gui.h
index e4d70bca3..c6266bc9a 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -217,36 +217,6 @@ void ro_plot_set_scale(float scale);
/* in theme_install.c */
bool ro_gui_theme_install_apply(wimp_w w);
-/* icon numbers for browser toolbars */
-#define ICON_TOOLBAR_BACK 0
-#define ICON_TOOLBAR_FORWARD 1
-#define ICON_TOOLBAR_STOP 2
-#define ICON_TOOLBAR_RELOAD 3
-#define ICON_TOOLBAR_HOME 4
-#define ICON_TOOLBAR_HISTORY 5
-#define ICON_TOOLBAR_SAVE 6
-#define ICON_TOOLBAR_PRINT 7
-#define ICON_TOOLBAR_BOOKMARK 8
-#define ICON_TOOLBAR_SCALE 9
-#define ICON_TOOLBAR_SEARCH 10
-#define ICON_TOOLBAR_URL 11 // Must be after highest toolbar icon
-#define ICON_TOOLBAR_THROBBER 12
-#define ICON_TOOLBAR_SUGGEST 13
-
-/* icon numbers for hotlist/history toolbars */
-#define ICON_TOOLBAR_DELETE 0
-#define ICON_TOOLBAR_EXPAND 1
-#define ICON_TOOLBAR_OPEN 2
-#define ICON_TOOLBAR_LAUNCH 3
-#define ICON_TOOLBAR_HISTORY_LAST 4
-#define ICON_TOOLBAR_CREATE 4 // must be after last history icon
-#define ICON_TOOLBAR_HOTLIST_LAST 5
-
-/* editing toolbar separator number */
-#define ICON_TOOLBAR_SEPARATOR_BROWSER 11
-#define ICON_TOOLBAR_SEPARATOR_HOTLIST 5
-#define ICON_TOOLBAR_SEPARATOR_HISTORY 4
-
/* icon numbers for toolbar status window */
#define ICON_STATUS_RESIZE 0
#define ICON_STATUS_TEXT 1
diff --git a/riscos/theme.c b/riscos/theme.c
index fb980a8e4..88871744a 100644
--- a/riscos/theme.c
+++ b/riscos/theme.c
@@ -112,6 +112,7 @@ static char theme_url_validation[] = "Pptr_write;KN\0";
static char theme_resize_validation[] = "R1;Pptr_lr,8,6\0";
static char theme_null_text_string[] = "\0";
static char theme_separator_name[] = "separator\0";
+static char theme_favicon_sprite[12];
/**
@@ -609,6 +610,7 @@ void ro_gui_theme_close(struct theme_descriptor *descriptor, bool list) {
*/
void ro_gui_theme_redraw(wimp_draw *redraw) {
struct toolbar *toolbar;
+ struct gui_window *g;
struct toolbar_icon *icon;
osbool more;
@@ -619,6 +621,20 @@ void ro_gui_theme_redraw(wimp_draw *redraw) {
toolbar = (struct toolbar *)ro_gui_wimp_event_get_user_data(redraw->w);
assert(toolbar);
+
+ /* set the content-type icon */
+ g = ro_gui_toolbar_lookup(toolbar->toolbar_handle);
+ assert(g);
+ assert(g->bw);
+ if (g->bw->current_content) {
+ sprintf(theme_favicon_sprite, "Ssmall_%.3x",
+ ro_content_filetype_from_type(
+ g->bw->current_content->type));
+ if (!ro_gui_wimp_sprite_exists(theme_favicon_sprite + 1))
+ sprintf(theme_favicon_sprite, "Ssmall_xxx");
+ } else {
+ sprintf(theme_favicon_sprite, "Ssmall_xxx");
+ }
/* set up the icon */
if ((toolbar->descriptor) && (toolbar->descriptor->theme) &&
@@ -911,7 +927,7 @@ bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor,
(toolbar->type == THEME_HISTORY_EDIT_TOOLBAR))
max_icon = ICON_TOOLBAR_HISTORY_LAST;
else
- max_icon = ICON_TOOLBAR_URL;
+ max_icon = ICON_TOOLBAR_LAST;
new_icon.w = toolbar->toolbar_handle;
new_icon.icon.data.indirected_text.size = 1;
new_icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_SPRITE |
@@ -961,16 +977,27 @@ bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor,
/* Create the URL/throbber icons
*/
if (toolbar->type == THEME_BROWSER_TOOLBAR) {
- new_icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_INDIRECTED |
- wimp_ICON_VCENTRED | wimp_ICON_BORDER |
- wimp_ICON_FILLED | (wimp_COLOUR_BLACK <<
- wimp_ICON_FG_COLOUR_SHIFT) |
- (wimp_BUTTON_WRITE_CLICK_DRAG <<
+ /* container for all URL bits (ie border) */
+ new_icon.icon.flags = wimp_ICON_BORDER | (wimp_COLOUR_BLACK <<
+ wimp_ICON_FG_COLOUR_SHIFT);
+ error = xwimp_create_icon(&new_icon, 0);
+ if (error) {
+ LOG(("xwimp_create_icon: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return false;
+ }
+
+ /* favicon image */
+ new_icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_SPRITE |
+ wimp_ICON_INDIRECTED | wimp_ICON_FILLED |
+ wimp_ICON_HCENTRED | wimp_ICON_VCENTRED |
+ (wimp_BUTTON_CLICK_DRAG <<
wimp_ICON_BUTTON_TYPE_SHIFT);
- new_icon.icon.data.indirected_text.text = toolbar->url_buffer;
+ new_icon.icon.data.indirected_text.text = theme_null_text_string;
new_icon.icon.data.indirected_text.validation =
- theme_url_validation;
- new_icon.icon.data.indirected_text.size = THEME_URL_MEMORY;
+ theme_favicon_sprite;
+ new_icon.icon.data.indirected_text.size = 1;
error = xwimp_create_icon(&new_icon, 0);
if (error) {
LOG(("xwimp_create_icon: 0x%x: %s",
@@ -979,15 +1006,17 @@ bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor,
return false;
}
- /* Now the throbber
- */
- new_icon.icon.flags = wimp_ICON_SPRITE | wimp_ICON_INDIRECTED |
- wimp_ICON_HCENTRED | wimp_ICON_VCENTRED;
- new_icon.icon.data.indirected_sprite.id =
- (osspriteop_id)toolbar->throbber_buffer;
- new_icon.icon.data.indirected_sprite.area = sprite_area;
- new_icon.icon.data.indirected_sprite.size =
- THEME_THROBBER_MEMORY;
+ /* Writable text portion */
+ new_icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_INDIRECTED |
+ wimp_ICON_VCENTRED |
+ wimp_ICON_FILLED | (wimp_COLOUR_BLACK <<
+ wimp_ICON_FG_COLOUR_SHIFT) |
+ (wimp_BUTTON_WRITE_CLICK_DRAG <<
+ wimp_ICON_BUTTON_TYPE_SHIFT);
+ new_icon.icon.data.indirected_text.text = toolbar->url_buffer;
+ new_icon.icon.data.indirected_text.validation =
+ theme_url_validation;
+ new_icon.icon.data.indirected_text.size = THEME_URL_MEMORY;
error = xwimp_create_icon(&new_icon, 0);
if (error) {
LOG(("xwimp_create_icon: 0x%x: %s",
@@ -1016,10 +1045,26 @@ bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor,
warn_user("WimpError", error->errmess);
return false;
}
+
+ /* Now the throbber
+ */
+ new_icon.icon.flags = wimp_ICON_SPRITE | wimp_ICON_INDIRECTED |
+ wimp_ICON_HCENTRED | wimp_ICON_VCENTRED;
+ new_icon.icon.data.indirected_sprite.id =
+ (osspriteop_id)toolbar->throbber_buffer;
+ new_icon.icon.data.indirected_sprite.area = sprite_area;
+ new_icon.icon.data.indirected_sprite.size =
+ THEME_THROBBER_MEMORY;
+ error = xwimp_create_icon(&new_icon, 0);
+ if (error) {
+ LOG(("xwimp_create_icon: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return false;
+ }
}
- if (toolbar->parent_handle) {
+ if (toolbar->parent_handle)
ro_gui_theme_attach_toolbar(toolbar, toolbar->parent_handle);
- }
/* Recreate the status window
*/
@@ -1301,6 +1346,14 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
struct toolbar_icon *toolbar_icon;
bool visible_icon = false;
int collapse_height;
+ int xeig, yeig;
+ os_coord pixel = {1, 1};
+ int top, bottom, right;
+
+ /* calculate 1px in OS units */
+ ro_convert_pixels_to_os_units(&pixel, (os_mode)-1);
+ xeig = pixel.x;
+ yeig = pixel.y;
/* find the parent window handle if we need to process the status
* window, or the caller has requested we calculate the width ourself */
@@ -1335,8 +1388,8 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
height = state.visible.y1 - state.visible.y0 + 2;
- /* We can't obscure the height of the scroll bar as we lose the resize
- icon if we do.
+ /* We can't obscure the height of the scroll bar as we
+ lose the resize icon if we do.
*/
if ((state.flags & wimp_WINDOW_SIZE_ICON) &&
!(state.flags & wimp_WINDOW_HSCROLL))
@@ -1380,7 +1433,8 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
if ((toolbar->type == THEME_BROWSER_TOOLBAR) && (toolbar->display_url)) {
if (toolbar->height < 52 + 8)
toolbar->height = 52 + 8;
- if ((toolbar->suggest) && (toolbar->height < (toolbar->suggest->height + 8)))
+ if ((toolbar->suggest) && (toolbar->height <
+ (toolbar->suggest->height + 8)))
toolbar->height = toolbar->suggest->height + 8;
}
@@ -1409,7 +1463,7 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
if (toolbar->type == THEME_BROWSER_TOOLBAR) {
if (!toolbar->reformat_buttons) left_edge = bottom_edge;
if (toolbar->display_url) {
- bottom_edge += 64;
+ bottom_edge += 112;
if (toolbar->suggest)
bottom_edge += toolbar->suggest->width + 8;
}
@@ -1420,7 +1474,8 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
(toolbar->descriptor->throbber_right)) {
bottom_edge += toolbar->descriptor->theme->throbber_width;
if (bottom_edge > right_edge) right_edge = bottom_edge;
- throbber_x = right_edge - toolbar->descriptor->theme->throbber_width;
+ throbber_x = right_edge -
+ toolbar->descriptor->theme->throbber_width;
right_edge -= toolbar->descriptor->theme->throbber_width + 8;
}
}
@@ -1430,12 +1485,14 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
if (toolbar->reformat_buttons) {
/* Hide the URL bar if we should
*/
- if ((!toolbar->display_url) && (toolbar->type == THEME_BROWSER_TOOLBAR)) {
+ if ((!toolbar->display_url) &&
+ (toolbar->type == THEME_BROWSER_TOOLBAR)) {
if (!xwimp_get_caret_position(&caret)) {
if ((caret.w == toolbar->toolbar_handle) &&
(caret.i == ICON_TOOLBAR_URL)) {
if (toolbar->parent_handle)
- xwimp_set_caret_position(toolbar->parent_handle,
+ xwimp_set_caret_position(
+ toolbar->parent_handle,
wimp_ICON_WINDOW,
-100, -100, 32, -1);
else
@@ -1443,16 +1500,20 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
0, 0, 0, 0, 0);
}
}
+ xwimp_resize_icon(toolbar->toolbar_handle, ICON_TOOLBAR_SURROUND,
+ 0, -16384, 0, -16384);
+ xwimp_resize_icon(toolbar->toolbar_handle, ICON_TOOLBAR_FAVICON,
+ 0, -16384, 0, -16384);
xwimp_resize_icon(toolbar->toolbar_handle, ICON_TOOLBAR_URL,
- 0, -16384, 0, -16384);
+ 0, -16384, 0, -16384);
xwimp_resize_icon(toolbar->toolbar_handle, ICON_TOOLBAR_SUGGEST,
- 0, -16384, 0, -16384);
+ 0, -16384, 0, -16384);
} else if (toolbar->type == THEME_BROWSER_TOOLBAR) {
- ro_gui_set_icon_shaded_state(toolbar->toolbar_handle, ICON_TOOLBAR_URL,
- !toolbar->display_url);
+ ro_gui_set_icon_shaded_state(toolbar->toolbar_handle,
+ ICON_TOOLBAR_URL, !toolbar->display_url);
}
xwimp_force_redraw(toolbar->toolbar_handle,
- 0, 0, 16384, 16384);
+ 0, 0, 16384, 16384);
/* Move the buttons
*/
@@ -1487,26 +1548,46 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
/* Move the URL bar
*/
if (toolbar->display_url) {
+ top = (toolbar->height / 2) + 26;
+ bottom = (toolbar->height / 2) - 26;
if (toolbar->suggest) {
- xwimp_resize_icon(toolbar->toolbar_handle, ICON_TOOLBAR_URL,
- left_edge, (toolbar->height / 2) - 26,
- right_edge - toolbar->suggest->width - 8,
- (toolbar->height / 2) + 26);
- xwimp_resize_icon(toolbar->toolbar_handle, ICON_TOOLBAR_SUGGEST,
+ right = right_edge - toolbar->suggest->width - 8;
+ xwimp_resize_icon(toolbar->toolbar_handle,
+ ICON_TOOLBAR_SUGGEST,
right_edge - toolbar->suggest->width,
(toolbar->height - toolbar->suggest->height) / 2,
right_edge,
(toolbar->height + toolbar->suggest->height) / 2);
- xwimp_force_redraw(toolbar->toolbar_handle,
- right_edge - toolbar->suggest->width - 8, 0,
- 16384, 16384);
} else {
- xwimp_resize_icon(toolbar->toolbar_handle, ICON_TOOLBAR_URL,
- left_edge, (toolbar->height / 2) - 26,
- right_edge, (toolbar->height / 2) + 26);
- xwimp_force_redraw(toolbar->toolbar_handle,
- right_edge, 0, 16384, 16384);
+ right = right_edge;
}
+ xwimp_resize_icon(toolbar->toolbar_handle, ICON_TOOLBAR_URL,
+ left_edge + 52,
+ bottom + yeig,
+ right - xeig,
+ top - yeig);
+ xwimp_resize_icon(toolbar->toolbar_handle, ICON_TOOLBAR_FAVICON,
+ left_edge + xeig,
+ bottom + yeig,
+ left_edge + 52,
+ top - yeig);
+ xwimp_resize_icon(toolbar->toolbar_handle, ICON_TOOLBAR_SURROUND,
+ left_edge,
+ bottom,
+ right,
+ top);
+ xwimp_force_redraw(toolbar->toolbar_handle,
+ right - xeig, 0, 16384, 16384);
+ xwimp_force_redraw(toolbar->toolbar_handle,
+ left_edge,
+ bottom,
+ right,
+ bottom + yeig);
+ xwimp_force_redraw(toolbar->toolbar_handle,
+ left_edge,
+ top - yeig,
+ right,
+ top);
if (!xwimp_get_caret_position(&caret)) {
if ((caret.w == toolbar->toolbar_handle) &&
(caret.i == ICON_TOOLBAR_URL)) {
@@ -1764,15 +1845,18 @@ void ro_gui_theme_toggle_edit(struct toolbar *toolbar) {
/* create/initialise the toolbar editor */
switch (toolbar->type) {
case THEME_BROWSER_TOOLBAR:
- toolbar->editor = ro_gui_theme_create_toolbar(toolbar->descriptor,
+ toolbar->editor = ro_gui_theme_create_toolbar(
+ toolbar->descriptor,
THEME_BROWSER_EDIT_TOOLBAR);
break;
case THEME_HOTLIST_TOOLBAR:
- toolbar->editor = ro_gui_theme_create_toolbar(toolbar->descriptor,
+ toolbar->editor = ro_gui_theme_create_toolbar(
+ toolbar->descriptor,
THEME_HOTLIST_EDIT_TOOLBAR);
break;
case THEME_HISTORY_TOOLBAR:
- toolbar->editor = ro_gui_theme_create_toolbar(toolbar->descriptor,
+ toolbar->editor = ro_gui_theme_create_toolbar(
+ toolbar->descriptor,
THEME_HISTORY_EDIT_TOOLBAR);
break;
default:
@@ -1788,7 +1872,8 @@ void ro_gui_theme_toggle_edit(struct toolbar *toolbar) {
switch (toolbar->type) {
case THEME_BROWSER_TOOLBAR:
if (g)
- ro_gui_window_update_dimensions(g, -toolbar->editor->height);
+ ro_gui_window_update_dimensions(g,
+ -toolbar->editor->height);
break;
default:
if (toolbar->parent_handle) {
@@ -1830,8 +1915,10 @@ void ro_gui_theme_toolbar_editor_sync(struct toolbar *toolbar) {
for (icon_edit = toolbar->editor->icon; icon_edit;
icon_edit = icon_edit->next)
if (icon_edit->icon_number == icon->icon_number)
- ro_gui_set_icon_shaded_state(toolbar->editor->toolbar_handle,
- icon_edit->icon_number, icon->display);
+ ro_gui_set_icon_shaded_state(
+ toolbar->editor->toolbar_handle,
+ icon_edit->icon_number,
+ icon->display);
}
@@ -2278,7 +2365,8 @@ void ro_gui_theme_add_toolbar_icons(struct toolbar *toolbar,
*/
void ro_gui_theme_set_help_prefix(struct toolbar *toolbar) {
if (toolbar->editor) {
- ro_gui_wimp_event_set_help_prefix(toolbar->toolbar_handle, "HelpEditToolbar");
+ ro_gui_wimp_event_set_help_prefix(toolbar->toolbar_handle,
+ "HelpEditToolbar");
return;
}
switch (toolbar->type) {
diff --git a/riscos/theme.h b/riscos/theme.h
index 4c21d0296..bd6a4783c 100644
--- a/riscos/theme.h
+++ b/riscos/theme.h
@@ -14,6 +14,39 @@
#ifndef _NETSURF_RISCOS_THEME_H_
#define _NETSURF_RISCOS_THEME_H_
+/* icon numbers for browser toolbars */
+#define ICON_TOOLBAR_BACK 0
+#define ICON_TOOLBAR_FORWARD 1
+#define ICON_TOOLBAR_STOP 2
+#define ICON_TOOLBAR_RELOAD 3
+#define ICON_TOOLBAR_HOME 4
+#define ICON_TOOLBAR_HISTORY 5
+#define ICON_TOOLBAR_SAVE 6
+#define ICON_TOOLBAR_PRINT 7
+#define ICON_TOOLBAR_BOOKMARK 8
+#define ICON_TOOLBAR_SCALE 9
+#define ICON_TOOLBAR_SEARCH 10
+#define ICON_TOOLBAR_LAST 11
+#define ICON_TOOLBAR_SURROUND 11 // Must be after highest toolbar icon
+#define ICON_TOOLBAR_FAVICON 12
+#define ICON_TOOLBAR_URL 13
+#define ICON_TOOLBAR_SUGGEST 14
+#define ICON_TOOLBAR_THROBBER 15
+
+/* icon numbers for hotlist/history toolbars */
+#define ICON_TOOLBAR_DELETE 0
+#define ICON_TOOLBAR_EXPAND 1
+#define ICON_TOOLBAR_OPEN 2
+#define ICON_TOOLBAR_LAUNCH 3
+#define ICON_TOOLBAR_HISTORY_LAST 4
+#define ICON_TOOLBAR_CREATE 4 // must be after last history icon
+#define ICON_TOOLBAR_HOTLIST_LAST 5
+
+/* editing toolbar separator number */
+#define ICON_TOOLBAR_SEPARATOR_BROWSER 11
+#define ICON_TOOLBAR_SEPARATOR_HOTLIST 5
+#define ICON_TOOLBAR_SEPARATOR_HISTORY 4
+
typedef enum {
THEME_BROWSER_TOOLBAR,
THEME_HOTLIST_TOOLBAR,
diff --git a/riscos/url_complete.c b/riscos/url_complete.c
index 0e0e360ce..88b2ad8e5 100644
--- a/riscos/url_complete.c
+++ b/riscos/url_complete.c
@@ -27,7 +27,7 @@
#define MAXIMUM_VISIBLE_LINES 7
-static char **url_complete_matches = NULL;
+static struct url_content **url_complete_matches = NULL;
static int url_complete_matches_allocated = 0;
static int url_complete_matches_available = 0;
static char *url_complete_matched_string = NULL;
@@ -37,9 +37,11 @@ static wimp_w url_complete_parent = 0;
static bool url_complete_matches_reset = false;
static char *url_complete_original_url = NULL;
-static char *url_complete_redraw[MAXIMUM_VISIBLE_LINES];
+static struct url_content *url_complete_redraw[MAXIMUM_VISIBLE_LINES];
static char url_complete_icon_null[] = "\0";
+static char url_complete_icon_sprite[12];
static wimp_icon url_complete_icon;
+static wimp_icon url_complete_sprite;
static int mouse_x;
static int mouse_y;
@@ -71,11 +73,11 @@ void ro_gui_url_complete_start(struct gui_window *g) {
*/
bool ro_gui_url_complete_keypress(struct gui_window *g, int key) {
wimp_window_state state;
- char **array_extend;
+ struct url_content **array_extend;
struct url_data *reference = NULL;
char *match_url;
char *url;
- char *output;
+ struct url_content *output;
int i, lines;
int old_selection;
bool ignore_changes = false;
@@ -119,7 +121,7 @@ bool ro_gui_url_complete_keypress(struct gui_window *g, int key) {
/* check if we should ignore text changes */
if ((url_complete_keypress_selection >= 0) && (url_complete_matches))
ignore_changes = !strcmp(url,
- url_complete_matches[url_complete_keypress_selection]);
+ url_complete_matches[url_complete_keypress_selection]->url);
/* if the text to match has changed then update it */
if (!ignore_changes && ((!url_complete_matched_string) ||
@@ -168,9 +170,10 @@ bool ro_gui_url_complete_keypress(struct gui_window *g, int key) {
if (url_complete_matches_available >
url_complete_matches_allocated) {
- array_extend = realloc(url_complete_matches,
+ array_extend = (struct url_content **)realloc(
+ url_complete_matches,
(url_complete_matches_allocated + 64) *
- sizeof(char *));
+ sizeof(struct url_content *));
if (!array_extend) {
ro_gui_url_complete_close(NULL, 0);
return false;
@@ -276,7 +279,7 @@ bool ro_gui_url_complete_keypress(struct gui_window *g, int key) {
} else {
ro_gui_set_icon_string(g->toolbar->toolbar_handle,
ICON_TOOLBAR_URL,
- url_complete_matches[url_complete_matches_selection]);
+ url_complete_matches[url_complete_matches_selection]->url);
}
url_complete_keypress_selection = url_complete_matches_selection;
@@ -355,7 +358,7 @@ void ro_gui_url_complete_resize(struct gui_window *g, wimp_open *open) {
return;
}
url_state.w = g->toolbar->toolbar_handle;
- url_state.i = ICON_TOOLBAR_URL;
+ url_state.i = ICON_TOOLBAR_SURROUND;
error = xwimp_get_icon_state(&url_state);
if (error) {
LOG(("xwimp_get_window_state: 0x%x: %s",
@@ -463,9 +466,17 @@ void ro_gui_url_complete_redraw(wimp_draw *redraw) {
wimp_ICON_TEXT | wimp_ICON_FILLED |
(wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) |
(wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT);
- url_complete_icon.extent.x0 = 0;
+ url_complete_icon.extent.x0 = 50;
url_complete_icon.extent.x1 = 16384;
url_complete_icon.data.indirected_text.validation = url_complete_icon_null;
+ 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;
+ url_complete_sprite.data.indirected_text.text = url_complete_icon_null;
+ url_complete_sprite.data.indirected_text.validation = url_complete_icon_sprite;
+ url_complete_sprite.data.indirected_text.size = 1;
/* no matches? no redraw */
if (!url_complete_matches) {
@@ -492,15 +503,28 @@ void ro_gui_url_complete_redraw(wimp_draw *redraw) {
url_complete_icon.extent.y1 = -line * 44;
url_complete_icon.extent.y0 = -(line + 1) * 44;
url_complete_icon.data.indirected_text.text =
- url_complete_matches[line];
+ url_complete_matches[line]->url;
url_complete_icon.data.indirected_text.size =
- strlen(url_complete_matches[line]);
+ strlen(url_complete_matches[line]->url);
error = xwimp_plot_icon(&url_complete_icon);
if (error) {
LOG(("xwimp_plot_icon: 0x%x: %s",
error->errnum, error->errmess));
warn_user("WimpError", error->errmess);
}
+ sprintf(url_complete_icon_sprite, "Ssmall_%.3x",
+ ro_content_filetype_from_type(
+ url_complete_matches[line]->type));
+ if (!ro_gui_wimp_sprite_exists(url_complete_icon_sprite + 1))
+ sprintf(url_complete_icon_sprite, "Ssmall_xxx");
+ url_complete_sprite.extent.y1 = -line * 44;
+ url_complete_sprite.extent.y0 = -(line + 1) * 44;
+ error = xwimp_plot_icon(&url_complete_sprite);
+ if (error) {
+ LOG(("xwimp_plot_icon: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ }
}
more = wimp_get_rectangle(redraw);
}
@@ -593,18 +617,18 @@ bool ro_gui_url_complete_click(wimp_pointer *pointer) {
if (pointer->buttons == wimp_CLICK_SELECT) {
ro_gui_set_icon_string(g->toolbar->toolbar_handle,
ICON_TOOLBAR_URL,
- url_complete_matches[url_complete_matches_selection]);
+ url_complete_matches[url_complete_matches_selection]->url);
browser_window_go(g->bw,
- url_complete_matches[url_complete_matches_selection],
+ url_complete_matches[url_complete_matches_selection]->url,
0);
- global_history_add_recent(url_complete_matches[url_complete_matches_selection]);
+ global_history_add_recent(url_complete_matches[url_complete_matches_selection]->url);
ro_gui_url_complete_close(NULL, 0);
/* Adjust just sets the text */
} else if (pointer->buttons == wimp_CLICK_ADJUST) {
ro_gui_set_icon_string(g->toolbar->toolbar_handle,
ICON_TOOLBAR_URL,
- url_complete_matches[url_complete_matches_selection]);
+ url_complete_matches[url_complete_matches_selection]->url);
ro_gui_url_complete_keypress(g, 0);
}
return true;
diff --git a/riscos/wimp.h b/riscos/wimp.h
index a7777d28d..f63357551 100644
--- a/riscos/wimp.h
+++ b/riscos/wimp.h
@@ -23,7 +23,6 @@
int ro_get_hscroll_height(wimp_w w);
int ro_get_vscroll_width(wimp_w w);
-struct eig_factors ro_read_eig_factors(os_mode mode);
void ro_convert_os_units_to_pixels(os_coord *os_units, os_mode mode);
void ro_convert_pixels_to_os_units(os_coord *pixels, os_mode mode);
diff --git a/riscos/window.c b/riscos/window.c
index 9ba7d02a4..c5af2fbb1 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -1020,6 +1020,8 @@ void gui_window_set_url(struct gui_window *g, const char *url)
ro_gui_set_icon_string(g->toolbar->toolbar_handle,
ICON_TOOLBAR_URL, url);
+ ro_gui_force_redraw_icon(g->toolbar->toolbar_handle,
+ ICON_TOOLBAR_FAVICON);
/* if the caret is in the address bar, move it to the end */
error = xwimp_get_caret_position(&caret);