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 646743 - gdkquartz needs objective-c
gdkquartz needs objective-c
Status: RESOLVED FIXED
Product: pygtk
Classification: Bindings
Component: gdk
Git Master
Other Mac OS
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2011-04-04 20:21 UTC by Anders F Björklund
Modified: 2011-08-06 00:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-use-objective-c-for-quartz.patch (1.04 KB, patch)
2011-04-04 20:24 UTC, Anders F Björklund
none Details | Review
0002-typo-in-configure-variable.patch (633 bytes, patch)
2011-04-05 13:21 UTC, Anders F Björklund
none Details | Review
unpatched build log (131.70 KB, application/x-gzip)
2011-08-06 00:14 UTC, Naohiro Aota
  Details
patched build log (12.43 KB, application/x-gzip)
2011-08-06 00:17 UTC, Naohiro Aota
  Details
pygtk-demo screen shot (png) (193.24 KB, image/png)
2011-08-06 00:31 UTC, Naohiro Aota
  Details

Description Anders F Björklund 2011-04-04 20:21:21 UTC
Any code including <gdk/gdkquartz.h> needs to be compiled as Objective-C...

Otherwise it will cause errors when trying to #include <AppKit/AppKit.h>
Comment 1 Anders F Björklund 2011-04-04 20:24:04 UTC
Created attachment 185147 [details] [review]
0001-use-objective-c-for-quartz.patch
Comment 2 John Stowers 2011-04-04 20:30:25 UTC
So this resolved your problem with gdkwidget.nswindow etc?

What did the gtk-macosx people say? I thought a fix like this should belong there.
Comment 3 Anders F Björklund 2011-04-04 20:34:03 UTC
It "should" resolve it, but my autotools aren't up to snuff to try it...

configure.ac:80: warning: macro `AM_CHECK_PYTHON_HEADERS' not found in library
configure.ac:101: warning: macro `AM_CHECK_PYMOD' not found in library

Do you mean something like hiding the actual Objective-C types in gtkquartz.h ?
Comment 4 John Stowers 2011-04-04 20:53:17 UTC
Ok, well let me know when you have tested it, and please check with the gtk-osx mailing list that this is the recommended fix.

I can't test on Mac.
Comment 5 Anders F Björklund 2011-04-04 20:55:49 UTC
Hacking in the "-xobjective-c" flag directly into INCLUDES in the gtk/Makefile does make the compilation pass OK, what I couldn't try was the autotools bit.
Comment 6 John Ralls 2011-04-04 22:58:18 UTC
This is caused by an ill-advised patch from Bug 631088. The creator of that patch filed Bug 632221, where he demanded that we (Gtk, not Gtk-OSX) add -ObjC (does the same as -xobjective-c, but works only in Apple-hacked compilers) to gdk-2.0.pc. As I said in that bug, we can't do that because GObject-introspection will see the flag and fail. It's up to pyGtk to fix your Makefile if you really want to include that header.
Comment 7 John Stowers 2011-04-04 23:51:37 UTC
Sure, so it looks like this is broken.

Looking over the other bugs, I struggle to see the point of having gdk_quartz_window_get_nsviewget_nswindow would be if one cannot use it.

Is our use of the function broken?
Comment 8 John Stowers 2011-04-04 23:57:12 UTC
Anders, if this is all really so unsupported then maybe the recommended way to fix it is to

./configure CFLAGS='-DUSE_QUARTZ -xobjective-c'

or some such.
Comment 9 John Ralls 2011-04-05 02:30:40 UTC
I don't know about broken. At some point the application embedding the native windows has to know what those pointers (NSView* and NSWindow*) mean, so it has to include either directly or indirectly AppKit.h. Once you do that, you need the -xobjective-c flag.

There's no need to pass special CFLAGS to configure. You can test for the quartz backend in configure (Anders's patch does this) and set -xobjective-c for the files that include gdkquartz.h. You have to hide that flag from girscanner, so don't put it in any of the global CFLAGS places. You can look at gtk/Makefile.am in the gtk-2-24-quartz branch for a better way to handle it than what's in gtk-2-24.
Comment 10 Anders F Björklund 2011-04-05 07:28:44 UTC
I think the workaround should be OK (and be backported to pygtk 2.22), at least as long as gdkquartz.h includes that AppKit header and not <objc.h> and "id" or so. The current configure wasn't going to work for gtk3 anyway, since it uses "gdktarget" (just one) and not "targets" (several). Seems natural to want the equivalent nsview/nswindow for xid/handle, even if it has memory/etc issues ?
Comment 11 John Stowers 2011-04-05 09:46:02 UTC
I'm not going to backport this to 2.22 - PyGTK (me) only maintains one stable release at a time.

I am considering applying it to 2.24 series, but I would like to see that you have tested it - perhaps a sample application, build output, reports from other testers if possible.

I don't have a mac, so I'd like some wider feedback on this.
Comment 12 Anders F Björklund 2011-04-05 13:21:26 UTC
Created attachment 185196 [details] [review]
0002-typo-in-configure-variable.patch

Addition to previous patch
Comment 13 Anders F Björklund 2011-04-05 13:23:11 UTC
Besides that I typoed the variable name (oops), the patch does fix the compilation (tested with jhbuild this time, as it has newer autotools)
Comment 14 Naohiro Aota 2011-08-06 00:14:46 UTC
Created attachment 193336 [details]
unpatched build log
Comment 15 Naohiro Aota 2011-08-06 00:17:32 UTC
Created attachment 193337 [details]
patched build log

These are build.log with patched and unpatched. (typo fix is included)
unpatched version fail to build and patched version go well.
Comment 16 Naohiro Aota 2011-08-06 00:31:47 UTC
Created attachment 193338 [details]
pygtk-demo screen shot (png)

Working pygtk-demo screen shot . Feel free to let me know any other information you need.
Comment 17 John Stowers 2011-08-06 00:38:41 UTC
(In reply to comment #16)
> Created an attachment (id=193338) [details]
> pygtk-demo screen shot (png)
> 
> Working pygtk-demo screen shot . Feel free to let me know any other information
> you need.

Thankyou for providing the information I requested.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.