Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/47379c04442c805af95ba16b9932fbdb549a7594
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/47379c04442c805af95ba16b9932fbdb549a7594
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/47379c04442c805af95ba16b9932fbdb549a7594

The branch, master has been updated
       via  47379c04442c805af95ba16b9932fbdb549a7594 (commit)
      from  9379a64c6dfab6046ba56b8cdb299c4da3d6c3f2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=47379c04442c805af95ba16b9932fbdb549a7594
commit 47379c04442c805af95ba16b9932fbdb549a7594
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Update treeviews to use event callback

diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index ad00557..e55e1da 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1925,7 +1925,7 @@ static void ami_handle_msg(void)
                w = node->objstruct;
 
                if(node->Type == AMINS_TVWINDOW) {
-                       if(ami_tree_event((struct treeview_window *)w)) {
+                       if(w->tbl->event(w)) {
                                ami_try_quit();
                                break;
                        } else {
@@ -2957,7 +2957,7 @@ void ami_quit_netsurf(void)
 {
        struct nsObject *node;
        struct nsObject *nnode;
-       struct gui_window_2 *gwin;
+       struct ami_generic_window *w;
 
        /* Disable the multiple tabs open warning */
        nsoption_set_bool(tab_close_warn, false);
@@ -2967,18 +2967,18 @@ void ami_quit_netsurf(void)
 
                do {
                        nnode=(struct nsObject *)GetSucc((struct Node *)node);
-                       gwin = node->objstruct;
+                       w = node->objstruct;
 
                        switch(node->Type) {
                                case AMINS_TVWINDOW:
-                                       ami_tree_close((struct treeview_window 
*)gwin);
+                                       w->tbl->close(w);
                                break;
 
                                case AMINS_WINDOW:
                                        /* This also closes windows that are 
attached to the
                                         * gui_window, such as local history 
and find. */
-                                       ShowWindow(gwin->win, WINDOW_BACKMOST); 
// do we need this??
-                                       gwin->w.tbl->close(gwin);
+                                       //ShowWindow(gwin->win, 
WINDOW_BACKMOST); // do we need this??
+                                       w->tbl->close(w);
                                break;
 
                                case AMINS_GUIOPTSWINDOW:
@@ -2986,7 +2986,7 @@ void ami_quit_netsurf(void)
                                break;
 
                                case AMINS_DLWINDOW:
-                                       ami_download_window_abort((struct 
gui_download_window *)gwin);
+                                       ami_download_window_abort((struct 
gui_download_window *)w);
                                break;
                        }
                } while((node = nnode));
@@ -3828,7 +3828,7 @@ HOOKF(void, ami_scroller_hook, Object *, object, struct 
IntuiMessage *)
 } 
 
 /* exported function documented in gui.h */
-nserror ami_gui_win_list_add(void *win, int type, struct ami_win_event_table 
*table)
+nserror ami_gui_win_list_add(void *win, int type, const struct 
ami_win_event_table *table)
 {
        struct nsObject *node = AddObject(window_list, type);
        if(node == NULL) return NSERROR_NOMEM;
@@ -3846,10 +3846,14 @@ void ami_gui_win_list_remove(void *win)
 {
        struct ami_generic_window *w = (struct ami_generic_window *)win;
 
-       DelObject(w->node);
+       if(w->node->Type == AMINS_TVWINDOW) {
+               DelObjectNoFree(w->node);
+       } else {
+               DelObject(w->node);
+       }
 }
 
-static struct ami_win_event_table ami_gui_table = {
+static const struct ami_win_event_table ami_gui_table = {
        ami_gui_event,
        ami_gui_close_window,
 };
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index da60c67..b76efdc 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -107,7 +107,7 @@ struct ami_win_event_table {
 
 struct ami_generic_window {
        struct nsObject *node;
-       struct ami_win_event_table *tbl;
+       const struct ami_win_event_table *tbl;
 };
 
 struct gui_window_2 {
@@ -276,7 +276,7 @@ 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);
+nserror ami_gui_win_list_add(void *win, int type, const struct 
ami_win_event_table *table);
 
 /**
  * Remove a window from the NetSurf window list
diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c
index 7e2b9a4..99ee5b4 100755
--- a/frontends/amiga/search.c
+++ b/frontends/amiga/search.c
@@ -94,9 +94,9 @@ static struct gui_search_table search_table = {
        ami_search_set_back_state,
 };
 
-static struct ami_win_event_table ami_search_table = {
+static const struct ami_win_event_table ami_search_table = {
        ami_search_event,
-       NULL, /* we don't explicitly close the search window n the frontend */
+       NULL, /* we don't explicitly close the search window on quit */
 };
 
 struct gui_search_table *amiga_search_table = &search_table;
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index 79753a7..f1c5327 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -89,7 +89,7 @@ enum {
 
 
 struct treeview_window {
-       struct nsObject *node;
+       struct ami_generic_window w;
        struct Window *win;
        Object *objects[GID_TREE_LAST];
        int type;
@@ -121,6 +121,13 @@ struct ami_tree_redraw_req {
        struct treeview_window *twin;
 };
 
+static BOOL ami_tree_event(void *w);
+
+static const struct ami_win_event_table ami_tree_table = {
+       ami_tree_event,
+       ami_tree_close,
+};
+
 #if 0
 void ami_tree_draw(struct treeview_window *twin);
 static void ami_tree_resized(struct tree *tree, int width,
@@ -877,21 +884,21 @@ void ami_tree_open(struct treeview_window *twin,int type)
                ICA_TARGET,ICTARGET_IDCMP,
                TAG_DONE);
 
-       twin->node = AddObject(window_list,AMINS_TVWINDOW);
-       twin->node->objstruct = twin;
+       ami_gui_win_list_add(twin, AMINS_TVWINDOW, &ami_tree_table);
 
        ami_tree_update_buttons(twin);
        ami_tree_resized(twin->tree, twin->max_width, twin->max_height, twin);
        ami_tree_draw(twin);
 }
 
-void ami_tree_close(struct treeview_window *twin)
+void ami_tree_close(void *w)
 {
+       struct treeview_window *twin = (struct treeview_window *)w;
        int i;
 
        twin->win = NULL;
        DisposeObject(twin->objects[OID_MAIN]);
-       DelObjectNoFree(twin->node);
+       ami_gui_win_list_remove(twin);
        ami_plot_release_pens(twin->shared_pens);
        ami_free_layers(&twin->globals);
 
@@ -942,9 +949,10 @@ static void ami_tree_update_quals(struct treeview_window 
*twin)
        }
 }
 
-BOOL ami_tree_event(struct treeview_window *twin)
+static BOOL ami_tree_event(void *w)
 {
        /* return TRUE if window destroyed */
+       struct treeview_window *twin = (struct treeview_window *)w;
        ULONG result,storage = 0;
        uint16 code;
        struct MenuItem *item;
diff --git a/frontends/amiga/tree.h b/frontends/amiga/tree.h
index 39a71d7..aa3c052 100755
--- a/frontends/amiga/tree.h
+++ b/frontends/amiga/tree.h
@@ -40,8 +40,7 @@ void ami_tree_destroy(struct treeview_window *twin);
 struct tree *ami_tree_get_tree(struct treeview_window *twin);
 
 void ami_tree_open(struct treeview_window *twin,int type);
-void ami_tree_close(struct treeview_window *twin);
-BOOL ami_tree_event(struct treeview_window *twin);
+void ami_tree_close(void *w); /* for Arexx interface only */
 
 extern const struct treeview_table ami_tree_callbacks;
 


-----------------------------------------------------------------------

Summary of changes:
 frontends/amiga/gui.c    |   24 ++++++++++++++----------
 frontends/amiga/gui.h    |    4 ++--
 frontends/amiga/search.c |    4 ++--
 frontends/amiga/tree.c   |   20 ++++++++++++++------
 frontends/amiga/tree.h   |    3 +--
 5 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index ad00557..e55e1da 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1925,7 +1925,7 @@ static void ami_handle_msg(void)
                w = node->objstruct;
 
                if(node->Type == AMINS_TVWINDOW) {
-                       if(ami_tree_event((struct treeview_window *)w)) {
+                       if(w->tbl->event(w)) {
                                ami_try_quit();
                                break;
                        } else {
@@ -2957,7 +2957,7 @@ void ami_quit_netsurf(void)
 {
        struct nsObject *node;
        struct nsObject *nnode;
-       struct gui_window_2 *gwin;
+       struct ami_generic_window *w;
 
        /* Disable the multiple tabs open warning */
        nsoption_set_bool(tab_close_warn, false);
@@ -2967,18 +2967,18 @@ void ami_quit_netsurf(void)
 
                do {
                        nnode=(struct nsObject *)GetSucc((struct Node *)node);
-                       gwin = node->objstruct;
+                       w = node->objstruct;
 
                        switch(node->Type) {
                                case AMINS_TVWINDOW:
-                                       ami_tree_close((struct treeview_window 
*)gwin);
+                                       w->tbl->close(w);
                                break;
 
                                case AMINS_WINDOW:
                                        /* This also closes windows that are 
attached to the
                                         * gui_window, such as local history 
and find. */
-                                       ShowWindow(gwin->win, WINDOW_BACKMOST); 
// do we need this??
-                                       gwin->w.tbl->close(gwin);
+                                       //ShowWindow(gwin->win, 
WINDOW_BACKMOST); // do we need this??
+                                       w->tbl->close(w);
                                break;
 
                                case AMINS_GUIOPTSWINDOW:
@@ -2986,7 +2986,7 @@ void ami_quit_netsurf(void)
                                break;
 
                                case AMINS_DLWINDOW:
-                                       ami_download_window_abort((struct 
gui_download_window *)gwin);
+                                       ami_download_window_abort((struct 
gui_download_window *)w);
                                break;
                        }
                } while((node = nnode));
@@ -3828,7 +3828,7 @@ HOOKF(void, ami_scroller_hook, Object *, object, struct 
IntuiMessage *)
 } 
 
 /* exported function documented in gui.h */
-nserror ami_gui_win_list_add(void *win, int type, struct ami_win_event_table 
*table)
+nserror ami_gui_win_list_add(void *win, int type, const struct 
ami_win_event_table *table)
 {
        struct nsObject *node = AddObject(window_list, type);
        if(node == NULL) return NSERROR_NOMEM;
@@ -3846,10 +3846,14 @@ void ami_gui_win_list_remove(void *win)
 {
        struct ami_generic_window *w = (struct ami_generic_window *)win;
 
-       DelObject(w->node);
+       if(w->node->Type == AMINS_TVWINDOW) {
+               DelObjectNoFree(w->node);
+       } else {
+               DelObject(w->node);
+       }
 }
 
-static struct ami_win_event_table ami_gui_table = {
+static const struct ami_win_event_table ami_gui_table = {
        ami_gui_event,
        ami_gui_close_window,
 };
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index da60c67..b76efdc 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -107,7 +107,7 @@ struct ami_win_event_table {
 
 struct ami_generic_window {
        struct nsObject *node;
-       struct ami_win_event_table *tbl;
+       const struct ami_win_event_table *tbl;
 };
 
 struct gui_window_2 {
@@ -276,7 +276,7 @@ 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);
+nserror ami_gui_win_list_add(void *win, int type, const struct 
ami_win_event_table *table);
 
 /**
  * Remove a window from the NetSurf window list
diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c
index 7e2b9a4..99ee5b4 100755
--- a/frontends/amiga/search.c
+++ b/frontends/amiga/search.c
@@ -94,9 +94,9 @@ static struct gui_search_table search_table = {
        ami_search_set_back_state,
 };
 
-static struct ami_win_event_table ami_search_table = {
+static const struct ami_win_event_table ami_search_table = {
        ami_search_event,
-       NULL, /* we don't explicitly close the search window n the frontend */
+       NULL, /* we don't explicitly close the search window on quit */
 };
 
 struct gui_search_table *amiga_search_table = &search_table;
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index 79753a7..f1c5327 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -89,7 +89,7 @@ enum {
 
 
 struct treeview_window {
-       struct nsObject *node;
+       struct ami_generic_window w;
        struct Window *win;
        Object *objects[GID_TREE_LAST];
        int type;
@@ -121,6 +121,13 @@ struct ami_tree_redraw_req {
        struct treeview_window *twin;
 };
 
+static BOOL ami_tree_event(void *w);
+
+static const struct ami_win_event_table ami_tree_table = {
+       ami_tree_event,
+       ami_tree_close,
+};
+
 #if 0
 void ami_tree_draw(struct treeview_window *twin);
 static void ami_tree_resized(struct tree *tree, int width,
@@ -877,21 +884,21 @@ void ami_tree_open(struct treeview_window *twin,int type)
                ICA_TARGET,ICTARGET_IDCMP,
                TAG_DONE);
 
-       twin->node = AddObject(window_list,AMINS_TVWINDOW);
-       twin->node->objstruct = twin;
+       ami_gui_win_list_add(twin, AMINS_TVWINDOW, &ami_tree_table);
 
        ami_tree_update_buttons(twin);
        ami_tree_resized(twin->tree, twin->max_width, twin->max_height, twin);
        ami_tree_draw(twin);
 }
 
-void ami_tree_close(struct treeview_window *twin)
+void ami_tree_close(void *w)
 {
+       struct treeview_window *twin = (struct treeview_window *)w;
        int i;
 
        twin->win = NULL;
        DisposeObject(twin->objects[OID_MAIN]);
-       DelObjectNoFree(twin->node);
+       ami_gui_win_list_remove(twin);
        ami_plot_release_pens(twin->shared_pens);
        ami_free_layers(&twin->globals);
 
@@ -942,9 +949,10 @@ static void ami_tree_update_quals(struct treeview_window 
*twin)
        }
 }
 
-BOOL ami_tree_event(struct treeview_window *twin)
+static BOOL ami_tree_event(void *w)
 {
        /* return TRUE if window destroyed */
+       struct treeview_window *twin = (struct treeview_window *)w;
        ULONG result,storage = 0;
        uint16 code;
        struct MenuItem *item;
diff --git a/frontends/amiga/tree.h b/frontends/amiga/tree.h
index 39a71d7..aa3c052 100755
--- a/frontends/amiga/tree.h
+++ b/frontends/amiga/tree.h
@@ -40,8 +40,7 @@ void ami_tree_destroy(struct treeview_window *twin);
 struct tree *ami_tree_get_tree(struct treeview_window *twin);
 
 void ami_tree_open(struct treeview_window *twin,int type);
-void ami_tree_close(struct treeview_window *twin);
-BOOL ami_tree_event(struct treeview_window *twin);
+void ami_tree_close(void *w); /* for Arexx interface only */
 
 extern const struct treeview_table ami_tree_callbacks;
 


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to