Comments (8)
Can we just add to this enum next values: Other(int) and DontScale=-1?
from gir.
Yes but in the automation context the more interesting question is if it's possible to detect such enums and divine the required additional variants. The "don't scale" case might be better reflected with Option::<IconSize>::None
.
from gir.
After better looking I found that we need find solution only for 3 functions gtk_icon_set_render_icon
, gtk_style_render_icon
, gtk_widget_render_icon
that accepts -1.
All other function accepts only registered values, so user can just store value returned by get_icon_register
and use it in function calls.
Only possible problem with IconSize matching but IMHO it mostly unneeded or can be solved direct comparing with stored value.
For 3 problem function we really can use optional size parameter, but it can't be detected automatically and need some config.
Also we needed solve difference in <type name="gint" c:type="GtkIconSize"/>
but IMHO it can be applied to all enums.
from gir.
Updated previous comment.
from gir.
When checking for <type name="gint" c:type="GtkIconSize"/>
found many
<type name="gint" c:type="int"/>
and only 2 other ginted ctypes: cairo_format_t
and pid_t
.
GUinted ctypes uid_t
with some unsigned
or unsigned int
.
from gir.
So this issue is extremely rare? Good. We could implement the conversions manually and let the generator assume they exist.
It's not clear why cairo_format_t
is replaced with an int
. Manually adding conversions to/from int
would take care of that I expect.
<type name="gint" c:type="int"/>
is weird but probably harmless, the rest seem like integers too.
from gir.
So, the current assumption in the code that enums are passed directly is problematic in light of these exceptions.
What do we do with GType
? There's enum Type
in glib
so the generator should ideally treat it as a converted enum as well.
from gir.
I think we can close this issue now.
from gir.
Related Issues (20)
- generated code broken HOT 2
- Regression in soup3-rs
- Types' names that start with a number in input gir file produce invalid code
- [Feature request] Create release for 0.16 HOT 1
- [Feature request] Create release for 0.17 HOT 1
- Fails to find .gir files out of nowhere
- Suggestion: Remove dox feature in favor of rustc args HOT 6
- How to fix libgir::parser warning with GTK4? HOT 4
- No bindings generated for Vala async methods
- `void`-returning non-throwing async method generates broken binding code HOT 1
- DEFAULT_GIR_PATH could respect CARGO_TARGET_DIR
- Append implementors list to ExtManual traits
- Add a way to disable abi test for a certain type
- Question: How to rename Object HOT 4
- Should generate deprecate warning in rust code, when C code macro expand to `__attribute__` `__deprecated__` HOT 6
- Should not implement `Default` if there is a function called `default`
- Allow for separate Gir and Library names
- Spurious clippy warning about unused import HOT 4
- [Bug] time_t64 causes regeneration to fail for gio-sys HOT 11
- Add support for `glib:finish-func` and related attributes for GIO async APIs
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 gir.