Commit c2f73b97 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

winex11.drv: Import text/plain XDND selections through the clipboard.

parent d33989f6
...@@ -186,6 +186,7 @@ static const struct ...@@ -186,6 +186,7 @@ static const struct
} builtin_formats[] = } builtin_formats[] =
{ {
{ CF_TEXT, XA_STRING, X11DRV_CLIPBOARD_ImportXAString, X11DRV_CLIPBOARD_ExportString}, { CF_TEXT, XA_STRING, X11DRV_CLIPBOARD_ImportXAString, X11DRV_CLIPBOARD_ExportString},
{ CF_TEXT, XATOM_text_plain, X11DRV_CLIPBOARD_ImportXAString, X11DRV_CLIPBOARD_ExportString},
{ CF_BITMAP, XATOM_WCF_BITMAP, X11DRV_CLIPBOARD_ImportClipboardData, NULL}, { CF_BITMAP, XATOM_WCF_BITMAP, X11DRV_CLIPBOARD_ImportClipboardData, NULL},
{ CF_METAFILEPICT, XATOM_WCF_METAFILEPICT, X11DRV_CLIPBOARD_ImportMetaFilePict, X11DRV_CLIPBOARD_ExportMetaFilePict }, { CF_METAFILEPICT, XATOM_WCF_METAFILEPICT, X11DRV_CLIPBOARD_ImportMetaFilePict, X11DRV_CLIPBOARD_ExportMetaFilePict },
{ CF_SYLK, XATOM_WCF_SYLK, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData }, { CF_SYLK, XATOM_WCF_SYLK, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
......
...@@ -73,13 +73,11 @@ static HWND XDNDLastDropTargetWnd; ...@@ -73,13 +73,11 @@ static HWND XDNDLastDropTargetWnd;
static void X11DRV_XDND_InsertXDNDData(int property, int format, void* data, unsigned int len); static void X11DRV_XDND_InsertXDNDData(int property, int format, void* data, unsigned int len);
static int X11DRV_XDND_DeconstructTextURIList(int property, void* data, int len); static int X11DRV_XDND_DeconstructTextURIList(int property, void* data, int len);
static int X11DRV_XDND_DeconstructTextPlain(int property, void* data, int len);
static void X11DRV_XDND_MapFormat(Display *display, Window xwin, unsigned int property, unsigned char *data, int len); static void X11DRV_XDND_MapFormat(Display *display, Window xwin, unsigned int property, unsigned char *data, int len);
static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
Atom *types, unsigned long count); Atom *types, unsigned long count);
static void X11DRV_XDND_SendDropFiles(HWND hwnd); static void X11DRV_XDND_SendDropFiles(HWND hwnd);
static void X11DRV_XDND_FreeDragDropOp(void); static void X11DRV_XDND_FreeDragDropOp(void);
static unsigned int X11DRV_XDND_UnixToDos(char** lpdest, char* lpsrc, int len);
static WCHAR* X11DRV_XDND_URIToDOS(char *encodedURI); static WCHAR* X11DRV_XDND_URIToDOS(char *encodedURI);
static CRITICAL_SECTION xdnd_cs; static CRITICAL_SECTION xdnd_cs;
...@@ -566,8 +564,6 @@ static void X11DRV_XDND_MapFormat(Display *display, Window xwin, unsigned int pr ...@@ -566,8 +564,6 @@ static void X11DRV_XDND_MapFormat(Display *display, Window xwin, unsigned int pr
if (property == x11drv_atom(text_uri_list)) if (property == x11drv_atom(text_uri_list))
X11DRV_XDND_DeconstructTextURIList(property, data, len); X11DRV_XDND_DeconstructTextURIList(property, data, len);
else if (property == x11drv_atom(text_plain))
X11DRV_XDND_DeconstructTextPlain(property, data, len);
else else
{ {
/* use the clipboard import functions for other types */ /* use the clipboard import functions for other types */
...@@ -676,25 +672,6 @@ static int X11DRV_XDND_DeconstructTextURIList(int property, void* data, int len) ...@@ -676,25 +672,6 @@ static int X11DRV_XDND_DeconstructTextURIList(int property, void* data, int len)
/************************************************************************** /**************************************************************************
* X11DRV_XDND_DeconstructTextPlain
*
* Interpret text/plain Data and add records to <dndfmt> linked list
*/
static int X11DRV_XDND_DeconstructTextPlain(int property, void* data, int len)
{
char* dostext;
/* Always supply plain text */
X11DRV_XDND_UnixToDos(&dostext, data, len);
X11DRV_XDND_InsertXDNDData(property, CF_TEXT, dostext, strlen(dostext));
TRACE("CF_TEXT (%d): %s\n", CF_TEXT, dostext);
return 1;
}
/**************************************************************************
* X11DRV_XDND_SendDropFiles * X11DRV_XDND_SendDropFiles
*/ */
static void X11DRV_XDND_SendDropFiles(HWND hwnd) static void X11DRV_XDND_SendDropFiles(HWND hwnd)
...@@ -766,40 +743,6 @@ static void X11DRV_XDND_FreeDragDropOp(void) ...@@ -766,40 +743,6 @@ static void X11DRV_XDND_FreeDragDropOp(void)
} }
/**************************************************************************
* X11DRV_XDND_UnixToDos
*/
static unsigned int X11DRV_XDND_UnixToDos(char** lpdest, char* lpsrc, int len)
{
int i;
unsigned int destlen, lines;
for (i = 0, lines = 0; i <= len; i++)
{
if (lpsrc[i] == '\n')
lines++;
}
destlen = len + lines + 1;
if (lpdest)
{
char* lpstr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, destlen);
for (i = 0, lines = 0; i <= len; i++)
{
if (lpsrc[i] == '\n')
lpstr[++lines + i] = '\r';
lpstr[lines + i] = lpsrc[i];
}
*lpdest = lpstr;
}
return lines;
}
/************************************************************************** /**************************************************************************
* X11DRV_XDND_URIToDOS * X11DRV_XDND_URIToDOS
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment