Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 23 18:03

    garetxe on master

    Add dependency on gi-pango Add dependency on gi-gio Add support for GValues and pro… (compare)

  • Oct 15 17:08

    garetxe on master

    Improve uploading scripts Bump version (compare)

  • Oct 15 17:06
    garetxe commented #390
  • Oct 15 17:05

    garetxe on master

    Add homebrew path to search pat… (compare)

  • Oct 15 12:07
    yobson opened #390
  • Oct 15 10:30

    garetxe on master

    Relax bounds on text Add freetype2 to Gtk4 cabal pro… Remove a warning in ghc 9.4.1 and 1 more (compare)

  • Sep 28 03:09
    Abastro commented #383
  • Sep 28 03:08
    Abastro commented #383
  • Sep 28 03:07
    Abastro commented #383
  • Sep 27 18:42
    garetxe commented #383
  • Sep 27 18:38
    garetxe commented #388
  • Sep 27 18:22
    garetxe commented #389
  • Sep 26 10:50
    felixonmars closed #389
  • Sep 26 10:50
    felixonmars commented #389
  • Sep 26 07:55
    felixonmars opened #389
  • Sep 14 06:46
    Abastro edited #388
  • Sep 13 07:36
    Abastro opened #388
  • Sep 13 05:09
    Abastro closed #383
  • Aug 08 01:07
    rpglover64 commented #369
  • Aug 07 09:27

    garetxe on master

    Update version of Ubuntu for gi… (compare)

sheaf
@sheaf
the other example is that, with the Event changes in GTK4, instead of doing "getEventKeyKeyval" (which gave me an Int32), you directly pass a function which takes in a Word32 (and not Int32)
Iñaki
@garetxe
Ah, I remember now
sheaf
@sheaf
well actually getEventKeyKeyval returns a Word32 it seems? I'm really confused now
Iñaki
@garetxe
I had added an override to gdk-3.0 fixing the constants: set-attr Gdk/~KEY_.*@constant/@type name guint
but did not add it to gdk-4.0.
I will add it, and will release the revised version soon
sheaf
@sheaf
ok so the net effect will be that the pattern synonyms will be Word32 and not Int32? or are some of the Word32s supposed to be Int32s?
(I don't know why that change was necessary)
Iñaki
@garetxe
Yes, this changes all the KEY_* pattern synonyms to be Word32.
The right fix is to fix the introspection data upstream, but honestly I cannot remember if I ever filed a bug
sheaf
@sheaf
ok, great, thank you and sorry for all the questions
Iñaki
@garetxe
If you have a minute and can file the issue upstream that would be good (although the workaround will fix it on the haskell side)
No worries :)
OK, this is now haskell-gi/haskell-gi@aed4bcf . I will release the new version of the bindings in a week or two, once I am done with the documentation changes I have been working on.
sheaf
@sheaf
excellent, thank you
Iñaki
@garetxe
Sure, no problem
sheaf
@sheaf:matrix.org
[m]
since migrating to GTK 4 I keep getting issues with accessing disowned pointers when using event controllers
haskell-gi tells me that the call to widgetAddController is disowning the pointer, the problem being that there are many callbacks in the application that use the event controller
WARNING: Accessing a disowned pointer <0x00000000649d0680>, this may lead to crashes.

• Callstack for the unsafe access to the pointer:
CallStack (from HasCallStack):
  notOwnedWarning, called at .\\Data\\GI\\Base\\ManagedPtr.hs:194:25 in haskell-gi-ba_-0.25.0-e54f296d31598ac13124f52c63d6d957a696495e:Data.GI.Base.ManagedPtr
  unsafeManagedPtrCastPtr, called at .\\GI\\Gtk\\Objects\\GestureSingle.hs:584:17 in gi-gtk-4.0.4-f0386fac927306f5dfd453fb2b725fbcae403b0c:GI.Gtk.Objects.GestureSingle
  gestureSingleGetCurrentButton, called at src/app\MetaBrush\Event.hs:106:25 in main:MetaBrush.Event

• The pointer was disowned at:
CallStack (from HasCallStack):
  disownManagedPtr, called at .\\Data\\GI\\Base\\ManagedPtr.hs:335:15 in haskell-gi-ba_-0.25.0-e54f296d31598ac13124f52c63d6d957a696495e:Data.GI.Base.ManagedPtr
  disownObject, called at .\\GI\\Gtk\\Objects\\Widget.hs:5847:20 in gi-gtk-4.0.4-f0386fac927306f5dfd453fb2b725fbcae403b0c:GI.Gtk.Objects.Widget
  widgetAddController, called at src/app\MetaBrush\Application.hs:489:3 in main:MetaBrush.Application
sheaf
@sheaf:matrix.org
[m]
I don't have a simple reproducer and maybe I'm just doing something stupid but at the moment I'm confused because it looks like any use of event controllers runs into this issue
or maybe this is just to be expected? adding the event controller to the widget means the widget now controls the lifetime of the event controller, and if there are any callbacks that refer to this event controller I must ensure they stop happening if the widget is no longer around?
Iñaki
@garetxe
Hi @sheaf:matrix.org ! Yes, this is expected: the controller is marked as (transfer null) in the introspection data, which means that managing its memory becomes the responsibility of the widget. And in particular, haskell-gi has no way of knowing if the underlying pointer it's alive after the call (well, currently, in principle it could detect it, but I haven't implemented it yet).
But perhaps there is a way so that you don't need to access it explicitly after adding it to the widget. How does the callback code look like?
sheaf
@sheaf:matrix.org
[m]
thanks, that makes sense, I think I won't worry about it then

I have callbacks of the form

        void $ GTK.afterGestureClickPressed  viewportClicksController
          ( handleMouseButtonEvent viewportClicksController )

which monitors clicks in a certain drawing area for user interaction over that area

and handleMouseButtonEvent gestureClick nbClicks x y has code like do { button <- GTK.gestureSingleGetCurrentButton gestureClick; handleAction (MouseClick (Point2D x y) button nbClicks) }, usual stuff really
so all in all I'm just adding some event controllers to a drawing area so that the user can interact with it to draw stuff on it etc
the drawing area is going to be present for the lifetime of the application so I assume this isn't going to be an issue based on what you said, thanks for taking the time to answer
Iñaki
@garetxe
Mmm, I see the problem
In C this is not an issue, because the callback receives the pointer to self, but in the Haskell bindings we omit it
It will not be an issue in practice, no, but let me think if I can come up with a way of avoiding the warnings here
Iñaki
@garetxe
May I ask that you please report an issue in the issue tracker so I don't forget about it?
sheaf
@sheaf:matrix.org
[m]
yes, absolutely
Iñaki
@garetxe
Great, thanks a lot!
This is not very hard to fix (we just need to expose the self argument in the callback somehow), but I need to think about the best way to expose this in the bindings
Maybe an opportunity to use implicit parameters? :)
sheaf
@sheaf:matrix.org
[m]
hi @garetxe , the fix using implicit parameters seems absolutely fine to me, and I think seeing the implicit parameter in the callback type in the haddocks should give users enough to go on to figure this out
I'm unsure about how to try out the commit, usually I add a source-repository-package stanza to my cabal.project pointing to that commit but I can't do that here, could you advise?
I assume I have to clone the repository myself and then run some code generation step first?
Iñaki
@garetxe
hi @sheaf:matrix.org ! I am not sure why that wouldn't work. Just to be clear: you only need the latest haskell-gi and haskell-gi-base from github, the bindings themselves (the gi-* packages) in hackage should be OK. Just make sure that they are regenerated (removing your .dist-newstyle should do the job).
Please make sure that you use commit haskell-gi/haskell-gi@04bf16a, I have changed some things there
sheaf
@sheaf:matrix.org
[m]
ah, I didn't realise I only needed to change haskell-gi and haskell-gi base, I'm trying that now and will let you know, thanks
sheaf
@sheaf:matrix.org
[m]
yes, that works fine for me, thanks a lot
Iñaki
@garetxe
Great, thanks for checking!
Huub de Beer
@htdebeer
Hello everyone! I have successfully created a stack project to run the "hello world" example on haskell-gi's README page
However, I am a bit stumped how to configure / setup my project to use GTK4 with stack
I tried adding "gi-gtk-4.04" to the "extra-deps" property of the "stack.yaml" file, but then I run into trouble with mismatched dependencies
Is there an example project or howto how to use GTK4 + haskell-gi and stack?
Iñaki
@garetxe
Hi @htdebeer !