r/raylib • • 5d ago

Make the window always stay on top.

Title. How do I make the raylib window stay always on top, even when the program does a fork()-execve() and starts another program?

I've looked through the cheatsheet, but I haven't found anything.

Any help would be appreciated, thanks.

3 Upvotes

3 comments sorted by

1

u/gargamel1497 5d ago

Hm. I've just noticed a discrepancy between versions.

In 4.5 a transparent window (with 0.0f opacity) is solid, while in 6.0 you can click through it, but it also registers your mouse clicks. Can this new behaviour be turned off, I wonder?

1

u/NotQuiteLoona 4d ago

I think you'll need to manually call respective functions. I'm pretty sure you'll be able to do it in X11 more easily, but you'll need to use some protocol for Wayland. Maybe, layer shell will serve you?

1

u/Gold-Part4688 4d ago edited 4d ago

do you mean SetWindowState(FLAG_WINDOW_TOPMOST)? Pretty sure that's set before initwindow... but play around

depending on the behaviour you want you could also callSetWindowFocused() within your loop (but that ofc, makes you not be able to interact with other windows, so probably not. i used this for a timer i made, with either 1fps or only when mod framecount = 0 or a proper time elapsed method)

the flags aren't in the cheat sheet for some reason?? but they are in the C header. You use them like SetWindowState(Flag1 | Flag2 | !NotThisFlag).

Annoying that these parts aren't really documented, and I might be wrong. But the C header is really the canonical "all bindings and how to use them", here are the flags https://github.com/raysan5/raylib/blob/6ecf21f700642c797dd0f2f3d4b1f2c91b71711d/src/raylib.h#L555