Handle case when data type is not registered.

This commit is contained in:
Ulrich Czekalla 2004-07-08 20:14:23 +00:00 committed by Alexandre Julliard
parent cddb03e6b9
commit 0a8d550901
1 changed files with 22 additions and 10 deletions

View File

@ -578,13 +578,13 @@ static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event )
* EVENT_SelectionRequest_AddTARGETS * EVENT_SelectionRequest_AddTARGETS
* Utility function for EVENT_SelectionRequest_TARGETS. * Utility function for EVENT_SelectionRequest_TARGETS.
*/ */
static void EVENT_SelectionRequest_AddTARGETS(Atom* targets, unsigned long* cTargets, Atom prop) static BOOL EVENT_SelectionRequest_AddTARGETS(Atom* targets, unsigned long cTargets, Atom prop)
{ {
int i; int i;
BOOL bExists; BOOL bExists;
/* Scan through what we have so far to avoid duplicates */ /* Scan through what we have so far to avoid duplicates */
for (i = 0, bExists = FALSE; i < *cTargets; i++) for (i = 0, bExists = FALSE; i < cTargets; i++)
{ {
if (targets[i] == prop) if (targets[i] == prop)
{ {
@ -594,7 +594,9 @@ static void EVENT_SelectionRequest_AddTARGETS(Atom* targets, unsigned long* cTar
} }
if (!bExists) if (!bExists)
targets[(*cTargets)++] = prop; targets[cTargets] = prop;
return !bExists;
} }
@ -613,7 +615,7 @@ static Atom EVENT_SelectionRequest_TARGETS( Display *display, Window requestor,
/* /*
* Count the number of items we wish to expose as selection targets. * Count the number of items we wish to expose as selection targets.
* We include the TARGETS item, and propery aliases * We include the TARGETS item, and property aliases
*/ */
cTargets = X11DRV_CountClipboardFormats() + 1; cTargets = X11DRV_CountClipboardFormats() + 1;
@ -629,6 +631,7 @@ static Atom EVENT_SelectionRequest_TARGETS( Display *display, Window requestor,
if (X11DRV_CLIPBOARD_LookupPropertyAlias(lpFormat->drvData)) if (X11DRV_CLIPBOARD_LookupPropertyAlias(lpFormat->drvData))
cTargets++; cTargets++;
} }
/* else most likely unregistered format such as CF_PRIVATE or CF_GDIOBJ */
} }
TRACE_(clipboard)(" found %ld formats\n", cTargets); TRACE_(clipboard)(" found %ld formats\n", cTargets);
@ -644,13 +647,22 @@ static Atom EVENT_SelectionRequest_TARGETS( Display *display, Window requestor,
{ {
lpFormat = X11DRV_CLIPBOARD_LookupFormat(wFormat); lpFormat = X11DRV_CLIPBOARD_LookupFormat(wFormat);
if (lpFormat->lpDrvExportFunc) if (lpFormat)
EVENT_SelectionRequest_AddTARGETS(targets, &cTargets, lpFormat->drvData); {
if (lpFormat->lpDrvExportFunc)
{
if (EVENT_SelectionRequest_AddTARGETS(targets, cTargets, lpFormat->drvData))
cTargets++;
}
/* Check if any alias should be listed */ /* Check if any alias should be listed */
alias = X11DRV_CLIPBOARD_LookupPropertyAlias(lpFormat->drvData); alias = X11DRV_CLIPBOARD_LookupPropertyAlias(lpFormat->drvData);
if (alias) if (alias)
EVENT_SelectionRequest_AddTARGETS(targets, &cTargets, alias); {
if (EVENT_SelectionRequest_AddTARGETS(targets, cTargets, alias))
cTargets++;
}
}
} }
wine_tsx11_lock(); wine_tsx11_lock();