garetxe on master
gi-gtk-hs: relax constraint on … (compare)
GdkEventand filling in its keyboard properties (http://hackage.haskell.org/package/gi-gdk-3.0.22/docs/GI-Gdk-Unions-Event.html). I don't, however, see any way to set the
Eventkeyboard modifiers. They are available in http://hackage.haskell.org/package/gi-gdk-3.0.22/docs/GI-Gdk-Structs-EventKey.html, but not in the more general event type. Any idea what's going on there? Thanks in advance!
Ptr Window. Which of the https://hackage.haskell.org/package/haskell-gi-base-0.23.0/docs/Data-GI-Base-ManagedPtr.html functions seem appropriate to you to get a
Ptrout to jam in a
Gdk.eventNew? My initial crack went with
Gtk.getWidgetWindow widgetand passing that to
withManagedPtrand then to
setEventKeyWindow, but that seems to cause GTK go haywire and delete the widget. :P
setEventKeyWindowwould take a
ManagedPtrand call ref on it itself.
:&=operator (see https://hackage.haskell.org/package/haskell-gi-base-0.23.0/docs/Data-GI-Base.html) work?
:&=says that it is fine to allocate
It is a struct, but isn't GTK free-ing all related ref counted fields if one calls its
g_object_freeor smth on it? I remember seeing the event-copy function mentioning that it increases the ref counts on its members.
haskell-gi cannot know this, from the point of view of the introspection data there is no information saying "this field will be freed when the struct is freed". So we have to play it safe
I suppose technically Haskell GI could ensure no-leaks if it ensured the return value of
Gdk.eventNewcame with a finalizer that unref-ed the event which in turn would, presumably, unref its fields.
Yeah, but this would mean treating
GdkEvent specially, and I want to keep my sanity :) Luckily
gtk4 fixes this to a large extent,
GdkEvent gains accessor functions with well defined memory management.
Elsewhere there is referencing introspection? So far Haskell GI seems to know when you ref things. :P
Yes, the problem is that is is a struct field. Generally we can do things nicely when there is a setter function, but this is not the case (generally) for struct fields
:&=papers over this complication.)