Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 25 12:26
    tclfs opened #377
  • Jan 23 11:54

    garetxe on master

    Add support for references to c… Merge branch 'master' of github… (compare)

  • Jan 22 21:28
    garetxe commented #373
  • Jan 22 21:28
    garetxe closed #373
  • Jan 22 21:14
    sigrdrifa commented #373
  • Jan 22 20:36
    garetxe commented #373
  • Jan 22 20:34
    garetxe commented #373
  • Jan 22 20:03
    sigrdrifa commented #373
  • Jan 22 19:52
    sigrdrifa commented #373
  • Jan 22 18:03
    garetxe commented #373
  • Jan 22 17:00
    sigrdrifa commented #373
  • Jan 22 16:10
    sigrdrifa commented #373
  • Jan 22 15:43
    sigrdrifa commented #373
  • Jan 22 11:46
    sigrdrifa commented #373
  • Jan 22 10:48
    garetxe commented #373
  • Jan 22 10:38
    garetxe commented #375
  • Jan 21 21:54
    sigrdrifa commented #373
  • Jan 20 16:58
    garetxe commented #376
  • Jan 20 16:58

    garetxe on master

    Add printWidgetTree function to… (compare)

  • Jan 20 16:58
    garetxe closed #376
sheaf
@sheaf:matrix.org
[m]
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 !

Is there an example project or howto how to use GTK4 + haskell-gi and stack?

Unfortunately nothing that I am aware of. It should be possible to do by adding enough packages to your stack.yaml, there is some relevant discussion in haskell-gi/haskell-gi#339

Nevertheless, if you have a chance I highly recommend trying cabal before going into that. At least for building haskell-gi generated bindings it is often easier with cabal.
Huub de Beer
@htdebeer
Thanks for you answer, @garetxe! Then I'll use cabal for the moment to learn how to use GTK4+Haskell and hope things will be resolved in the meanwhile.
Iñaki
@garetxe
No worries! Please do let me know if you have any issues with cabal, I'll be happy to help if I can.
Las
@Las:matrix.org
[m]

How would you translate

    new Gtk.Window [ On #destroy Gtk.mainQuit ]
`

to code that doesn't use labels?

sheaf
@sheaf:matrix.org
[m]
do
  window <- Gtk.windowNew
  Gtk.onWidgetDestroy window Gtk.mainQuit
Las
@Las:matrix.org
[m]
Thanks
Also: I'm trying out the WebKit example, and the text is much smaller than compared to other browsers
Is it supposed to be like this? Is it perhaps because of NixOS?
Iñaki
@garetxe
Hi @Las:matrix.org !
I also see the text slightly small here. It is not intentional, it seems to be due to defaults in webkit. You can check by opening "Epiphany", Gnome's web browser, which is also based on WebKit.
At least in my computer both epiphany and the webkit example display text at the same size.
If you figure out how to make the default a bit larger I would gladly welcome a pull request :)
Las
@Las:matrix.org
[m]
@garetxe: Thanks for confirming my suspicion, Epiphany shows much larger text (that is within the normal range, albeit a bit smaller than what Firefox displays). What I get on https://haskell.org is text so small that it's hard to even read. It's likely a problem with my nix derivation for it then.
Tisoxin
@vherrmann:shmerver.de
[m]
Hi! I'm currently trying to combine some concepts of gi-gtk-declarative with the reflex-gi-gtk library, but i've hit a (seeming) dead end for me.
But even though gtk-declarative is able to use new (from GI.Gtk) without specifying the bins type, i don't seem to be able to
I can't even write a top-level myNew = new (with GI.Gtk in scope)
1 reply
Tisoxin
@vherrmann:shmerver.de
[m]
Help would be greatly appreciated!
    • Overlapping instances for GI.Constructible a0 tag0
        arising from a use of ‘GI.new’
      Matching instances:
        instance [overlappable] (GI.GObject a, tag ~ 'GI.AttrConstruct) =>
                                GI.Constructible a tag
          -- Defined in ‘Data.GI.Base.Constructible’
        instance (tag ~ 'GI.AttrSet) =>
                 GI.Constructible G.AccelGroupEntry tag
          -- Defined in ‘GI.Gtk.Structs.AccelGroupEntry’
        instance (tag ~ 'GI.AttrSet) => GI.Constructible G.AccelKey tag
          -- Defined in ‘GI.Gtk.Structs.AccelKey’
        ...plus 35 others
        ...plus 95 instances involving out-of-scope types
        (use -fprint-potential-instances to see them all)
      (The choice depends on the instantiation of ‘a0, tag0’
       To pick the first instance above, use IncoherentInstances
       when compiling the other instance declarations)
    • In the expression: GI.new
      In an equation for ‘myNew’: myNew = GI.new
   |
97 | myNew = G.new
   |         ^^^^^
in this case GI is Data.GI.Base.ShortPrelude and G is GI.GTK