GNOME Bugzilla – Bug 763907
GDK W32: Clipboard handling is not tight enough
Last modified: 2016-03-26 00:07:51 UTC
OpenClipboard() is called too early, or without need. CloseClipboard() is not called soon enough.
Created attachment 324322 [details] [review] GDK W32: Optimize clipboard handling a bit Delay as long as possible before calling OpenClipboard(), call CloseClipboard() as quickly as possible after that. Don't call OpenClipboard() when we don't need to (for example, we don't need to open clipboard to call GetClipboardOwner()). Also, print out actual W32 error code in some cases where it was not printed before.
Review of attachment 324322 [details] [review]: Patch looks good to me but fix the nitpicks. Feel free to push with those minor fixes. ::: gdk/win32/gdkdisplay-win32.c @@ +383,2 @@ HWND hwndOwner; + HWND hwndOpener; I know it was like that but change it to: hwnd_owner, hwnd_opener @@ +407,3 @@ + success = OpenClipboard (hwnd); + + if (!success) just reomve the success var and put the call to OpenClipboard here
Created attachment 324329 [details] [review] GDK W32: Optimize clipboard handling a bit v2: * Fix nitpicks * Put all debug stuff under one ifdef, including Open/Close clipboard calls.
Review of attachment 324329 [details] [review]: See another nitpick that I missed before. ::: gdk/win32/gdkdisplay-win32.c @@ +416,3 @@ + DWORD w32_error = GetLastError (); + + g_warning ("Failed to OpenClipboard on window handle %p: %lu ", hwnd, w32_error); I would change this to: Fail on OpenClipboard on window handle... Also instead of printing the error code print the error message?
(In reply to Ignacio Casal Quinteiro (nacho) from comment #4) > Review of attachment 324329 [details] [review] [review]: > > I would change this to: > Fail on OpenClipboard on window handle... Okay. Anything else? > Also instead of printing the error code print the error message? Code is better. You can always look up the code. Looking up a message is more difficult. Code *and* message is ok though.
OK, I think that's all, also code + message is fine for me.
Hi, I think it's also good for me. With blessings, thank you!
Created attachment 324774 [details] [review] GDK W32: Optimize clipboard handling a bit v3: * Refactored the code a bit, now that W32_API_FAILED() prints the error code
Review of attachment 324774 [details] [review]: Looks good.
Attachment 324774 [details] pushed as b9b67e0 - GDK W32: Optimize clipboard handling a bit