winex11: Convert the clipboard format list to a standard Wine list.
This commit is contained in:
parent
bfa753ba55
commit
7aa4acb80a
|
@ -111,14 +111,13 @@ typedef HANDLE (*DRVEXPORTFUNC)(Display *display, Window requestor, Atom aTarget
|
||||||
typedef HANDLE (*DRVIMPORTFUNC)(Display *d, Window w, Atom prop);
|
typedef HANDLE (*DRVIMPORTFUNC)(Display *d, Window w, Atom prop);
|
||||||
|
|
||||||
typedef struct tagWINE_CLIPFORMAT {
|
typedef struct tagWINE_CLIPFORMAT {
|
||||||
|
struct list entry;
|
||||||
UINT wFormatID;
|
UINT wFormatID;
|
||||||
LPCWSTR Name;
|
LPCWSTR Name;
|
||||||
UINT drvData;
|
UINT drvData;
|
||||||
UINT wFlags;
|
UINT wFlags;
|
||||||
DRVIMPORTFUNC lpDrvImportFunc;
|
DRVIMPORTFUNC lpDrvImportFunc;
|
||||||
DRVEXPORTFUNC lpDrvExportFunc;
|
DRVEXPORTFUNC lpDrvExportFunc;
|
||||||
struct tagWINE_CLIPFORMAT *PrevFormat;
|
|
||||||
struct tagWINE_CLIPFORMAT *NextFormat;
|
|
||||||
} WINE_CLIPFORMAT, *LPWINE_CLIPFORMAT;
|
} WINE_CLIPFORMAT, *LPWINE_CLIPFORMAT;
|
||||||
|
|
||||||
typedef struct tagWINE_CLIPDATA {
|
typedef struct tagWINE_CLIPDATA {
|
||||||
|
@ -209,82 +208,44 @@ static const WCHAR wszCF_DSPBITMAP[] = {'W','C','F','_','D','S','P','B','I','T',
|
||||||
static const WCHAR wszCF_DSPMETAFILEPICT[] = {'W','C','F','_','D','S','P','M','E','T','A','F','I','L','E','P','I','C','T',0};
|
static const WCHAR wszCF_DSPMETAFILEPICT[] = {'W','C','F','_','D','S','P','M','E','T','A','F','I','L','E','P','I','C','T',0};
|
||||||
static const WCHAR wszCF_DSPENHMETAFILE[] = {'W','C','F','_','D','S','P','E','N','H','M','E','T','A','F','I','L','E',0};
|
static const WCHAR wszCF_DSPENHMETAFILE[] = {'W','C','F','_','D','S','P','E','N','H','M','E','T','A','F','I','L','E',0};
|
||||||
|
|
||||||
static WINE_CLIPFORMAT ClipFormats[] =
|
static const struct
|
||||||
{
|
{
|
||||||
{ CF_TEXT, wszCF_TEXT, XA_STRING, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportXAString,
|
UINT id;
|
||||||
X11DRV_CLIPBOARD_ExportString, NULL, &ClipFormats[1]},
|
LPCWSTR name;
|
||||||
|
UINT data;
|
||||||
{ CF_BITMAP, wszCF_BITMAP, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
DRVIMPORTFUNC import;
|
||||||
NULL, &ClipFormats[0], &ClipFormats[2]},
|
DRVEXPORTFUNC export;
|
||||||
|
} builtin_formats[] =
|
||||||
{ CF_METAFILEPICT, wszCF_METAFILEPICT, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportMetaFilePict,
|
{
|
||||||
X11DRV_CLIPBOARD_ExportMetaFilePict, &ClipFormats[1], &ClipFormats[3]},
|
{ CF_TEXT, wszCF_TEXT, XA_STRING, X11DRV_CLIPBOARD_ImportXAString, X11DRV_CLIPBOARD_ExportString},
|
||||||
|
{ CF_BITMAP, wszCF_BITMAP, 0, X11DRV_CLIPBOARD_ImportClipboardData, NULL},
|
||||||
{ CF_SYLK, wszCF_SYLK, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
{ CF_METAFILEPICT, wszCF_METAFILEPICT, 0, X11DRV_CLIPBOARD_ImportMetaFilePict, X11DRV_CLIPBOARD_ExportMetaFilePict },
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[2], &ClipFormats[4]},
|
{ CF_SYLK, wszCF_SYLK, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
|
{ CF_DIF, wszCF_DIF, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
{ CF_DIF, wszCF_DIF, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
{ CF_TIFF, wszCF_TIFF, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[3], &ClipFormats[5]},
|
{ CF_OEMTEXT, wszCF_OEMTEXT, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
|
{ CF_DIB, wszCF_DIB, XA_PIXMAP, X11DRV_CLIPBOARD_ImportXAPIXMAP, X11DRV_CLIPBOARD_ExportXAPIXMAP },
|
||||||
{ CF_TIFF, wszCF_TIFF, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
{ CF_PALETTE, wszCF_PALETTE, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[4], &ClipFormats[6]},
|
{ CF_PENDATA, wszCF_PENDATA, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
|
{ CF_RIFF, wszCF_RIFF, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
{ CF_OEMTEXT, wszCF_OEMTEXT, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
{ CF_WAVE, wszCF_WAVE, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[5], &ClipFormats[7]},
|
{ CF_UNICODETEXT, wszUTF8STRING, 0, X11DRV_CLIPBOARD_ImportUTF8, X11DRV_CLIPBOARD_ExportString },
|
||||||
|
/* If UTF8_STRING is not available, attempt COMPOUND_TEXT */
|
||||||
{ CF_DIB, wszCF_DIB, XA_PIXMAP, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportXAPIXMAP,
|
{ CF_UNICODETEXT, wszCOMPOUNDTEXT, 0, X11DRV_CLIPBOARD_ImportCompoundText, X11DRV_CLIPBOARD_ExportString },
|
||||||
X11DRV_CLIPBOARD_ExportXAPIXMAP, &ClipFormats[6], &ClipFormats[8]},
|
{ CF_ENHMETAFILE, wszCF_ENHMETAFILE, 0, X11DRV_CLIPBOARD_ImportEnhMetaFile, X11DRV_CLIPBOARD_ExportEnhMetaFile },
|
||||||
|
{ CF_HDROP, wszCF_HDROP, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
{ CF_PALETTE, wszCF_PALETTE, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
{ CF_LOCALE, wszCF_LOCALE, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[7], &ClipFormats[9]},
|
{ CF_DIBV5, wszCF_DIBV5, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
|
{ CF_OWNERDISPLAY, wszCF_OWNERDISPLAY, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
{ CF_PENDATA, wszCF_PENDATA, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
{ CF_DSPTEXT, wszCF_DSPTEXT, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[8], &ClipFormats[10]},
|
{ CF_DSPBITMAP, wszCF_DSPBITMAP, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
|
{ CF_DSPMETAFILEPICT, wszCF_DSPMETAFILEPICT, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
{ CF_RIFF, wszCF_RIFF, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
{ CF_DSPENHMETAFILE, wszCF_DSPENHMETAFILE, 0, X11DRV_CLIPBOARD_ImportClipboardData, X11DRV_CLIPBOARD_ExportClipboardData },
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[9], &ClipFormats[11]},
|
{ CF_DIB, wszIMAGEBMP, 0, X11DRV_CLIPBOARD_ImportImageBmp, X11DRV_CLIPBOARD_ExportImageBmp },
|
||||||
|
|
||||||
{ CF_WAVE, wszCF_WAVE, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[10], &ClipFormats[12]},
|
|
||||||
|
|
||||||
{ CF_UNICODETEXT, wszUTF8STRING, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportUTF8,
|
|
||||||
X11DRV_CLIPBOARD_ExportString, &ClipFormats[11], &ClipFormats[13]},
|
|
||||||
|
|
||||||
/* If UTF8_STRING is not available, attempt COMPUND_TEXT */
|
|
||||||
{ CF_UNICODETEXT, wszCOMPOUNDTEXT, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportCompoundText,
|
|
||||||
X11DRV_CLIPBOARD_ExportString, &ClipFormats[12], &ClipFormats[14]},
|
|
||||||
|
|
||||||
{ CF_ENHMETAFILE, wszCF_ENHMETAFILE, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportEnhMetaFile,
|
|
||||||
X11DRV_CLIPBOARD_ExportEnhMetaFile, &ClipFormats[13], &ClipFormats[15]},
|
|
||||||
|
|
||||||
{ CF_HDROP, wszCF_HDROP, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[14], &ClipFormats[16]},
|
|
||||||
|
|
||||||
{ CF_LOCALE, wszCF_LOCALE, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[15], &ClipFormats[17]},
|
|
||||||
|
|
||||||
{ CF_DIBV5, wszCF_DIBV5, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[16], &ClipFormats[18]},
|
|
||||||
|
|
||||||
{ CF_OWNERDISPLAY, wszCF_OWNERDISPLAY, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[17], &ClipFormats[19]},
|
|
||||||
|
|
||||||
{ CF_DSPTEXT, wszCF_DSPTEXT, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[18], &ClipFormats[20]},
|
|
||||||
|
|
||||||
{ CF_DSPBITMAP, wszCF_DSPBITMAP, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[19], &ClipFormats[21]},
|
|
||||||
|
|
||||||
{ CF_DSPMETAFILEPICT, wszCF_DSPMETAFILEPICT, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[20], &ClipFormats[22]},
|
|
||||||
|
|
||||||
{ CF_DSPENHMETAFILE, wszCF_DSPENHMETAFILE, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportClipboardData,
|
|
||||||
X11DRV_CLIPBOARD_ExportClipboardData, &ClipFormats[21], &ClipFormats[23]},
|
|
||||||
|
|
||||||
{ CF_DIB, wszIMAGEBMP, 0, CF_FLAG_BUILTINFMT, X11DRV_CLIPBOARD_ImportImageBmp,
|
|
||||||
X11DRV_CLIPBOARD_ExportImageBmp, &ClipFormats[22], NULL},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct list format_list = LIST_INIT( format_list );
|
||||||
|
|
||||||
#define GET_ATOM(prop) (((prop) < FIRST_XATOM) ? (Atom)(prop) : X11DRV_Atoms[(prop) - FIRST_XATOM])
|
#define GET_ATOM(prop) (((prop) < FIRST_XATOM) ? (Atom)(prop) : X11DRV_Atoms[(prop) - FIRST_XATOM])
|
||||||
|
|
||||||
/* Maps X properties to Windows formats */
|
/* Maps X properties to Windows formats */
|
||||||
|
@ -357,6 +318,19 @@ void X11DRV_InitClipboard(void)
|
||||||
UINT i;
|
UINT i;
|
||||||
WINE_CLIPFORMAT *format;
|
WINE_CLIPFORMAT *format;
|
||||||
|
|
||||||
|
/* Register built-in formats */
|
||||||
|
for (i = 0; i < sizeof(builtin_formats)/sizeof(builtin_formats[0]); i++)
|
||||||
|
{
|
||||||
|
if (!(format = HeapAlloc( GetProcessHeap(), 0, sizeof(*format )))) break;
|
||||||
|
format->wFormatID = builtin_formats[i].id;
|
||||||
|
format->Name = builtin_formats[i].name;
|
||||||
|
format->drvData = builtin_formats[i].data;
|
||||||
|
format->wFlags = CF_FLAG_BUILTINFMT;
|
||||||
|
format->lpDrvImportFunc = builtin_formats[i].import;
|
||||||
|
format->lpDrvExportFunc = builtin_formats[i].export;
|
||||||
|
list_add_tail( &format_list, &format->entry );
|
||||||
|
}
|
||||||
|
|
||||||
/* Register known mapping between window formats and X properties */
|
/* Register known mapping between window formats and X properties */
|
||||||
for (i = 0; i < sizeof(PropertyFormatMap)/sizeof(PropertyFormatMap[0]); i++)
|
for (i = 0; i < sizeof(PropertyFormatMap)/sizeof(PropertyFormatMap[0]); i++)
|
||||||
X11DRV_CLIPBOARD_InsertClipboardFormat(PropertyFormatMap[i].lpszFormat, GET_ATOM(PropertyFormatMap[i].prop));
|
X11DRV_CLIPBOARD_InsertClipboardFormat(PropertyFormatMap[i].lpszFormat, GET_ATOM(PropertyFormatMap[i].prop));
|
||||||
|
@ -380,7 +354,8 @@ static void intern_atoms(void)
|
||||||
Atom *atoms;
|
Atom *atoms;
|
||||||
Display *display;
|
Display *display;
|
||||||
|
|
||||||
for (format = ClipFormats, count = 0; format; format = format->NextFormat)
|
count = 0;
|
||||||
|
LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry )
|
||||||
if (!format->drvData) count++;
|
if (!format->drvData) count++;
|
||||||
if (!count) return;
|
if (!count) return;
|
||||||
|
|
||||||
|
@ -389,24 +364,24 @@ static void intern_atoms(void)
|
||||||
names = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*names) );
|
names = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*names) );
|
||||||
atoms = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*atoms) );
|
atoms = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*atoms) );
|
||||||
|
|
||||||
for (format = ClipFormats, i = 0; format; format = format->NextFormat) {
|
i = 0;
|
||||||
|
LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry )
|
||||||
if (!format->drvData) {
|
if (!format->drvData) {
|
||||||
len = WideCharToMultiByte(CP_UNIXCP, 0, format->Name, -1, NULL, 0, NULL, NULL);
|
len = WideCharToMultiByte(CP_UNIXCP, 0, format->Name, -1, NULL, 0, NULL, NULL);
|
||||||
names[i] = HeapAlloc(GetProcessHeap(), 0, len);
|
names[i] = HeapAlloc(GetProcessHeap(), 0, len);
|
||||||
WideCharToMultiByte(CP_UNIXCP, 0, format->Name, -1, names[i++], len, NULL, NULL);
|
WideCharToMultiByte(CP_UNIXCP, 0, format->Name, -1, names[i++], len, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
XInternAtoms( display, names, count, False, atoms );
|
XInternAtoms( display, names, count, False, atoms );
|
||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
|
|
||||||
for (format = ClipFormats, i = 0; format; format = format->NextFormat) {
|
i = 0;
|
||||||
|
LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry )
|
||||||
if (!format->drvData) {
|
if (!format->drvData) {
|
||||||
HeapFree(GetProcessHeap(), 0, names[i]);
|
HeapFree(GetProcessHeap(), 0, names[i]);
|
||||||
format->drvData = atoms[i++];
|
format->drvData = atoms[i++];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
HeapFree( GetProcessHeap(), 0, names );
|
HeapFree( GetProcessHeap(), 0, names );
|
||||||
HeapFree( GetProcessHeap(), 0, atoms );
|
HeapFree( GetProcessHeap(), 0, atoms );
|
||||||
|
@ -420,17 +395,16 @@ static void intern_atoms(void)
|
||||||
*/
|
*/
|
||||||
static WINE_CLIPFORMAT *register_format( LPCWSTR FormatName, Atom prop )
|
static WINE_CLIPFORMAT *register_format( LPCWSTR FormatName, Atom prop )
|
||||||
{
|
{
|
||||||
LPWINE_CLIPFORMAT lpFormat = ClipFormats;
|
LPWINE_CLIPFORMAT lpFormat;
|
||||||
|
|
||||||
TRACE("%s\n", debugstr_w(FormatName));
|
TRACE("%s\n", debugstr_w(FormatName));
|
||||||
|
|
||||||
/* walk format chain to see if it's already registered */
|
/* walk format chain to see if it's already registered */
|
||||||
while (lpFormat)
|
LIST_FOR_EACH_ENTRY( lpFormat, &format_list, WINE_CLIPFORMAT, entry )
|
||||||
{
|
{
|
||||||
if (CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, lpFormat->Name, -1, FormatName, -1) == CSTR_EQUAL
|
if (CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, lpFormat->Name, -1, FormatName, -1) == CSTR_EQUAL
|
||||||
&& (lpFormat->wFlags & CF_FLAG_BUILTINFMT) == 0)
|
&& (lpFormat->wFlags & CF_FLAG_BUILTINFMT) == 0)
|
||||||
return lpFormat;
|
return lpFormat;
|
||||||
lpFormat = lpFormat->NextFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return X11DRV_CLIPBOARD_InsertClipboardFormat(FormatName, prop);
|
return X11DRV_CLIPBOARD_InsertClipboardFormat(FormatName, prop);
|
||||||
|
@ -442,17 +416,15 @@ static WINE_CLIPFORMAT *register_format( LPCWSTR FormatName, Atom prop )
|
||||||
*/
|
*/
|
||||||
static LPWINE_CLIPFORMAT X11DRV_CLIPBOARD_LookupFormat(WORD wID)
|
static LPWINE_CLIPFORMAT X11DRV_CLIPBOARD_LookupFormat(WORD wID)
|
||||||
{
|
{
|
||||||
LPWINE_CLIPFORMAT lpFormat = ClipFormats;
|
WINE_CLIPFORMAT *format;
|
||||||
|
|
||||||
while(lpFormat)
|
LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry )
|
||||||
{
|
{
|
||||||
if (lpFormat->wFormatID == wID)
|
if (format->wFormatID != wID) continue;
|
||||||
break;
|
if (!format->drvData) intern_atoms();
|
||||||
|
return format;
|
||||||
lpFormat = lpFormat->NextFormat;
|
|
||||||
}
|
}
|
||||||
if (lpFormat && !lpFormat->drvData) intern_atoms();
|
return NULL;
|
||||||
return lpFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -463,17 +435,14 @@ static LPWINE_CLIPFORMAT X11DRV_CLIPBOARD_LookupProperty(LPWINE_CLIPFORMAT curre
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
LPWINE_CLIPFORMAT lpFormat = ClipFormats;
|
struct list *ptr = current ? ¤t->entry : &format_list;
|
||||||
BOOL need_intern = FALSE;
|
BOOL need_intern = FALSE;
|
||||||
|
|
||||||
if (current)
|
while ((ptr = list_next( &format_list, ptr )))
|
||||||
lpFormat = current->NextFormat;
|
|
||||||
|
|
||||||
while(lpFormat)
|
|
||||||
{
|
{
|
||||||
|
LPWINE_CLIPFORMAT lpFormat = LIST_ENTRY( ptr, WINE_CLIPFORMAT, entry );
|
||||||
if (lpFormat->drvData == drvData) return lpFormat;
|
if (lpFormat->drvData == drvData) return lpFormat;
|
||||||
if (!lpFormat->drvData) need_intern = TRUE;
|
if (!lpFormat->drvData) need_intern = TRUE;
|
||||||
lpFormat = lpFormat->NextFormat;
|
|
||||||
}
|
}
|
||||||
if (!need_intern) return NULL;
|
if (!need_intern) return NULL;
|
||||||
intern_atoms();
|
intern_atoms();
|
||||||
|
@ -501,7 +470,6 @@ static LPWINE_CLIPDATA X11DRV_CLIPBOARD_LookupData(DWORD wID)
|
||||||
*/
|
*/
|
||||||
static WINE_CLIPFORMAT *X11DRV_CLIPBOARD_InsertClipboardFormat(LPCWSTR FormatName, Atom prop)
|
static WINE_CLIPFORMAT *X11DRV_CLIPBOARD_InsertClipboardFormat(LPCWSTR FormatName, Atom prop)
|
||||||
{
|
{
|
||||||
LPWINE_CLIPFORMAT lpFormat;
|
|
||||||
LPWINE_CLIPFORMAT lpNewFormat;
|
LPWINE_CLIPFORMAT lpNewFormat;
|
||||||
LPWSTR new_name;
|
LPWSTR new_name;
|
||||||
|
|
||||||
|
@ -528,15 +496,7 @@ static WINE_CLIPFORMAT *X11DRV_CLIPBOARD_InsertClipboardFormat(LPCWSTR FormatNam
|
||||||
lpNewFormat->lpDrvImportFunc = X11DRV_CLIPBOARD_ImportClipboardData;
|
lpNewFormat->lpDrvImportFunc = X11DRV_CLIPBOARD_ImportClipboardData;
|
||||||
lpNewFormat->lpDrvExportFunc = X11DRV_CLIPBOARD_ExportClipboardData;
|
lpNewFormat->lpDrvExportFunc = X11DRV_CLIPBOARD_ExportClipboardData;
|
||||||
|
|
||||||
/* Link Format */
|
list_add_tail( &format_list, &lpNewFormat->entry );
|
||||||
lpFormat = ClipFormats;
|
|
||||||
|
|
||||||
while(lpFormat->NextFormat) /* Move to last entry */
|
|
||||||
lpFormat = lpFormat->NextFormat;
|
|
||||||
|
|
||||||
lpNewFormat->NextFormat = NULL;
|
|
||||||
lpFormat->NextFormat = lpNewFormat;
|
|
||||||
lpNewFormat->PrevFormat = lpFormat;
|
|
||||||
|
|
||||||
TRACE("Registering format(%04x): %s drvData %d\n",
|
TRACE("Registering format(%04x): %s drvData %d\n",
|
||||||
lpNewFormat->wFormatID, debugstr_w(FormatName), lpNewFormat->drvData);
|
lpNewFormat->wFormatID, debugstr_w(FormatName), lpNewFormat->drvData);
|
||||||
|
@ -2969,7 +2929,7 @@ static Atom X11DRV_SelectionRequest_TARGETS( Display *display, Window requestor,
|
||||||
UINT i;
|
UINT i;
|
||||||
Atom* targets;
|
Atom* targets;
|
||||||
ULONG cTargets;
|
ULONG cTargets;
|
||||||
LPWINE_CLIPFORMAT lpFormats;
|
LPWINE_CLIPFORMAT format;
|
||||||
LPWINE_CLIPDATA lpData;
|
LPWINE_CLIPDATA lpData;
|
||||||
|
|
||||||
/* Create X atoms for any clipboard types which don't have atoms yet.
|
/* Create X atoms for any clipboard types which don't have atoms yet.
|
||||||
|
@ -2987,19 +2947,11 @@ static Atom X11DRV_SelectionRequest_TARGETS( Display *display, Window requestor,
|
||||||
if (!list_head( &data_list )) return None;
|
if (!list_head( &data_list )) return None;
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY( lpData, &data_list, WINE_CLIPDATA, entry )
|
LIST_FOR_EACH_ENTRY( lpData, &data_list, WINE_CLIPDATA, entry )
|
||||||
{
|
LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry )
|
||||||
lpFormats = ClipFormats;
|
if ((format->wFormatID == lpData->wFormatID) &&
|
||||||
|
format->lpDrvExportFunc && format->drvData)
|
||||||
while (lpFormats)
|
|
||||||
{
|
|
||||||
if ((lpFormats->wFormatID == lpData->wFormatID) &&
|
|
||||||
lpFormats->lpDrvExportFunc && lpFormats->drvData)
|
|
||||||
cTargets++;
|
cTargets++;
|
||||||
|
|
||||||
lpFormats = lpFormats->NextFormat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE(" found %d formats\n", cTargets);
|
TRACE(" found %d formats\n", cTargets);
|
||||||
|
|
||||||
/* Allocate temp buffer */
|
/* Allocate temp buffer */
|
||||||
|
@ -3011,18 +2963,10 @@ static Atom X11DRV_SelectionRequest_TARGETS( Display *display, Window requestor,
|
||||||
targets[i++] = x11drv_atom(TARGETS);
|
targets[i++] = x11drv_atom(TARGETS);
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY( lpData, &data_list, WINE_CLIPDATA, entry )
|
LIST_FOR_EACH_ENTRY( lpData, &data_list, WINE_CLIPDATA, entry )
|
||||||
{
|
LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry )
|
||||||
lpFormats = ClipFormats;
|
if ((format->wFormatID == lpData->wFormatID) &&
|
||||||
|
format->lpDrvExportFunc && format->drvData)
|
||||||
while (lpFormats)
|
targets[i++] = format->drvData;
|
||||||
{
|
|
||||||
if ((lpFormats->wFormatID == lpData->wFormatID) &&
|
|
||||||
lpFormats->lpDrvExportFunc && lpFormats->drvData)
|
|
||||||
targets[i++] = lpFormats->drvData;
|
|
||||||
|
|
||||||
lpFormats = lpFormats->NextFormat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue