-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does lgi support Gtk4? #278
Comments
Currently, I don't think so. |
the introspection of gtk4 works after #273 at least on my setup. Until now i have encountered no crashes which i would assign to lgi |
@jdeut Oh, those are good news. I'll try it by myself to see if it works |
@JeysonFlores, did it work for you? I mean, maybe support is already there (and this issue could be closed). |
i tried this, no luck, does not work for me tried with gtk3, works like a charm |
using linux mint 21.1 vera (latest, greatest of them all lol) thank you, bow |
also, seems that something has been done in direction to make lgi be used with gtk4, but i am so confused i have installed lgi with luarocks please install lgi if i git clone and build / compile on my system, should this update lgi to version with 'let's make lgi work with gtk4' commits included ? godspeed aum |
Hello @aum7. Yeah, the release cycle of LGI is a mess. Currently, the latest release is the one version from 2017. It's the version distro packages should be, and also the one you'll install by default with Luarocks. To use the latest developments from here, you have to either, manually build from sources, or use the rockspec file from #305 as described in the PR message. |
@Aire-One thank you for the clear & useful answer since i am low-level programmer (lol, meaning not an experienced one), i would like to clarify, before i (again) brake my os (though i recently got used to do dev in qemu vm)
thank you for your help, really appreciate ps : is there a particular reason that public version has not been updated, especially since gtk4 is already mature for few years now ? (i might be wrong here.) and this is really useful binding, afaik. just curious pps: if i ask devs for public update, will it make any difference ? have fun aum |
Looks good to me.
It wouldn't change much. We already have this request on other threads... The SCM rockspec is actually a community initiative to distribute an up-to-date version. |
he he he while installing lgi, i got compiler warnings i might nevertheless try it, can not hurt, wright ? lol thanks for your help have fun |
This is indeed an issue on our side. You can silently ignore these warnings. They are just deprecation notices because LGI still uses ancient libraries. It shouldn't affect your work. |
all hail aireone ! have fun |
just for the sake of completeness, here is a reply from glib devs : The warnings come from lgi using deprecated GLib API. GLib has nothing to do with it. The appropriate fix is for lgi not to use deprecated API. If they wish to continue using deprecated API while avoiding the compiler warnings that come from that choice, then they have two options:
quote end have fun |
not sure, maybe this is not a good place for such questions, i trust you will let me know ;) i would kindly ask if someone can offer some help :
gives me a runtime error qs:
which again gives me an runtime error ( attempt to call global 'dump' (a nil value) ), this time i guess because i do not have i am particularly interested in :
using lnx mint 21.1 thank you for your understanding godspeed |
while browsing some more, i might have found partial answer to q2 :
then it occurred i might try :
running the code produced no error. good. now i need to use this icon. how ? |
olo kindly asking for a help, i got stuck here godspeed |
Recent finding: Here is a repository with some GTK4 code examples in Lua with LGI https://github.com/Miqueas/GTK-Examples/tree/main/lua/gtk4 that can be used as references. (CC @Miqueas) |
Yes, the repo isn't so much very active, but in there you may found useful examples |
thanks for update have fun aum |
Fellas, i poked around and found out. Here's some investigative work:
Not sure what's going on here. Do these features rely on the now nonexistant Paste and run this lua code for a blank window (It's supposed to have a button) Snippet: lgi gtk4 window (from constructors)
lgi = require 'lgi'
gtk = lgi.require('Gtk','4.0')
local app= gtk.Application{application_id = 'org.phicross.gtk4lua.intro'}
local handles = {application = app}
function app:on_startup()
end
function app:on_activate()
handles.window = gtk.ApplicationWindow{
id = 'theWindow',
application = self,
title = "intro app.",
default_width = 200,
default_height = 200,
gtk.Grid {
id='atop',
orientation = gtk.Orientation.VERTICAL,
gtk.Button {
id = "theButton",
gtk.Label{
id = 'intro',
label = 'whatsup.'
}
, on_clicked = function(self)
print 'did you just slap me?'
end
}
}
}
handles.window:show()
end
app:run(arg) Now paste and run this new (ugly) version, and this time the button shows up. Snippet: lgi gtk4 window (explicitly setting hierarchy)
lgi = require 'lgi'
gtk = lgi.require('Gtk','4.0')
local app= gtk.Application{application_id = 'org.phicross.gtk4lua.intro'}
local handles = {application = app}
function app:on_startup()
end
function app:on_activate()
handles.window = gtk.ApplicationWindow{
application = self,
title = "intro app.",
default_width = 200,
default_height = 200
}
handles.atop = gtk.Box{ orientation = gtk.Orientation.VERTICAL}
handles.window:set_child(handles.atop)
print('ready.')
handles.theButton = gtk.Button {
label = 'slap',
on_clicked = function(self)
print 'did you just slap me?'
end
}
handles.atop:append(handles.theButton)
function handles.theButton:on_clicked()
print 'overriden click callback.'
end
handles.window:show()
end
app:run(arg)
|
@PhiCross5 that's probably a copy/past issue, but your first snippet can't work because the line |
Oops, sorry about that. Both the snippets had been improperly pasted, so i fixed them now. |
Early work in GTK4 migrationAs of #313 , nested constructors work again on GTK4, but only for Boxes. Containers were the secret sauce.Nested constructors were one of the custom niceties provided by lgi's internal GTK override. In GTK3, they relied on methods from the Help us migrateContributors are welcome to help reimplement these wrappings or propose a new way to describe a widget hierarchy neatly in lua code without somehow bringing back "the diddly gosh darned Generic Containers" GTK4 wants everyone to drop so much. What to do if "i want GTK4 now"Just like any other C library with a G-Introspection package available for it, you can use the methods directly as if they were just renamed C functions under a namespace. Because lgi does support GTK4, it just doesn't have all the fancy object-oriented bindings for it like it did for GTK3. When in doubt, follow the C examples by GTK themselves and convert the functions to lgi's calling convention (it is described in the documentation) |
Hi, I was considering using Lgi with Fennel for one of my future projects. However I develop apps for the eOS platform, and in the next months they'll be releasing Gtk4 (only for developers) to start working on it. So I was wondering Lgi supports (at least decently) Gtk4. It seems one of the latest commits was about not getting errors on Gtk but I don't think that means a full support of the new version of Gtk. Also, if the answer is no, Do you plan to give support to Gtk4 in the near future? Thanks
The text was updated successfully, but these errors were encountered: