Hi Andy,

From: Andy Stewart <lazycat.manatee@gmail.com>

Hi John,

John Lato <jwlato@gmail.com> writes:

> Hello,
> I just managed to install gtkglext with the quartz backend provided by gtk-osx.? This was much more
> work than it should be,
> although a lot of that is probably related to the packaging of gtkglext.
> If anyone's interested, instructions are at
> http://johnlato.blogspot.com/2010/12/installing-gtkglext-haskell-bindings.html
I have seen you patches, to be honest, i don't like them.

I agree they're pretty dirty.  But getting something to build at all is an important first step.

Such as :

 #if !defined(WIN32)
-foreign import ccall unsafe "gdk_x11_drawable_get_xid"
-  gdk_x11_drawable_get_xid :: (Ptr Drawable) -> IO CInt
 foreign import ccall unsafe "gdk_win32_drawable_get_handle"
  gdk_win32_drawable_get_handle :: (Ptr Drawable) -> IO (Ptr a)
@@ -609,7 +607,7 @@
  liftM toNativeWindowId $
  (\(Drawable drawable) ->
 #if !defined(WIN32)
-     withForeignPtr drawable gdk_x11_drawable_get_xid
+     withForeignPtr drawable (error "drawableGetID not defined on OS X")
     withForeignPtr drawable gdk_win32_drawable_get_handle

You just simple remove "gdk_x11_drawable_get_xid" for quartz backend,
but X11 backend, this function is exist.

IMO, If haven't any flag for quartz backend,
we should add below flag in gtk.cabal

Flag use-quartz-backend
 Description: Flag for quartz backend, thereby disabling certain features.
 Default:  False

then we can use "USE_QUARTZ_BACKEND" flag to disable
"gdk_x11_drawable_get_xid" on quartz backend.


Then you need pass "use-quartz-backend" to cabal explicitly when you install
gtk on quartz backend.

I agree this is the right thing to do, but I don't like the user needing to specify it.  It would be much better if this could be auto-discovered somehow.
Other patches about quartz backend should use same way.

This is the only quartz-specific change I found.

AFAICT all of the functions I error'ed in gtkglext should be removed entirely; I can't find them anywhere in the gtkglext c source.  Hopefully somebody more familiar with gtkglext could confirm this.

Also there's the issue of the gtkglext library names.  But that's related to the gtk-osx package; the macports quartz version would likely require a different flag.