From c70fdea6816e31fe61ba4a6cb0b3271fec2ca033 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sun, 8 Feb 2015 14:48:13 +0000 Subject: clipboard debug: Dump clipboard formats when it's contains a non-text format v3: Take Windows clipboard ownership when trying to enumerate formats. You must own the Windows clipboard to enumerate the formats it contains. --- hw/xwin/winclipboard/wndproc.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/hw/xwin/winclipboard/wndproc.c b/hw/xwin/winclipboard/wndproc.c index ed099b3a9..9a4d1b9f4 100644 --- a/hw/xwin/winclipboard/wndproc.c +++ b/hw/xwin/winclipboard/wndproc.c @@ -331,6 +331,36 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) "Clipboard does not contain CF_TEXT nor " "CF_UNICODETEXT.\n"); + winDebug("winClipboardWindowProc: %d formats\n", + CountClipboardFormats()); + + if (OpenClipboard(hwnd)) { + unsigned int format = 0; + + do { + format = EnumClipboardFormats(format); + if (GetLastError() != ERROR_SUCCESS) { + winDebug + ("winClipboardWindowProc: EnumClipboardFormats failed %x\n", + GetLastError()); + } + if (format > 0xc000) { + char buff[256]; + + GetClipboardFormatName(format, buff, 256); + winDebug("winClipboardWindowProc: %d %s\n", format, + buff); + } + else if (format > 0) + winDebug("winClipboardWindowProc: %d\n", format); + } while (format != 0); + CloseClipboard(); + } + else { + winDebug + ("WindowProc: could not open clipboard to enumerate formats\n"); + } + /* * We need to make sure that the X Server has processed * previous XSetSelectionOwner messages. -- cgit v1.2.3