Cancel a few changes to get back basic text clipboard functionality.
This commit is contained in:
parent
4d24e0f5a6
commit
9289a5dff8
|
@ -57,7 +57,7 @@ static HWND hWndViewer = 0; /* start of viewers chain */
|
||||||
static WORD LastRegFormat = CF_REGFORMATBASE;
|
static WORD LastRegFormat = CF_REGFORMATBASE;
|
||||||
|
|
||||||
/* Clipboard cache initial data.
|
/* 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
|
* declared in clipboard.h
|
||||||
*/
|
*/
|
||||||
WINE_CLIPFORMAT ClipFormats[] = {
|
WINE_CLIPFORMAT ClipFormats[] = {
|
||||||
|
@ -390,8 +390,9 @@ static BOOL CLIPBOARD_RenderFormat(LPWINE_CLIPFORMAT lpFormat)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If WINE is not the selection owner, and the format is available
|
* 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()
|
if ( !USER_Driver.pIsSelectionOwner()
|
||||||
&& USER_Driver.pIsClipboardFormatAvailable( lpFormat->wFormatID ) )
|
&& USER_Driver.pIsClipboardFormatAvailable( lpFormat->wFormatID ) )
|
||||||
{
|
{
|
||||||
|
@ -492,7 +493,8 @@ static INT CLIPBOARD_ConvertText(WORD src_fmt, void const *src, INT src_size,
|
||||||
static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
|
static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
|
||||||
{
|
{
|
||||||
LPWINE_CLIPFORMAT lpSource = ClipFormats;
|
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
|
/* Asked for CF_TEXT but not available - always attempt to convert
|
||||||
from CF_UNICODETEXT or CF_OEMTEXT */
|
from CF_UNICODETEXT or CF_OEMTEXT */
|
||||||
|
@ -503,7 +505,7 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
|
||||||
/* Convert UNICODETEXT -> TEXT */
|
/* Convert UNICODETEXT -> TEXT */
|
||||||
lpSource = &ClipFormats[CF_UNICODETEXT-1];
|
lpSource = &ClipFormats[CF_UNICODETEXT-1];
|
||||||
lpTarget = &ClipFormats[CF_TEXT-1];
|
lpTarget = &ClipFormats[CF_TEXT-1];
|
||||||
|
foundData = TRUE;
|
||||||
TRACE("\tUNICODETEXT -> TEXT\n");
|
TRACE("\tUNICODETEXT -> TEXT\n");
|
||||||
}
|
}
|
||||||
else if(ClipFormats[CF_OEMTEXT-1].wDataPresent)
|
else if(ClipFormats[CF_OEMTEXT-1].wDataPresent)
|
||||||
|
@ -511,11 +513,9 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
|
||||||
/* Convert OEMTEXT -> TEXT */
|
/* Convert OEMTEXT -> TEXT */
|
||||||
lpSource = &ClipFormats[CF_OEMTEXT-1];
|
lpSource = &ClipFormats[CF_OEMTEXT-1];
|
||||||
lpTarget = &ClipFormats[CF_TEXT-1];
|
lpTarget = &ClipFormats[CF_TEXT-1];
|
||||||
|
foundData = TRUE;
|
||||||
TRACE("\tOEMTEXT -> TEXT\n");
|
TRACE("\tOEMTEXT -> TEXT\n");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
lpSource = NULL; /* Conversion format is not available */
|
|
||||||
}
|
}
|
||||||
/* Asked for CF_OEMTEXT but not available - always attempt to convert
|
/* Asked for CF_OEMTEXT but not available - always attempt to convert
|
||||||
from CF_UNICODETEXT or CF_TEXT */
|
from CF_UNICODETEXT or CF_TEXT */
|
||||||
|
@ -526,7 +526,7 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
|
||||||
/* Convert UNICODETEXT -> OEMTEXT */
|
/* Convert UNICODETEXT -> OEMTEXT */
|
||||||
lpSource = &ClipFormats[CF_UNICODETEXT-1];
|
lpSource = &ClipFormats[CF_UNICODETEXT-1];
|
||||||
lpTarget = &ClipFormats[CF_OEMTEXT-1];
|
lpTarget = &ClipFormats[CF_OEMTEXT-1];
|
||||||
|
foundData = TRUE;
|
||||||
TRACE("\tUNICODETEXT -> OEMTEXT\n");
|
TRACE("\tUNICODETEXT -> OEMTEXT\n");
|
||||||
}
|
}
|
||||||
else if(ClipFormats[CF_TEXT-1].wDataPresent)
|
else if(ClipFormats[CF_TEXT-1].wDataPresent)
|
||||||
|
@ -534,11 +534,9 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
|
||||||
/* Convert TEXT -> OEMTEXT */
|
/* Convert TEXT -> OEMTEXT */
|
||||||
lpSource = &ClipFormats[CF_TEXT-1];
|
lpSource = &ClipFormats[CF_TEXT-1];
|
||||||
lpTarget = &ClipFormats[CF_OEMTEXT-1];
|
lpTarget = &ClipFormats[CF_OEMTEXT-1];
|
||||||
|
foundData = TRUE;
|
||||||
TRACE("\tTEXT -> OEMTEXT\n");
|
TRACE("\tTEXT -> OEMTEXT\n");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
lpSource = NULL; /* Conversion format is not available */
|
|
||||||
}
|
}
|
||||||
/* Asked for CF_UNICODETEXT but not available - always attempt to convert
|
/* Asked for CF_UNICODETEXT but not available - always attempt to convert
|
||||||
from CF_TEXT or CF_OEMTEXT */
|
from CF_TEXT or CF_OEMTEXT */
|
||||||
|
@ -549,7 +547,7 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
|
||||||
/* Convert TEXT -> UNICODETEXT */
|
/* Convert TEXT -> UNICODETEXT */
|
||||||
lpSource = &ClipFormats[CF_TEXT-1];
|
lpSource = &ClipFormats[CF_TEXT-1];
|
||||||
lpTarget = &ClipFormats[CF_UNICODETEXT-1];
|
lpTarget = &ClipFormats[CF_UNICODETEXT-1];
|
||||||
|
foundData = TRUE;
|
||||||
TRACE("\tTEXT -> UNICODETEXT\n");
|
TRACE("\tTEXT -> UNICODETEXT\n");
|
||||||
}
|
}
|
||||||
else if(ClipFormats[CF_OEMTEXT-1].wDataPresent)
|
else if(ClipFormats[CF_OEMTEXT-1].wDataPresent)
|
||||||
|
@ -557,17 +555,22 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
|
||||||
/* Convert OEMTEXT -> UNICODETEXT */
|
/* Convert OEMTEXT -> UNICODETEXT */
|
||||||
lpSource = &ClipFormats[CF_OEMTEXT-1];
|
lpSource = &ClipFormats[CF_OEMTEXT-1];
|
||||||
lpTarget = &ClipFormats[CF_UNICODETEXT-1];
|
lpTarget = &ClipFormats[CF_UNICODETEXT-1];
|
||||||
|
foundData = TRUE;
|
||||||
TRACE("\tOEMTEXT -> UNICODETEXT\n");
|
TRACE("\tOEMTEXT -> UNICODETEXT\n");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
lpSource = NULL; /* Conversion format is not available */
|
|
||||||
}
|
}
|
||||||
/* Text format requested is available - no conversion necessary */
|
if (!foundData)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
lpSource = __lookup_format( ClipFormats, wFormat );
|
if ((wFormat == CF_TEXT) || (wFormat == CF_OEMTEXT))
|
||||||
lpTarget = lpSource;
|
{
|
||||||
|
lpSource = &ClipFormats[CF_UNICODETEXT-1];
|
||||||
|
lpTarget = __lookup_format( ClipFormats, wFormat );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lpSource = __lookup_format( ClipFormats, wFormat );
|
||||||
|
lpTarget = lpSource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First render the source text format */
|
/* First render the source text format */
|
||||||
|
@ -633,6 +636,62 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
|
||||||
return (lpTarget->hData16 || lpTarget->hData32) ? lpTarget : NULL;
|
return (lpTarget->hData16 || lpTarget->hData32) ? lpTarget : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* 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
|
* WIN32 Clipboard implementation
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -1074,7 +1133,6 @@ INT WINAPI CountClipboardFormats(void)
|
||||||
return FormatCount;
|
return FormatCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* EnumClipboardFormats (USER.144)
|
* EnumClipboardFormats (USER.144)
|
||||||
*/
|
*/
|
||||||
|
@ -1089,9 +1147,6 @@ UINT16 WINAPI EnumClipboardFormats16( UINT16 wFormat )
|
||||||
*/
|
*/
|
||||||
UINT WINAPI EnumClipboardFormats( UINT wFormat )
|
UINT WINAPI EnumClipboardFormats( UINT wFormat )
|
||||||
{
|
{
|
||||||
LPWINE_CLIPFORMAT lpFormat = ClipFormats;
|
|
||||||
BOOL bFormatPresent;
|
|
||||||
|
|
||||||
TRACE("(%04X)\n", wFormat);
|
TRACE("(%04X)\n", wFormat);
|
||||||
|
|
||||||
if (CLIPBOARD_IsLocked())
|
if (CLIPBOARD_IsLocked())
|
||||||
|
@ -1100,51 +1155,7 @@ UINT WINAPI EnumClipboardFormats( UINT wFormat )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wFormat == 0) /* start from the beginning */
|
return CLIPBOARD_EnumClipboardFormats(wFormat);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1368,8 +1379,13 @@ BOOL WINAPI IsClipboardFormatAvailable( UINT wFormat )
|
||||||
if (wFormat == 0) /* Reject this case quickly */
|
if (wFormat == 0) /* Reject this case quickly */
|
||||||
bRet = FALSE;
|
bRet = FALSE;
|
||||||
else
|
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);
|
TRACE("(%04X)- ret(%d)\n", wFormat, bRet);
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@ Atom X11DRV_CLIPBOARD_MapFormatToProperty(UINT wFormat)
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* X11DRV_CLIPBOARD_IsNativeProperty
|
* 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)
|
BOOL X11DRV_CLIPBOARD_IsNativeProperty(Atom prop)
|
||||||
{
|
{
|
||||||
|
@ -332,6 +332,7 @@ int X11DRV_CLIPBOARD_CacheDataFormats( Atom SelectionName )
|
||||||
Window w;
|
Window w;
|
||||||
Window ownerSelection = 0;
|
Window ownerSelection = 0;
|
||||||
|
|
||||||
|
TRACE("enter\n");
|
||||||
/*
|
/*
|
||||||
* Empty the clipboard cache
|
* Empty the clipboard cache
|
||||||
*/
|
*/
|
||||||
|
@ -379,7 +380,7 @@ int X11DRV_CLIPBOARD_CacheDataFormats( Atom SelectionName )
|
||||||
if ( (xe.xselection.target != aTargets)
|
if ( (xe.xselection.target != aTargets)
|
||||||
|| (xe.xselection.property == None) )
|
|| (xe.xselection.property == None) )
|
||||||
{
|
{
|
||||||
TRACE("\tCould not retrieve TARGETS\n");
|
TRACE("\tExit, could not retrieve TARGETS\n");
|
||||||
return cSelectionTargets;
|
return cSelectionTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -890,7 +891,7 @@ BOOL X11DRV_IsClipboardFormatAvailable(UINT wFormat)
|
||||||
Window ownerPrimary = TSXGetSelectionOwner(display,XA_PRIMARY);
|
Window ownerPrimary = TSXGetSelectionOwner(display,XA_PRIMARY);
|
||||||
Window ownerClipboard = TSXGetSelectionOwner(display,xaClipboard);
|
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,
|
* If the selection has not been previously cached, or the selection has changed,
|
||||||
|
@ -915,10 +916,14 @@ BOOL X11DRV_IsClipboardFormatAvailable(UINT wFormat)
|
||||||
/* Exit if there is no selection */
|
/* Exit if there is no selection */
|
||||||
if ( !ownerClipboard && !ownerPrimary )
|
if ( !ownerClipboard && !ownerPrimary )
|
||||||
{
|
{
|
||||||
TRACE("There is no selection\n");
|
TRACE("There is no selection owner\n");
|
||||||
return FALSE;
|
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
|
* Many X client apps (such as XTerminal) don't support being queried
|
||||||
* for the "TARGETS" target atom. To handle such clients we must actually
|
* for the "TARGETS" target atom. To handle such clients we must actually
|
||||||
|
|
Loading…
Reference in New Issue