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 is handle by parent top-level window, i will send key DBus > message > to child process if current key is not handle by parent process > Window. > > In my screenshot, up is webkit browser, down is editor. All those > sub-module is running in child > process. In editor, i can use some APIs emulate insert key after i > receive key > message from DBus. But WebKitGTK+ haven't open APIs let me do some > *insert key* > event. So i need propagate key event on WebKit widget in child > process. > > For propagate key event on child widget, i found three functions: > > gtk_propagate_event > (http://library.gnome.org/devel/gtk/unstable/gtk3-General.html#gtk-propagate-event > > ) > gtk_widget_event > (http://library.gnome.org/devel/gtk/unstable/GtkWidget.html#gtk-widget-event > ) > gtk_main_do_event > (http://library.gnome.org/devel/gtk/unstable/gtk3-General.html#gtk-main-do-event > > ) > > And gtk_main_do_event is right method to synthesize event in child > process widget. > > For my situation, i need convection Key (include attribute > eventRelease, > eventSent, eventTime...etc) from ParentProcess to ChildProcess by > DBus, > then use "mainDoEvent :: Event -> IO ()" propagate key event with > WebKit > child process. > > 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 contains pointers and varying fields. Event did not mangage to translate all of them, also because new event are being added to Gtk+ occasionally. If you want to convert a C Event structure completely to Haskell, send it over the network and then reemit the event inside a different application, I suggest that you start with the Event module and create an opaque but serializable data type. This data type should contain some events of interest (keys, mouse) but not all events. You would probably need to re-insert the time stamp of the event when you reemit it in the other application. If you implement this, then the extraction of an event should be a function serializeEvent :: EventM t SerializedEvent that runs in the EventM monad. It should throw an exception if it is applied to an event that it can't handle. Then at the client side, we can implement gtk_main_do_event as mainDoEvent :: EventM t () and have deserializeEvent :: SerializedEvent -> (EventM t a) -> IO a which executes any EventM function with the serialized event. Let me know if you need further help. The functions in Event.hs may help you to get started with marshalling the events, but you should use the EventM interface as described above. Cheers, Axel > Thanks! > > -- Andy > > > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Gtk2hs-devel mailing list > Gtk2hs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Gtk2hs-devel mailing list Gtk2hs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel