summaryrefslogtreecommitdiff
path: root/frontends/amiga/gui.h
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-12-30 00:59:12 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2016-12-30 00:59:12 +0000
commit9379a64c6dfab6046ba56b8cdb299c4da3d6c3f2 (patch)
tree01cd86f80d086bb4e45c5f062a8a6e1e66777565 /frontends/amiga/gui.h
parent7ca75a4cee083ded7f3607bba5e841c430556d93 (diff)
downloadnetsurf-9379a64c6dfab6046ba56b8cdb299c4da3d6c3f2.tar.gz
netsurf-9379a64c6dfab6046ba56b8cdb299c4da3d6c3f2.tar.bz2
Start tidying up Amiga event-handling code
As we used a shared message port, we call different event-handling functions for different window types. This changes that so we register the event-handler as a callback so we can handle event processing for all windows generically. Currently the main browser window and find window use the new approach, so the handling still has a long list of window types. This should also make window_list private to gui.c
Diffstat (limited to 'frontends/amiga/gui.h')
-rw-r--r--frontends/amiga/gui.h37
1 files changed, 33 insertions, 4 deletions
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index db3fef208..da60c6749 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2015 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2008-2016 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -91,8 +91,27 @@ struct history_window;
#define AMI_GUI_TOOLBAR_MAX 20
-struct gui_window_2 {
+struct ami_win_event_table {
+ /* callback to handle events when using a shared msgport
+ *
+ * @param pointer to our window structure (must start with ami_generic_window)
+ * @return TRUE if window was destroyed during event processing
+ */
+ BOOL (*event)(void *w);
+
+ /* callback for explicit window closure
+ * some windows are implicitly closed by the browser and should set this to NULL
+ */
+ void (*close)(void *w);
+};
+
+struct ami_generic_window {
struct nsObject *node;
+ struct ami_win_event_table *tbl;
+};
+
+struct gui_window_2 {
+ struct ami_generic_window w;
struct Window *win;
Object *restrict objects[GID_LAST];
struct gui_window *gw; /* currently-displayed gui_window */
@@ -203,9 +222,9 @@ void ami_gui_set_scale(struct gui_window *gw, float scale);
/**
* Close a window and all tabs attached to it.
*
- * @param gwin gui_window_2 to act upon.
+ * @param w gui_window_2 to act upon.
*/
-void ami_gui_close_window(struct gui_window_2 *gwin);
+void ami_gui_close_window(void *w);
/**
* Close all tabs in a window except the active one.
@@ -253,5 +272,15 @@ void ami_gui_set_default_gg(void);
* Switch to the most-recently-opened tab
*/
void ami_gui_switch_to_new_tab(struct gui_window_2 *gwin);
+
+/**
+ * Add a window to the NetSurf window list (to enable event processing)
+ */
+nserror ami_gui_win_list_add(void *win, int type, struct ami_win_event_table *table);
+
+/**
+ * Remove a window from the NetSurf window list
+ */
+void ami_gui_win_list_remove(void *win);
#endif