Fix - Occasional Paste Problem. (Dan Wilks @ Intuit)

This commit is contained in:
Harold L Hunt II 2004-04-23 18:17:29 +00:00
parent 525f80baae
commit 5228ce0353
5 changed files with 43 additions and 0 deletions

View file

@ -765,6 +765,9 @@ winPixmapToRegionNativeGDI (PixmapPtr pPix);
Bool
winInitClipboard (void);
void
winFixClipboardChain (void);
#endif

View file

@ -76,6 +76,7 @@
#define WIN_XEVENTS_CONVERT 2
#define WIN_XEVENTS_NOTIFY 3
#define WM_WM_REINIT (WM_USER + 1)
/*
* References to external symbols

View file

@ -47,6 +47,8 @@ DISPATCH_PROC(winProcSetSelectionOwner);
extern pthread_t g_ptClipboardProc;
extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
extern Bool g_fClipboard;
extern HWND g_hwndClipboard;
/*
@ -126,3 +128,13 @@ winClipboardCreateMessagingWindow ()
return hwnd;
}
void
winFixClipboardChain (void)
{
if (g_fClipboard
&& g_hwndClipboard)
{
SendMessage (g_hwndClipboard, WM_WM_REINIT, 0, 0);
}
}

View file

@ -181,6 +181,30 @@ winClipboardWindowProc (HWND hwnd, UINT message,
}
return 0;
case WM_WM_REINIT:
{
/* Ensure that we're in the clipboard chain. Some apps,
WinXP's remote desktop for one, don't play nice with
the chain. This message is called whenever we receive
a WM_ACTIVATEAPP message to ensure that we continue to
receive clipboard messages.
It might be possible to detect if we're still in the
chain by calling
SendMessage (GetClipboardViewer(), WM_DRAWCLIPBOARD, 0, 0);
and then seeing if we get the WM_DRAWCLIPBOARD message.
That, however, might be more expensive than just putting
ourselves back into the chain.
*/
s_fCBCInitialized = FALSE;
ChangeClipboardChain (hwnd, s_hwndNextViewer);
s_hwndNextViewer = NULL;
s_fCBCInitialized = FALSE;
s_hwndNextViewer = SetClipboardViewer (hwnd);
}
return 0;
case WM_DRAWCLIPBOARD:
{

View file

@ -1110,6 +1110,9 @@ winWindowProc (HWND hwnd, UINT message,
ShowCursor (TRUE);
}
/* Make sure the clipboard chain is ok. */
winFixClipboardChain ();
/* Call engine specific screen activation/deactivation function */
(*s_pScreenPriv->pwinActivateApp) (s_pScreen);
return 0;