Cancel a few changes to get back basic text clipboard functionality.
diff --git a/windows/clipboard.c b/windows/clipboard.c
index 59fac4b..93643f6 100644
--- a/windows/clipboard.c
+++ b/windows/clipboard.c
@@ -57,7 +57,7 @@
static WORD LastRegFormat = CF_REGFORMATBASE;
/* Clipboard cache initial data.
- * WARNING: This data ordering is dependendent on the WINE_CLIPFORMAT structure
+ * WARNING: This data ordering is dependent on the WINE_CLIPFORMAT structure
* declared in clipboard.h
*/
WINE_CLIPFORMAT ClipFormats[] = {
@@ -390,8 +390,9 @@
{
/*
* If WINE is not the selection owner, and the format is available
- * we must ask the the driver to render the data to the clipboard cache.
+ * we must ask the driver to render the data to the clipboard cache.
*/
+ TRACE("enter format=%d\n", lpFormat->wFormatID);
if ( !USER_Driver.pIsSelectionOwner()
&& USER_Driver.pIsClipboardFormatAvailable( lpFormat->wFormatID ) )
{
@@ -492,8 +493,9 @@
static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
{
LPWINE_CLIPFORMAT lpSource = ClipFormats;
- LPWINE_CLIPFORMAT lpTarget;
-
+ LPWINE_CLIPFORMAT lpTarget = NULL;
+ BOOL foundData = FALSE;
+
/* Asked for CF_TEXT but not available - always attempt to convert
from CF_UNICODETEXT or CF_OEMTEXT */
if( wFormat == CF_TEXT && !ClipFormats[CF_TEXT-1].wDataPresent )
@@ -503,7 +505,7 @@
/* Convert UNICODETEXT -> TEXT */
lpSource = &ClipFormats[CF_UNICODETEXT-1];
lpTarget = &ClipFormats[CF_TEXT-1];
-
+ foundData = TRUE;
TRACE("\tUNICODETEXT -> TEXT\n");
}
else if(ClipFormats[CF_OEMTEXT-1].wDataPresent)
@@ -511,11 +513,9 @@
/* Convert OEMTEXT -> TEXT */
lpSource = &ClipFormats[CF_OEMTEXT-1];
lpTarget = &ClipFormats[CF_TEXT-1];
-
+ foundData = TRUE;
TRACE("\tOEMTEXT -> TEXT\n");
}
- else
- lpSource = NULL; /* Conversion format is not available */
}
/* Asked for CF_OEMTEXT but not available - always attempt to convert
from CF_UNICODETEXT or CF_TEXT */
@@ -526,7 +526,7 @@
/* Convert UNICODETEXT -> OEMTEXT */
lpSource = &ClipFormats[CF_UNICODETEXT-1];
lpTarget = &ClipFormats[CF_OEMTEXT-1];
-
+ foundData = TRUE;
TRACE("\tUNICODETEXT -> OEMTEXT\n");
}
else if(ClipFormats[CF_TEXT-1].wDataPresent)
@@ -534,11 +534,9 @@
/* Convert TEXT -> OEMTEXT */
lpSource = &ClipFormats[CF_TEXT-1];
lpTarget = &ClipFormats[CF_OEMTEXT-1];
-
+ foundData = TRUE;
TRACE("\tTEXT -> OEMTEXT\n");
}
- else
- lpSource = NULL; /* Conversion format is not available */
}
/* Asked for CF_UNICODETEXT but not available - always attempt to convert
from CF_TEXT or CF_OEMTEXT */
@@ -549,7 +547,7 @@
/* Convert TEXT -> UNICODETEXT */
lpSource = &ClipFormats[CF_TEXT-1];
lpTarget = &ClipFormats[CF_UNICODETEXT-1];
-
+ foundData = TRUE;
TRACE("\tTEXT -> UNICODETEXT\n");
}
else if(ClipFormats[CF_OEMTEXT-1].wDataPresent)
@@ -557,17 +555,22 @@
/* Convert OEMTEXT -> UNICODETEXT */
lpSource = &ClipFormats[CF_OEMTEXT-1];
lpTarget = &ClipFormats[CF_UNICODETEXT-1];
-
+ foundData = TRUE;
TRACE("\tOEMTEXT -> UNICODETEXT\n");
}
- else
- lpSource = NULL; /* Conversion format is not available */
}
- /* Text format requested is available - no conversion necessary */
- else
- {
- lpSource = __lookup_format( ClipFormats, wFormat );
- lpTarget = lpSource;
+ if (!foundData)
+ {
+ if ((wFormat == CF_TEXT) || (wFormat == CF_OEMTEXT))
+ {
+ lpSource = &ClipFormats[CF_UNICODETEXT-1];
+ lpTarget = __lookup_format( ClipFormats, wFormat );
+ }
+ else
+ {
+ lpSource = __lookup_format( ClipFormats, wFormat );
+ lpTarget = lpSource;
+ }
}
/* First render the source text format */
@@ -634,6 +637,62 @@
}
/**************************************************************************
+ * CLIPBOARD_EnumClipboardFormats (internal)
+ */
+static UINT CLIPBOARD_EnumClipboardFormats( UINT wFormat )
+{
+ LPWINE_CLIPFORMAT lpFormat = ClipFormats;
+ BOOL bFormatPresent;
+
+ if (wFormat == 0) /* start from the beginning */
+ lpFormat = ClipFormats;
+ else
+ {
+ /* walk up to the specified format record */
+
+ if( !(lpFormat = __lookup_format( lpFormat, wFormat )) )
+ return 0;
+ lpFormat = lpFormat->NextFormat; /* right */
+ }
+
+ while(TRUE)
+ {
+ if (lpFormat == NULL) return 0;
+
+ if(CLIPBOARD_IsPresent(lpFormat->wFormatID))
+ break;
+
+ /* Query the driver if not yet in the cache */
+ if (!USER_Driver.pIsSelectionOwner())
+ {
+ if(lpFormat->wFormatID == CF_UNICODETEXT ||
+ lpFormat->wFormatID == CF_TEXT ||
+ lpFormat->wFormatID == CF_OEMTEXT)
+ {
+ if(USER_Driver.pIsClipboardFormatAvailable(CF_UNICODETEXT) ||
+ USER_Driver.pIsClipboardFormatAvailable(CF_TEXT) ||
+ USER_Driver.pIsClipboardFormatAvailable(CF_OEMTEXT))
+ bFormatPresent = TRUE;
+ else
+ bFormatPresent = FALSE;
+ }
+ else
+ bFormatPresent = USER_Driver.pIsClipboardFormatAvailable(lpFormat->wFormatID);
+
+ if(bFormatPresent)
+ break;
+ }
+
+ lpFormat = lpFormat->NextFormat;
+ }
+
+ TRACE("Next available format %d\n", lpFormat->wFormatID);
+
+ return lpFormat->wFormatID;
+}
+
+
+/**************************************************************************
* WIN32 Clipboard implementation
**************************************************************************/
@@ -1074,7 +1133,6 @@
return FormatCount;
}
-
/**************************************************************************
* EnumClipboardFormats (USER.144)
*/
@@ -1089,9 +1147,6 @@
*/
UINT WINAPI EnumClipboardFormats( UINT wFormat )
{
- LPWINE_CLIPFORMAT lpFormat = ClipFormats;
- BOOL bFormatPresent;
-
TRACE("(%04X)\n", wFormat);
if (CLIPBOARD_IsLocked())
@@ -1100,51 +1155,7 @@
return 0;
}
- if (wFormat == 0) /* start from the beginning */
- lpFormat = ClipFormats;
- else
- {
- /* walk up to the specified format record */
-
- if( !(lpFormat = __lookup_format( lpFormat, wFormat )) )
- return 0;
- lpFormat = lpFormat->NextFormat; /* right */
- }
-
- while(TRUE)
- {
- if (lpFormat == NULL) return 0;
-
- if(CLIPBOARD_IsPresent(lpFormat->wFormatID))
- break;
-
- /* Query the driver if not yet in the cache */
- if (!USER_Driver.pIsSelectionOwner())
- {
- if(lpFormat->wFormatID == CF_UNICODETEXT ||
- lpFormat->wFormatID == CF_TEXT ||
- lpFormat->wFormatID == CF_OEMTEXT)
- {
- if(USER_Driver.pIsClipboardFormatAvailable(CF_UNICODETEXT) ||
- USER_Driver.pIsClipboardFormatAvailable(CF_TEXT) ||
- USER_Driver.pIsClipboardFormatAvailable(CF_OEMTEXT))
- bFormatPresent = TRUE;
- else
- bFormatPresent = FALSE;
- }
- else
- bFormatPresent = USER_Driver.pIsClipboardFormatAvailable(lpFormat->wFormatID);
-
- if(bFormatPresent)
- break;
- }
-
- lpFormat = lpFormat->NextFormat;
- }
-
- TRACE("Next available format %d\n", lpFormat->wFormatID);
-
- return lpFormat->wFormatID;
+ return CLIPBOARD_EnumClipboardFormats(wFormat);
}
@@ -1368,8 +1379,13 @@
if (wFormat == 0) /* Reject this case quickly */
bRet = FALSE;
else
- bRet = EnumClipboardFormats(wFormat - 1) == wFormat;
-
+ {
+ UINT iret = CLIPBOARD_EnumClipboardFormats(wFormat - 1);
+ if ((wFormat == CF_TEXT) || (wFormat == CF_OEMTEXT) || (wFormat == CF_UNICODETEXT))
+ bRet = ((iret == CF_TEXT) || (iret == CF_OEMTEXT) || (iret == CF_UNICODETEXT));
+ else
+ bRet = iret == wFormat;
+ }
TRACE("(%04X)- ret(%d)\n", wFormat, bRet);
return bRet;
}
diff --git a/windows/x11drv/clipboard.c b/windows/x11drv/clipboard.c
index 17b8b2c..2c490b9 100644
--- a/windows/x11drv/clipboard.c
+++ b/windows/x11drv/clipboard.c
@@ -192,7 +192,7 @@
/**************************************************************************
* X11DRV_CLIPBOARD_IsNativeProperty
*
- * Checks if a property is a native property type
+ * Checks if a property is a native Wine property type
*/
BOOL X11DRV_CLIPBOARD_IsNativeProperty(Atom prop)
{
@@ -332,6 +332,7 @@
Window w;
Window ownerSelection = 0;
+ TRACE("enter\n");
/*
* Empty the clipboard cache
*/
@@ -379,7 +380,7 @@
if ( (xe.xselection.target != aTargets)
|| (xe.xselection.property == None) )
{
- TRACE("\tCould not retrieve TARGETS\n");
+ TRACE("\tExit, could not retrieve TARGETS\n");
return cSelectionTargets;
}
@@ -444,7 +445,7 @@
/* Free the list of targets */
TSXFree(targetList);
}
-
+
return cSelectionTargets;
}
@@ -890,7 +891,7 @@
Window ownerPrimary = TSXGetSelectionOwner(display,XA_PRIMARY);
Window ownerClipboard = TSXGetSelectionOwner(display,xaClipboard);
- TRACE("%d\n", wFormat);
+ TRACE("enter for %d\n", wFormat);
/*
* If the selection has not been previously cached, or the selection has changed,
@@ -915,9 +916,13 @@
/* Exit if there is no selection */
if ( !ownerClipboard && !ownerPrimary )
{
- TRACE("There is no selection\n");
+ TRACE("There is no selection owner\n");
return FALSE;
}
+
+ /* Check if the format is available in the clipboard cache */
+ if ( CLIPBOARD_IsPresent(wFormat) )
+ return TRUE;
/*
* Many X client apps (such as XTerminal) don't support being queried