diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2015-02-08 14:48:13 +0000 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2015-02-08 15:11:30 +0000 |
commit | c70fdea6816e31fe61ba4a6cb0b3271fec2ca033 (patch) | |
tree | 84fd0428a9a3b3f5d5c69c09d01e8602f3d53702 | |
parent | d5fbcbede36f02ed73de9627f50e9bec3cac8a08 (diff) |
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.
-rw-r--r-- | hw/xwin/winclipboard/wndproc.c | 30 |
1 files changed, 30 insertions, 0 deletions
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. |