summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2017-01-08 13:59:51 (GMT)
committer Chris Young <chris@unsatisfactorysoftware.co.uk>2017-01-08 13:59:51 (GMT)
commitc19ea4deaa61f8418db2c92f1843456be0389b7e (patch)
treefe13be080aec7fd3a6062ac5e830f0727414ea3b
parent05e4463230d8ae9880ac3aef38ca12f09d30d960 (diff)
downloadnetsurf-c19ea4deaa61f8418db2c92f1843456be0389b7e.tar.gz
netsurf-c19ea4deaa61f8418db2c92f1843456be0389b7e.tar.bz2
Support SimpleRefresh corewindows
These queue redraws unlike the main browser window, which seems to work a bit better than redrawing immediately.
-rw-r--r--frontends/amiga/cookies.c13
-rw-r--r--frontends/amiga/corewindow.c81
-rw-r--r--frontends/amiga/gui.c2
-rw-r--r--frontends/amiga/history.c13
-rw-r--r--frontends/amiga/hotlist.c13
-rw-r--r--frontends/amiga/sslcert.c14
6 files changed, 108 insertions, 28 deletions
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index f428881..74c89cb 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -288,6 +288,11 @@ static nserror
ami_cookies_create_window(struct ami_cookie_window *cookie_win)
{
struct ami_corewindow *ami_cw = (struct ami_corewindow *)&cookie_win->core;
+ ULONG refresh_mode = WA_SmartRefresh;
+
+ if(nsoption_bool(window_simple_refresh) == true) {
+ refresh_mode = WA_SimpleRefresh;
+ }
ami_cw->objects[GID_CW_WIN] = WindowObj,
WA_ScreenTitle, ami_gui_get_screen_title(),
@@ -304,11 +309,13 @@ ami_cookies_create_window(struct ami_cookie_window *cookie_win)
WA_Height, nsoption_int(cookies_window_ysize),
WA_PubScreen, scrn,
WA_ReportMouse, TRUE,
- WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+ refresh_mode, TRUE,
+ WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
- IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY,
+ IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
- WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
+ IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
WINDOW_SharedPort, sport,
WINDOW_HorizProp, 1,
WINDOW_VertProp, 1,
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 2417d7b..d2bfbf9 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -66,8 +66,6 @@
#include "amiga/schedule.h"
#include "amiga/utf8.h"
-static void ami_cw_get_window_dimensions(struct core_window *cw, int *width, int *height);
-
static void
ami_cw_scroller_top(struct ami_corewindow *ami_cw, ULONG *restrict x, ULONG *restrict y)
{
@@ -86,6 +84,22 @@ ami_cw_scroller_top(struct ami_corewindow *ami_cw, ULONG *restrict x, ULONG *res
*y = ys;
}
+static void
+ami_cw_window_size(struct ami_corewindow *ami_cw, int *width, int *height)
+{
+ struct IBox *bbox;
+
+ if(ami_gui_get_space_box((Object *)ami_cw->objects[GID_CW_DRAW], &bbox) != NSERROR_OK) {
+ amiga_warn_user("NoMemory", "");
+ return;
+ }
+
+ *width = bbox->Width;
+ *height = bbox->Height;
+
+ ami_gui_free_space_box(bbox);
+}
+
/**
* Convert co-ordinates relative to space.gadget
@@ -366,6 +380,41 @@ ami_cw_redraw(struct ami_corewindow *ami_cw, const struct rect *restrict r)
ami_schedule(1, ami_cw_redraw_cb, ami_cw);
}
+static void ami_cw_simplerefresh(struct ami_corewindow *ami_cw)
+{
+ struct rect r;
+ struct RegionRectangle *regrect;
+
+ BeginRefresh(ami_cw->win);
+
+ r.x0 = ami_cw->win->RPort->Layer->DamageList->bounds.MinX;
+ r.x1 = ami_cw->win->RPort->Layer->DamageList->bounds.MaxX;
+ r.y0 = ami_cw->win->RPort->Layer->DamageList->bounds.MinY;
+ r.y1 = ami_cw->win->RPort->Layer->DamageList->bounds.MaxY;
+
+ ami_cw_coord_amiga_to_ns(ami_cw, &r.x0, &r.y0);
+ ami_cw_coord_amiga_to_ns(ami_cw, &r.y0, &r.y1);
+
+ regrect = ami_cw->win->RPort->Layer->DamageList->RegionRectangle;
+
+ ami_cw_redraw(ami_cw, &r); /* queue redraw */
+
+ while(regrect) {
+ r.x0 = regrect->bounds.MinX;
+ r.x1 = regrect->bounds.MaxX;
+ r.y0 = regrect->bounds.MinY;
+ r.y1 = regrect->bounds.MaxY;
+ ami_cw_coord_amiga_to_ns(ami_cw, &r.x0, &r.y0);
+ ami_cw_coord_amiga_to_ns(ami_cw, &r.y0, &r.y1);
+
+ regrect = regrect->Next;
+
+ ami_cw_redraw(ami_cw, &r); /* queue redraw */
+ }
+
+ EndRefresh(ami_cw->win, TRUE);
+}
+
static void
ami_cw_toggle_scrollbar(struct ami_corewindow *ami_cw, bool vert, bool visible)
{
@@ -464,6 +513,17 @@ HOOKF(void, ami_cw_idcmp_hook, Object *, object, struct IntuiMessage *)
}
break;
#endif
+
+ case IDCMP_SIZEVERIFY:
+ break;
+
+ case IDCMP_REFRESHWINDOW:
+ ami_cw_simplerefresh(ami_cw);
+ break;
+
+ default:
+ LOG("IDCMP hook unhandled event: %ld", msg->Class);
+ break;
}
}
@@ -548,7 +608,7 @@ static void
ami_cw_newsize(struct ami_corewindow *ami_cw)
{
int win_w, win_h;
- ami_cw_get_window_dimensions(ami_cw, &win_w, &win_h);
+ ami_cw_window_size(ami_cw, &win_w, &win_h);
if(ami_cw->objects[GID_CW_HSCROLL] != NULL) {
RefreshSetGadgetAttrs((struct Gadget *)ami_cw->objects[GID_CW_HSCROLL], ami_cw->win, NULL,
@@ -750,17 +810,8 @@ static void
ami_cw_get_window_dimensions(struct core_window *cw, int *width, int *height)
{
struct ami_corewindow *ami_cw = (struct ami_corewindow *)cw;
- struct IBox *bbox;
- if(ami_gui_get_space_box((Object *)ami_cw->objects[GID_CW_DRAW], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- *width = bbox->Width;
- *height = bbox->Height;
-
- ami_gui_free_space_box(bbox);
+ ami_cw_window_size(ami_cw, width, height);
}
@@ -770,7 +821,7 @@ ami_cw_update_size(struct core_window *cw, int width, int height)
struct ami_corewindow *ami_cw = (struct ami_corewindow *)cw;
int win_w, win_h;
- ami_cw_get_window_dimensions((struct core_window *)ami_cw, &win_w, &win_h);
+ ami_cw_window_size(ami_cw, &win_w, &win_h);
if(width == -1) {
ami_cw_toggle_scrollbar(ami_cw, false, false);
@@ -805,7 +856,7 @@ ami_cw_scroll_visible(struct core_window *cw, const struct rect *r)
ULONG win_x0, win_y0;
int win_x1, win_y1;
- ami_cw_get_window_dimensions((struct core_window *)ami_cw, &win_w, &win_h);
+ ami_cw_window_size(ami_cw, &win_w, &win_h);
ami_cw_scroller_top(ami_cw, &win_x0, &win_y0);
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index e27d105..823bbcf 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -3784,7 +3784,7 @@ HOOKF(void, ami_scroller_hook, Object *, object, struct IntuiMessage *)
break;
default:
- LOG("IDCMP hook unhandled event: %ld\n", msg->Class);
+ LOG("IDCMP hook unhandled event: %ld", msg->Class);
break;
}
// ReplyMsg((struct Message *)msg);
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index f326f91..b2a3cc0 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -360,6 +360,11 @@ static nserror
ami_history_global_create_window(struct ami_history_global_window *history_win)
{
struct ami_corewindow *ami_cw = (struct ami_corewindow *)&history_win->core;
+ ULONG refresh_mode = WA_SmartRefresh;
+
+ if(nsoption_bool(window_simple_refresh) == true) {
+ refresh_mode = WA_SimpleRefresh;
+ }
ami_cw->objects[GID_CW_WIN] = WindowObj,
WA_ScreenTitle, ami_gui_get_screen_title(),
@@ -376,11 +381,13 @@ ami_history_global_create_window(struct ami_history_global_window *history_win)
WA_Height, nsoption_int(history_window_ysize),
WA_PubScreen, scrn,
WA_ReportMouse, TRUE,
- WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+ refresh_mode, TRUE,
+ WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
- IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY,
+ IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
- WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
+ IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
WINDOW_SharedPort, sport,
WINDOW_HorizProp, 1,
WINDOW_VertProp, 1,
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index a0fd303..8aa181b 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -464,6 +464,11 @@ static nserror
ami_hotlist_create_window(struct ami_hotlist_window *hotlist_win)
{
struct ami_corewindow *ami_cw = (struct ami_corewindow *)&hotlist_win->core;
+ ULONG refresh_mode = WA_SmartRefresh;
+
+ if(nsoption_bool(window_simple_refresh) == true) {
+ refresh_mode = WA_SimpleRefresh;
+ }
ami_cw->objects[GID_CW_WIN] = WindowObj,
WA_ScreenTitle, ami_gui_get_screen_title(),
@@ -480,11 +485,13 @@ ami_hotlist_create_window(struct ami_hotlist_window *hotlist_win)
WA_Height, nsoption_int(hotlist_window_ysize),
WA_PubScreen, scrn,
WA_ReportMouse, TRUE,
- WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+ refresh_mode, TRUE,
+ WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
- IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY,
+ IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
- WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
+ IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
WINDOW_SharedPort, sport,
WINDOW_HorizProp, 1,
WINDOW_VertProp, 1,
diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c
index 2cb3d8e..5929f7e 100644
--- a/frontends/amiga/sslcert.c
+++ b/frontends/amiga/sslcert.c
@@ -41,6 +41,7 @@
#include "netsurf/plotters.h"
#include "desktop/sslcert_viewer.h"
#include "utils/messages.h"
+#include "utils/nsoption.h"
#include "amiga/corewindow.h"
#include "amiga/libs.h"
@@ -214,6 +215,11 @@ static nserror
ami_crtvrfy_create_window(struct ami_crtvrfy_window *crtvrfy_win)
{
struct ami_corewindow *ami_cw = (struct ami_corewindow *)&crtvrfy_win->core;
+ ULONG refresh_mode = WA_SmartRefresh;
+
+ if(nsoption_bool(window_simple_refresh) == true) {
+ refresh_mode = WA_SimpleRefresh;
+ }
ami_cw->objects[GID_CW_WIN] = WindowObj,
WA_ScreenTitle, ami_gui_get_screen_title(),
@@ -227,11 +233,13 @@ ami_crtvrfy_create_window(struct ami_crtvrfy_window *crtvrfy_win)
WA_Height, scrn->Height / 2,
WA_PubScreen, scrn,
WA_ReportMouse, TRUE,
- WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+ refresh_mode, TRUE,
+ WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
- IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY,
+ IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
- WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
+ IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
WINDOW_SharedPort, sport,
WINDOW_UserData, crtvrfy_win,
/* WINDOW_NewMenu, twin->menu, -> No menu for SSL Cert */