Comments (6)
There actually is a downside: a lot of weird constants in GIR utilize the fact that a gint
is always 32-bit to do some cursed bitting, and using Go's int
breaks that, because they're 64-bit. I've tried using int
before.
The real issue here is GIR using gint
for ResponseType
instead of being its own enum type afaict.
from gotk4.
Hm… cursed
How about convenience funcs similar to func gobool(b C.cairo_bool_t) bool
, but exported so that API users can access them?
from gotk4.
Eh, that's more trouble than it's worth. I think it's probably better to hard-code a special rule where all parameters with the name responseId
with type int
will have a type gtk.ResponseType
instead.
from gotk4.
Hm… while it can be somewhat annoying to not be able to create custom response types in more complex dialogs, one can design around it I guess
side note: I updated the issue description with a concrete example to showcase the exact issue/use case of the cannot use response (variable of type gtk.ResponseType) as int value
error.
And included a separate error constant unknown with invalid type
, which is probably due to my current setup
from gotk4.
the former is currently marked as an error in my environment (probably because it's not completely set up yet):
cannot use gtk.ResponseAccept (constant unknown with invalid type) as int value in argument to m.dialog.AddButton
. All cgo constants from gotk4 trigger this error, though only the first case is listed in the errors list
Does this happen during development or build? It should build fine even with this error.
the latter causes the following error message:
cannot use response (variable of type gtk.ResponseType) as int value in argument to m.dialog.AddButtoncompiler[IncompatibleAssign](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#IncompatibleAssign)
Just cast it to int: int(response)
. You'll have to do the same for gtk.Response*
constants too.
from gotk4.
Does this happen during development or build? It should build fine even with this error.
That was during development. A build shows an error which sounds more sensible:
vendor/github.com/diamondburned/gotk4/pkg/core/glib/paramspec.go:60:13: could not determine kind of name for C.g_param_spec_is_valid_name
That's why the IDE cannot find the type.
I need to upgrade my system first.
Just cast it to int: int(response). You'll have to do the same for gtk.Response* constants too.
Indeed… I thought I would need a more complex solution due to it involving cgo. Seems both errors have the same root cause, will close the issue.
Thank you!
from gotk4.
Related Issues (20)
- Support binding Go objects to GObjects with `GObject.set_qdata`
- How to use GTK 4 GridView with gio.ListStore and gtk.BuilderListItemFactory HOT 2
- pkg-config not working from cgo in snap HOT 7
- Apply for GNOME Circle HOT 1
- SIGSEGV: segmentation violation when using a go routine inside gtk.DropTarget.Connect HOT 8
- Migrate g_log to log/slog HOT 1
- SetShowArrow seems to be missing on gtk.DropDown HOT 1
- Widget memory is not freed when removed HOT 10
- VTE bindings HOT 14
- Add core/glib.PID built-in
- Panic in ListBox.ConnectRowSelected HOT 10
- Error compiling using mingw HOT 6
- Add a definition for GTK_INVALID_LIST_POSITION HOT 2
- GtkListView scroll_to missing HOT 1
- Segmentation fault when calling widget functions inside a goroutine HOT 4
- DragEnd on DragSource not being fired when dragged outside of app HOT 1
- Error when initializing listview with empty list HOT 2
- ConnectCommandLine, how to close remote application? HOT 1
- Missing: Information trees HOT 14
- gtk.Picture memory leak HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gotk4.