summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-12-31 00:43:06 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2016-12-31 00:43:06 +0000
commit9df30eb78fc024448c39182a5d9fb0053c6ef137 (patch)
treee7c573b98770c6631370279393aa3c4a5dbd1de0
parentd8eec1b048fe7c7cac4a0bd3bb4f31203524ee79 (diff)
downloadnetsurf-9df30eb78fc024448c39182a5d9fb0053c6ef137.tar.gz
netsurf-9df30eb78fc024448c39182a5d9fb0053c6ef137.tar.bz2
Update local history window to use event callback
-rw-r--r--frontends/amiga/gui.c2
-rwxr-xr-xfrontends/amiga/history_local.c24
-rwxr-xr-xfrontends/amiga/history_local.h12
3 files changed, 22 insertions, 16 deletions
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 82db164bf..a453e0810 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1941,7 +1941,7 @@ static void ami_handle_msg(void)
continue;
}
} else if(node->Type == AMINS_HISTORYWINDOW) {
- if(ami_history_event((struct history_window *)w)) {
+ if(w->tbl->event(w)) {
ami_try_quit();
break;
} else {
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 5009ce888..3d1c6f39b 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -57,9 +57,25 @@
#include "amiga/gui.h"
#include "amiga/history_local.h"
+struct history_window {
+ struct ami_generic_window w;
+ struct Window *win;
+ Object *objects[GID_LAST];
+ struct gui_window *gw;
+ struct Hook scrollerhook;
+ struct gui_globals *gg;
+};
+
static void ami_history_update_extent(struct history_window *hw);
HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *);
+static BOOL ami_history_event(void *w);
+
+static const struct ami_win_event_table ami_localhistory_table = {
+ ami_history_event,
+ NULL, /* we don't explicitly close the local history window on quit */
+};
+
/**
* Redraw history window.
*/
@@ -159,8 +175,7 @@ void ami_history_open(struct gui_window *gw)
EndWindow;
gw->hw->win = (struct Window *)RA_OpenWindow(gw->hw->objects[OID_MAIN]);
- gw->hw->node = AddObject(window_list,AMINS_HISTORYWINDOW);
- gw->hw->node->objstruct = gw->hw;
+ ami_gui_win_list_add(gw->hw, AMINS_HISTORYWINDOW, &ami_localhistory_table);
GetAttr(WINDOW_HorizObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_HSCROLL]);
GetAttr(WINDOW_VertObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_VSCROLL]);
@@ -229,12 +244,13 @@ void ami_history_close(struct history_window *hw)
free(hw->gg);
hw->gw->hw = NULL;
DisposeObject(hw->objects[OID_MAIN]);
- DelObject(hw->node);
+ ami_gui_win_list_remove(hw);
}
-BOOL ami_history_event(struct history_window *hw)
+static BOOL ami_history_event(void *w)
{
/* return TRUE if window destroyed */
+ struct history_window *hw = (struct history_window *)w;
ULONG result = 0;
uint16 code;
const char *url;
diff --git a/frontends/amiga/history_local.h b/frontends/amiga/history_local.h
index 284da3422..97aea0579 100755
--- a/frontends/amiga/history_local.h
+++ b/frontends/amiga/history_local.h
@@ -24,15 +24,7 @@
struct gui_window;
struct gui_globals;
-
-struct history_window {
- struct nsObject *node;
- struct Window *win;
- Object *objects[GID_LAST];
- struct gui_window *gw;
- struct Hook scrollerhook;
- struct gui_globals *gg;
-};
+struct history_window;
/**
* Open history window.
@@ -42,7 +34,5 @@ struct history_window {
void ami_history_open(struct gui_window *gw);
void ami_history_close(struct history_window *hw);
-BOOL ami_history_event(struct history_window *hw);
-
#endif