summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/gui.h1
-rw-r--r--desktop/netsurf.c29
-rw-r--r--riscos/gui.c75
-rw-r--r--riscos/options.h2
4 files changed, 51 insertions, 56 deletions
diff --git a/desktop/gui.h b/desktop/gui.h
index be1686510..fbb4f8525 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -26,6 +26,7 @@ typedef enum { GUI_POINTER_DEFAULT, GUI_POINTER_POINT, GUI_POINTER_CARET,
#include "netsurf/desktop/browser.h"
void gui_init(int argc, char** argv);
+void gui_init2(void);
void gui_multitask(void);
void gui_poll(bool active);
void gui_quit(void);
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index befa82d67..5f12f74fd 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -14,11 +14,6 @@
#include "netsurf/utils/config.h"
#include "netsurf/content/fetch.h"
#include "netsurf/content/fetchcache.h"
-#ifdef riscos
- #include "netsurf/riscos/options.h"
-#else
- #include "netsurf/desktop/options.h"
-#endif
#include "netsurf/desktop/netsurf.h"
#include "netsurf/desktop/browser.h"
#include "netsurf/desktop/gui.h"
@@ -40,26 +35,7 @@ static void lib_init(void);
int main(int argc, char** argv)
{
- char url[80];
- int length;
-
- netsurf_init(argc, argv);
-
-#ifdef WITH_KIOSK_BROWSING
- browser_window_create("file:/<NetSurf$Dir>/Docs/Intro_En", NULL);
-#endif
-
- if (option_open_browser_at_startup == true){
- if (!(option_homepage_url == NULL)){
- browser_window_create(option_homepage_url, NULL);
- }
- else {
- if ((length = snprintf(url, sizeof(url),
- "file:/<NetSurf$Dir>/Docs/intro_%s",
- option_language)) >= 0 && length < (int)sizeof(url))
- browser_window_create(url, NULL);
- }
- }
+ netsurf_init(argc, argv);
while (!netsurf_quit)
netsurf_poll();
@@ -86,7 +62,7 @@ void netsurf_init(int argc, char** argv)
LOG(("version '%s'", netsurf_version));
if (uname(&utsname) != 0)
- LOG(("Failed to extract machine information\n"));
+ LOG(("Failed to extract machine information"));
else
LOG(("NetSurf on <%s>, node <%s>, release <%s>, version <%s>, "
"machine <%s>", utsname.sysname,
@@ -99,6 +75,7 @@ void netsurf_init(int argc, char** argv)
setlocale(LC_ALL, "");
fetch_init();
fetchcache_init();
+ gui_init2();
}
/**
diff --git a/riscos/gui.c b/riscos/gui.c
index 3ee556698..c89a2d22d 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -127,7 +127,7 @@ struct ro_gui_poll_block *ro_gui_poll_queued_blocks = 0;
static void ro_gui_choose_language(void);
static void ro_gui_check_fonts(void);
-static void ro_gui_pointers_init(void);
+static void ro_gui_sprites_init(void);
static void ro_gui_icon_bar_create(void);
static void ro_gui_handle_event(wimp_event_no event, wimp_block *block);
static void ro_gui_poll_queue(wimp_event_no event, wimp_block *block);
@@ -183,7 +183,7 @@ void gui_init(int argc, char** argv)
messages_load(path);
messages_load("<NetSurf$Dir>.Resources.LangNames");
- /* Totally pedantic, but base the taskname on the buid options.
+ /* Totally pedantic, but base the taskname on the build options.
*/
#ifndef ncos
error = xwimp_initialise(wimp_VERSION_RO38, "NetSurf",
@@ -240,7 +240,7 @@ void gui_init(int argc, char** argv)
#endif
ro_gui_history_init();
wimp_close_template();
- ro_gui_pointers_init();
+ ro_gui_sprites_init();
ro_gui_hotlist_init();
/* We don't create an Iconbar icon on NCOS */
@@ -339,10 +339,10 @@ void ro_gui_check_fonts(void)
/**
- * Initialise pointer sprite area.
+ * Load resource sprites (pointers and misc icons).
*/
-void ro_gui_pointers_init(void)
+void ro_gui_sprites_init(void)
{
int len;
fileswitch_object_type obj_type;
@@ -411,6 +411,31 @@ void ro_gui_check_resolvers(void)
/**
+ * Last-minute gui init, after all other modules have initialised.
+ */
+
+void gui_init2(void)
+{
+#ifdef WITH_KIOSK_BROWSING
+ browser_window_create("file:/<NetSurf$Dir>/Docs/intro_en", NULL);
+#else
+ char url[80];
+
+ if (option_open_browser_at_startup) {
+ if (option_homepage_url && option_homepage_url[0]) {
+ browser_window_create(option_homepage_url, NULL);
+ } else {
+ snprintf(url, sizeof url,
+ "file:/<NetSurf$Dir>/Docs/intro_%s",
+ option_language);
+ browser_window_create(url, NULL);
+ }
+ }
+#endif
+}
+
+
+/**
* Close down the gui (RISC OS).
*/
@@ -799,36 +824,28 @@ void ro_gui_mouse_click(wimp_pointer *pointer)
void ro_gui_icon_bar_click(wimp_pointer *pointer)
{
- int key_down = 0;
+ char url[80];
+ int key_down = 0;
+
if (pointer->buttons == wimp_CLICK_MENU) {
ro_gui_create_menu(iconbar_menu, pointer->pos.x,
96 + iconbar_menu_height, NULL);
- } else if (pointer->buttons == wimp_CLICK_SELECT) {
- char url[80];
- int length;
-
- /* Open the homepage based on our the user options. */
- if (!(option_homepage_url == NULL)){
- browser_window_create(option_homepage_url, NULL);
- }
- else {
- if ((length = snprintf(url, sizeof(url),
- "file:/<NetSurf$Dir>/Docs/intro_%s",
- option_language)) >= 0 && length < (int)sizeof(url))
- browser_window_create(url, NULL);
- }
+ } else if (pointer->buttons == wimp_CLICK_SELECT) {
+ if (option_homepage_url && option_homepage_url[0]) {
+ browser_window_create(option_homepage_url, NULL);
+ } else {
+ snprintf(url, sizeof url,
+ "file:/<NetSurf$Dir>/Docs/intro_%s",
+ option_language);
+ browser_window_create(url, NULL);
+ }
} else if (pointer->buttons == wimp_CLICK_ADJUST) {
- /* I've no idea what the correct way to scan for keys is when in the
- desktop, so I've used os_byte to scan directly. This may cause some
- weirdness for very unresponsive desktops due to the clicks being
- buffered and the keypresses not.
- */
- xosbyte1(osbyte_SCAN_KEYBOARD, 0 ^ 0x80, 0, &key_down);
- if (key_down == 0) {
- ro_gui_hotlist_show();
- } else {
+ xosbyte1(osbyte_SCAN_KEYBOARD, 0 ^ 0x80, 0, &key_down);
+ if (key_down == 0) {
+ ro_gui_hotlist_show();
+ } else {
ro_gui_debugwin_open();
}
}
diff --git a/riscos/options.h b/riscos/options.h
index 6b6d1a60f..a1f767f34 100644
--- a/riscos/options.h
+++ b/riscos/options.h
@@ -78,7 +78,7 @@ bool option_background_images = true; \
bool option_background_blending = true; \
bool option_buffer_animations = true; \
bool option_buffer_everything = false; \
-char *option_homepage_url =0;\
+char *option_homepage_url = 0; \
bool option_open_browser_at_startup = false;
#define EXTRA_OPTION_TABLE \