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 772281 - Quartz backend: gtk_clipboard_get_selection not implemented
Quartz backend: gtk_clipboard_get_selection not implemented
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Quartz
3.22.x
Other Mac OS
: Normal normal
: ---
Assigned To: Philip Chimento
gtk-bugs
Depends on:
Blocks: 774453 778037
 
 
Reported: 2016-10-01 08:37 UTC by Tom Schoonjans
Modified: 2017-07-19 03:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
quartz: Implement gtk_clipboard_get_selection (958 bytes, patch)
2016-11-03 06:46 UTC, Philip Chimento
committed Details | Review

Description Tom Schoonjans 2016-10-01 08:37:19 UTC
While trying to compile the latest gtkmm 3.22.0 against gtk 3.22.1, I noticed a linking error:

Undefined symbols for architecture x86_64:
  "_gtk_clipboard_get_selection", referenced from:
      Gtk::Clipboard::get_selection() const in clipboard.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Some investigation into this showed that gtk_clipboard_get_selection was never implemented in gtkclipboard-quartz.c, which is the file that gets compiled into libgtk3 when the quartz backend is requested.
Comment 1 Philip Chimento 2016-11-03 06:46:21 UTC
Created attachment 339008 [details] [review]
quartz: Implement gtk_clipboard_get_selection

This function is trivial and can be copied from the X11 implementation.
Comment 2 Kjell Ahlstedt 2017-02-03 10:15:43 UTC
gtk_clipboard_get_default() is also omitted from gtkclipboard-quartz.c.
That omission is not noticed when gtkmm is build, because it's not wrapped in
C++ code in gtkmm. Another omission, this one in gtkmm!
Comment 3 Partha 2017-02-03 12:33:32 UTC
Thanks for pointing this out @Kjell. 

It's ironic that 3.22.x series is currently at 3.22.7 and this "trivial" function couldn't be easily added in the source.
Comment 4 Emmanuele Bassi (:ebassi) 2017-02-03 12:49:17 UTC
(In reply to Partha from comment #3)

> It's ironic that 3.22.x series is currently at 3.22.7 and this "trivial"
> function couldn't be easily added in the source.

It's not "ironic" at all. Just like Linux and Windows users volunteer their time to ensure GTK+ works on those two platforms, we rely on macOS users to actually help us making GTK+ work on their OS.
Comment 5 Emmanuele Bassi (:ebassi) 2017-02-03 12:49:50 UTC
Review of attachment 339008 [details] [review]:

Okay.
Comment 6 Partha 2017-02-03 12:51:55 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #4)
> (In reply to Partha from comment #3)
> 
> > It's ironic that 3.22.x series is currently at 3.22.7 and this "trivial"
> > function couldn't be easily added in the source.
> 
> It's not "ironic" at all. Just like Linux and Windows users volunteer their
> time to ensure GTK+ works on those two platforms, we rely on macOS users to
> actually help us making GTK+ work on their OS.

Yes, if the problem was known in gtk+. However, it shows up in making gtkmm.
Comment 7 Kjell Ahlstedt 2017-02-03 14:44:28 UTC
It would be fine if someone with knowledge of macOS could also fix the missing
gtk_clipboard_get_default() in gtkclipboard-quartz.c. Otherwise this story will
repeat itself when we add Gtk::Clipboard::get_default() to gtkmm.
Comment 8 Philip Chimento 2017-02-05 22:53:18 UTC
I'd suggest opening a gtkmm bug for that.
Comment 9 Philip Chimento 2017-02-05 22:56:30 UTC
Comment on attachment 339008 [details] [review]
quartz: Implement gtk_clipboard_get_selection

Attachment 339008 [details] pushed as e338b45 - quartz: Implement gtk_clipboard_get_selection
Comment 10 Philip Chimento 2017-02-05 22:57:18 UTC
Emmanuele, should I commit this patch to master as well? I haven't looked at how different the clipboard stuff looks on GTK 4...
Comment 11 Kjell Ahlstedt 2017-02-06 09:07:20 UTC
(In reply to Philip Chimento from comment #8)
> I'd suggest opening a gtkmm bug for that.

For what? A gtkmm bug for the missing gtk_clipboard_get_default() in gtk+/gtk/
gtkclipboard-quartz.c?
Comment 12 Kjell Ahlstedt 2017-02-06 09:52:47 UTC
Please ignore my comments 7 and 11.

gtk_clipboard_get_default() is a specialization of
gtk_clipboard_get_for_display(). The function in gtkmm, corresponding to
gtk_clipboard_get_for_display(), declares the GdkAtom selection argument with
default value GDK_SELECTION_CLIPBOARD, which makes it unnecessary to wrap
gtk_clipboard_get_default() in C++ code in gtkmm.

There is no reason to wrap gtk_clipboard_get_default() in gtkmm. If it's
missing from gtkclipboard-quartz.c, it won't matter to gtkmm or users of
gtkmm. But of course it might matter to users of gtk+.

Sorry for these unnecessary comments.
Comment 13 Tom Schoonjans 2017-06-21 07:30:47 UTC
gtk 3.22.16 fails to compile on macOS because of gtk_clipboard_get_default not being implemented:

  CCLD     gtk3-icon-browser
Undefined symbols for architecture x86_64:
  "_gtk_clipboard_get_default", referenced from:
      _copy_to_clipboard in iconbrowserwin.o
ld: symbol(s) not found for architecture x86_64

Shall I open a new bug for this?
Comment 14 Philip Chimento 2017-06-25 02:46:11 UTC
> Shall I open a new bug for this?

Probably.

I hadn't closed this one yet because I wasn't sure if the patch should be committed to master.
Comment 15 John Ralls 2017-07-19 03:29:58 UTC
gtkclipboard.c hasn't changed significantly between 3.22 and master so I cherry-picked it over.