GNOME Bugzilla – Bug 163702
clear_func is called immediately after gtk_clipboard_set_with_*
Last modified: 2005-01-23 00:43:42 UTC
This breaks cells copying of Gnumeric on Win32.
Created attachment 35838 [details] [review] proposed patch This patch tries to handle WM_DESTROYCLIPBOARD and append a corresponding selection clear event for it. After removing the artificial GDK_SELECTION_EVENT in gdk_selection_send_notify_for_display(), I cannot reproduce the problem described in the comment block of the function.
Patch looks reasonable. I don't like the name of the _gdk_selection_filter_clear_event() function, though, that name sounds like the fnction clears some event. Why not just make the filter_clear_event variable global (and name it a bit better)? We use lots of other global variables in gdk/win32. Is there a slight race possibility, if some other process calls EmptyClipboard() at the same time, and the WM_DESTROYCLIPBOARD caused by that then also ends up getting ignored? But that's hardly anything worth losing sleep over?
> I don't like the name of the > _gdk_selection_filter_clear_event() function The name was first stolen from gdkslection-x11.c, but eventually it does nothing more than return a variable. I agree that using global variable is better. > Is there a slight race possibility, if some other process > calls EmptyClipboard() at the same time, and the > WM_DESTROYCLIPBOARD caused by that then also ends up getting ignored? Probably no. From MSDN, OpenClipboard() "prevents other applications from modifying the clipboard content". "Modifying" should includes clipboard emptying.
Patch applied to HEAD and gtk-2-6, thanks! Fix for #163702, from Ivan Wong: * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkglobals-win32.c: New flag _ignore_destroy_clipboard. * gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle WM_DESTROYCLIPBOARD. Unless _ignore_destroy_clipboard, generate a GDK_SELECTION_CLEAR event. * gdk/win32/gdkselection-win32.c (gdk_selection_owner_set_for_display): Set _ignore_destroy_clipboard when emptying the clipboard ourselves. (gdk_selection_send_notify_for_display): Remove the artifical GDK_SELECTION_CLEAR event generation.