39#include <oslib/colourtrans.h>
40#include <oslib/osbyte.h>
41#include <oslib/osfile.h>
42#include <oslib/osspriteop.h>
43#include <oslib/wimp.h>
44#include <oslib/wimpspriteop.h>
45#include <nsutils/time.h>
98#define wimp_KEY_END wimp_KEY_COPY
101#ifndef wimp_WINDOW_GIVE_SHADED_ICON_INFO
103#define wimp_WINDOW_GIVE_SHADED_ICON_INFO ((wimp_extra_window_flags) 0x10u)
106#define SCROLL_VISIBLE_PADDING 32
108#define SCROLL_TOP INT_MIN
109#define SCROLL_PAGE_UP (INT_MIN + 1)
110#define SCROLL_PAGE_DOWN (INT_MAX - 1)
111#define SCROLL_BOTTOM INT_MAX
140 1.5, 2.0, 3.0, 4.0, 6.0, 8.0, 12.0, 16.0};
141#define SCALE_SNAP_TO_SIZE (sizeof scale_snap_to) / (sizeof(float))
155 {
true,
"ptr_default", 0, 0 },
156 {
false,
"ptr_point", 6, 0 },
157 {
false,
"ptr_caret", 4, 9 },
158 {
false,
"ptr_menu", 6, 4 },
159 {
false,
"ptr_ud", 6, 7 },
160 {
false,
"ptr_ud", 6, 7 },
161 {
false,
"ptr_lr", 7, 6 },
162 {
false,
"ptr_lr", 7, 6 },
163 {
false,
"ptr_ld", 7, 7 },
164 {
false,
"ptr_ld", 7, 7 },
165 {
false,
"ptr_rd", 7, 7 },
166 {
false,
"ptr_rd", 6, 7 },
167 {
false,
"ptr_cross", 7, 7 },
168 {
false,
"ptr_move", 8, 0 },
169 {
false,
"ptr_wait", 7, 10 },
170 {
false,
"ptr_help", 0, 0 },
171 {
false,
"ptr_nodrop", 0, 0 },
172 {
false,
"ptr_nt_allwd", 10, 10 },
173 {
false,
"ptr_progress", 0, 0 },
208 error = xwimp_set_caret_position(
g->
window, -1,
211 NSLOG(netsurf, INFO,
"xwimp_set_caret_position: 0x%x: %s",
212 error->errnum, error->errmess);
228 int toolbar_height = 0;
229 wimp_window_state state;
239 error = xwimp_get_window_state(&state);
242 "xwimp_get_window_state: 0x%x: %s",
249 width = state.visible.x1 - state.visible.x0;
251 height = state.visible.y1 - state.visible.y0;
272 os_box extent = { 0, -
height,
width, toolbar_height };
273 error = xwimp_set_extent(
g->
window, &extent);
275 NSLOG(netsurf, INFO,
"xwimp_set_extent: 0x%x: %s",
276 error->errnum, error->errmess);
293 int width = open->visible.x1 - open->visible.x0;
294 int height = open->visible.y1 - open->visible.y0;
297 int toolbar_height = 0;
299 wimp_window_state
state;
317 error = xwimp_get_window_state_and_nesting(&
state, &
parent, &linkage);
319 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
320 error->errnum, error->errmess);
331 state.visible = open->visible;
332 state.xscroll = open->xscroll;
333 state.yscroll = open->yscroll;
334 state.next = open->next;
343 bool no_hscroll =
false;
350 if (!(
state.flags & wimp_WINDOW_HSCROLL)) {
352 state.visible.y0 += size;
357 state.flags |= wimp_WINDOW_HSCROLL;
359 if (
state.flags & wimp_WINDOW_HSCROLL) {
361 state.visible.y0 -= size;
366 state.flags &= ~wimp_WINDOW_HSCROLL;
373 if (!(
state.flags & wimp_WINDOW_VSCROLL)) {
375 state.visible.x1 -= size;
380 state.flags |= wimp_WINDOW_VSCROLL;
382 if (
state.flags & wimp_WINDOW_VSCROLL) {
384 state.visible.x1 += size;
389 state.flags &= ~wimp_WINDOW_VSCROLL;
423 state.yscroll = toolbar_height;
426 error = xwimp_open_window_nested_with_flags(&
state,
parent, linkage);
428 NSLOG(netsurf, INFO,
"xwimp_open_window: 0x%x: %s",
429 error->errnum, error->errmess);
461 wimp_window_info info;
466 error = xwimp_get_window_info_header_only(&info);
469 "xwimp_get_window_info_header_only: 0x%x: %s",
479 info.yscroll += scroll;
501 if (g != NULL && g->
toolbar != NULL) {
541 if (g == NULL || g->
toolbar == NULL)
587 if (g == NULL || g->
bw == NULL || g->
toolbar == NULL ||
607 if (g == NULL || g->
bw == NULL || g->
toolbar == NULL ||
626 if ((gw == NULL) || (gw->
bw == NULL)) {
645 static const char *addr = NETSURF_HOMEPAGE;
649 if (g == NULL || g->
bw == NULL)
748 char icon_buf[20] =
"file_xxx";
750 const char *icon = icon_buf;
751 const char *title, *url;
753 const char *enc =
"-";
767 sprintf(icon_buf,
"file_xxx");
771 snprintf(enc_buf,
sizeof enc_buf,
"%s (%s)",
789 lwc_string_data(mime),
true);
791 lwc_string_unref(mime);
802 if (g == NULL || g->
bw == NULL ||
834 switch (action.
url) {
1000 if (url_s == NULL) {
1029 if (g == NULL || g->
bw == NULL)
1058 wimp_scroll_direction scroll_x,
1059 wimp_scroll_direction scroll_y)
1061 int visible_x, visible_y;
1062 int step_x = 0, step_y = 0;
1064 wimp_window_state
state;
1065 wimp_pointer pointer;
1068 bool handled =
false;
1077 error = xwimp_get_window_state(&state);
1079 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
1080 error->errnum, error->errmess);
1089 visible_x = state.visible.x1 - state.visible.x0 - 32;
1090 visible_y = state.visible.y1 - state.visible.y0 - 32 - toolbar_y;
1092 error = xwimp_get_pointer_info(&pointer);
1094 NSLOG(netsurf, INFO,
"xwimp_get_pointer_info 0x%x : %s",
1095 error->errnum, error->errmess);
1105 case wimp_SCROLL_PAGE_LEFT:
1108 case wimp_SCROLL_AUTO_LEFT:
1109 case wimp_SCROLL_COLUMN_LEFT:
1112 case wimp_SCROLL_AUTO_RIGHT:
1113 case wimp_SCROLL_COLUMN_RIGHT:
1116 case wimp_SCROLL_PAGE_RIGHT:
1126 step_x = (32 * (scroll_x / 4));
1131 case wimp_SCROLL_PAGE_UP:
1134 case wimp_SCROLL_AUTO_UP:
1135 case wimp_SCROLL_LINE_UP:
1138 case wimp_SCROLL_AUTO_DOWN:
1139 case wimp_SCROLL_LINE_DOWN:
1142 case wimp_SCROLL_PAGE_DOWN:
1152 step_y = -(32 * (scroll_y / 4));
1158 if (step_x == 0 && step_y == 0)
1165 if (pointer.w == g->
window &&
1181 state.xscroll -= 0x10000000;
1184 state.xscroll += 0x10000000;
1187 state.xscroll += visible_x;
1190 state.xscroll -= visible_x;
1193 state.xscroll += 2 * step_x;
1199 state.yscroll += 0x10000000;
1202 state.yscroll -= 0x10000000;
1205 state.yscroll += visible_y;
1208 state.yscroll -= visible_y;
1211 state.yscroll -= 2 * step_y;
1215 error = xwimp_open_window((wimp_open *) &state);
1217 NSLOG(netsurf, INFO,
"xwimp_open_window: 0x%x: %s",
1218 error->errnum, error->errmess);
1236 scale = cscale - 0.1;
1238 scale = cscale + 0.1;
1239 }
else if (c == 17) {
1263 if (cscale != scale) {
1289 wimp_pointer pointer;
1291 uint32_t c = (uint32_t) key->c;
1292 wimp_scroll_direction xscroll = wimp_SCROLL_NONE;
1293 wimp_scroll_direction yscroll = wimp_SCROLL_NONE;
1299 ro_error = xwimp_get_pointer_info(&pointer);
1301 NSLOG(netsurf, INFO,
"xwimp_get_pointer_info: 0x%x: %s\n",
1302 ro_error->errnum, ro_error->errmess);
1316 "https://www.netsurf-browser.org/documentation/",
1331 case IS_WIMP_KEY + wimp_KEY_CONTROL + wimp_KEY_F1:
1344 case IS_WIMP_KEY + wimp_KEY_CONTROL + wimp_KEY_F2:
1356 case IS_WIMP_KEY + wimp_KEY_CONTROL + wimp_KEY_F3:
1364 case IS_WIMP_KEY + wimp_KEY_CONTROL + wimp_KEY_SHIFT + wimp_KEY_F3:
1379 case IS_WIMP_KEY + wimp_KEY_CONTROL + wimp_KEY_F5:
1392 case IS_WIMP_KEY + wimp_KEY_CONTROL + wimp_KEY_F7:
1407 case IS_WIMP_KEY + wimp_KEY_CONTROL + wimp_KEY_F9:
1411 case IS_WIMP_KEY + wimp_KEY_CONTROL + wimp_KEY_SHIFT + wimp_KEY_F9:
1426 case wimp_KEY_RETURN:
1428 const char *toolbar_url;
1434 case wimp_KEY_ESCAPE:
1461 case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_LEFT:
1462 case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_RIGHT:
1468 case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_UP:
1470 case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_DOWN:
1483 xscroll = wimp_SCROLL_COLUMN_LEFT;
1486 xscroll = wimp_SCROLL_COLUMN_RIGHT;
1488 case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_LEFT:
1489 xscroll = 0x7fffffff;
1491 case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_RIGHT:
1492 xscroll = 0x80000000;
1495 yscroll = wimp_SCROLL_LINE_UP;
1498 yscroll = wimp_SCROLL_LINE_DOWN;
1501 yscroll = wimp_SCROLL_PAGE_UP;
1504 yscroll = wimp_SCROLL_PAGE_DOWN;
1507 case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_UP:
1508 yscroll = 0x7fffffff;
1511 case IS_WIMP_KEY | wimp_KEY_CONTROL | wimp_KEY_DOWN:
1512 yscroll = 0x80000000;
1578 wimp_pointer pointer;
1581 char *filename = NULL;
1585 error = xwimp_get_pointer_info(&pointer);
1587 NSLOG(netsurf, INFO,
"xwimp_get_pointer_info: 0x%x: %s",
1588 error->errnum, error->errmess);
1595 if (pointer.buttons & wimp_CLICK_ADJUST) {
1602 if (filename != NULL) {
1603 temp_name = malloc(strlen(filename) + 32);
1606 sprintf(temp_name,
"Filer_OpenDir %s",
1608 r = temp_name + strlen(temp_name);
1609 while (r > temp_name) {
1616 error = xos_cli(temp_name);
1618 NSLOG(netsurf, INFO,
1619 "xos_cli: 0x%x: %s",
1631 if (!destroy &&
url != NULL)
1652 const wimp_draw *wimp_rect,
1657 .background_images =
true,
1717 error = xwimp_redraw_window(
redraw, &more);
1719 NSLOG(netsurf, INFO,
"xwimp_redraw_window: 0x%x: %s",
1720 error->errnum, error->errmess);
1730 error = xwimp_get_rectangle(
redraw, &more);
1737 option.buffer_everything &&
1738 error->errnum == error_WIMP_GET_RECT)) {
1739 NSLOG(netsurf, INFO,
"xwimp_get_rectangle: 0x%x: %s",
1740 error->errnum, error->errmess);
1757 float cscale,
scale, inc;
1773 if (scroll->ymin & 3) {
1783 inc = (1 << (
ABS(scroll->ymin)>>2)) / 20.0F;
1786 if (scroll->ymin > 0) {
1787 scale = cscale + inc;
1792 scale = cscale - inc;
1797 if (
scale != cscale) {
1848 uint32_t c = (uint32_t) key->c;
1857 if ((
unsigned)c < 0x20 ||
1858 (0x7f <= c && c <= 0x9f) ||
1868 case wimp_KEY_SHIFT | wimp_KEY_TAB:
1874 case wimp_KEY_CONTROL | wimp_KEY_LEFT:
1886 case wimp_KEY_CONTROL | wimp_KEY_RIGHT:
1890 case wimp_KEY_CONTROL | wimp_KEY_UP:
1894 case wimp_KEY_CONTROL | wimp_KEY_DOWN:
1898 case wimp_KEY_SHIFT | wimp_KEY_LEFT:
1902 case wimp_KEY_SHIFT | wimp_KEY_RIGHT:
1906 case wimp_KEY_SHIFT | wimp_KEY_UP:
1910 case wimp_KEY_SHIFT | wimp_KEY_DOWN:
1918 case wimp_KEY_RIGHT:
1935 case wimp_KEY_DELETE:
1982 if (pointer->buttons == wimp_CLICK_MENU) {
1992 if (pointer->buttons & (wimp_SINGLE_SELECT | wimp_SINGLE_ADJUST))
1998 wimp_BUTTON_DOUBLE_CLICK_DRAG),
2019 unsigned int item, entries;
2020 char *text_convert, *temp;
2030 while (option != NULL) {
2043 for (item = 0; ; item++) {
2045 indirected_text.text);
2069 NSLOG(netsurf, INFO,
"utf8_to_local_encoding failed");
2080 for (item = 0; item < entries; item++) {
2095 NSLOG(netsurf, INFO,
"cnv_space2nbsp failed");
2107 NSLOG(netsurf, INFO,
"utf8_to_enc failed");
2119 data.indirected_text.text) + 1;
2124 wimp_MENU_TITLE_INDIRECTED;
2146 bool *export_sprite)
2148 bool found_type =
false;
2150 if (export_draw != NULL) {
2151 *export_draw =
false;
2153 if (export_sprite != NULL) {
2154 *export_sprite =
false;
2159 case osfile_TYPE_SPRITE:
2162 if (export_sprite != NULL) {
2163 *export_sprite =
true;
2167 case osfile_TYPE_DRAW:
2170 if (export_draw != NULL) {
2171 *export_draw =
true;
2198 wimp_pointer *pointer)
2204 bool export_sprite, export_draw, have_content;
2230 if (pointer != NULL && g->
window == w) {
2238 pointer->pos.y, &pos)) {
2342 &export_draw, &export_sprite);
2346 &export_draw, &export_sprite);
2351 || !(export_sprite || export_draw));
2485 char icon_buf[20] =
"file_xxx";
2488 const char *target =
"-";
2492 sprintf(icon_buf,
"file_xxx");
2501 if (target_url != NULL) {
2512 lwc_string_data(mime),
true);
2514 lwc_string_unref(mime);
2552 wimp_window_state state;
2578 error =
nsurl_create(
"https://www.netsurf-browser.org/documentation/", &
url);
2590 error =
nsurl_create(
"https://www.netsurf-browser.org/documentation/guide", &
url);
2602 error =
nsurl_create(
"https://www.netsurf-browser.org/documentation/info", &
url);
2686 }
else if (h != NULL) {
2875 if (
bw != NULL && h != NULL)
2927 oserror = xwimp_get_window_state(&
state);
2929 NSLOG(netsurf, INFO,
2930 "xwimp_get_window_state: 0x%x: %s",
3170 }
else if (h != NULL) {
3175 h, NULL, NULL, NULL);
3188 }
else if (h != NULL) {
3193 h, NULL, NULL, NULL);
3251 if ((old_gui) && (old_gui->
toolbar)) {
3279 int screen_width, screen_height;
3280 static int window_count = 2;
3282 wimp_window_state
state;
3284 bool open_centred =
true;
3287 g = malloc(
sizeof *g);
3299 strcpy(g->
title,
"NetSurf");
3303 if (existing != NULL &&
3307 error = xwimp_get_window_state(&
state);
3309 NSLOG(netsurf, INFO,
3310 "xwimp_get_window_state: 0x%x: %s",
3319 open_centred =
false;
3321 int win_width, win_height;
3340 window.visible.y0 += 96 -
3341 (48 * (window_count % 5));
3343 open_centred =
false;
3344 if (win_width < 100)
3346 if (win_height < 100)
3352 win_width = screen_width * 3 / 4;
3353 if (1600 < win_width)
3355 win_height = win_width * 3 / 4;
3357 window.visible.x0 = (screen_width - win_width) / 2;
3358 window.visible.y0 = ((screen_height - win_height) / 2) +
3359 96 - (48 * (window_count % 5));
3369 window.flags = wimp_WINDOW_MOVEABLE |
3370 wimp_WINDOW_NEW_FORMAT |
3371 wimp_WINDOW_VSCROLL |
3372 wimp_WINDOW_HSCROLL |
3373 wimp_WINDOW_IGNORE_XEXTENT |
3374 wimp_WINDOW_IGNORE_YEXTENT |
3375 wimp_WINDOW_SCROLL_REPEAT;
3376 window.title_fg = wimp_COLOUR_BLACK;
3377 window.title_bg = wimp_COLOUR_LIGHT_GREY;
3378 window.work_fg = wimp_COLOUR_LIGHT_GREY;
3379 window.work_bg = wimp_COLOUR_TRANSPARENT;
3380 window.scroll_outer = wimp_COLOUR_DARK_GREY;
3381 window.scroll_inner = wimp_COLOUR_MID_LIGHT_GREY;
3382 window.highlight_bg = wimp_COLOUR_CREAM;
3383 window.extra_flags = wimp_WINDOW_USE_EXTENDED_SCROLL_REQUEST |
3389 window.title_flags = wimp_ICON_TEXT |
3390 wimp_ICON_INDIRECTED |
3392 window.work_flags = wimp_BUTTON_DOUBLE_CLICK_DRAG <<
3393 wimp_ICON_BUTTON_TYPE_SHIFT;
3394 window.sprite_area = wimpspriteop_AREA;
3398 window.title_data.indirected_text.validation = (
char *) -1;
3399 window.title_data.indirected_text.size = 255;
3403 window.flags |= wimp_WINDOW_SIZE_ICON |
3404 wimp_WINDOW_BACK_ICON |
3405 wimp_WINDOW_CLOSE_ICON |
3406 wimp_WINDOW_TITLE_ICON |
3407 wimp_WINDOW_TOGGLE_ICON;
3411 window.visible.x0 -= scroll_width;
3416 NSLOG(netsurf, INFO,
"xwimp_create_window: 0x%x: %s",
3417 error->errnum, error->errmess);
3484 error = xwimp_get_window_state(&
state);
3486 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
3487 error->errnum, error->errmess);
3492 state.next = wimp_TOP;
3561 error = xwimp_delete_window(w);
3563 NSLOG(netsurf, INFO,
"xwimp_delete_window: 0x%x: %s",
3564 error->errnum, error->errmess);
3588 int scale_disp = scale * 100;
3590 if (
ABS((
float)scale_disp - scale * 100) >= 0.05) {
3592 title, scale * 100);
3616 wimp_window_state state;
3618 int toolbar_height = 0;
3623 error = xwimp_get_window_state(&state);
3625 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
3626 error->errnum, error->errmess);
3634 *sx = state.xscroll / 2;
3635 *sy = -(state.yscroll - toolbar_height) / 2;
3653 wimp_window_state state;
3655 int toolbar_height = 0;
3660 error = xwimp_get_window_state(&state);
3662 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
3663 error->errnum, error->errmess);
3674 state.xscroll =
rect->
x0 * 2;
3675 state.yscroll = (-
rect->
y0 * 2) + toolbar_height;
3680 int padding_available;
3688 cx0 = state.xscroll;
3689 cy0 = -state.yscroll + toolbar_height;
3690 width = state.visible.x1 - state.visible.x0;
3691 height = state.visible.y1 - state.visible.y0 - toolbar_height;
3694 correction = (
x1 - cx0 -
width);
3695 if (correction > 0) {
3699 if (correction > 0) {
3710 padding_available = (
width -
x1 +
x0) / 2;
3711 if (padding_available > 0) {
3715 correction = (cx0 +
width -
x1);
3716 if (correction < padding_available) {
3717 cx0 += padding_available;
3719 correction = (
x0 - cx0);
3720 if (correction < padding_available) {
3721 cx0 -= padding_available;
3725 if (padding_available > 0) {
3730 if (correction < padding_available) {
3731 cy0 += padding_available;
3733 correction = (
y0 - cy0);
3734 if (correction < padding_available) {
3735 cy0 -= padding_available;
3739 state.xscroll = cx0;
3740 state.yscroll = -cy0 + toolbar_height;
3847 error = xwimp_get_caret_position(&caret);
3849 NSLOG(netsurf, INFO,
"xwimp_get_caret_position: 0x%x: %s",
3850 error->errnum, error->errmess);
3884 wimp_pointer pointer;
3892 error = xwimp_drag_box((wimp_drag*)-1);
3894 NSLOG(netsurf, INFO,
"xwimp_drag_box: 0x%x : %s",
3895 error->errnum, error->errmess);
3899 error = xwimp_get_pointer_info(&pointer);
3901 NSLOG(netsurf, INFO,
"xwimp_get_pointer_info 0x%x : %s",
3902 error->errnum, error->errmess);
3907 error = xwimpspriteop_set_pointer_shape(
"ptr_default", 0x31, 0, 0, 0, 0);
3909 NSLOG(netsurf, INFO,
3910 "xwimpspriteop_set_pointer_shape: 0x%x: %s",
3929 wimp_window_info_base info;
3930 wimp_pointer pointer;
3936 error = xwimp_get_pointer_info(&pointer);
3938 NSLOG(netsurf, INFO,
"xwimp_get_pointer_info 0x%x : %s",
3939 error->errnum, error->errmess);
3945 error = xwimp_get_window_info_header_only((wimp_window_info*)&info);
3947 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x : %s",
3948 error->errnum, error->errmess);
3953 width = info.extent.x1 - info.extent.x0;
3954 height = info.extent.y1 - info.extent.y0;
3956 drag.type = wimp_DRAG_USER_POINT;
3957 drag.bbox.x1 = pointer.pos.x + info.xscroll;
3958 drag.bbox.y0 = pointer.pos.y + info.yscroll;
3959 drag.bbox.x0 = drag.bbox.x1 - (
width - (info.visible.x1 - info.visible.x0));
3960 drag.bbox.y1 = drag.bbox.y0 + (
height - (info.visible.y1 - info.visible.y0));
3964 drag.bbox.y0 -= tbar_height;
3965 drag.bbox.y1 -= tbar_height;
3968 error = xwimp_drag_box(&drag);
3970 NSLOG(netsurf, INFO,
"xwimp_drag_box: 0x%x : %s",
3971 error->errnum, error->errmess);
3995 wimp_pointer pointer;
4002 os_error *error = xwimp_get_pointer_info(&pointer);
4004 NSLOG(netsurf, INFO,
4005 "xwimp_get_pointer_info 0x%x : %s",
4012 drag.type = wimp_DRAG_USER_POINT;
4013 drag.bbox.x0 = pointer.pos.x +
4015 drag.bbox.y0 = pointer.pos.y +
4017 drag.bbox.x1 = pointer.pos.x +
4019 drag.bbox.y1 = pointer.pos.y +
4022 error = xwimp_drag_box(&drag);
4024 NSLOG(netsurf, INFO,
"xwimp_drag_box: 0x%x : %s",
4025 error->errnum, error->errmess);
4075 wimp_pointer pointer;
4086 error = xwimp_get_pointer_info(&pointer);
4088 NSLOG(netsurf, INFO,
"xwimp_get_pointer_info: 0x%x: %s",
4089 error->errnum, error->errmess);
4097 pointer.pos.x, pointer.pos.y, g->
window);
4111 fileswitch_object_type obj_type;
4113 char *buf, *utf8_buf, *sp;
4119 error = xosfile_read_stamped(filename, &obj_type, NULL, NULL,
4122 NSLOG(netsurf, INFO,
"xosfile_read_stamped: 0x%x:%s",
4123 error->errnum, error->errmess);
4132 buf = calloc(size + 1,
sizeof(
char));
4138 error = xosfile_load_stamped(filename, (
byte*)buf,
4139 NULL, NULL, NULL, NULL, NULL);
4142 NSLOG(netsurf, INFO,
"xosfile_load_stamped: 0x%x:%s",
4143 error->errnum, error->errmess);
4153 NSLOG(netsurf, INFO,
"utf8_from_local_encoding failed");
4158 size = strlen(utf8_buf);
4160 ep = utf8_buf + size;
4164 while (isspace(*p)) p++;
4167 while (*p && *p !=
'\r' && *p !=
'\n')
4266 static const struct ns_menu browser_definition = {
4273#ifdef WITH_DRAW_EXPORT
4276#ifdef WITH_PDF_EXPORT
4294#ifdef WITH_DRAW_EXPORT
4297 {
"Object.Object.SaveURL",
NO_ACTION, 0 },
4376 wimp_window_info info;
4383 error = xwimp_get_window_info_header_only(&info);
4385 NSLOG(netsurf, INFO,
4386 "xwimp_get_window_info_header_only: 0x%x: %s",
4393 error = xwimp_force_redraw(
g->
window,
4394 info.extent.x0, info.extent.y0,
4395 info.extent.x1, info.extent.y1);
4397 NSLOG(netsurf, INFO,
"xwimp_force_redraw: 0x%x: %s",
4398 error->errnum, error->errmess);
4432 NSLOG(netsurf, INFO,
"No memory for malloc.");
4453 char *idn_url_s = NULL;
4487 if (0x1000 <= message->data.data_xfer.file_type)
4491 message->data.data_xfer.pos.y, &pos))
4495 message->data.data_xfer.file_name) ==
false)
4499 message->action = message_DATA_LOAD_ACK;
4500 message->your_ref = message->my_ref;
4501 error = xwimp_send_message(wimp_USER_MESSAGE, message, message->sender);
4503 NSLOG(netsurf, INFO,
"xwimp_send_message: 0x%x: %s\n",
4504 error->errnum, error->errmess);
4522 wimp_BUTTON_DOUBLE_CLICK_DRAG),
4535 const char *temp_fname =
"Pipe:$._tmpfile";
4537 osspriteop_header *overlay = NULL;
4538 osspriteop_header *sprite_header;
4540 osspriteop_area *area;
4554 error = xosspriteop_read_sprite_info(osspriteop_PTR,
4555 (osspriteop_area *)0x100,
4559 NSLOG(netsurf, INFO,
4560 "xosspriteop_read_sprite_info: 0x%x: %s",
4566 NSLOG(netsurf, INFO,
"overlay sprite is not 8bpp");
4575 NSLOG(netsurf, INFO,
"Thumbnail initialisation failed.");
4585 NSLOG(netsurf, INFO,
"Thumbnail conversion failed.");
4600 sprite_header = (osspriteop_header *)(area + 1);
4601 len = sprintf(sprite_header->name,
"ic_netsf%.2d",
id);
4603 error = xosspriteop_save_sprite_file(osspriteop_USER_AREA,
4606 NSLOG(netsurf, INFO,
"xosspriteop_save_sprite_file: 0x%x:%s",
4607 error->errnum, error->errmess);
4613 error = xwimpspriteop_merge_sprite_file(temp_fname);
4615 NSLOG(netsurf, INFO,
4616 "xwimpspriteop_merge_sprite_file: 0x%x:%s",
4625 memcpy(wi->sprite_name, sprite_header->name + 3, len - 2);
4626 strncpy(wi->title, g->
title,
sizeof(wi->title));
4627 wi->title[
sizeof(wi->title) - 1] =
'\0';
4629 if (wimptextop_string_width(wi->title, 0) > 182) {
4632 if (strlen(wi->title) > 10)
4633 wi->title[10] =
'\0';
4634 while (wimptextop_string_width(wi->title, 0) > 182)
4635 wi->title[strlen(wi->title) - 1] =
'\0';
4638 wi->size =
sizeof(wimp_full_message_window_info);
4639 wi->your_ref = wi->my_ref;
4640 error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)wi,
4643 NSLOG(netsurf, INFO,
"xwimp_send_message: 0x%x:%s",
4644 error->errnum, error->errmess);
4659 if (message->data.data_xfer.file_type == osfile_TYPE_TEXT &&
4661 message->data.data_xfer.file_name)) {
4665 message->action = message_DATA_LOAD_ACK;
4666 message->your_ref = message->my_ref;
4667 error = xwimp_send_message(wimp_USER_MESSAGE, message,
4670 NSLOG(netsurf, INFO,
4671 "xwimp_send_message: 0x%x: %s\n",
4716 update.box.x0 = cur->
x0;
4717 update.box.y0 = cur->
y0;
4718 update.box.x1 = cur->
x1;
4719 update.box.y1 = cur->
y1;
4721 error = xwimp_update_window(&update, &more);
4723 NSLOG(netsurf, INFO,
"xwimp_update_window: 0x%x: %s",
4724 error->errnum, error->errmess);
4735 error = xwimp_get_rectangle(&update, &more);
4741 if (error && !(use_buffer &&
4742 error->errnum == error_WIMP_GET_RECT)) {
4743 NSLOG(netsurf, INFO,
4744 "xwimp_get_rectangle: 0x%x: %s",
4857 wimp_window_state state;
4863 error = xwimp_get_window_state(&state);
4865 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x:%s",
4866 error->errnum, error->errmess);
4870 pos->x = (x - (state.visible.x0 - state.xscroll)) / 2 ;
4871 pos->y = ((state.visible.y1 - state.yscroll) - y) / 2 ;
4882 enum { CLICK_SINGLE, CLICK_DOUBLE, CLICK_TRIPLE }
type;
4887 case wimp_BUTTON_CLICK_DRAG:
4892 if (buttons & (wimp_CLICK_SELECT))
4894 if (buttons & (wimp_CLICK_ADJUST))
4898 case wimp_BUTTON_DOUBLE_CLICK_DRAG:
4903 if (buttons & (wimp_SINGLE_SELECT)) {
4906 }
else if (buttons & (wimp_SINGLE_ADJUST)) {
4913 if (buttons & (wimp_DOUBLE_SELECT)) {
4917 }
else if (buttons & (wimp_DOUBLE_ADJUST)) {
4932 if (last_click.type == CLICK_DOUBLE) {
4934 nsu_getmonotonic_ms(&ms_now);
4936 if (ms_now < (last_click.time + 500)) {
4940 last_click.type = CLICK_TRIPLE;
4944 last_click.type = CLICK_SINGLE;
4948 last_click.type = CLICK_SINGLE;
4959 if (last_click.type == CLICK_TRIPLE) {
4960 state &= ~BROWSER_MOUSE_DOUBLE_CLICK;
4961 last_click.type = CLICK_SINGLE;
4963 last_click.type = CLICK_DOUBLE;
4964 nsu_getmonotonic_ms(&last_click.time);
4967 last_click.type = CLICK_SINGLE;
4973 if (buttons & (wimp_DRAG_SELECT)) {
4978 if (buttons & (wimp_DRAG_ADJUST)) {
5000 if (!(buttons & (wimp_CLICK_SELECT | wimp_CLICK_ADJUST))) {
5027 xosbyte1(osbyte_SCAN_KEYBOARD, 0 ^ 0x80, 0, &shift);
5028 return (shift == 0xff);
5036 xosbyte1(osbyte_SCAN_KEYBOARD, 1 ^ 0x80, 0, &ctrl);
5037 return (ctrl == 0xff);
5045 xosbyte1(osbyte_SCAN_KEYBOARD, 2 ^ 0x80, 0, &alt);
5046 return (alt == 0xff);
5057 if (shape == curr_pointer)
5067 error = xwimpspriteop_set_pointer_shape(entry->
sprite_name,
5070 NSLOG(netsurf, INFO,
5071 "xwimpspriteop_set_pointer_shape: 0x%x: %s",
5078 error = xosspriteop_set_pointer_shape(osspriteop_USER_AREA,
5083 NSLOG(netsurf, INFO,
5084 "xosspriteop_set_pointer_shape: 0x%x: %s",
5091 curr_pointer = shape;
void gui_start_selection(struct gui_window *g)
@ BROWSER_NAVIGATE_FORWARD
@ BROWSER_OBJECT_EXPORT_SPRITE
@ BROWSER_OBJECT_SAVE_URL_URI
@ BROWSER_IMAGES_BACKGROUND
@ BROWSER_OBJECT_SAVE_URL_URL
@ BROWSER_NAVIGATE_RELOAD_ALL
@ BROWSER_IMAGES_FOREGROUND
@ BROWSER_OBJECT_SAVE_URL_TEXT
@ HELP_LAUNCH_INTERACTIVE
nserror browser_window_history_forward(struct browser_window *bw, bool new_window)
Go forward in the history.
nserror browser_window_history_back(struct browser_window *bw, bool new_window)
Go back in the history.
Interface to browser history operations.
Browser window creation and manipulation interface.
nserror browser_window_schedule_reformat(struct browser_window *bw)
Reformat the browser window contents in a safe context.
bool browser_window_redraw_ready(struct browser_window *bw)
Check whether browser window is ready for redraw.
bool browser_window_can_select(struct browser_window *bw)
Find out if given browser window content is selectable.
nserror browser_window_get_features(struct browser_window *bw, int x, int y, struct browser_window_features *data)
Get access to any page features at the given coordinates.
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.
float browser_window_get_scale(struct browser_window *bw)
Gets the scale of a browser window.
bool browser_window_has_content(struct browser_window *bw)
Find out if a browser window is currently showing a content.
bool browser_window_back_available(struct browser_window *bw)
Check availability of Back action for a given browser window.
nserror browser_window_get_scrollbar_type(struct browser_window *bw, browser_scrolling *h, browser_scrolling *v)
Get the browser window's scrollbar details.
nserror browser_window_debug(struct browser_window *bw, enum content_debug op)
Set debug options on a window.
nserror browser_window_get_url(struct browser_window *bw, bool fragment, struct nsurl **url_out)
Access a browser window's URL.
bool browser_window_can_search(struct browser_window *bw)
Find out if given browser window can be searched.
void browser_window_mouse_click(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks in a browser window.
bool browser_window_scroll_at_point(struct browser_window *bw, int x, int y, int scrx, int scry)
Send a scroll request to a browser window at a particular point.
bool browser_window_up_available(struct browser_window *bw)
Return true if a browser window can navigate upwards.
void browser_window_destroy(struct browser_window *bw)
Close and destroy a browser window.
nserror browser_window_navigate_up(struct browser_window *bw, bool new_window)
Navigate to a browser_window's parent URL.
nserror browser_window_reload(struct browser_window *bw, bool all)
Reload the page in a browser window.
@ BW_EDITOR_CAN_PASTE
Can paste, input.
@ BW_EDITOR_CAN_CUT
Selection not read-only.
@ BW_EDITOR_CAN_COPY
Have selection.
struct nsurl * browser_window_access_url(const struct browser_window *bw)
Access a browser window's URL.
bool browser_window_reload_available(struct browser_window *bw)
Check availability of Reload action for a given browser window.
bool browser_window_forward_available(struct browser_window *bw)
Check availability of Forward action for a given browser window.
char * browser_window_get_selection(struct browser_window *bw)
Get the current selection from a root browser window, ownership passed to caller, who must free() it.
const char * browser_window_get_title(struct browser_window *bw)
Get the title of 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.
void browser_window_stop(struct browser_window *bw)
Stop all fetching activity in a browser window.
bool browser_window_is_frameset(struct browser_window *bw)
Find out if a browser window contains a frameset.
nserror browser_window_set_scale(struct browser_window *bw, float scale, bool absolute)
Sets the scale of a browser window.
struct hlcache_handle * browser_window_get_content(struct browser_window *bw)
Get a cache handle for the content within a browser window.
browser_editor_flags browser_window_get_editor_flags(struct browser_window *bw)
Check whether browser window can accept a cut/copy/paste, or has a selection that could be saved.
@ BW_CREATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
@ BW_CREATE_CLONE
New gui_window to be clone of "existing" gui_window.
bool browser_window_stop_available(struct browser_window *bw)
Check availability of Stop action for a given browser window.
bool browser_window_drop_file_at_point(struct browser_window *bw, int x, int y, char *file)
Drop a file onto a browser window at a particular point, or determine if a file may be dropped onto t...
@ BW_NAVIGATE_DOWNLOAD
download rather than render the uri
@ BW_NAVIGATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
void browser_window_mouse_track(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle non-click mouse action in a browser window.
void ro_gui_buffer_close(void)
Closes any open buffer and flushes the contents to screen.
void ro_gui_buffer_open(const wimp_draw *redraw)
Opens a buffer for writing to.
Screen buffering (interface).
@ CONTENT_IMAGE
All images.
@ CONTENT_HTML
content is HTML
@ CONTENT_TEXTPLAIN
content is plain text
@ CONTENT_DEBUG_REDRAW
Debug redraw operations.
@ CONTENT_ENCODING_NORMAL
The content encoding.
@ CONTENT_ENCODING_SOURCE
The content encoding source.
bool cookie_manager_keypress(uint32_t key)
Key press handling.
Cookie Manager (interface).
nserror search_web_omni(const char *term, enum search_web_omni_flags flags, struct nsurl **url_out)
Generate a nsurl from a search term.
void ro_gui_dialog_close_persistent(wimp_w parent)
Close persistent dialogs associated with a window.
void ro_gui_dialog_open_persistent(wimp_w parent, wimp_w w, bool pointer)
Open a persistent dialog box relative to the pointer.
void ro_gui_save_options(void)
Save the current options.
void ro_gui_dialog_prepare_zoom(struct gui_window *g)
Prepares the Scale view dialog.
void gui_drag_save_selection(struct gui_window *g, const char *selection)
void gui_drag_save_object(struct gui_window *g, struct hlcache_handle *c, gui_save_type type)
nserror
Enumeration of error codes.
@ NSERROR_BAD_ENCODING
The character set is unknown.
@ NSERROR_BAD_PARAMETER
Bad Parameter.
@ NSERROR_INVALID
Invalid data.
@ NSERROR_NOMEM
Memory exhaustion.
#define NOF_ELEMENTS(array)
nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
osspriteop_area * riscos_bitmap_convert_8bpp(struct bitmap *bitmap)
Convert a bitmap to 8bpp.
void riscos_bitmap_destroy(void *vbitmap)
Free a bitmap.
void riscos_bitmap_overlay_sprite(struct bitmap *bitmap, const osspriteop_header *s)
void * riscos_bitmap_create(int width, int height, enum gui_bitmap_flags flags)
Create a bitmap.
nserror riscos_bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content)
Render content into bitmap.
nserror ro_gui_global_history_present(void)
make the global history window visible.
RISc OS global history interface.
void ro_gui_hotlist_remove_page(nsurl *url)
Remove a URL from the hotlist.
nserror ro_gui_hotlist_present(void)
make the cookie window visible.
void ro_gui_hotlist_add_page(nsurl *url)
Add a URL to the hotlist.
nserror ro_gui_local_history_present(wimp_w parent, struct browser_window *bw)
make the local history window visible.
RISC OS local history interface.
void ro_mouse_drag_start(void(*drag_end)(wimp_dragged *dragged, void *data), void(*drag_track)(wimp_pointer *pointer, void *data), void(*drag_cancel)(void *data), void *data)
Start a drag, providing a function to be called when the Wimp_DragEnd event is received and optionall...
void ro_mouse_track_start(void(*poll_end)(wimp_leaving *leaving, void *data), void(*poll_track)(wimp_pointer *pointer, void *data), void *data)
Start tracking the mouse in a window, providing a function to be called on null polls and optionally ...
void ro_mouse_kill(void *data)
Kill any tracking events if the data pointers match the supplied pointer.
Mouse dragging and tracking support interface for RISC OS.
void ro_gui_selection_prepare_paste(wimp_w w, ro_gui_selection_prepare_paste_cb cb, void *pw)
Prepare to paste data from another application.
Text selection import/export (interface).
@ THEME_STYLE_BROWSER_TOOLBAR
Browser window handling (interface).
struct gui_window * window_list
Generic bitmap handling interface.
@ BITMAP_CLEAR
memory should be wiped to 0
@ BITMAP_OPAQUE
image is opaque
Public content interface.
struct nsurl * hlcache_handle_get_url(const struct hlcache_handle *handle)
Retrieve the URL associated with a high level cache handle.
const char * content_get_title(struct hlcache_handle *h)
Retrieve title associated with content.
void content_invalidate_reuse_data(struct hlcache_handle *h)
Invalidate content reuse data.
const char * content_get_encoding(struct hlcache_handle *h, enum content_encoding_type op)
Retrieve the encoding of a content.
lwc_string * content_get_mime_type(struct hlcache_handle *h)
Retrieve mime-type of content.
content_type content_get_type(struct hlcache_handle *h)
Retrieve computed type of content.
browser_mouse_state
Mouse state: 1 is primary mouse button.
@ BROWSER_MOUSE_PRESS_1
primary button pressed
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
@ BROWSER_MOUSE_PRESS_2
auxillary button pressed
@ BROWSER_MOUSE_TRIPLE_CLICK
button triple clicked
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
@ BROWSER_MOUSE_MOD_2
2nd modifier key pressed (eg.
@ BROWSER_MOUSE_DOUBLE_CLICK
button double clicked
@ BROWSER_MOUSE_MOD_3
3rd modifier key pressed (eg.
@ BROWSER_MOUSE_MOD_1
1st modifier key pressed (eg.
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
@ BROWSER_MOUSE_HOLDING_2
during button 2 drag
@ BROWSER_MOUSE_HOLDING_1
during button 1 drag
@ BROWSER_MOUSE_DRAG_ON
a drag operation was started and a mouse button is still pressed
@ BROWSER_MOUSE_DRAG_2
start of button 2 drag
Target independent plotting interface.
Interface to platform-specific graphical user interface window operations.
gui_window_create_flags
Window creation control flags.
@ GW_CREATE_CLONE
Clone existing window.
@ GUI_SAVE_TEXT_SELECTION
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_SELECTION
selection started
@ GW_EVENT_START_THROBBER
start the navigation throbber.
Netsurf additional integer type formatting macros.
Interface to key press operations.
@ NS_KEY_DELETE_LINE_START
bool browser_window_key_press(struct browser_window *bw, uint32_t key)
Handle key presses in a browser window.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
NetSurf URL handling (interface).
nserror nsurl_get_utf8(const nsurl *url, char **url_s, size_t *url_l)
Get a UTF-8 string (for human readable IDNs) from a NetSurf URL object.
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.
nsurl * nsurl_ref(nsurl *url)
Increment the reference count to a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
Backward compatible defines to make NetSurf buildable with pre-OSLib 7 releases.
nserror ro_gui_cookies_present(const char *search_term)
make the cookie window visible.
Interface to riscos cookie viewing using riscos core window.
int ro_content_filetype(struct hlcache_handle *c)
Determine the RISC OS filetype for a content.
int ro_content_native_type(struct hlcache_handle *c)
Determine the native RISC OS filetype to export a content as.
RISC OS filetpe interface.
void ro_gui_screen_size(int *width, int *height)
Find screen size in OS units.
void ro_gui_view_source(struct hlcache_handle *c)
Send the source of a content to a text editor.
osspriteop_area * gui_sprites
Sprite area containing pointer and hotlist sprites.
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
void ro_gui_dump_browser_window(struct browser_window *bw)
Send the debug dump of a content to a text editor.
#define ICON_PAGEINFO_ICON
wimp_w current_menu_window
Window that owns the current menu.
struct rect ro_plot_clip_rect
const struct plotter_table ro_plotters
RISC OS plotter operation table.
#define ICON_OBJINFO_ICON
#define ICON_PAGEINFO_URL
void ro_gui_print_prepare(struct gui_window *g)
Prepares all aspects of the print dialog prior to opening.
#define ICON_PAGEINFO_TYPE
void ro_gui_search_prepare(struct browser_window *g)
Open the search dialog.
#define ICON_OBJINFO_TYPE
#define ICON_OBJINFO_TARGET
#define ICON_PAGEINFO_ENC
#define ICON_PAGEINFO_TITLE
bool ro_gui_interactive_help_available(void)
Checks if interactive help is running.
void ro_gui_interactive_help_start(void)
Launches interactive help.
Interactive help (interface).
nserror ro_gui_pageinfo_present(struct gui_window *gw)
make the pageinfo window visible.
Interface to page info core window for RISC OS.
File/object/selection saving (Interface).
static bool mouse_drag_adjust
static struct form_control * gui_form_select_control
Form control which gui_form_select_menu is for.
static nserror ro_gui_window_event(struct gui_window *gw, enum gui_window_event event)
process miscellaneous window events
static nserror gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
Save the specified content as a link.
static void ro_gui_window_pointer_entering(wimp_entering *entering)
Process Pointer Entering Window events in a browser window.
static void ro_gui_window__redraw_rect(const struct gui_window *gui_win, const wimp_draw *wimp_rect, bool use_buffer)
Wrapper for calls to browser_window_redraw for a wimp_draw rectangle.
static bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action)
Handle selections from a browser window menu.
static void ro_gui_window_prepare_objectinfo(struct hlcache_handle *object, nsurl *target_url)
Prepare the object info window for use.
static void ro_gui_window_paste_cb(void *pw)
callback to handle window paste operation
enum browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons, wimp_icon_flags type)
Returns the state of the mouse buttons and modifiers keys for a mouse action, suitable for passing to...
static const struct toolbar_callbacks ro_gui_window_toolbar_callbacks
toolbar callbacks for a browser window.
static void gui_window_destroy(struct gui_window *g)
Close a browser window and free any related resources.
static bool ro_gui_window_import_text(struct gui_window *g, const char *filename)
Import text file into window.
static void gui_window_remove_caret(struct gui_window *g)
Remove the caret, if present.
bool ro_gui_shift_pressed(void)
Returns true iff one or more Shift keys is held down.
static void ro_gui_window_scroll_action(struct gui_window *g, wimp_scroll_direction scroll_x, wimp_scroll_direction scroll_y)
Scroll a browser window.
static nserror gui_window_get_dimensions(struct gui_window *gw, int *width, int *height)
Find the current dimensions of a browser window's content area.
static void gui_window_page_info_change(struct gui_window *gw)
Update the interface to reflect change in page info status.
static void gui_window_update_extent(struct gui_window *g)
Update the extent of the inside of a browser window to that of the current content.
static void ro_gui_window_action_save(struct gui_window *g, gui_save_type save_type)
Open a save dialogue for a browser window contents.
static void ro_gui_window_process_form_select_menu(struct gui_window *g, wimp_selection *selection)
Process selections from a form select menu, passing them back to the core.
static bool ro_gui_window_toolbar_keypress(void *data, wimp_key *key)
Callback handler for keypresses within browser window toolbars.
static float scale_snap_to[]
static void ro_gui_window_update_theme(void *data, bool ok)
Update a window and its toolbar.
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
set the pointer shape
static struct gui_window * gui_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
Create and open a new browser window.
void ro_gui_throb(void)
Animate the "throbbers" of all browser windows.
static void ro_gui_window_track_end(wimp_leaving *leaving, void *data)
Process Pointer Leaving Window events in a browser window.
static void gui_window_start_throbber(struct gui_window *g)
Update the interface to reflect start of page loading.
void ro_gui_window_set_scale(struct gui_window *g, float scale)
Set a gui_window's scale.
struct gui_window * ro_gui_toolbar_lookup(wimp_w window)
Convert a toolbar RISC OS window handle to a gui_window.
static struct gui_window_table window_table
RISC OS browser window operation table.
static void gui_window_set_title(struct gui_window *g, const char *title)
Set the title of a browser window.
static void ro_gui_window_action_home(struct gui_window *g)
Perform a Navigate Home action on a browser window.
nserror ro_gui_window_invalidate_area(struct gui_window *g, const struct rect *rect)
Cause an area of a window to be invalidated.
void ro_gui_window_update_boxes(void)
Redraw any pending update boxes.
bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, os_coord *pos)
Convert x,y screen co-ordinates into window co-ordinates.
static void ro_gui_window_clone_options(struct gui_window *new_gui, struct gui_window *old_gui)
Clones a browser window's options.
static void riscos_window_set_status(struct gui_window *g, const char *text)
Set the status bar of a browser window.
bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message)
Handle Message_DataLoad (file dragged in) for a toolbar.
static bool ro_gui_window_content_export_types(struct hlcache_handle *h, bool *export_draw, bool *export_sprite)
Return boolean flags to show what RISC OS types we can sensibly convert the given object into.
static void ro_gui_window_prepare_pageinfo(struct gui_window *g)
Prepare the page info window for use.
struct gui_window * ro_gui_current_redraw_gui
GUI window which is being redrawn.
static void ro_gui_window_action_page_info(struct gui_window *g)
Open a page info box for a browser window.
static void ro_gui_window_action_add_bookmark(struct gui_window *g)
Add a hotlist entry for a browser window.
browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons, wimp_icon_flags type)
Returns the state of the mouse buttons and modifiers keys whilst dragging, for passing to the OS-inde...
#define SCROLL_VISIBLE_PADDING
static bool iconise_used[64]
Remembers which iconised sprite numbers are in use.
bool ro_gui_ctrl_pressed(void)
Returns true iff one or more Ctrl keys is held down.
static void ro_gui_window_scroll(wimp_scroll *scroll)
Process Scroll_Request events in a browser window.
struct ro_gui_pointer_entry ro_gui_pointer_table[]
Map from gui_pointer_shape to pointer sprite data.
static void ro_gui_window_scroll_end(wimp_dragged *drag, void *data)
Completes scrolling of a browser window.
static void gui_window_stop_throbber(struct gui_window *g)
Update the interface to reflect page loading stopped.
static nsurl * current_menu_url
URL of link under menu, or 0 if no link.
static bool gui_window_scroll_start(struct gui_window *g)
Starts drag scrolling of a browser window.
static void gui_window_set_extent(struct gui_window *g, int width, int height)
Updates a windows extent.
static void ro_gui_window_menu_warning(wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action)
Handle submenu warnings for a browser window menu.
void ro_gui_window_redraw_all(void)
Redraws the content for all windows.
static bool ro_gui_window_keypress(wimp_key *key)
Process Key_Pressed events in a browser window.
static void ro_gui_window_action_search(struct gui_window *g)
Open a text search dialogue for a browser window.
static wimp_menu * gui_form_select_menu
Menu of options for form select controls.
bool ro_gui_window_check_menu(wimp_menu *menu)
Check if a particular menu handle is a browser window menu.
struct gui_window_table * riscos_window_table
static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip)
Place the caret in a browser window.
static bool ro_gui_window_click(wimp_pointer *pointer)
Handle Mouse_Click events in a browser window.
static void ro_gui_window_action_local_history(struct gui_window *gw)
Open a local history pane for a browser window.
static void ro_gui_window_close(wimp_w w)
Handle wimp closing event.
bool ro_gui_alt_pressed(void)
Returns true iff one or more Alt keys is held down.
static void ro_gui_window_action_print(struct gui_window *g)
Open a print dialogue for a browser window.
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
Get the scroll position of a browser window.
static void ro_gui_window_update_toolbar_buttons(struct gui_window *g)
Update the toolbar buttons for a given browser window to reflect the current state of its contents.
static wimp_menu * ro_gui_browser_window_menu
The browser window menu handle.
static nserror gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
Set the scroll position of a riscos browser window.
static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
set favicon
static void ro_gui_window_update_toolbar(void *data)
Update a window to reflect a change in toolbar size: used as a callback by the toolbar module when a ...
static void ro_gui_window_action_new_window(struct gui_window *g)
Open a new browser window.
void ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi)
Window is being iconised.
static void gui_window_new_content(struct gui_window *g)
Called when the gui_window has new content.
static bool mouse_drag_select
Whether a pressed mouse button has become a drag.
void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data)
Handle pointer movements in a browser window.
struct gui_window * ro_gui_window_lookup(wimp_w window)
Convert a RISC OS window handle to a gui_window.
static void ro_gui_window_toolbar_click(void *data, toolbar_action_type action_type, union toolbar_action action)
Process Mouse_Click events in a toolbar's button bar.
static void ro_gui_window_remove_update_boxes(struct gui_window *g)
Remove all pending update boxes for a window.
static void ro_gui_window_save_toolbar_buttons(void *data, char *config)
Save a new toolbar button configuration.
static void ro_gui_window_redraw(wimp_draw *redraw)
Handle a Redraw_Window_Request for a browser window.
static bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu, wimp_pointer *pointer)
Prepare the browser window menu for (re-)opening.
struct update_box * pending_updates
static struct hlcache_handle * current_menu_main
Main content object under menu, or 0 if none.
bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message)
Handle Message_DataLoad (file dragged in) for a window.
static void ro_gui_window_launch_url(struct gui_window *g, const char *url_s)
Launch a new url in the given window.
static void ro_gui_window_action_zoom(struct gui_window *g)
Open a zoom dialogue for a browser window.
static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type, const struct rect *rect)
Platform-dependent part of starting drag operation.
static bool ro_gui_window_prepare_form_select_menu(struct gui_window *g, struct form_control *control)
Prepare or reprepare a form select menu.
static bool handle_local_keypress_scale(struct gui_window *gw, uint32_t c)
handle scale kepresses within RISC OS
static void ro_gui_window_open(wimp_open *open)
Open a window.
static void gui_window_create_form_select_menu(struct gui_window *g, struct form_control *control)
Display a menu of options for a form select control.
void ro_gui_window_quit(void)
Destroy all browser windows.
#define wimp_WINDOW_GIVE_SHADED_ICON_INFO
static bool ro_gui_window_handle_local_keypress(struct gui_window *g, wimp_key *key, bool is_toolbar)
Handle keypresses within the RISC OS GUI.
static void ro_gui_window_action_remove_bookmark(struct gui_window *g)
Remove a hotlist entry for a browser window.
static void ro_gui_window_menu_close(wimp_w w, wimp_i i, wimp_menu *menu)
Handle the closure of a browser window menu.
static struct hlcache_handle * current_menu_object
Object under menu, or 0 if no object.
nserror ro_gui_window_set_url(struct gui_window *g, nsurl *url)
Set the contents of a window's address bar.
#define SCALE_SNAP_TO_SIZE
void ro_gui_window_default_options(struct gui_window *gui)
Makes a browser window's options the default.
void ro_gui_window_initialise(void)
Initialise the browser window module and its menus.
void ro_gui_drag_save_link(gui_save_type save_type, const nsurl *url, const char *title, struct gui_window *g)
Initiates drag saving of a link/URL file.
void ro_gui_save_prepare(gui_save_type save_type, struct hlcache_handle *h, char *s, const nsurl *url, const char *title)
Prepares the save box to reflect gui_save_type and a content, and opens it.
core web search facilities interface.
@ SEARCH_WEB_OMNI_NONE
no changes to default operation
byte sprite_bpp(const osspriteop_header *s)
Returns the bit depth of a sprite.
Content for image/x-riscos-sprite (RISC OS interface).
unsigned int ro_gui_status_bar_get_width(struct status_bar *sb)
Get the proportional width the status bar is currently using.
void ro_gui_status_bar_resize(struct status_bar *sb)
Resize a status bar following a change in the dimensions of the parent window.
void ro_gui_status_bar_set_text(struct status_bar *sb, const char *text)
Set the text to display in the status bar.
struct status_bar * ro_gui_status_bar_create(wimp_w parent, unsigned int width)
Create a new status bar.
void ro_gui_status_bar_destroy(struct status_bar *sb)
Destroy a status bar and free all associated resources.
UTF8 status bar (interface).
Interface to utility string handling.
char * cnv_space2nbsp(const char *s)
Converts NUL terminated UTF-8 encoded string s containing zero or more spaces (char 32) or TABs (char...
RISC OS wimp toolkit bitmap.
Page features at a specific spatial location.
struct hlcache_handle * object
Object at position or NULL.
struct hlcache_handle * main
handle of top level content.
struct nsurl * link
URL of a link or NULL.
struct browser_window * bw
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.
int old_width
Width when last opened / os units.
GtkLabel * status_bar
statusbar
struct fbtk_widget_s * toolbar
bool update_extent
Update the extent on next opening.
struct gui_window * next
list for cleanup
bool active
Whether the throbber should be active.
bool buffer_animations
Use screen buffering for animations.
struct fbtk_widget_s * window
RECT redraw
Area needing redraw.
bool buffer_everything
Use screen buffering for everything.
int old_height
Height when last opened / os units.
struct gui_window::@47 option
Options.
int iconise_icon
ID number of icon when window is iconised.
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
bool interactive
Redraw to show interactive features.
An entry in ro_gui_pointer_table.
char sprite_name[16]
The pointer is in the Wimp's sprite area.
void talloc_report_full(const void *ptr, FILE *f)
Interface to time operations.
UCS conversion tables (interface) This is only used if nothing claims Service_International,...
@ TOOLBAR_URL_DRAG_FAVICON
@ TOOLBAR_URL_ADJUST_PGINFO
@ TOOLBAR_URL_SELECT_PGINFO
@ TOOLBAR_URL_SELECT_HOTLIST
@ TOOLBAR_URL_ADJUST_HOTLIST
void ro_gui_url_complete_start(struct toolbar *toolbar)
Should be called when the caret is placed into a URL completion icon.
bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
Handles a keypress for URL completion.
void ro_gui_url_complete_resize(struct toolbar *toolbar, wimp_open *open)
Move and resize the url completion window to match the toolbar.
bool ro_gui_url_complete_close(void)
Try to close the current url completion window.
Central repository for URL data (interface).
Unified URL information database public interface.
void urldb_dump(void)
Dump URL database to stderr.
URL Suggestion Menu (interface).
nserror netsurf_nsurl_to_path(struct nsurl *url, char **path_out)
Create a path from a nsurl.
Default operations table for files.
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
#define nsoption_int(OPTION)
Get the value of an integer option.
#define nsoption_set_int(OPTION, VALUE)
set an integer option in the default table
#define nsoption_set_bool(OPTION, VALUE)
set a boolean option in the default table
#define nsoption_set_charp(OPTION, VALUE)
set string option in default table
#define nsoption_bool(OPTION)
Get the value of a boolean option.
size_t utf8_next(const char *s, size_t l, size_t o)
Find next legal UTF-8 char in string.
UTF-8 manipulation functions (interface).
Interface to a number of general purpose functionality.
os_error * ro_gui_wimp_get_sprite(const char *name, osspriteop_header **sprite)
Locate a sprite in the Wimp sprite pool, returning a pointer to it.
void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8)
Set the contents of a text or sprite icon to a string.
int ro_get_hscroll_height(wimp_w w)
Gets the horizontal scrollbar height.
void ro_gui_set_window_title(wimp_w w, const char *text)
Set a window title.
int ro_get_title_height(wimp_w w)
Gets the title bar height.
bool ro_gui_wimp_sprite_exists(const char *sprite)
Check if a sprite is present in the Wimp sprite pool.
int ro_get_vscroll_width(wimp_w w)
Gets the vertical scrollbar width.
General RISC OS WIMP/OS library functions (interface).
bool ro_gui_wimp_event_register_keypress(wimp_w w, bool(*callback)(wimp_key *key))
Register a function to be called for all keypresses within a particular window.
bool ro_gui_wimp_event_register_redraw_window(wimp_w w, void(*callback)(wimp_draw *redraw))
Register a function to be called for all window redraw operations.
void ro_gui_wimp_event_finalise(wimp_w w)
Free any resources associated with a window.
void * ro_gui_wimp_event_get_user_data(wimp_w w)
Gets the user data associated with a window.
bool ro_gui_wimp_event_register_menu_selection(wimp_w w, bool(*callback)(wimp_w w, wimp_i i, wimp_menu *m, wimp_selection *s, menu_action a))
Register a function to be called following a menu selection.
bool ro_gui_wimp_event_register_mouse_click(wimp_w w, bool(*callback)(wimp_pointer *pointer))
Register a function to be called for all mouse-clicks to icons in a window that don't have registered...
bool ro_gui_wimp_event_register_menu_prepare(wimp_w w, bool(*callback)(wimp_w w, wimp_i i, wimp_menu *m, wimp_pointer *p))
Register a function to be called before a menu is (re-)opened.
bool ro_gui_wimp_event_set_user_data(wimp_w w, void *user)
Sets the user data associated with a window.
bool ro_gui_wimp_event_register_menu_close(wimp_w w, void(*callback)(wimp_w w, wimp_i i, wimp_menu *m))
Register a function to be called before a menu is finally closed.
bool ro_gui_wimp_event_register_pointer_entering_window(wimp_w w, void(*callback)(wimp_entering *entering))
Register a function to be called for all pointer entering window requests.
bool ro_gui_wimp_event_register_close_window(wimp_w w, void(*callback)(wimp_w w))
Register a function to be called after the window has been closed.
bool ro_gui_wimp_event_register_scroll_window(wimp_w w, void(*callback)(wimp_scroll *scroll))
Register a function to be called for all window scroll requests.
bool ro_gui_wimp_event_register_open_window(wimp_w w, void(*callback)(wimp_open *open))
Register a function to be called for all window opening requests.
bool ro_gui_wimp_event_register_menu_warning(wimp_w w, void(*callback)(wimp_w w, wimp_i i, wimp_menu *m, wimp_selection *s, menu_action a))
Register a function to be called when a sub-menu warning is received.
bool ro_gui_wimp_event_register_menu(wimp_w w, wimp_menu *m, bool menu_auto, bool position_ibar)
Register a window menu to be (semi-)automatically handled.
Automated RISC OS WIMP event handling (interface).
A collection of grubby utilities for working with OSLib's wimp API.
#define PTR_WIMP_OPEN(pstate)
static nserror bitmap(const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags)
Plot a bitmap.
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.