diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2010-10-24 18:07:11 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2010-10-24 18:07:11 +0000 |
commit | 00434615ed1a25b7d722e942406d0ddc8c08cdf3 (patch) | |
tree | c9af428403440e9dc8e59ca0d84e3dd273209b52 /amiga | |
parent | bdf3c32f44880fd36c2fe66966863626b95e5d2d (diff) | |
download | netsurf-00434615ed1a25b7d722e942406d0ddc8c08cdf3.tar.gz netsurf-00434615ed1a25b7d722e942406d0ddc8c08cdf3.tar.bz2 |
Selection drags now use clipboard unit 1 instead of 0. This stops the user's
clipboard being unexpectedly changed.
svn path=/trunk/netsurf/; revision=10905
Diffstat (limited to 'amiga')
-rwxr-xr-x | amiga/clipboard.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/amiga/clipboard.c b/amiga/clipboard.c index 81ff68687..436a65961 100755 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -43,21 +43,35 @@ struct IFFHandle *iffh = NULL; bool ami_add_to_clipboard(const char *text, size_t length, bool space); -void ami_clipboard_init(void) +struct IFFHandle *ami_clipboard_init_internal(int unit) { - if(iffh = AllocIFF()) + struct IFFHandle *iffhandle = NULL; + + if(iffhandle = AllocIFF()) { - if(iffh->iff_Stream = (ULONG)OpenClipboard(0)) + if(iffhandle->iff_Stream = (ULONG)OpenClipboard(unit)) { - InitIFFasClip(iffh); + InitIFFasClip(iffhandle); } } + + return iffhandle; +} + +void ami_clipboard_init(void) +{ + iffh = ami_clipboard_init_internal(0); +} + +void ami_clipboard_free_internal(struct IFFHandle *iffhandle) +{ + if(iffhandle->iff_Stream) CloseClipboard((struct ClipboardHandle *)iffhandle->iff_Stream); + if(iffhandle) FreeIFF(iffhandle); } void ami_clipboard_free(void) { - if(iffh->iff_Stream) CloseClipboard((struct ClipboardHandle *)iffh->iff_Stream); - if(iffh) FreeIFF(iffh); + ami_clipboard_free_internal(iffh); } void gui_start_selection(struct gui_window *g) @@ -263,6 +277,7 @@ void ami_drag_selection(struct selection *s) struct box *text_box; ULONG x; ULONG y; + struct IFFHandle *old_iffh = iffh; struct gui_window_2 *gwin = ami_window_at_pointer(); if(!gwin) @@ -276,11 +291,16 @@ void ami_drag_selection(struct selection *s) if(text_box = ami_text_box_at_point(gwin, &x, &y)) { + iffh = ami_clipboard_init_internal(1); + if(gui_copy_to_clipboard(s)) { 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; } else { |