After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 163702 - clear_func is called immediately after gtk_clipboard_set_with_*
clear_func is called immediately after gtk_clipboard_set_with_*
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
unspecified
Other Windows
: Normal normal
: Small fix
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks: 160343
 
 
Reported: 2005-01-11 17:40 UTC by Ivan Wong
Modified: 2005-01-23 00:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (4.86 KB, patch)
2005-01-11 17:46 UTC, Ivan Wong
none Details | Review

Description Ivan Wong 2005-01-11 17:40:17 UTC
This breaks cells copying of Gnumeric on Win32.
Comment 1 Ivan Wong 2005-01-11 17:46:00 UTC
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.
Comment 2 Tor Lillqvist 2005-01-12 21:49:18 UTC
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?
Comment 3 Ivan Wong 2005-01-13 04:05:41 UTC
> 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.
Comment 4 Tor Lillqvist 2005-01-23 00:43:42 UTC
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.