winex11: Implement the UpdateClipboard entry point to refresh the cache.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
11c3867349
commit
adf96003a5
@ -95,6 +95,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(clipboard);
|
|||||||
#define SELECTION_RETRIES 500 /* wait for .5 seconds */
|
#define SELECTION_RETRIES 500 /* wait for .5 seconds */
|
||||||
#define SELECTION_WAIT 1000 /* us */
|
#define SELECTION_WAIT 1000 /* us */
|
||||||
|
|
||||||
|
#define SELECTION_UPDATE_DELAY 2000 /* delay between checks of the X11 selection */
|
||||||
|
|
||||||
/* Selection masks */
|
/* Selection masks */
|
||||||
#define S_NOSELECTION 0
|
#define S_NOSELECTION 0
|
||||||
#define S_PRIMARY 1
|
#define S_PRIMARY 1
|
||||||
@ -224,10 +226,6 @@ static unsigned int nb_current_x11_formats;
|
|||||||
static struct list data_list = LIST_INIT( data_list );
|
static struct list data_list = LIST_INIT( data_list );
|
||||||
static UINT ClipDataCount = 0;
|
static UINT ClipDataCount = 0;
|
||||||
|
|
||||||
/*
|
|
||||||
* Clipboard sequence number
|
|
||||||
*/
|
|
||||||
static UINT wSeqNo = 0;
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Internal Clipboard implementation methods
|
* Internal Clipboard implementation methods
|
||||||
@ -586,39 +584,6 @@ static void X11DRV_CLIPBOARD_FreeData(LPWINE_CLIPDATA lpData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* X11DRV_CLIPBOARD_UpdateCache
|
|
||||||
*/
|
|
||||||
static BOOL X11DRV_CLIPBOARD_UpdateCache(void)
|
|
||||||
{
|
|
||||||
BOOL bret = TRUE;
|
|
||||||
|
|
||||||
if (!selectionAcquired)
|
|
||||||
{
|
|
||||||
DWORD seqno = GetClipboardSequenceNumber();
|
|
||||||
|
|
||||||
if (!seqno)
|
|
||||||
{
|
|
||||||
ERR("Failed to retrieve clipboard information.\n");
|
|
||||||
bret = FALSE;
|
|
||||||
}
|
|
||||||
else if (wSeqNo < seqno)
|
|
||||||
{
|
|
||||||
empty_clipboard();
|
|
||||||
|
|
||||||
if (X11DRV_CLIPBOARD_QueryAvailableData(thread_init_display()) < 0)
|
|
||||||
{
|
|
||||||
ERR("Failed to cache clipboard data owned by another process.\n");
|
|
||||||
bret = FALSE;
|
|
||||||
}
|
|
||||||
wSeqNo = seqno;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return bret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* X11DRV_CLIPBOARD_RenderFormat
|
* X11DRV_CLIPBOARD_RenderFormat
|
||||||
*/
|
*/
|
||||||
@ -2379,8 +2344,6 @@ void CDECL X11DRV_EmptyClipboard(void)
|
|||||||
*/
|
*/
|
||||||
BOOL CDECL X11DRV_SetClipboardData(UINT wFormat, HANDLE hData, BOOL owner)
|
BOOL CDECL X11DRV_SetClipboardData(UINT wFormat, HANDLE hData, BOOL owner)
|
||||||
{
|
{
|
||||||
if (!owner) X11DRV_CLIPBOARD_UpdateCache();
|
|
||||||
|
|
||||||
return X11DRV_CLIPBOARD_InsertClipboardData( wFormat, hData );
|
return X11DRV_CLIPBOARD_InsertClipboardData( wFormat, hData );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2390,10 +2353,6 @@ BOOL CDECL X11DRV_SetClipboardData(UINT wFormat, HANDLE hData, BOOL owner)
|
|||||||
*/
|
*/
|
||||||
INT CDECL X11DRV_CountClipboardFormats(void)
|
INT CDECL X11DRV_CountClipboardFormats(void)
|
||||||
{
|
{
|
||||||
X11DRV_CLIPBOARD_UpdateCache();
|
|
||||||
|
|
||||||
TRACE(" count=%d\n", ClipDataCount);
|
|
||||||
|
|
||||||
return ClipDataCount;
|
return ClipDataCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2405,10 +2364,6 @@ UINT CDECL X11DRV_EnumClipboardFormats(UINT wFormat)
|
|||||||
{
|
{
|
||||||
struct list *ptr = NULL;
|
struct list *ptr = NULL;
|
||||||
|
|
||||||
TRACE("(%04X)\n", wFormat);
|
|
||||||
|
|
||||||
X11DRV_CLIPBOARD_UpdateCache();
|
|
||||||
|
|
||||||
if (!wFormat)
|
if (!wFormat)
|
||||||
{
|
{
|
||||||
ptr = list_head( &data_list );
|
ptr = list_head( &data_list );
|
||||||
@ -2431,10 +2386,6 @@ BOOL CDECL X11DRV_IsClipboardFormatAvailable(UINT wFormat)
|
|||||||
{
|
{
|
||||||
BOOL bRet = FALSE;
|
BOOL bRet = FALSE;
|
||||||
|
|
||||||
TRACE("(%04X)\n", wFormat);
|
|
||||||
|
|
||||||
X11DRV_CLIPBOARD_UpdateCache();
|
|
||||||
|
|
||||||
if (wFormat != 0 && X11DRV_CLIPBOARD_LookupData(wFormat))
|
if (wFormat != 0 && X11DRV_CLIPBOARD_LookupData(wFormat))
|
||||||
bRet = TRUE;
|
bRet = TRUE;
|
||||||
|
|
||||||
@ -2453,8 +2404,6 @@ HANDLE CDECL X11DRV_GetClipboardData(UINT wFormat)
|
|||||||
|
|
||||||
TRACE("(%04X)\n", wFormat);
|
TRACE("(%04X)\n", wFormat);
|
||||||
|
|
||||||
X11DRV_CLIPBOARD_UpdateCache();
|
|
||||||
|
|
||||||
if ((lpRender = X11DRV_CLIPBOARD_LookupData(wFormat)))
|
if ((lpRender = X11DRV_CLIPBOARD_LookupData(wFormat)))
|
||||||
{
|
{
|
||||||
if ( !lpRender->hData )
|
if ( !lpRender->hData )
|
||||||
@ -2468,6 +2417,25 @@ HANDLE CDECL X11DRV_GetClipboardData(UINT wFormat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* X11DRV_UpdateClipboard
|
||||||
|
*/
|
||||||
|
void CDECL X11DRV_UpdateClipboard(void)
|
||||||
|
{
|
||||||
|
static ULONG last_update;
|
||||||
|
ULONG now;
|
||||||
|
|
||||||
|
if (selectionAcquired) return;
|
||||||
|
now = GetTickCount();
|
||||||
|
if ((int)(now - last_update) <= SELECTION_UPDATE_DELAY) return;
|
||||||
|
last_update = now;
|
||||||
|
|
||||||
|
empty_clipboard();
|
||||||
|
if (X11DRV_CLIPBOARD_QueryAvailableData(thread_init_display()) < 0)
|
||||||
|
ERR("Failed to cache clipboard data owned by another process.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* ResetSelectionOwner
|
* ResetSelectionOwner
|
||||||
*
|
*
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
@ cdecl SetWindowText(long wstr) X11DRV_SetWindowText
|
@ cdecl SetWindowText(long wstr) X11DRV_SetWindowText
|
||||||
@ cdecl ShowWindow(long long ptr long) X11DRV_ShowWindow
|
@ cdecl ShowWindow(long long ptr long) X11DRV_ShowWindow
|
||||||
@ cdecl SysCommand(long long long) X11DRV_SysCommand
|
@ cdecl SysCommand(long long long) X11DRV_SysCommand
|
||||||
|
@ cdecl UpdateClipboard() X11DRV_UpdateClipboard
|
||||||
@ cdecl UpdateLayeredWindow(long ptr ptr) X11DRV_UpdateLayeredWindow
|
@ cdecl UpdateLayeredWindow(long ptr ptr) X11DRV_UpdateLayeredWindow
|
||||||
@ cdecl WindowMessage(long long long long) X11DRV_WindowMessage
|
@ cdecl WindowMessage(long long long long) X11DRV_WindowMessage
|
||||||
@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) X11DRV_WindowPosChanging
|
@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) X11DRV_WindowPosChanging
|
||||||
|
Loading…
x
Reference in New Issue
Block a user