Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-07-05 Thread Andy Stewart
Hi Axel, I'm not sure i understand your new solution, looks ugly... :) I found gdk_event_new in GDK manual: --> gdk_event_new start <-- GdkEvent* gdk_event_new (GdkEventType type); Creates a new event of th

Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-07-04 Thread Axel Simon
Hi Andy, since the marshalling of bit-fields is difficult, it might be worthwhile trying to do things completely differently. You could try to serialize an event using the following strategy: - query the size of the event - read each of the bytes in an event and serialize them (in hex or so) -

Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-07-04 Thread Andy Stewart
Hi Axel, Axel Simon writes: > Hi Andy, > > On Jul 4, 2010, at 16:20, Andy Stewart wrote: >>> >>> pokeSerializedEventKey ptr (SerializedEvent >>> (SerializedEventKeyValue >>> { >>> [..] >>> ,sEventString = string_ >>> }) window_) = do >>> str <- newCString string_ >>> [..] >>> #{poke GdkEventKey,

Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-07-04 Thread Axel Simon
Hi Andy, On Jul 4, 2010, at 16:20, Andy Stewart wrote: >> >> pokeSerializedEventKey ptr (SerializedEvent >> (SerializedEventKeyValue >> { >> [..] >> ,sEventString = string_ >> }) window_) = do >> str <- newCString string_ >> [..] >> #{poke GdkEventKey, string} ptr str >> Here, you leak the space o

Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-07-04 Thread Andy Stewart
Hi Axel, Axel Simon writes: > H Andy, > > a few comment: > > - you make your SerializedEvent an instance of Storable. That could work, but > you really have to > ensure that the size of the C structure you allocated is big enough. At the > moment, you have > > instance Storable SerializedEven

Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-07-04 Thread Axel Simon
H Andy, a few comment: - you make your SerializedEvent an instance of Storable. That could work, but you really have to ensure that the size of the C structure you allocated is big enough. At the moment, you have instance Storable SerializedEvent where sizeOf _ = #{const sizeof (GdkEventKey)

Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-07-03 Thread Andy Stewart
Hi Axel, Axel Simon writes: > On 30.06.2010, at 17:34, Andy Stewart wrote: So my question is how to binding gtk_main_do_event ? Looks I should use Graphics.UI.Gtk.Gdk.Events.Event and not EventM. >>> >>> Event is deprecated and will be removed soon. The problem with the C >>>

Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-06-30 Thread Axel Simon
On 30.06.2010, at 17:34, Andy Stewart wrote: >>> >>> So my question is how to binding gtk_main_do_event ? >>> Looks I should use Graphics.UI.Gtk.Gdk.Events.Event and not EventM. >>> >> >> Event is deprecated and will be removed soon. The problem with the C >> Event structure is that it can contain

Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-06-30 Thread Andy Stewart
Hi Axel, Axel Simon writes: > Hi Andy, > > On 30.06.2010, at 06:12, Andy Stewart wrote: > >> Hi Axel, >> >> I have multi-processese framework like Google Chrome, below is >> screenshot: >> >> http://farm5.static.flickr.com/4137/4747331678_441d6eb8ec_b.jpg >> >> UI is is render in parent proces

Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-06-30 Thread Andy Stewart
Axel Simon writes: > Hi Andy, > > On 30.06.2010, at 06:12, Andy Stewart wrote: > >> Hi Axel, >> >> I have multi-processese framework like Google Chrome, below is screenshot: >> >> http://farm5.static.flickr.com/4137/4747331678_441d6eb8ec_b.jpg >> >> UI is is render in parent processes with GtkSoc

Re: [Gtk2hs-devel] Question about binding gtk_main_do_event

2010-06-30 Thread Axel Simon
Hi Andy, On 30.06.2010, at 06:12, Andy Stewart wrote: > Hi Axel, > > I have multi-processese framework like Google Chrome, below is > screenshot: > > http://farm5.static.flickr.com/4137/4747331678_441d6eb8ec_b.jpg > > UI is is render in parent processes with GtkSocket, so all keyPress > event i