56 if (c_ring->win_num ==
win_num) {
78 struct gui_window *ret = calloc(1,
sizeof(*ret));
89 "NEW WIN %u FOR %p EXISTING %p NEWTAB %s CLONE %s",
94 "SIZE WIN %u WIDTH %d HEIGHT %d",
131 "GET_DIMENSIONS WIN %u WIDTH %d HEIGHT %d",
196 "INVALIDATE_AREA WIN %u X %d Y %d WIDTH %d HEIGHT %d",
228 const char *ptr_name =
"UNKNOWN";
277 ptr_name =
"PROGRESS";
280 ptr_name =
"NO_DROP";
283 ptr_name =
"NOT_ALLOWED";
286 ptr_name =
"DEFAULT";
361 const char *src_text;
362 const char *level_text;
366 src_text =
"client-input";
369 src_text =
"scripting-error";
372 src_text =
"scripting-console";
375 assert(0 &&
"Unknown scripting source");
376 src_text =
"unknown";
382 level_text =
"DEBUG";
394 level_text =
"ERROR";
397 assert(0 &&
"Unknown console logging level");
398 level_text =
"unknown";
403 g->
win_num, src_text, foldable ?
"" :
"NOT-", level_text,
410 const char *
state =
"***WAH***";
430 state =
"SECURE_OVERRIDE";
434 state =
"SECURE_ISSUES";
442 assert(0 &&
"Monkey needs some lovin' here");
482 uint32_t nr = atoi((argc > 2) ? argv[2] :
"-1");
498 nsurl *ref_url = NULL;
501 if (argc < 4 || argc > 5) {
527 if (ref_url != NULL) {
568 .background_images =
true,
572 if (argc != 3 && argc != 7) {
590 clip.x0 = atoi(argv[3]);
591 clip.y0 = atoi(argv[4]);
592 clip.x1 = atoi(argv[5]);
593 clip.y1 = atoi(argv[6]);
596 NSLOG(netsurf, INFO,
"Issue redraw");
606 if (argc != 3 && argc != 4) {
635 for (
int i = 4; i < argc; ++i) {
636 total += strlen(argv[i]) + 1;
638 char *cmd = calloc(total, 1);
643 strcpy(cmd, argv[4]);
644 for (
int i = 5; i < argc; ++i) {
646 strcat(cmd, argv[i]);
673 int x = atoi(argv[5]);
674 int y = atoi(argv[7]);
676 const char *button = argv[9];
677 const char *kind = argv[11];
678 if (strcmp(button,
"LEFT") == 0) {
680 }
else if (strcmp(button,
"RIGHT") == 0) {
686 if (strcmp(kind,
"SINGLE") == 0) {
688 }
else if (strcmp(kind,
"DOUBLE") == 0) {
690 }
else if (strcmp(kind,
"TRIPLE") == 0) {
706 if (strcmp(argv[1],
"NEW") == 0) {
708 }
else if (strcmp(argv[1],
"DESTROY") == 0) {
710 }
else if (strcmp(argv[1],
"GO") == 0) {
712 }
else if (strcmp(argv[1],
"STOP") == 0) {
714 }
else if (strcmp(argv[1],
"REDRAW") == 0) {
716 }
else if (strcmp(argv[1],
"RELOAD") == 0) {
718 }
else if (strcmp(argv[1],
"EXEC") == 0) {
720 }
else if (strcmp(argv[1],
"CLICK") == 0) {
Browser window creation and manipulation interface.
nserror browser_window_navigate(struct browser_window *bw, struct nsurl *url, struct nsurl *referrer, enum browser_window_nav_flags flags, char *post_urlenc, struct fetch_multipart_data *post_multipart, struct hlcache_handle *parent)
Start fetching a page in a browser window.
bool browser_window_redraw(struct browser_window *bw, int x, int y, const struct rect *clip, const struct redraw_context *ctx)
Redraw an area of a window.
bool browser_window_exec(struct browser_window *bw, const char *src, size_t srclen)
Execute some JavaScript code in a browsing context.
void browser_window_mouse_click(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks in a browser window.
void browser_window_destroy(struct browser_window *bw)
Close and destroy a browser window.
nserror browser_window_reload(struct browser_window *bw, bool all)
Reload the page in a browser window.
@ PAGE_STATE_INSECURE
Insecure page load.
@ PAGE_STATE_UNKNOWN
Unable to determine.
@ PAGE_STATE_SECURE_ISSUES
Secure load, but has insecure elements.
@ PAGE_STATE_SECURE
Secure load.
@ PAGE_STATE_SECURE_OVERRIDE
Secure load, but had to override.
@ PAGE_STATE_LOCAL
Page loaded from file:/// etc.
@ PAGE_STATE_INTERNAL
Page loaded from internal handler.
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.
void browser_window_stop(struct browser_window *bw)
Stop all fetching activity in a browser window.
browser_window_page_info_state browser_window_get_page_info_state(const struct browser_window *bw)
Request the current browser window page info state.
@ BW_CREATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
@ BW_NAVIGATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
browser_window_console_source
Sources of messages which end up in the browser window console.
@ BW_CS_SCRIPT_CONSOLE
Logging from some running script.
@ BW_CS_INPUT
Input from the client.
@ BW_CS_SCRIPT_ERROR
Error from some running script.
browser_window_console_flags
Flags for browser window console logging.
@ BW_CS_FLAG_LEVEL_LOG
Logged at the 'log' level, please only use one of the LEVEL flags.
@ BW_CS_FLAG_LEVEL_DEBUG
Logged at the 'debug' level, please use only one of the LEVEL flags.
@ BW_CS_FLAG_LEVEL_INFO
Logged at the 'info' level, please use only one of the LEVEL flags.
@ BW_CS_FLAG_LEVEL_MASK
Mask for the error level to allow easy comparison using the above.
@ BW_CS_FLAG_LEVEL_WARN
Logged at the 'warn' level, please use only one of the LEVEL flags.
@ BW_CS_FLAG_LEVEL_ERROR
Logged at the 'error' level, please use only one of the LEVEL flags.
@ BW_CS_FLAG_FOLDABLE
The log entry is foldable.
nserror
Enumeration of error codes.
static void monkey_window_handle_destroy(int argc, char **argv)
nserror monkey_warn_user(const char *warning, const char *detail)
static nserror gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
static nserror gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
Set the scroll position of a monkey browser window.
static void gui_window_set_status(struct gui_window *g, const char *text)
static nserror gui_window_event(struct gui_window *gw, enum gui_window_event event)
process miscellaneous window events
static void gui_window_destroy(struct gui_window *g)
static void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
static void gui_window_remove_caret(struct gui_window *g)
static void gui_window_update_extent(struct gui_window *g)
static void monkey_window_handle_new(int argc, char **argv)
void monkey_kill_browser_windows(void)
static void monkey_window_handle_stop(int argc, char **argv)
handle WINDOW STOP command
static struct gui_window * gui_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
static void monkey_window_handle_exec(int argc, char **argv)
static nserror monkey_window_invalidate_area(struct gui_window *gw, const struct rect *rect)
Invalidates an area of a monkey browser window.
static void gui_window_start_throbber(struct gui_window *g)
static struct gui_window_table window_table
static void monkey_window_handle_redraw(int argc, char **argv)
static void gui_window_set_title(struct gui_window *g, const char *title)
static nserror gui_window_set_url(struct gui_window *g, nsurl *url)
struct gui_window_table * monkey_window_table
struct gui_window * monkey_find_window_by_num(uint32_t win_num)
static void gui_window_stop_throbber(struct gui_window *g)
static bool gui_window_scroll_start(struct gui_window *g)
static void monkey_window_handle_reload(int argc, char **argv)
static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip)
static struct gui_window * gw_ring
static void gui_window_report_page_info(struct gui_window *g)
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
void monkey_window_handle_command(int argc, char **argv)
static void gui_window_new_content(struct gui_window *g)
static nserror gui_window_get_dimensions(struct gui_window *g, int *width, int *height)
Find the current dimensions of a monkey browser window content area.
static void monkey_window_handle_go(int argc, char **argv)
static void monkey_window_handle_click(int argc, char **argv)
static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type, const struct rect *rect)
static void gui_window_console_log(struct gui_window *g, browser_window_console_source src, const char *msg, size_t msglen, browser_window_console_flags flags)
Core mouse and pointer states.
browser_mouse_state
Mouse state: 1 is primary mouse button.
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
@ BROWSER_MOUSE_TRIPLE_CLICK
button triple clicked
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
@ BROWSER_MOUSE_DOUBLE_CLICK
button double clicked
@ 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.
@ GW_CREATE_TAB
Create tab in same window as existing.
@ GW_CREATE_CLONE
Clone existing window.
gui_window_event
Window events.
@ GW_EVENT_SCROLL_START
Starts drag scrolling of a browser window.
@ GW_EVENT_PAGE_INFO_CHANGE
Page status has changed and so the padlock should be updated.
@ 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.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
Localised message support (interface).
const struct plotter_table * monkey_plotters
NetSurf URL handling (interface).
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.
int moutf(enum monkey_output_type mout_type, const char *fmt,...)
#define RING_ITERATE_STOP(ring, iteratorptr)
#define RING_REMOVE(ring, element)
Remove the given element from the specified ring.
#define RING_INSERT(ring, element)
Insert the given item into the specified ring.
#define RING_ITERATE_END(ring, iteratorptr)
#define RING_ITERATE_START(ringtype, ring, iteratorptr)
Interface to utility string handling.
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
int height
height of drawing area
int scrollx
current scroll location
struct gui_window::@32 mouse
int scrolly
current scroll location
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
bool interactive
Redraw to show interactive features.
Interface to a number of general purpose functionality.
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.