46#include "atari/gemtk/gemtk.h"
58#include "atari/res/netsurf.rsh"
94 .emi_flags = MU_MESAG | MU_TIMER | MU_KEYBD | MU_BUTTON | MU_M1,
98 .emi_m1leave = MO_ENTER,
128 printf(
"long poll!\n");
136 graf_mkstate(&mx, &my, &dummy, &dummy);
198 NSLOG(netsurf, INFO,
"gw: %p, BW: %p, existing %p, flags: %d\n", gw,
bw,
199 existing, (
int)flags);
205 NSLOG(netsurf, INFO,
"new window: %p, bw: %p\n", gw,
bw);
226 while( tmp->
next != NULL ) {
257 NSLOG(netsurf, INFO,
"%s\n", __FUNCTION__);
270 if(gw->
prev != NULL ) {
275 if( gw->
next != NULL ) {
286 while( gw != NULL ) {
334 if(gw->
title == NULL)
335 gw->
title = malloc(l);
339 strncpy(gw->
title, conv, l);
343 if(gw->
title == NULL)
344 gw->
title = malloc(l);
359 if (w == NULL ||
text == NULL)
398 struct gemtk_wm_scroll_info_s *slid;
400 slid = gemtk_wm_get_scroll_info(gw->
root->
win);
402 area.g_x +=
rect->
x0 - (slid->x_pos * slid->x_unit_px);
403 area.g_y +=
rect->
y0 - (slid->y_pos * slid->y_unit_px);
444 NSLOG(netsurf, INFO,
"scroll (gui_window: %p) %d, %d\n", gw,
rect->
x0,
568 if (w->
url == NULL) {
571 w->
url = realloc(w->
url, l);
603 if (gw->
root == NULL)
689 struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w->
root->
win);
692 gemtk_wm_update_slider(w->
root->
win, GEMTK_WM_VH_SLIDER);
721 clip_len = strlen(
clip);
727 *length = strlen(utf8);
748 if (length > 0 &&
buffer != NULL) {
767 NSLOG(netsurf, INFO,
"Setting input window from: %p to %p\n",
779 NSLOG(netsurf, INFO,
"quitting");
808 NSLOG(netsurf, INFO,
"Shutting down plotter");
810 NSLOG(netsurf, INFO,
"done");
820 bool set_default_dimensions =
true;
822 NSLOG(netsurf, INFO,
"argc %d, argv %p", argc, argv);
833 set_default_dimensions =
false;
837 if (set_default_dimensions) {
838 if( sys_type() == SYS_TOS ) {
857 while((opt = getopt(argc, argv,
"w:h:")) != -1) {
869 "Usage: %s [w,h,v] url\n",
915 NSLOG(netsurf, INFO,
"Failed initialising string options");
932 NSLOG(netsurf, INFO,
"Using RSC file: %s ", (
char *)&buf);
933 if (rsrc_load(buf)==0) {
937 snprintf(msg, 1024,
"Unable to open GEM Resource file (%s)!", buf);
941 wind_get_grect(0, WF_WORKXYWH, &
desk_area);
951 cursors = gemtk_obj_get_tree(CURSOR);
968 NSLOG(netsurf, INFO,
"Enabling core select menu");
976 NSLOG(netsurf, INFO,
"Loading cookies from: %s",
983 die(
"unable to process command line.\n");
985 NSLOG(netsurf, INFO,
"Initializing NKC...");
988 NSLOG(netsurf, INFO,
"Initializing plotters...");
991 .background_images =
true,
1002 menu_register( -1,
theapp);
1003 if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) {
1004 menu_register( _AESapid, (
char*)
" NetSurf ");
1103 char * file_url = NULL;
1104 struct stat stat_buf;
1125 die(
"NetSurf operation table failed registration");
1129 setbuf(stderr, NULL);
1130 setbuf(stdout, NULL);
1131#ifdef WITH_DBG_LOGFILE
1132 freopen(
"stdout.log",
"a+", stdout);
1133 freopen(
"stderr.log",
"a+", stderr);
1136 graf_mouse(BUSY_BEE, NULL);
1154 die(
"Options failed to initialise");
1162 NSLOG(netsurf, INFO,
"Initialising core...");
1165 die(
"NetSurf failed to initialise");
1168 NSLOG(netsurf, INFO,
"Initializing GUI...");
1171 graf_mouse( ARROW , NULL);
1173 NSLOG(netsurf, INFO,
"Creating initial browser window...");
1175 if (strncmp(addr,
"file://", 7) && strncmp(addr,
"http://", 7)) {
1176 if (stat(addr, &stat_buf) == 0) {
1195 NSLOG(netsurf, INFO,
"Entering Atari event mainloop...");
1205#ifdef WITH_DBG_LOGFILE
1209 NSLOG(netsurf, INFO,
"exit_gem");
const char * fetch_filetype(const char *unix_path)
Determine the MIME type of a local file.
int main(int argc, char **argv)
Normal entry point from OS.
int scrap_txt_write(char *str)
char * scrap_txt_read(void)
void atari_cookie_manager_init(void)
void atari_cookie_manager_destroy(void)
char * local_file_to_url(const char *filename)
char * atari_find_resource(char *buf, const char *filename, const char *def)
static void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles)
Core tells front end to put given text in clipboard.
static nserror gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
Set the scroll position of a atari browser window.
static bool process_cmdline(int argc, char **argv)
Process commandline parameters.
static nsurl * gui_get_resource_url(const char *path)
static nserror gui_window_event(struct gui_window *gw, enum gui_window_event event)
process miscellaneous window events
static nserror gui_window_get_dimensions(struct gui_window *gw, int *width, int *height)
Find the current dimensions of a atari browser window content area.
static void create_cursor(int flags, short mode, void *form, MFORM_EX *m)
struct gui_window * gui_get_input_window(void)
static void gui_init(int argc, char **argv)
Initialise atari gui.
const char * option_homepage_url
static struct gui_fetch_table atari_fetch_table
static void throbber_advance(void *data)
static void gui_get_clipboard(char **buffer, size_t *length)
Core asks front end for clipboard contents.
static struct gui_window * gui_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
Create and open a gui window for a browsing context.
static struct gui_misc_table atari_misc_table
static nserror gui_window_set_url(struct gui_window *w, nsurl *url)
static nserror set_defaults(struct nsoption_s *defaults)
Set option defaults for atari frontend.
static void gui_window_remove_caret(struct gui_window *w)
clear window caret
struct gui_window * input_window
static void gui_quit(void)
void gui_window_destroy(struct gui_window *gw)
Destroy previously created gui window.
static void gui_window_new_content(struct gui_window *w)
static void atari_poll(void)
Core atari event processing.
static nserror atari_window_invalidate_area(struct gui_window *gw, const struct rect *rect)
Invalidates an area of an atari browser window.
void gui_window_set_pointer(struct gui_window *gw, gui_pointer_shape shape)
set the pointer shape
static void gui_window_start_throbber(struct gui_window *w)
static struct gui_clipboard_table atari_clipboard_table
char * gui_window_get_url(struct gui_window *gw)
void gui_set_input_gui_window(struct gui_window *gw)
void atari_window_set_status(struct gui_window *w, const char *text)
Set the status bar of a browser window.
static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
Set a favicon for a gui window.
static void gui_window_set_title(struct gui_window *gw, const char *title)
Set the title of a window.
struct gui_window * window_list
static void gui_window_update_extent(struct gui_window *gw)
Update the extent of the inside of a browser window to that of the current content.
bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy)
static struct gui_window_table atari_window_table
static void gui_window_stop_throbber(struct gui_window *w)
static void gui_window_place_caret(struct gui_window *w, int x, int y, int height, const struct rect *clip)
Place caret in window.
char * gui_window_get_title(struct gui_window *gw)
#define CARET_STATE_ENABLED
#define MFORM_EX_FLAG_USERFORM
struct s_gem_cursors gem_cursors
void atari_global_history_init(void)
void atari_global_history_destroy(void)
void gem_set_cursor(MFORM_EX *cursor)
nserror atari_warn_user(const char *warning, const char *detail)
Warn the user of an event.
const struct plotter_table atari_plotters
atari plottr operation table
int plot_init(const struct redraw_context *ctx, char *fdrvrname)
Init screen and font driver objects.
int schedule_run(void)
Process events up to current time.
nserror atari_schedule(int ival, void(*callback)(void *p), void *p)
Schedule a callback.
Low-level source data cache backing store interface.
struct gui_llcache_table * filesystem_llcache_table
Browser window creation and manipulation interface.
bool browser_window_has_content(struct browser_window *bw)
Find out if a browser window is currently showing a content.
void browser_window_destroy(struct browser_window *bw)
Close and destroy a browser window.
nserror browser_window_get_extents(struct browser_window *bw, bool scaled, int *width, int *height)
Get a browser window's content extents.
nserror browser_window_create(enum browser_window_create_flags flags, struct nsurl *url, struct nsurl *referrer, struct browser_window *existing, struct browser_window **bw)
Create and open a new root browser window with the given page.
@ BW_CREATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
static os_mode mode
The current sprite mode.
static osspriteop_area * buffer
The buffer characteristics.
Unified cookie database public interface.
void urldb_save_cookies(const char *filename)
Save persistent cookies to file.
void urldb_load_cookies(const char *filename)
Load a cookie file into the database.
Useful interned string pointers (interface).
struct gui_utf8_table * atari_utf8_table
nserror
Enumeration of error codes.
@ NSERROR_BAD_PARAMETER
Bad Parameter.
nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
struct gui_bitmap_table * atari_bitmap_table
Atari bitmap handling implementation.
struct gui_download_table * atari_download_table
struct gui_file_table * atari_file_table
struct gui_layout_table * atari_layout_table
void atari_hotlist_destroy(void)
void atari_hotlist_init(void)
struct gui_search_table * atari_search_table
void nsatari_search_session_destroy(struct s_search_form_session *s)
void atari_treeview_flush_redraws(void)
Process all redraw request of all open Treeview windows.
struct core_window_table * atari_core_window_table
static nserror store(nsurl *url, enum backing_store_flags bsflags, uint8_t *data, const size_t datalen)
Place an object in the backing store.
Interface to platform-specific clipboard operations.
Public content interface.
struct bitmap * content_get_bitmap(struct hlcache_handle *h)
Retrieve the bitmap contained in an image content.
Interface to platform-specific fetcher operations.
Interface to platform-specific layout operation table.
Interface to platform-specific miscellaneous browser operation table.
@ BROWSER_POINTER_DEFAULT
@ GUI_POINTER_NOT_ALLOWED
Target independent plotting interface.
Interface to platform-specific graphical user interface window operations.
gui_window_create_flags
Window creation control flags.
gui_window_event
Window events.
@ GW_EVENT_REMOVE_CARET
Remove the caret, if present.
@ GW_EVENT_NEW_CONTENT
Called when the gui_window has new content.
@ GW_EVENT_STOP_THROBBER
stop the navigation throbber.
@ GW_EVENT_UPDATE_EXTENT
Update the extent of the inside of a browser window to that of the current content.
@ GW_EVENT_START_THROBBER
start the navigation throbber.
nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv)
Initialise the logging system.
void nslog_finalise(void)
Shut down the logging system.
#define NSLOG(catname, level, logmsg, args...)
nserror messages_add_from_file(const char *path)
Read keys and values from messages file into the standard Messages hash.
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
Localised message support (interface).
NetSurf core interface registration, construction and destruction.
void netsurf_exit(void)
Finalise NetSurf core.
nserror netsurf_init(const char *store_path)
Initialise netsurf core.
nserror netsurf_register(struct netsurf_table *table)
Register operation table.
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
struct nsurl nsurl
NetSurf URL object.
NS_ATARI_SYSINFO atari_sysinfo
void die(const char *const error)
Display an error and exit.
void window_get_scroll(ROOTWIN *rootwin, int *x, int *y)
void window_update_back_forward(struct s_gui_win_root *rootwin)
void window_set_icon(ROOTWIN *rootwin, struct bitmap *bmp)
struct gui_window * window_get_active_gui_window(ROOTWIN *rootwin)
void window_set_focus(struct s_gui_win_root *rootwin, enum focus_element_type type, void *element)
void window_schedule_redraw_grect(ROOTWIN *rootwin, GRECT *area)
void window_scroll_by(ROOTWIN *root, int sx, int sy)
void window_unref_gui_window(ROOTWIN *rootwin, struct gui_window *gw)
void window_set_title(struct s_gui_win_root *rootwin, char *title)
void window_set_content_size(ROOTWIN *rootwin, int width, int height)
Set the dimensions of the scrollable content.
int window_create(struct gui_window *gw, struct browser_window *bw, struct gui_window *existing, unsigned long inflags)
void window_get_grect(ROOTWIN *rootwin, enum browser_area_e which, GRECT *d)
void window_place_caret(ROOTWIN *rootwin, short mode, int content_x, int content_y, int h, GRECT *work)
void window_open(ROOTWIN *rootwin, struct gui_window *gw, GRECT pos)
show the window at specified position and make gw the active tab.
void window_set_stauts(struct s_gui_win_root *rootwin, char *text)
void window_process_redraws(ROOTWIN *rootwin)
short aes_max_win_title_len
RISC OS wimp toolkit bitmap.
function table for clipboard operations.
void(* get)(char **buffer, size_t *length)
Core asks front end for clipboard contents.
function table for fetcher operations.
const char *(* filetype)(const char *unix_path)
Determine the MIME type of a local file.
Graphical user interface browser misc function table.
nserror(* schedule)(int t, void(*callback)(void *p), void *p)
Schedule a callback.
Graphical user interface window function table.
struct gui_window *(* create)(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
Create and open a gui window for a browsing context.
first entry in window list
struct gui_window * prev
Previous in linked list.
struct gui_window * next
list for cleanup
struct s_search_form_session * search
struct s_gui_win_root * root
struct s_browser * browser
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
NetSurf operation function table.
struct gui_misc_table * misc
Browser table.
bool interactive
Redraw to show interactive features.
struct browser_window * bw
struct s_redrw_slots redraw_slots
struct gui_window * active_gui_window
short volatile areas_used
struct rect rect
Rectangle coordinates.
Unified URL information database public interface.
nserror urldb_save(const char *filename)
Export the current database to file.
nserror urldb_load(const char *filename)
Import an URL database from file, replacing any existing database.
nserror netsurf_path_to_nsurl(const char *path, struct nsurl **url)
Create a nsurl from a path.
struct nsoption_s * nsoptions_default
global default option table.
static struct nsoption_s defaults[]
The table of compiled in default options.
nserror nsoption_read(const char *path, struct nsoption_s *opts)
Read choices file and set them in the passed table.
struct nsoption_s * nsoptions
global active option table.
nserror nsoption_commandline(int *pargc, char **argv, struct nsoption_s *opts)
Process commandline and set options approriately.
nserror nsoption_init(nsoption_set_default_t *set_defaults, struct nsoption_s **popts, struct nsoption_s **pdefs)
Initialise option system.
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
#define nsoption_setnull_charp(OPTION, VALUE)
set string option in default table if currently unset
#define nsoption_int(OPTION)
Get the value of an integer option.
#define nsoption_set_bool(OPTION, VALUE)
set a boolean option in the default table
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.