-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
X11 bindings broken/annoying #3944
Comments
Just to add some further context to future readers about the segment at the bottom: extern Window XCreateSimpleWindow(
Display* /* display */,
Window /* parent */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int /* border_width */,
unsigned long /* border */,
unsigned long /* background */
); It takes unsigned long for border and background, but the vendor api defines the procedure as CreateSimpleWindow :: proc(
display: ^Display,
parent: Window,
x: i32,
y: i32,
width: u32,
height: u32,
bordersz: u32,
border: int,
bg: int,
) -> Window --- |
So the issue is that the signedness is wrong? |
Yes, it should be uint. It's not the width that's wrong, but its "signedness." |
Context
While playing with the X11 bindings I encountered a fatal bug and a couple annoyances.
Odin: dev-2024-07:7237f9c9f
OS: Linux Mint 21.3, Linux 5.15.0-113-generic
CPU: Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz
RAM: 7637 MiB
Backend: LLVM 14.0.0
Expected Behavior
I am expecting the X11.DefaultDepth() function to return an i32
Current Behavior
It immediately segfaults my program.
Failure Information (for bugs)
The bindings to the C function are wrong. DefaultDepth is a macro that takes two arguments in C (*Display, int).
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Just call the function. It reliably segfaults my process.
Failure Logs
Please include any relevant log snippets or files here.
Segmentation fault (core dumped)
Additionally, some odin xlib functions return the wrong type of integer. This is annoying since you have to cast them to feed them into their respective function. The one example I encountered:
black: uint = X11.BlackPixel(display, screen)
white: uint = X11.WhitePixel(display, screen)
but the function X11.CreateSimpleWindow() takes two "colors" as the final arguments and those colors are int, not uint. I think they should match.
The text was updated successfully, but these errors were encountered: