From 4d9b67499727f1cce58c2bd65a06178f91fc30b4 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 22 Feb 2013 19:02:58 +0000 Subject: Remove struct selection from ami_file_save and anywhere that feeds into it --- amiga/clipboard.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'amiga/clipboard.c') diff --git a/amiga/clipboard.c b/amiga/clipboard.c index 91dd6c790..2fe016b10 100644 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -315,15 +315,18 @@ struct ami_text_selection *ami_selection_to_text(struct gui_window_2 *gwin) return sel; } -void ami_drag_selection(struct selection *s) +void ami_drag_selection(struct gui_window *g) { int x; int y; char *utf8text; - struct ami_text_selection *sel; + char *sel; struct IFFHandle *old_iffh = iffh; struct gui_window_2 *gwin = ami_window_at_pointer(AMINS_WINDOW); - + + /* NB: 'gwin' is at the drop point, 'g' is where the selection was dragged from. + * These may be different if the selection has been dragged between windows. */ + if(!gwin) { DisplayBeep(scrn); @@ -337,11 +340,9 @@ void ami_drag_selection(struct selection *s) { iffh = ami_clipboard_init_internal(1); - if(selection_copy_to_clipboard(s)) - { - browser_window_mouse_click(gwin->bw, BROWSER_MOUSE_PRESS_1, x, y); - browser_window_key_press(gwin->bw, KEY_PASTE); - } + browser_window_key_press(g->shared->bw, KEY_COPY_SELECTION); + browser_window_mouse_click(gwin->bw, BROWSER_MOUSE_PRESS_1, x, y); + browser_window_key_press(gwin->bw, KEY_PASTE); ami_clipboard_free_internal(iffh); iffh = old_iffh; @@ -353,23 +354,23 @@ void ami_drag_selection(struct selection *s) if(ami_gadget_hit(gwin->objects[GID_URL], x, y)) { - if(sel = ami_selection_to_text(gwin)) + if(sel = browser_window_get_selection(g->shared->bw)) { - utf8text = ami_utf8_easy(sel->text); + utf8text = ami_utf8_easy(sel); RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_URL], gwin->win, NULL, STRINGA_TextVal, utf8text, TAG_DONE); - FreeVec(sel); + free(sel); ami_utf8_free(utf8text); } } else if(ami_gadget_hit(gwin->objects[GID_SEARCHSTRING], x, y)) { - if(sel = ami_selection_to_text(gwin)) + if(sel = browser_window_get_selection(g->shared->bw)) { - utf8text = ami_utf8_easy(sel->text); + utf8text = ami_utf8_easy(sel); RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_SEARCHSTRING], gwin->win, NULL, STRINGA_TextVal, utf8text, TAG_DONE); - FreeVec(sel); + free(sel); ami_utf8_free(utf8text); } } -- cgit v1.2.3