[project @ 2003-07-30 13:06:22 by jmb]

Add support for Acorn URI Protocol and URI files (Rob Jackson)

svn path=/import/netsurf/; revision=242
This commit is contained in:
John Mark Bell 2003-07-30 13:06:22 +00:00
parent 3c0daf429a
commit 7c474c848e
10 changed files with 225 additions and 46 deletions

17
!NetSurf/!Boot Normal file
View File

@ -0,0 +1,17 @@
Set NetSurf$Dir <Obey$Dir>
IconSprites <NetSurf$Dir>.!Sprites
Set File$Type_F79 CSS
| Acorn URI protocol
Set NetSurf$start_uri_handler "no"
RMEnsure AcornURI 0.10 Set NetSurf$start_uri_handler "yes"
RMEnsure AcornURI 0.10 RMLoad System:310.Modules.Network.URI
If "<NetSurf$start_uri_handler>" = "yes" Then Desktop
If "<Alias$Open_URI_http>" = "" Then Set Alias$Open_URI_http <NetSurf$Dir>.URILaunch
If "<Alias$Open_URI_https>" = "" Then Set Alias$Open_URI_https <NetSurf$Dir>.URILaunch
If "<Alias$Open_URI_file>" = "" Then Set Alias$Open_URI_file <NetSurf$Dir>.URILaunch
| Claim URI files
If "<Alias$@RunType_F91>" = "" Then Set Alias$@RunType_F91 <NetSurf$Dir>.URILaunch

17
!NetSurf/!Boot,feb Normal file
View File

@ -0,0 +1,17 @@
Set NetSurf$Dir <Obey$Dir>
IconSprites <NetSurf$Dir>.!Sprites
Set File$Type_F79 CSS
| Acorn URI protocol
Set NetSurf$start_uri_handler "no"
RMEnsure AcornURI 0.10 Set NetSurf$start_uri_handler "yes"
RMEnsure AcornURI 0.10 RMLoad System:310.Modules.Network.URI
If "<NetSurf$start_uri_handler>" = "yes" Then Desktop
If "<Alias$Open_URI_http>" = "" Then Set Alias$Open_URI_http <NetSurf$Dir>.URILaunch
If "<Alias$Open_URI_https>" = "" Then Set Alias$Open_URI_https <NetSurf$Dir>.URILaunch
If "<Alias$Open_URI_file>" = "" Then Set Alias$Open_URI_file <NetSurf$Dir>.URILaunch
| Claim URI files
If "<Alias$@RunType_F91>" = "" Then Set Alias$@RunType_F91 <NetSurf$Dir>.URILaunch

View File

@ -1,15 +1,16 @@
|rafs_flush
Set NetSurf$Dir <Obey$Dir>
IconSprites <NetSurf$Dir>.!Sprites
Set File$Type_F79 CSS
If "<NetSurf$Dir>" = "" Then Obey <Obey$Dir>.!Boot
RMensure WindowManager 3.80 Error 0 NetSurf requires the Nested Window Manager.
RMEnsure UtilityModule 3.70 RMensure CallASWI 0.00 RMload <NetSurf$Dir>.CallASWI
RMEnsure SharedUnixLibrary 1.00 RMLoad System:Modules.SharedULib
| drag the 'next' slot in the task manager to something huge and ridiculous,
| and/or increase the number below
Wimpslot -min 2000k
Set NetSurf$running "yes"
<NetSurf$Dir>.!RunImage 2><NetSurf$Dir>.stderr
UnSet NetSurf$running

1
!NetSurf/URILaunch,feb Normal file
View File

@ -0,0 +1 @@
If "<NetSurf$running>" <> "yes" Then Run <NetSurf$Dir>.!Run

View File

@ -1,4 +1,4 @@
$Id: TODO-General,v 1.4 2003/07/07 22:10:51 jmb Exp $
$Id: TODO-General,v 1.5 2003/07/30 13:06:22 jmb Exp $
TODO-General for NetSurf.
@ -8,10 +8,8 @@ This file documents general things which need doing.
Disk Cache
Saving
Printing
View Source
Global Clipboard Support
More Image file formats
JavaScript?
URI Protocol support
ANT URL protocol support
#targets in URLS eg: http://www.moo.com/index.html#blah

View File

@ -13,7 +13,7 @@ OBJECTS_COMMON = cache.o content.o fetch.o fetchcache.o other.o \
OBJECTS = $(OBJECTS_COMMON) \
browser.o netsurf.o \
gif.o gui.o jpeg.o png.o theme.o plugin.o \
options.o filetype.o font.o
options.o filetype.o font.o uri.o
OBJECTS_DEBUG = $(OBJECTS_COMMON) \
netsurfd.o \
optionsd.o filetyped.o fontd.o

View File

@ -19,12 +19,15 @@
#include "oslib/osgbpb.h"
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
#include "oslib/uri.h"
#include "netsurf/desktop/gui.h"
#include "netsurf/desktop/netsurf.h"
#include "netsurf/desktop/options.h"
#include "netsurf/render/font.h"
#include "netsurf/render/html.h"
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/theme.h"
#include "netsurf/riscos/uri.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/utils.h"
@ -138,32 +141,6 @@ int ro_y_units(unsigned long browser_units);
unsigned long browser_x_units(int ro_units);
unsigned long browser_y_units(int ro_units);
struct ro_gui_window
{
gui_window_type type;
union {
struct {
wimp_w window;
wimp_w toolbar;
int toolbar_width;
struct browser_window* bw;
} browser;
} data;
char status[256];
char title[256];
char url[256];
gui_window* next;
int throbber;
float throbtime;
gui_safety redraw_safety;
enum { drag_NONE, drag_UNKNOWN, drag_BROWSER_TEXT_SELECTION } drag_status;
int old_width;
};
void ro_gui_window_click(gui_window* g, wimp_pointer* mouse);
//void ro_gui_window_mouse_at(gui_window* g, wimp_pointer* mouse);
void ro_gui_window_open(gui_window* g, wimp_open* open);
@ -366,7 +343,7 @@ ro_theme* current_theme = NULL;
const char* BROWSER_VALIDATION = "\0";
const char* task_name = "NetSurf";
const wimp_MESSAGE_LIST(3) task_messages = { {message_DATA_SAVE, message_DATA_LOAD, 0} };
const wimp_MESSAGE_LIST(4) task_messages = { {message_DATA_SAVE, message_DATA_LOAD, message_URI_PROCESS, 0} };
wimp_t task_handle;
wimp_i ro_gui_iconbar_i;
@ -2007,11 +1984,24 @@ void gui_multitask(void)
case wimp_USER_MESSAGE :
case wimp_USER_MESSAGE_RECORDED :
case wimp_USER_MESSAGE_ACKNOWLEDGE:
fprintf(stderr, "MESSAGE %d (%x) HAS ARRIVED\n", block.message.action, block.message.action);
if (block.message.action == message_DATA_SAVE)
ro_msg_datasave(&(block.message));
else if (block.message.action == message_DATA_LOAD)
ro_msg_dataload(&(block.message));
switch (block.message.action)
{
case message_DATA_SAVE :
ro_msg_datasave(&(block.message));
break;
case message_DATA_LOAD :
ro_msg_dataload(&(block.message));
break;
case message_URI_PROCESS :
ro_uri_message_received(&(block.message));
break;
}
if (block.message.action == message_QUIT)
netsurf_quit = 1;
else
@ -2317,14 +2307,28 @@ void gui_poll(void)
case wimp_USER_MESSAGE :
case wimp_USER_MESSAGE_RECORDED :
case wimp_USER_MESSAGE_ACKNOWLEDGE:
fprintf(stderr, "MESSAGE %d (%x) HAS ARRIVED\n", block.message.action, block.message.action);
if (block.message.action == message_DATA_SAVE)
ro_msg_datasave(&(block.message));
else if (block.message.action == message_DATA_LOAD)
ro_msg_dataload(&(block.message));
else if (block.message.action == message_QUIT)
netsurf_quit = 1;
break;
switch (block.message.action)
{
case message_DATA_SAVE :
ro_msg_datasave(&(block.message));
break;
case message_DATA_LOAD :
ro_msg_dataload(&(block.message));
break;
case message_URI_PROCESS :
ro_uri_message_received(&(block.message));
break;
case message_QUIT :
netsurf_quit = 1;
break;
}
break;
}
} while (finished == 0);

41
riscos/gui.h Normal file
View File

@ -0,0 +1,41 @@
/*
* This file is part of NetSurf, http://netsurf.sourceforge.net/
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
*/
#ifndef _NETSURF_RISCOS_GUI_H_
#define _NETSURF_RISCOS_GUI_H_
#include "netsurf/desktop/browser.h"
#include "netsurf/desktop/gui.h"
#include "oslib/wimp.h"
struct ro_gui_window
{
gui_window_type type;
union {
struct {
wimp_w window;
wimp_w toolbar;
int toolbar_width;
struct browser_window* bw;
} browser;
} data;
char status[256];
char title[256];
char url[256];
gui_window* next;
int throbber;
float throbtime;
gui_safety redraw_safety;
enum { drag_NONE, drag_UNKNOWN, drag_BROWSER_TEXT_SELECTION } drag_status;
int old_width;
};
#endif

87
riscos/uri.c Normal file
View File

@ -0,0 +1,87 @@
/*
* This file is part of NetSurf, http://netsurf.sourceforge.net/
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
* Copyright 2003 Rob Jackson <jacko@xms.ms>
*/
#include <stdio.h>
#include <string.h>
#include "oslib/uri.h"
#include "oslib/wimp.h"
#include "netsurf/desktop/browser.h"
#include "netsurf/riscos/theme.h"
#include "netsurf/desktop/gui.h"
#include "netsurf/riscos/gui.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/utils.h"
void ro_uri_message_received(uri_full_message_process*);
extern ro_theme* current_theme;
void ro_uri_message_received(uri_full_message_process* uri_message)
{
uri_h uri_handle;
char* uri_requested;
char* temp;
struct browser_window* bw;
int uri_length;
int i;
uri_handle = uri_message->handle;
LOG(("URI message... %s, handle = %d", uri_message->uri,
(int)uri_message->handle));
if ( (strspn(uri_message->uri, "http://") != strlen("http://")) &&
(strspn(uri_message->uri, "https://") != strlen("https://")) &&
(strspn(uri_message->uri, "file:/") != strlen("file:/")) )
return;
else LOG(("URI message deemed relevant"));
uri_message->your_ref = uri_message->my_ref;
uri_message->action = message_URI_PROCESS_ACK;
xwimp_send_message(wimp_USER_MESSAGE_ACKNOWLEDGE,
(wimp_message*)uri_message,
uri_message->sender);
xuri_request_uri(0, 0, 0, uri_handle, &uri_length);
uri_requested = xcalloc(uri_length, sizeof(char));
if (uri_requested == NULL)
return;
xuri_request_uri(0, uri_requested, uri_length, uri_handle, NULL);
/* Kludge for file:/ URLs (changes them into file:/// URLs) */
if( (strncasecmp(uri_requested, "file:/", 6) == 0) &&
(strncasecmp(uri_requested, "file://", 7) != 0) ) {
temp = xcalloc(strlen(uri_requested) + 5, sizeof(char));
strcpy(temp, "file:///");
for(i=6; i!=strlen(uri_requested); i++) {
temp[i+2] = uri_message->uri[i];
}
xfree(uri_requested);
uri_requested = strdup(temp);
xfree(temp);
}
bw = create_browser_window(browser_TITLE | browser_TOOLBAR
| browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480);
gui_window_show(bw->window);
browser_window_open_location(bw, uri_requested);
wimp_set_caret_position(bw->window->data.browser.toolbar,
ro_theme_icon(current_theme, THEME_TOOLBAR, "TOOLBAR_URL"),
0,0,-1, (int) strlen(bw->window->url) - 1);
xfree(uri_requested);
}

13
riscos/uri.h Normal file
View File

@ -0,0 +1,13 @@
/*
* This file is part of NetSurf, http://netsurf.sourceforge.net/
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
* Copyright 2003 Rob Jackson <jacko@xms.ms>
*/
#ifndef _NETSURF_RISCOS_URI_H_
#define _NETSURF_RISCOS_URI_H_
static void ro_uri_message_received(uri_full_message_process*);
#endif