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 790031 - GtkClipboardClearFunc is not being called
GtkClipboardClearFunc is not being called
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-11-07 17:58 UTC by Jakub Janků
Modified: 2017-11-29 10:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase (2.55 KB, text/x-csrc)
2017-11-07 17:58 UTC, Jakub Janků
  Details
wayland: Remove unused data structure (820 bytes, patch)
2017-11-28 17:01 UTC, Christophe Fergeau
committed Details | Review
wayland: emit GDK_SELECTION_CLEAR on owner changes (2.72 KB, patch)
2017-11-28 17:02 UTC, Christophe Fergeau
committed Details | Review

Description Jakub Janků 2017-11-07 17:58:19 UTC
Created attachment 363167 [details]
Testcase

GtkClipboardClearFunc supplied with gtk_clipboard_set_with_owner() or gtk_clipboard_set_with_data() is not being called.

Likely related:
When using gtk_clipboard_set_with_owner(), gtk_clipboard_get_owner() returns non-NULL value even though the clipboard is owned by another application.


Affects latest GTK+ from master (version 3.93), as well as stable version 3.22.
Concerns both GDK_SELECTION_CLIPBOARD and GDK_SELECTION_PRIMARY.

Testcase included.
Steps to reproduce:
1) click the "Set clipboard" button in the test program
2) copy (Ctrl+C) something from another application
3) return back to the test program

Actual results:
GtkClipboardClearFunc is not called at all.
gtk_clipboard_get_owner() returns the owner we set in step 1), although it should return NULL, since the clipboard is owned by the app from step 2).

Expected results:
If the clipboard ownership is lost, GtkClipboardClearFunc should be called subsequently (in this case in step 3)).
If the clipboard ownership has been claimed by another application, gtk_clipboard_get_owner() should return NULL.

The behavior should correspond to the one on X11.


Build 2017-11-07 on Fedora 26
Comment 1 Christophe Fergeau 2017-11-28 17:01:28 UTC
Created attachment 364579 [details] [review]
wayland: Remove unused data structure
Comment 2 Christophe Fergeau 2017-11-28 17:02:46 UTC
Created attachment 364580 [details] [review]
wayland: emit GDK_SELECTION_CLEAR on owner changes

This patch fixes the test case here. One thing I'm not clear about is whether we want to emit GDK_SELECTION_CLEAR from data_source_dnd_finished() as well, I guess not?
Comment 3 Matthias Clasen 2017-11-29 04:40:53 UTC
Review of attachment 364579 [details] [review]:

makes sense. for both gtk-3-22 and master
Comment 4 Matthias Clasen 2017-11-29 04:41:07 UTC
Review of attachment 364580 [details] [review]:

this one too
Comment 5 Matthias Clasen 2017-11-29 04:41:08 UTC
Review of attachment 364580 [details] [review]:

this one too
Comment 6 Christophe Fergeau 2017-11-29 10:48:20 UTC
Pushed both patches to both branches.