Re: [Haskell-cafe] Problem with Gtk2hs

2007-12-10 Thread Andrew Coppin

Duncan Coutts wrote:
On Sat, 2007-12-08 at 13:08 -0800, Stefan O'Rear wrote: 
  

That's pretty obviously a bug - Graphics.UI.Gtk.Gdk.PixbufData doesn't
fully implement the (M)Array class.



The MArray class changed in ghc-6.8 and we didn't notice until the
gtk2hs release was already out.
  


Ah. I knew there'd be a reason...


So there are a couple workarounds, either grab the darcs version of the
0.9.12 branch which contains the fix:
http://darcs.haskell.org/gtk2hs-branches/gtk2hs-0.9.12/

Or use the released version with ghc-6.6.x rather than 6.8.x, since 6.6
has the previous different MArray interface.

Or use the unsafe indexing operators which bypass the bounds check which
calls getNumElements.
  


Eeek! I just recompiled my existing working code with 6.8.1, and sure 
enough it's broken. I was assuming that the new code I added was the 
problem, but no, apparently it's the change of compiler [and hence 
libraries]. Well that changes things...


What do I need to compile the darcs version? Just GHC? Or do I need the 
GTK+ header files? (Remember, I'm on Windows here.)


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with Gtk2hs

2007-12-10 Thread Duncan Coutts

On Mon, 2007-12-10 at 10:40 +, Andrew Coppin wrote:

 What do I need to compile the darcs version? Just GHC? Or do I need the 
 GTK+ header files? (Remember, I'm on Windows here.)

Ah, that's a bit harder. It's not for the feint of heart.

I've not updated the instructions in a while. The old ones are here:
http://haskell.org/gtk2hs/archives/2005/06/24/building-from-source-on-windows/

but we now use the official Gtk+ windows binaries and headers rather
than the ones from http://gladewin32.sourceforge.net/

Our new header bundles are here: http://haskell.org/gtk2hs/win32/
and scripts are here: http://darcs.haskell.org/gtk2hs/tools/win32/
You'd want the win32-build-* ones.

You also need mingw of course. I would not recommend starting from darcs
but from a tarball and then copying over the two changed files from
darcs. The reason for that is that trying to get autoconf and automake
working on windows is more trouble than it's worth (I've never done it)
where as the tarball contains pre-generated autoconf/automake stuff.

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with Gtk2hs

2007-12-10 Thread Andrew Coppin

Duncan Coutts wrote:

On Mon, 2007-12-10 at 10:40 +, Andrew Coppin wrote:

  
What do I need to compile the darcs version? Just GHC? Or do I need the 
GTK+ header files? (Remember, I'm on Windows here.)



Ah, that's a bit harder. It's not for the feint of heart.

I've not updated the instructions in a while. The old ones are here:
http://haskell.org/gtk2hs/archives/2005/06/24/building-from-source-on-windows/

but we now use the official Gtk+ windows binaries and headers rather
than the ones from http://gladewin32.sourceforge.net/

Our new header bundles are here: http://haskell.org/gtk2hs/win32/
and scripts are here: http://darcs.haskell.org/gtk2hs/tools/win32/
You'd want the win32-build-* ones.

You also need mingw of course. I would not recommend starting from darcs
but from a tarball and then copying over the two changed files from
darcs. The reason for that is that trying to get autoconf and automake
working on windows is more trouble than it's worth (I've never done it)
where as the tarball contains pre-generated autoconf/automake stuff.

Duncan
  


Uh... or maybe I could just wait until the next binary release. :-}

*runs away*

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with Gtk2hs

2007-12-09 Thread Andrew Coppin

Stefan O'Rear wrote:

On Sat, Dec 08, 2007 at 08:33:36PM +, Andrew Coppin wrote:
  
I just spent the evening writing a library that's a thin layer over Gtk2hs. 
It took an age to get it to compile, but eventually it worked. Yay!


When I ran it, I got this:

Test2: gtk/Graphics/UI/Gtk/Gdk/PixbufData.hs.pp:58:0: No instance nor 
default method for class operation Data.Array.Base.getNumElements


Er... wow.

OK, at this point, I am completely stumped. Any hints?



That's pretty obviously a bug - Graphics.UI.Gtk.Gdk.PixbufData doesn't
fully implement the (M)Array class.
  


Well OK, but... how come nobody else has tripped over this before?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with Gtk2hs

2007-12-09 Thread Felipe Lessa
On Dec 8, 2007 6:33 PM, Andrew Coppin [EMAIL PROTECTED] wrote:
 (Also, the documentation for Graphics.UI.Gtk.Misc.DrawingArea suggests
 that you may want to draw a Pixbuf using the pixbufRenderToDrawable
 function - but GHC complains that this function doesn't exist. I had to
 use drawPixbuf instead. Wow that has a lot of parameters... In
 particular, the final two don't seem to be documented. Interesting.
 They're both 0 in the fastdraw demo.)

Just for the record:
http://library.gnome.org/devel/gdk/unstable/gdk-Drawing-Primitives.html#gdk-draw-pixbuf

I have found that it's eventually useful to try to look at Gtk+
official C documentation when coding with a binding (not only with
Gtk2Hs, but also Gtk#, PyGtk, etc).

(Also, it seem the second argument should be Maybe GC as the C
documentation says it could be a NULL value.)

HTH,

-- 
Felipe.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with Gtk2hs

2007-12-09 Thread Duncan Coutts

On Sat, 2007-12-08 at 13:08 -0800, Stefan O'Rear wrote: 
 On Sat, Dec 08, 2007 at 08:33:36PM +, Andrew Coppin wrote:
  I just spent the evening writing a library that's a thin layer over Gtk2hs. 
  It took an age to get it to compile, but eventually it worked. Yay!
 
  When I ran it, I got this:
 
  Test2: gtk/Graphics/UI/Gtk/Gdk/PixbufData.hs.pp:58:0: No instance nor 
  default method for class operation Data.Array.Base.getNumElements
 
  Er... wow.
 
  OK, at this point, I am completely stumped. Any hints?
 
 That's pretty obviously a bug - Graphics.UI.Gtk.Gdk.PixbufData doesn't
 fully implement the (M)Array class.

The MArray class changed in ghc-6.8 and we didn't notice until the
gtk2hs release was already out.

So there are a couple workarounds, either grab the darcs version of the
0.9.12 branch which contains the fix:
http://darcs.haskell.org/gtk2hs-branches/gtk2hs-0.9.12/

Or use the released version with ghc-6.6.x rather than 6.8.x, since 6.6
has the previous different MArray interface.

Or use the unsafe indexing operators which bypass the bounds check which
calls getNumElements.


Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Problem with Gtk2hs

2007-12-08 Thread Andrew Coppin
I just spent the evening writing a library that's a thin layer over 
Gtk2hs. It took an age to get it to compile, but eventually it worked. Yay!


When I ran it, I got this:

Test2: gtk/Graphics/UI/Gtk/Gdk/PixbufData.hs.pp:58:0: No instance nor 
default method for class operation Data.Array.Base.getNumElements


Er... wow.

OK, at this point, I am completely stumped. Any hints?



(Also, the documentation for Graphics.UI.Gtk.Misc.DrawingArea suggests 
that you may want to draw a Pixbuf using the pixbufRenderToDrawable 
function - but GHC complains that this function doesn't exist. I had to 
use drawPixbuf instead. Wow that has a lot of parameters... In 
particular, the final two don't seem to be documented. Interesting. 
They're both 0 in the fastdraw demo.)


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with Gtk2hs

2007-12-08 Thread Stefan O'Rear
On Sat, Dec 08, 2007 at 08:33:36PM +, Andrew Coppin wrote:
 I just spent the evening writing a library that's a thin layer over Gtk2hs. 
 It took an age to get it to compile, but eventually it worked. Yay!

 When I ran it, I got this:

 Test2: gtk/Graphics/UI/Gtk/Gdk/PixbufData.hs.pp:58:0: No instance nor 
 default method for class operation Data.Array.Base.getNumElements

 Er... wow.

 OK, at this point, I am completely stumped. Any hints?

That's pretty obviously a bug - Graphics.UI.Gtk.Gdk.PixbufData doesn't
fully implement the (M)Array class.

 (Also, the documentation for Graphics.UI.Gtk.Misc.DrawingArea suggests that 
 you may want to draw a Pixbuf using the pixbufRenderToDrawable function - 
 but GHC complains that this function doesn't exist. I had to use drawPixbuf 
 instead. Wow that has a lot of parameters... In particular, the final two 
 don't seem to be documented. Interesting. They're both 0 in the fastdraw 
 demo.)

Stefan


signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe