diff --git a/hw/xwin/winclipboardwndproc.c b/hw/xwin/winclipboardwndproc.c index a006b46d3..369aac58d 100644 --- a/hw/xwin/winclipboardwndproc.c +++ b/hw/xwin/winclipboardwndproc.c @@ -35,6 +35,8 @@ #include #include "winclipboard.h" +extern void winFixClipboardChain(); + /* * Constants @@ -181,28 +183,10 @@ winClipboardWindowProc (HWND hwnd, UINT message, case WM_CHANGECBCHAIN: { - static Bool s_fProcessingChangeCBChain = FALSE; winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: wParam(%x) " "lParam(%x) s_hwndNextViewer(%x)\n", wParam, lParam, s_hwndNextViewer); - - /* - * We've occasionally seen a loop in the clipboard chain. Break - * it on the first hint of recursion. - */ - if (! s_fProcessingChangeCBChain) - { - s_fProcessingChangeCBChain = TRUE; - } - else - { - winErrorFVerb (1, "winClipboardWindowProc - WM_CHANGECBCHAIN - " - "Nested calls detected. Bailing.\n"); - winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n"); - return 0; - } - if ((HWND) wParam == s_hwndNextViewer) { s_hwndNextViewer = (HWND) lParam; @@ -217,7 +201,6 @@ winClipboardWindowProc (HWND hwnd, UINT message, SendMessage (s_hwndNextViewer, message, wParam, lParam); - s_fProcessingChangeCBChain = FALSE; } winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n"); return 0; @@ -274,8 +257,8 @@ winClipboardWindowProc (HWND hwnd, UINT message, winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n"); /* - * We've occasionally seen a loop in the clipboard chain. Break - * it on the first hint of recursion. + * We've occasionally seen a loop in the clipboard chain. + * Try and fix it on the first hint of recursion. */ if (! s_fProcessingDrawClipboard) { @@ -283,16 +266,17 @@ winClipboardWindowProc (HWND hwnd, UINT message, } else { + /* Attempt to break the nesting by getting out of the chain, twice?, and then fix and bail */ + s_fCBCInitialized = FALSE; + ChangeClipboardChain (hwnd, s_hwndNextViewer); + winFixClipboardChain(); winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - " - "Nested calls detected. Bailing.\n"); + "Nested calls detected. Re-initing.\n"); winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n"); + s_fProcessingDrawClipboard = FALSE; return 0; } - /* Pass the message on the next window in the clipboard viewer chain */ - if (s_hwndNextViewer) - SendMessage (s_hwndNextViewer, message, 0, 0); - /* Bail on first message */ if (!s_fCBCInitialized) { @@ -318,6 +302,8 @@ winClipboardWindowProc (HWND hwnd, UINT message, "We own the clipboard, returning.\n"); winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n"); s_fProcessingDrawClipboard = FALSE; + if (s_hwndNextViewer) + SendMessage (s_hwndNextViewer, message, wParam, lParam); return 0; } @@ -379,6 +365,8 @@ winClipboardWindowProc (HWND hwnd, UINT message, winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n"); s_fProcessingDrawClipboard = FALSE; + if (s_hwndNextViewer) + SendMessage (s_hwndNextViewer, message, wParam, lParam); return 0; } @@ -422,6 +410,9 @@ winClipboardWindowProc (HWND hwnd, UINT message, s_fProcessingDrawClipboard = FALSE; } winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n"); + /* Pass the message on the next window in the clipboard viewer chain */ + if (s_hwndNextViewer) + SendMessage (s_hwndNextViewer, message, wParam, lParam); return 0; diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c index 7c93e4063..796a08593 100644 --- a/hw/xwin/wincreatewnd.c +++ b/hw/xwin/wincreatewnd.c @@ -58,6 +58,8 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + int iX = pScreenInfo->dwInitialX; + int iY = pScreenInfo->dwInitialY; int iWidth = pScreenInfo->dwWidth; int iHeight = pScreenInfo->dwHeight; HWND *phwnd = &pScreenPriv->hwndScreen; @@ -99,8 +101,8 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) WINDOW_CLASS, /* Class name */ szTitle, /* Window name */ WS_POPUP, - 0, /* Horizontal position */ - 0, /* Vertical position */ + iX, /* Horizontal position */ + iY, /* Vertical position */ iWidth, /* Right edge */ iHeight, /* Bottom edge */ (HWND) NULL, /* No parent or owner window */