Ensure selection drags to NetSurf text boxes are always UTF-8

svn path=/trunk/netsurf/; revision=12263
This commit is contained in:
Chris Young 2011-04-30 11:21:14 +00:00
parent 9f9436bf40
commit 003f3537c6

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008-2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
* Copyright 2008-2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@ -42,6 +42,7 @@
#include <datatypes/pictureclass.h>
struct IFFHandle *iffh = NULL;
bool ami_utf8_clipboard = false; // force UTF-8 in clipboard
bool ami_add_to_clipboard(const char *text, size_t length, bool space);
static bool ami_copy_selection(const char *text, size_t length,
@ -166,7 +167,7 @@ bool gui_empty_clipboard(void)
{
if(!(PushChunk(iffh,ID_FTXT,ID_FORM,IFFSIZE_UNKNOWN)))
{
if(option_utf8_clipboard)
if(option_utf8_clipboard || ami_utf8_clipboard)
{
if(!(PushChunk(iffh,0,ID_CSET,24)))
{
@ -215,7 +216,7 @@ bool ami_add_to_clipboard(const char *text, size_t length, bool space)
{
char *buffer;
if(option_utf8_clipboard)
if(option_utf8_clipboard || ami_utf8_clipboard)
{
WriteChunkBytes(iffh,text,length);
}
@ -346,6 +347,8 @@ void ami_drag_selection(struct selection *s)
if(text_box = ami_text_box_at_point(gwin, &x, &y))
{
ami_utf8_clipboard = true;
iffh = ami_clipboard_init_internal(1);
if(gui_copy_to_clipboard(s))
@ -356,6 +359,7 @@ void ami_drag_selection(struct selection *s)
ami_clipboard_free_internal(iffh);
iffh = old_iffh;
ami_utf8_clipboard = false;
}
else
{