From a4bedbbaebec62294bcf6e7210c4c2b0b64f936c Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 7 Jan 2017 00:26:15 +0000 Subject: Broken corewindow drag implementation --- frontends/amiga/history.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'frontends/amiga/history.c') diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c index 0fea42042..2210301bd 100644 --- a/frontends/amiga/history.c +++ b/frontends/amiga/history.c @@ -37,6 +37,7 @@ #include #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" @@ -171,6 +173,49 @@ ami_history_global_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect return NSERROR_OK; } +/** + * 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) { -- cgit v1.2.3