Gitweb links:

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

The branch, chris/amiga-corewindow has been updated
       via  a4bedbbaebec62294bcf6e7210c4c2b0b64f936c (commit)
      from  917a602dce32286260a34d61b7c0db4bee502ec0 (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=a4bedbbaebec62294bcf6e7210c4c2b0b64f936c
commit a4bedbbaebec62294bcf6e7210c4c2b0b64f936c
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Broken corewindow drag implementation

diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 1bfc537..03ad509 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -59,6 +59,7 @@
 #include <reaction/reaction_macros.h>
 
 #include "amiga/corewindow.h"
+#include "amiga/drag.h"
 #include "amiga/memory.h"
 #include "amiga/misc.h"
 #include "amiga/object.h"
@@ -451,6 +452,71 @@ HOOKF(void, ami_cw_idcmp_hook, Object *, object, struct 
IntuiMessage *)
        }
 } 
 
+/**
+ * Drag start
+ */
+static void
+ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
+{
+       ami_cw->dragging = true;
+       ami_cw->drag_x_start = x;
+       ami_cw->drag_y_start = y;
+
+       switch(ami_cw->drag_status) {
+               case CORE_WINDOW_DRAG_SELECTION:
+               break;
+
+               case CORE_WINDOW_DRAG_MOVE:
+                       ami_drag_icon_show(ami_cw->win, "project");
+               break;
+
+               default:
+               break;
+       }
+}
+
+/**
+ * Drag progress
+ */
+static void
+ami_cw_drag_progress(struct ami_corewindow *ami_cw, int x, int y)
+{
+       switch(ami_cw->drag_status) {
+               case CORE_WINDOW_DRAG_SELECTION:
+               break;
+
+               case CORE_WINDOW_DRAG_MOVE:
+                       ami_drag_icon_move();
+               break;
+
+               default:
+               break;
+       }
+}
+
+/**
+ * Drag end
+ */
+static void
+ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+       ami_cw->dragging = false;
+       
+       switch(ami_cw->drag_status) {
+               case CORE_WINDOW_DRAG_SELECTION:
+               break;
+
+               case CORE_WINDOW_DRAG_MOVE:
+                       ami_drag_icon_close(ami_cw->win);
+                       if((ami_cw != ami_window_at_pointer(AMINS_COREWINDOW)) 
&& (ami_cw->drag_end != NULL)) {
+                               ami_cw->drag_end(ami_cw, scrn->MouseX, 
scrn->MouseY);
+                       }
+               break;
+
+               default:
+               break;
+       }
+}
 
 /**
  * Main event loop for our core window
@@ -479,9 +545,31 @@ ami_cw_event(void *w)
 
                switch(result & WMHI_CLASSMASK) {
                        case WMHI_MOUSEMOVE:
-                               if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
+                               if(ami_cw->dragging == false) {
+                                       if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
+                                               if(ami_cw->mouse_state & 
BROWSER_MOUSE_PRESS_1) {
+                                                       /* Start button 1 drag 
*/
+                                                       ami_cw->mouse(ami_cw, 
BROWSER_MOUSE_DRAG_1, x, y);
+                                                       /* Replace PRESS with 
HOLDING and declare drag in progress */
+                                                       ami_cw->mouse_state = 
BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
+                                               } else if(ami_cw->mouse_state & 
BROWSER_MOUSE_PRESS_2) {
+                                                       /* Start button 2 drag 
*/
+                                                       ami_cw->mouse(ami_cw, 
BROWSER_MOUSE_DRAG_2, x, y);
+                                                       /* Replace PRESS with 
HOLDING and declare drag in progress */
+                                                       ami_cw->mouse_state = 
BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
+                                               }
+                                               key_state = 
ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+                                               ami_cw->mouse(ami_cw, 
ami_cw->mouse_state | key_state, x, y);
+                                               
+                                               if ((ami_cw->drag_status == 
CORE_WINDOW_DRAG_SELECTION) ||
+                                                       (ami_cw->drag_status == 
CORE_WINDOW_DRAG_MOVE)) {
+                                                       
ami_cw_drag_start(ami_cw, x, y);
+                                               }
+                                       }
+                               } else {
                                        key_state = 
ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
                                        ami_cw->mouse(ami_cw, 
ami_cw->mouse_state | key_state, x, y);
+                                       ami_cw_drag_progress(ami_cw, x, y);
                                }
                        break;
 
@@ -539,6 +627,10 @@ ami_cw_event(void *w)
                                        break;
                                }
                                ami_cw->mouse(ami_cw, ami_cw->mouse_state | 
key_state, x, y);
+                               
+                               if((ami_cw->dragging == true) && 
(ami_cw->mouse_state & BROWSER_MOUSE_HOVER)) {
+                                       ami_cw_drag_end(ami_cw, x, y);
+                               }
                        break;
 
                        case WMHI_RAWKEY:
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index 17af249..cfcd7fc 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -58,6 +58,10 @@ struct ami_corewindow {
                int mouse_y_click;
                int mouse_state;
 
+               bool dragging;
+               int drag_x_start;
+               int drag_y_start;
+
                bool close_window; // set to true to close the window during 
event loop
 
                APTR deferred_rects_pool;
@@ -129,6 +133,31 @@ struct ami_corewindow {
                BOOL (*event)(struct ami_corewindow *ami_cw, ULONG result);
 
                /**
+                * callback for drag end on Amiga core window
+                * ie. a drag *from* this window to a different window
+                *
+                * \param ami_cw The Amiga core window structure.
+                * \param x mouse x position **in screen co-ordinates**
+                * \param y mouse y position **in screen co-ordinates**
+                * \return NSERROR_OK on success otherwise apropriate error code
+                */
+               nserror (*drag_end)(struct ami_corewindow *ami_cw, int x, int 
y);
+
+               /**
+                * callback for icon drop on Amiga core window
+                * ie. a drag has ended *above* this window
+                * \todo this may not be very flexible but serves our current 
purposes
+                *
+                * \param ami_cw The Amiga core window structure.
+                * \param url url of dropped icon
+                * \param title title of dropped icon
+                * \param x mouse x position **in screen co-ordinates**
+                * \param y mouse y position **in screen co-ordinates**
+                * \return NSERROR_OK on success otherwise apropriate error code
+                */
+               nserror (*icon_drop)(struct ami_corewindow *ami_cw, struct 
nsurl *url, const char *title, int x, int y);
+
+               /**
                 * callback to close an Amiga core window
                 *
                 * \param ami_cw The Amiga core window structure.
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index 0fea420..2210301 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -37,6 +37,7 @@
 #include <reaction/reaction_macros.h>
 
 #include "desktop/global_history.h"
+#include "netsurf/browser_window.h"
 #include "netsurf/keypress.h"
 #include "netsurf/plotters.h"
 #include "utils/log.h"
@@ -44,6 +45,7 @@
 #include "utils/nsoption.h"
 
 #include "amiga/corewindow.h"
+#include "amiga/drag.h"
 #include "amiga/file.h"
 #include "amiga/history.h"
 #include "amiga/libs.h"
@@ -172,6 +174,49 @@ ami_history_global_draw(struct ami_corewindow *ami_cw, int 
x, int y, struct rect
 }
 
 /**
+ * callback on drag end for history viewer
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+       struct nsurl *url = NULL;
+       const char *title = NULL;
+       bool ok = false;
+       struct gui_window_2 *gwin;
+       struct ami_corewindow *cw;
+
+       if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
+               return NSERROR_OK;
+
+       if(global_history_has_selection()) {
+               ok = global_history_get_selection(&url, &title);
+       }
+       
+       if((ok == false) || (url == NULL)) {
+               DisplayBeep(scrn);
+       } else if(url) {
+               if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
+                       browser_window_navigate(gwin->gw->bw,
+                                       url,
+                                       NULL,
+                                       BW_NAVIGATE_HISTORY,
+                                       NULL,
+                                       NULL,
+                                       NULL);
+               } else if((cw = (struct ami_corewindow 
*)ami_window_at_pointer(AMINS_COREWINDOW)) &&
+                       (ami_cw->icon_drop != NULL)) {
+                       cw->icon_drop(cw, url, title, x, y);
+               }
+       }
+       return NSERROR_OK;
+}
+
+/**
  * menu stuff
  */
 
@@ -396,6 +441,8 @@ nserror ami_history_global_present(void)
        ncwin->core.mouse = ami_history_global_mouse;
        ncwin->core.close = ami_history_global_destroy;
        ncwin->core.event = NULL;
+       ncwin->core.drag_end = ami_history_global_drag_end;
+       ncwin->core.icon_drop = NULL;
 
        res = ami_corewindow_init(&ncwin->core);
        if (res != NSERROR_OK) {
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index de8b6ac..422586a 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -37,6 +37,7 @@
 #include <reaction/reaction_macros.h>
 
 #include "desktop/hotlist.h"
+#include "netsurf/browser_window.h"
 #include "netsurf/keypress.h"
 #include "netsurf/plotters.h"
 #include "utils/log.h"
@@ -44,6 +45,7 @@
 #include "utils/nsoption.h"
 
 #include "amiga/corewindow.h"
+#include "amiga/drag.h"
 #include "amiga/file.h"
 #include "amiga/hotlist.h"
 #include "amiga/libs.h"
@@ -222,6 +224,68 @@ ami_hotlist_draw(struct ami_corewindow *ami_cw, int x, int 
y, struct rect *r, st
        return NSERROR_OK;
 }
 
+/**
+ * callback for drag end on Amiga core window
+ * ie. a drag *from* this window has ended
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+       nsurl *url = NULL;
+       const char *title = NULL;
+       bool ok = false;
+       struct gui_window_2 *gwin;
+       struct ami_corewindow *cw;
+
+       if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
+               return NSERROR_OK;
+
+       if(hotlist_has_selection()) {
+               ok = hotlist_get_selection(&url, &title);
+       }
+       
+       if((ok == false) || (url == NULL)) {
+               DisplayBeep(scrn);
+       } else if(url) {
+               if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
+                       browser_window_navigate(gwin->gw->bw,
+                                       url,
+                                       NULL,
+                                       BW_NAVIGATE_HISTORY,
+                                       NULL,
+                                       NULL,
+                                       NULL);
+               } else if((cw = (struct ami_corewindow 
*)ami_window_at_pointer(AMINS_COREWINDOW)) &&
+                       (ami_cw->icon_drop != NULL)) {
+                       cw->icon_drop(cw, url, title, x, y);
+               }
+       }
+       return NSERROR_OK;
+}
+               
+/**
+ * callback for icon drop on Amiga core window
+ * ie. a drag has ended *above* this window
+ * \todo this may not be very flexible but serves our current purposes
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param url url of dropped icon
+ * \param title title of dropped icon
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_icon_drop(struct ami_corewindow *ami_cw, struct nsurl *url, const 
char *title, int x, int y)
+{
+       hotlist_add_entry(url, title, true, y);
+       return NSERROR_OK;
+}
 
 /**
  * menu stuff
@@ -487,7 +551,7 @@ nserror ami_hotlist_present(void)
                return NSERROR_NOMEM;
        }
 
-       ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Cookies"));
+       ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Hotlist"));
 
        res = ami_hotlist_create_window(ncwin);
        if (res != NSERROR_OK) {
@@ -503,6 +567,8 @@ nserror ami_hotlist_present(void)
        ncwin->core.mouse = ami_hotlist_mouse;
        ncwin->core.close = ami_hotlist_destroy;
        ncwin->core.event = NULL;
+       ncwin->core.drag_end = ami_hotlist_drag_end;
+       ncwin->core.icon_drop = ami_hotlist_icon_drop;
 
        res = ami_corewindow_init(&ncwin->core);
        if (res != NSERROR_OK) {


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

Summary of changes:
 frontends/amiga/corewindow.c |   94 +++++++++++++++++++++++++++++++++++++++++-
 frontends/amiga/corewindow.h |   29 +++++++++++++
 frontends/amiga/history.c    |   47 +++++++++++++++++++++
 frontends/amiga/hotlist.c    |   68 +++++++++++++++++++++++++++++-
 4 files changed, 236 insertions(+), 2 deletions(-)

diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 1bfc537..03ad509 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -59,6 +59,7 @@
 #include <reaction/reaction_macros.h>
 
 #include "amiga/corewindow.h"
+#include "amiga/drag.h"
 #include "amiga/memory.h"
 #include "amiga/misc.h"
 #include "amiga/object.h"
@@ -451,6 +452,71 @@ HOOKF(void, ami_cw_idcmp_hook, Object *, object, struct 
IntuiMessage *)
        }
 } 
 
+/**
+ * Drag start
+ */
+static void
+ami_cw_drag_start(struct ami_corewindow *ami_cw, int x, int y)
+{
+       ami_cw->dragging = true;
+       ami_cw->drag_x_start = x;
+       ami_cw->drag_y_start = y;
+
+       switch(ami_cw->drag_status) {
+               case CORE_WINDOW_DRAG_SELECTION:
+               break;
+
+               case CORE_WINDOW_DRAG_MOVE:
+                       ami_drag_icon_show(ami_cw->win, "project");
+               break;
+
+               default:
+               break;
+       }
+}
+
+/**
+ * Drag progress
+ */
+static void
+ami_cw_drag_progress(struct ami_corewindow *ami_cw, int x, int y)
+{
+       switch(ami_cw->drag_status) {
+               case CORE_WINDOW_DRAG_SELECTION:
+               break;
+
+               case CORE_WINDOW_DRAG_MOVE:
+                       ami_drag_icon_move();
+               break;
+
+               default:
+               break;
+       }
+}
+
+/**
+ * Drag end
+ */
+static void
+ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+       ami_cw->dragging = false;
+       
+       switch(ami_cw->drag_status) {
+               case CORE_WINDOW_DRAG_SELECTION:
+               break;
+
+               case CORE_WINDOW_DRAG_MOVE:
+                       ami_drag_icon_close(ami_cw->win);
+                       if((ami_cw != ami_window_at_pointer(AMINS_COREWINDOW)) 
&& (ami_cw->drag_end != NULL)) {
+                               ami_cw->drag_end(ami_cw, scrn->MouseX, 
scrn->MouseY);
+                       }
+               break;
+
+               default:
+               break;
+       }
+}
 
 /**
  * Main event loop for our core window
@@ -479,9 +545,31 @@ ami_cw_event(void *w)
 
                switch(result & WMHI_CLASSMASK) {
                        case WMHI_MOUSEMOVE:
-                               if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
+                               if(ami_cw->dragging == false) {
+                                       if(ami_cw_mouse_pos(ami_cw, &x, &y)) {
+                                               if(ami_cw->mouse_state & 
BROWSER_MOUSE_PRESS_1) {
+                                                       /* Start button 1 drag 
*/
+                                                       ami_cw->mouse(ami_cw, 
BROWSER_MOUSE_DRAG_1, x, y);
+                                                       /* Replace PRESS with 
HOLDING and declare drag in progress */
+                                                       ami_cw->mouse_state = 
BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON;
+                                               } else if(ami_cw->mouse_state & 
BROWSER_MOUSE_PRESS_2) {
+                                                       /* Start button 2 drag 
*/
+                                                       ami_cw->mouse(ami_cw, 
BROWSER_MOUSE_DRAG_2, x, y);
+                                                       /* Replace PRESS with 
HOLDING and declare drag in progress */
+                                                       ami_cw->mouse_state = 
BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_ON;
+                                               }
+                                               key_state = 
ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
+                                               ami_cw->mouse(ami_cw, 
ami_cw->mouse_state | key_state, x, y);
+                                               
+                                               if ((ami_cw->drag_status == 
CORE_WINDOW_DRAG_SELECTION) ||
+                                                       (ami_cw->drag_status == 
CORE_WINDOW_DRAG_MOVE)) {
+                                                       
ami_cw_drag_start(ami_cw, x, y);
+                                               }
+                                       }
+                               } else {
                                        key_state = 
ami_gui_get_quals(ami_cw->objects[GID_CW_WIN]);
                                        ami_cw->mouse(ami_cw, 
ami_cw->mouse_state | key_state, x, y);
+                                       ami_cw_drag_progress(ami_cw, x, y);
                                }
                        break;
 
@@ -539,6 +627,10 @@ ami_cw_event(void *w)
                                        break;
                                }
                                ami_cw->mouse(ami_cw, ami_cw->mouse_state | 
key_state, x, y);
+                               
+                               if((ami_cw->dragging == true) && 
(ami_cw->mouse_state & BROWSER_MOUSE_HOVER)) {
+                                       ami_cw_drag_end(ami_cw, x, y);
+                               }
                        break;
 
                        case WMHI_RAWKEY:
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index 17af249..cfcd7fc 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -58,6 +58,10 @@ struct ami_corewindow {
                int mouse_y_click;
                int mouse_state;
 
+               bool dragging;
+               int drag_x_start;
+               int drag_y_start;
+
                bool close_window; // set to true to close the window during 
event loop
 
                APTR deferred_rects_pool;
@@ -129,6 +133,31 @@ struct ami_corewindow {
                BOOL (*event)(struct ami_corewindow *ami_cw, ULONG result);
 
                /**
+                * callback for drag end on Amiga core window
+                * ie. a drag *from* this window to a different window
+                *
+                * \param ami_cw The Amiga core window structure.
+                * \param x mouse x position **in screen co-ordinates**
+                * \param y mouse y position **in screen co-ordinates**
+                * \return NSERROR_OK on success otherwise apropriate error code
+                */
+               nserror (*drag_end)(struct ami_corewindow *ami_cw, int x, int 
y);
+
+               /**
+                * callback for icon drop on Amiga core window
+                * ie. a drag has ended *above* this window
+                * \todo this may not be very flexible but serves our current 
purposes
+                *
+                * \param ami_cw The Amiga core window structure.
+                * \param url url of dropped icon
+                * \param title title of dropped icon
+                * \param x mouse x position **in screen co-ordinates**
+                * \param y mouse y position **in screen co-ordinates**
+                * \return NSERROR_OK on success otherwise apropriate error code
+                */
+               nserror (*icon_drop)(struct ami_corewindow *ami_cw, struct 
nsurl *url, const char *title, int x, int y);
+
+               /**
                 * callback to close an Amiga core window
                 *
                 * \param ami_cw The Amiga core window structure.
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index 0fea420..2210301 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -37,6 +37,7 @@
 #include <reaction/reaction_macros.h>
 
 #include "desktop/global_history.h"
+#include "netsurf/browser_window.h"
 #include "netsurf/keypress.h"
 #include "netsurf/plotters.h"
 #include "utils/log.h"
@@ -44,6 +45,7 @@
 #include "utils/nsoption.h"
 
 #include "amiga/corewindow.h"
+#include "amiga/drag.h"
 #include "amiga/file.h"
 #include "amiga/history.h"
 #include "amiga/libs.h"
@@ -172,6 +174,49 @@ ami_history_global_draw(struct ami_corewindow *ami_cw, int 
x, int y, struct rect
 }
 
 /**
+ * callback on drag end for history viewer
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_global_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+       struct nsurl *url = NULL;
+       const char *title = NULL;
+       bool ok = false;
+       struct gui_window_2 *gwin;
+       struct ami_corewindow *cw;
+
+       if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
+               return NSERROR_OK;
+
+       if(global_history_has_selection()) {
+               ok = global_history_get_selection(&url, &title);
+       }
+       
+       if((ok == false) || (url == NULL)) {
+               DisplayBeep(scrn);
+       } else if(url) {
+               if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
+                       browser_window_navigate(gwin->gw->bw,
+                                       url,
+                                       NULL,
+                                       BW_NAVIGATE_HISTORY,
+                                       NULL,
+                                       NULL,
+                                       NULL);
+               } else if((cw = (struct ami_corewindow 
*)ami_window_at_pointer(AMINS_COREWINDOW)) &&
+                       (ami_cw->icon_drop != NULL)) {
+                       cw->icon_drop(cw, url, title, x, y);
+               }
+       }
+       return NSERROR_OK;
+}
+
+/**
  * menu stuff
  */
 
@@ -396,6 +441,8 @@ nserror ami_history_global_present(void)
        ncwin->core.mouse = ami_history_global_mouse;
        ncwin->core.close = ami_history_global_destroy;
        ncwin->core.event = NULL;
+       ncwin->core.drag_end = ami_history_global_drag_end;
+       ncwin->core.icon_drop = NULL;
 
        res = ami_corewindow_init(&ncwin->core);
        if (res != NSERROR_OK) {
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index de8b6ac..422586a 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -37,6 +37,7 @@
 #include <reaction/reaction_macros.h>
 
 #include "desktop/hotlist.h"
+#include "netsurf/browser_window.h"
 #include "netsurf/keypress.h"
 #include "netsurf/plotters.h"
 #include "utils/log.h"
@@ -44,6 +45,7 @@
 #include "utils/nsoption.h"
 
 #include "amiga/corewindow.h"
+#include "amiga/drag.h"
 #include "amiga/file.h"
 #include "amiga/hotlist.h"
 #include "amiga/libs.h"
@@ -222,6 +224,68 @@ ami_hotlist_draw(struct ami_corewindow *ami_cw, int x, int 
y, struct rect *r, st
        return NSERROR_OK;
 }
 
+/**
+ * callback for drag end on Amiga core window
+ * ie. a drag *from* this window has ended
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, int y)
+{
+       nsurl *url = NULL;
+       const char *title = NULL;
+       bool ok = false;
+       struct gui_window_2 *gwin;
+       struct ami_corewindow *cw;
+
+       if(ami_cw == ami_window_at_pointer(AMINS_COREWINDOW))
+               return NSERROR_OK;
+
+       if(hotlist_has_selection()) {
+               ok = hotlist_get_selection(&url, &title);
+       }
+       
+       if((ok == false) || (url == NULL)) {
+               DisplayBeep(scrn);
+       } else if(url) {
+               if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
+                       browser_window_navigate(gwin->gw->bw,
+                                       url,
+                                       NULL,
+                                       BW_NAVIGATE_HISTORY,
+                                       NULL,
+                                       NULL,
+                                       NULL);
+               } else if((cw = (struct ami_corewindow 
*)ami_window_at_pointer(AMINS_COREWINDOW)) &&
+                       (ami_cw->icon_drop != NULL)) {
+                       cw->icon_drop(cw, url, title, x, y);
+               }
+       }
+       return NSERROR_OK;
+}
+               
+/**
+ * callback for icon drop on Amiga core window
+ * ie. a drag has ended *above* this window
+ * \todo this may not be very flexible but serves our current purposes
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param url url of dropped icon
+ * \param title title of dropped icon
+ * \param x mouse x co-ordinate
+ * \param y mouse y co-ordinate
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_hotlist_icon_drop(struct ami_corewindow *ami_cw, struct nsurl *url, const 
char *title, int x, int y)
+{
+       hotlist_add_entry(url, title, true, y);
+       return NSERROR_OK;
+}
 
 /**
  * menu stuff
@@ -487,7 +551,7 @@ nserror ami_hotlist_present(void)
                return NSERROR_NOMEM;
        }
 
-       ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Cookies"));
+       ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Hotlist"));
 
        res = ami_hotlist_create_window(ncwin);
        if (res != NSERROR_OK) {
@@ -503,6 +567,8 @@ nserror ami_hotlist_present(void)
        ncwin->core.mouse = ami_hotlist_mouse;
        ncwin->core.close = ami_hotlist_destroy;
        ncwin->core.event = NULL;
+       ncwin->core.drag_end = ami_hotlist_drag_end;
+       ncwin->core.icon_drop = ami_hotlist_icon_drop;
 
        res = ami_corewindow_init(&ncwin->core);
        if (res != NSERROR_OK) {


-- 
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