Skip to content
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

Fixed gint/guint not being different types #22

Merged
merged 3 commits into from Aug 30, 2017
Merged

Conversation

PMunch
Copy link
Contributor

@PMunch PMunch commented Jun 20, 2017

Noticed while using GdkColor that guint and gint were not different types. This meant that I couldn't assign the highest values of a guint to it without doing weird casting. This PR should fix the issue.

src/gtk2.nim Outdated
@@ -6463,7 +6463,7 @@ proc in_drag*(a: PHandleBox): guint
proc set_in_drag*(a: PHandleBox, `in_drag`: guint)
proc shrink_on_detach*(a: PHandleBox): guint
proc set_shrink_on_detach*(a: PHandleBox, `shrink_on_detach`: guint)
proc snap_edge*(a: PHandleBox): gint
#proc snap_edge*(a: PHandleBox): gint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the comment on line #13328:
set_snap_edge was in a when false. snap_edge put in when false as the actual return type should be GtkPositionType not gint

@PMunch
Copy link
Contributor Author

PMunch commented Jun 20, 2017

Better? All those should really be turned into enums, but that is a task for another day, or for someone else.

Copy link
Contributor

@dom96 dom96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you verify that Aporia still compiles after these changes?

@PMunch
Copy link
Contributor Author

PMunch commented Aug 30, 2017

c2nim seems to do some weird stuff when converting enums. But with the latest push to the PMunch/gtk2 branch and the PR nim-lang/Aporia#145 it compiles and runs fine.

@dom96
Copy link
Contributor

dom96 commented Aug 30, 2017

Okay, cool. Hopefully this won't cause any breakage.

@dom96 dom96 merged commit e2d2e5e into nim-lang:master Aug 30, 2017
@dom96
Copy link
Contributor

dom96 commented Aug 30, 2017

oh damn, I misread. Thought there would be no changes required to Aporia :\

@dom96
Copy link
Contributor

dom96 commented Aug 30, 2017

Oh well. I guess this is for the best anyway.

@PMunch
Copy link
Contributor Author

PMunch commented Aug 31, 2017

Yeah, the wrapper was simply wrong, so this is indeed for the best. It breaks some code, but at least it should now be more correct. I'm sure there are still things left to be converted. It seems like a lot of the code uses enums, for which the definitions have been converted to Nim const int statements and the usage of which has been converted to Nim uint statements.. And C doing its uint variable = -1; thing certainly doesn't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants