summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Docs/USING-Monkey116
-rw-r--r--monkey/browser.c8
-rw-r--r--monkey/plot.c21
3 files changed, 126 insertions, 19 deletions
diff --git a/Docs/USING-Monkey b/Docs/USING-Monkey
index 7e30a49ad..33e504239 100644
--- a/Docs/USING-Monkey
+++ b/Docs/USING-Monkey
@@ -35,9 +35,19 @@ Overview
parsed a token at a time, so that when such a string is encountered,
the parser can stop splitting and return the rest.
+ Commands to Monkey are namespaced. For example commands related to
+ browser windows are prefixed by WINDOW.
+
Top level tags for nsmonkey
---------------------------
+ QUIT
+
+ WINDOW
+
+ Top level response tags for nsmonkey
+ ------------------------------------
+
GENERIC
WARN, ERROR, DIE
@@ -50,6 +60,8 @@ Overview
401LOGIN
+ PLOT
+
In the below, %something% indicates a substitution made by Monkey.
%url% will be a URL
@@ -65,20 +77,71 @@ Overview
Errors (tagged ERROR) tend to come from Monkey's parsers
Death (tagged DIE) comes from the core and kills Monkey dead.
+Commands
+========
+
+ Generic commands
+ ----------------
+
+ QUIT
+ Cause monkey to quit cleanly.
+ This will cleanly destroy open windows etc.
+
+ Window commands
+ ---------------
+
+ WINDOW NEW [%url%]
+ Create a new browser window, optionally giving the core
+ a URL to immediately navigate to.
+ Minimally you will receive a WINDOW NEW WIN %id% response.
+
+ WINDOW DESTROY %id%
+ Destroy the given browser window.
+ Minimally you will recieve a WINDOW DESTROY WIN %id% response.
+
+ WINDOW GO %id% %url% [%url%]
+ Cause the given browser window to visit the given URL.
+ Optionally you can give a referrer URL to also use (simulating
+ a click in the browser on a link).
+ Minimally you can expect throbber, url etc responses.
+
+ WINDOW REDRAW %id% [%num% %num% %num% %num%]
+ Cause a browser window to redraw. Optionally you can give a
+ set of coordinates to simulate a partial expose of the window.
+ Said coordinates are in traditional X0 Y0 X1 Y1 order.
+ The coordinates are in canvas, not window, coordinates. So you
+ should take into account the scroll offsets when issuing this
+ command.
+ Minimally you can expect redraw start/stop messages and you
+ can likely expect some number of PLOT results.
+
+ WINDOW RELOAD %id%
+ Cause a browser window to reload its current content.
+ Expect responses similar to a GO command.
+
+
+Responses
+=========
+
Generic messages
----------------
GENERIC STARTED
Monkey has started and is ready for commands
+
GENERIC CLOSING_DOWN
Monkey has been told to shut down and is doing so
+
GENERIC FINISHED
Monkey has finished and will now exit
+
GENERIC LAUNCH URL %url%
The core asked monkey to launch the given URL
+
GENERIC THUMBNAIL URL %url%
The core asked monkey to thumbnail a content without
a window.
+
GENERIC POLL BLOCKING
Monkey reached a point where it could sleep waiting for
commands or scheduled timeouts. No fetches nor redraws
@@ -91,7 +154,7 @@ Overview
The core asked Monkey to open a new window. The IDs for 'FOR' and
'CLONE' are core window IDs, the WIN id is a Monkey window ID.
- WINDOW SIZE WIN %id% WIDTH %num% HEIGHT %num%
+ WINDOW SIZE WIN %id% WIDTH %n% HEIGHT %n%
The window specified has been set to the shown width and height.
WINDOW DESTROY WIN %id%
@@ -103,7 +166,7 @@ Overview
WINDOW REDRAW WIN %id%
The core asked that Monkey redraw the given window.
- WINDOW GET_DIMENSIONS WIN %id% WIDTH %num% HEIGHT %num%
+ WINDOW GET_DIMENSIONS WIN %id% WIDTH %n% HEIGHT %n%
The core asked Monkey what the dimensions of the window are.
Monkey has to respond immediately and returned the supplied width
and height values to the core.
@@ -124,16 +187,16 @@ Overview
The core asked Monkey to stop the throbber for the named
window. This indicates to the user that the window is finished.
- WINDOW SET_SCROLL WIN %id% X %num% Y %num%
+ WINDOW SET_SCROLL WIN %id% X %n% Y %n%
The core asked Monkey to set the named window's scroll offsets
to the given X and Y position.
- WINDOW UPDATE_BOX WIN %id% X %num% Y %num% WIDTH %num% HEIGHT %num%
+ WINDOW UPDATE_BOX WIN %id% X %n% Y %n% WIDTH %n% HEIGHT %n%
The core asked Monkey to redraw the given portion of the content
display. Note these coordinates refer to the content, not the
viewport which Monkey is simulating.
- WINDOW UPDATE_EXTENT WIN %id% WIDTH %num% HEIGHT %num%
+ WINDOW UPDATE_EXTENT WIN %id% WIDTH %n% HEIGHT %n%
The core has told us that the content in the given window has a
total width and height as shown. This allows us (along with the
window's width and height) to know the scroll limits.
@@ -146,7 +209,7 @@ Overview
The core has told us to update the mouse pointer for the given
window to the given pointer ID.
- WINDOW SET_SCALE WIN %id% SCALE %num%
+ WINDOW SET_SCALE WIN %id% SCALE %n%
The core has asked us to scale the given window by the given scale
factor.
@@ -154,29 +217,29 @@ Overview
The core has informed us that the given window's URL bar needs
updating to the given url.
- WINDOW GET_SCROLL WIN %id% X %num% Y %num%
+ WINDOW GET_SCROLL WIN %id% X %n% Y %n%
The core asked Monkey for the scroll offsets. Monkey returned the
numbers shown for the window named.
WINDOW SCROLL_START WIN %id%
The core asked Monkey to scroll the named window to the top/left.
- WINDOW POSITION_FRAME WIN %id% X0 %num% Y0 %num% X1 %num% Y1 %num%
+ WINDOW POSITION_FRAME WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
The core asked Monkey to position the named window as a frame at
the given coordinates of its parent.
- WINDOW SCROLL_VISIBLE WIN %id% X0 %num% Y0 %num% X1 %num% Y1 %num%
+ WINDOW SCROLL_VISIBLE WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
The core asked Monkey to scroll the named window until the
indicated box is visible.
- WINDOW PLACE_CARET WIN %id% X %num% Y %num% HEIGHT %num%
+ WINDOW PLACE_CARET WIN %id% X %n% Y %n% HEIGHT %n%
The core asked Monkey to render a caret in the named window at the
indicated position with the indicated height.
WINDOW REMOVE_CARET WIN %id%
The core asked Monkey to remove any caret in the named window.
- WINDOW SCROLL_START WIN %id% X0 %num% Y0 %num% X1 %num% Y1 %num%
+ WINDOW SCROLL_START WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
The core asked Monkey to scroll the named window to the start of
the given box.
@@ -192,6 +255,11 @@ Overview
The core asked Monkey to render a thumbnail for the given window
which is currently at the given URL.
+ WINDOW REDRAW WIN %id% START
+ WINDOW REDRAW WIN %id% STOP
+ The core wraps redraws in these messages. Thus PLOT responses can
+ be allocated to the appropriate window.
+
Download window messages
------------------------
@@ -199,7 +267,7 @@ Overview
The core asked Monkey to create a download window owned by the
given browser window.
- DOWNLOAD_WINDOW DATA DWIN %id% SIZE %num% DATA %str%
+ DOWNLOAD_WINDOW DATA DWIN %id% SIZE %n% DATA %str%
The core asked Monkey to update the named download window with
the given byte size and data string.
@@ -224,3 +292,27 @@ Overview
The core asked Monkey to ask for identification for the named
realm at the given URL.
+ Plotter messages
+ ----------------
+
+ Note, Monkey won't clip coordinates, but sometimes the core does.
+
+ PLOT CLIP X0 %n% Y0 %n% X1 %n% Y1 %n%
+ The core asked Monkey to clip plotting to the given clipping
+ rectangle (X0,Y0) (X1,Y1)
+
+ PLOT TEXT X %n% Y %n% STR %str%
+ The core asked Monkey to plot the given string at the
+ given coordinates.
+
+ PLOT LINE X0 %n% Y0 %n% X1 %n% Y1 %n%
+ The core asked Monkey to plot a line with the given start
+ and end coordinates.
+
+ PLOT RECT X0 %n% Y0 %n% X1 %n% Y1 %n%
+ The core asked Monkey to plot a rectangle with the given
+ coordinates as the corners.
+
+ PLOT BITMAP X %n% Y %n% WIDTH %n% HEIGHT %n%
+ The core asked Monkey to plot a bitmap at the given
+ coordinates, scaled to the given width/height.
diff --git a/monkey/browser.c b/monkey/browser.c
index 1c02c238a..c077bda6c 100644
--- a/monkey/browser.c
+++ b/monkey/browser.c
@@ -453,7 +453,7 @@ monkey_window_handle_redraw(int argc, char **argv)
};
if (argc != 3 && argc != 7) {
- fprintf(stdout, "ERROR WINDOW REDRAW ARGS BAD");
+ fprintf(stdout, "ERROR WINDOW REDRAW ARGS BAD\n");
return;
}
@@ -477,7 +477,9 @@ monkey_window_handle_redraw(int argc, char **argv)
}
LOG(("Issue redraw"));
+ fprintf(stdout, "WINDOW REDRAW WIN %d START\n", atoi(argv[2]));
browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx);
+ fprintf(stdout, "WINDOW REDRAW WIN %d STOP\n", atoi(argv[2]));
}
static void
@@ -485,7 +487,7 @@ monkey_window_handle_reload(int argc, char **argv)
{
struct gui_window *gw;
if (argc != 3 && argc != 4) {
- fprintf(stdout, "ERROR WINDOW RELOAD ARGS BAD");
+ fprintf(stdout, "ERROR WINDOW RELOAD ARGS BAD\n");
}
gw = monkey_find_window_by_num(atoi(argv[2]));
@@ -514,6 +516,8 @@ monkey_window_handle_command(int argc, char **argv)
monkey_window_handle_redraw(argc, argv);
} else if (strcmp(argv[1], "RELOAD") == 0) {
monkey_window_handle_reload(argc, argv);
+ } else {
+ fprintf(stdout, "ERROR WINDOW COMMAND UNKNOWN %s\n", argv[1]);
}
}
diff --git a/monkey/plot.c b/monkey/plot.c
index c93a9a8ec..76980ce5b 100644
--- a/monkey/plot.c
+++ b/monkey/plot.c
@@ -18,6 +18,8 @@
#include "desktop/plotters.h"
+#include <stdio.h>
+
static bool
monkey_plot_disc(int x, int y, int radius, const plot_style_t *style)
{
@@ -41,7 +43,8 @@ static bool
monkey_plot_text(int x, int y, const char *text, size_t length,
const plot_font_style_t *fstyle)
{
- return true;
+ fprintf(stdout, "PLOT TEXT X %d Y %d STR %*s\n", x, y, (int)length, text);
+ return true;
}
static bool
@@ -50,19 +53,25 @@ monkey_plot_bitmap(int x, int y,
struct bitmap *bitmap, colour bg,
bitmap_flags_t flags)
{
- return true;
+ fprintf(stdout, "PLOT BITMAP X %d Y %d WIDTH %d HEIGHT %d\n",
+ x, y, width, height);
+ return true;
}
static bool
monkey_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
- return true;
+ fprintf(stdout, "PLOT RECT X0 %d Y0 %d X1 %d Y1 %d\n",
+ x0, y0, x1, y1);
+ return true;
}
static bool
monkey_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
- return true;
+ fprintf(stdout, "PLOT LINE X0 %d Y0 %d X1 %d Y1 %d\n",
+ x0, y0, x1, y1);
+ return true;
}
@@ -80,7 +89,9 @@ monkey_plot_path(const float *p,
static bool
monkey_plot_clip(const struct rect *clip)
{
- return true;
+ fprintf(stdout, "PLOT CLIP X0 %d Y0 %d X1 %d Y1 %d\n",
+ clip->x0, clip->y0, clip->x1, clip->y1);
+ return true;
}
const struct plotter_table monkey_plotters = {