Open superloach opened 3 years ago
Hi! Sorry but I'm not sure your suggestion. Is what you want an API to pass an existing X Window handle to make Ebiten render on?
That's essentially it, yes. A convenience method for detecting this from XSCREENSAVER_WINDOW
could be written, but it's not necessary.
Edit: or in the way vroot.h
does it, which is xlib stuff (I think)
I'd like to know the detailed intention why you want to pass it. For a screen saver, doesn't Ebiten's fullscreen work?
XScreenSaver's APIs require you to use the window it provides. This allows it to render into a preview window, and to manage locking/unlocking.
Ah, I see. I didn't know the software XScreenSaver and that this is different from the X Window itself.
https://en.wikipedia.org/wiki/XScreenSaver
I'm a little hesitate to expose the window handle from the Ebiten internal. Instead of adding an API, does using XSCREENSAVER_WINDOW work? Ebiten would detect the existence of XSCREENSAVER_WINDOW and use it automatically when available. Does this sound good?
That sounds great if you can do that, yeah!
It would appear that XSCREENSAVER_WINDOW
is in 0x...
literal format. Not sure what the bit depth is, but that's probably a standard X thing.
I will investigate the lock/unlock signals later today, though that's probably not within the scope of Ebiten.
Edit: it appears to only send SIGTERM
, which is fine for the user's program to handle itself.
Edit: looks like X uses uint32
for everything, though you probably already knew that.
Hmm, from https://dbeef.lol/2018/12/26/writing-x11-screensaver-with-c-opengl/, this is not an easy task since the GLFW part should be replaced with GLX. As long as https://github.com/glfw/glfw/issues/25 is not resolved, I'm afraid I have to de-prioritize this work.
No worries! This was really just a side project idea I had, so we can close it if there isn't any necessity for this feature.
Let's keep this open. Though this is a tough work, I understand it's worth trying when GLFW can accept a native window handler or we can remove the dependency on GLFW from Ebiten.
Ebiten is currently the most straightforward way to do 2D graphics in Go. APIs for working with XScreenSaver would be useful. This would probably not be exposed in the main package.
I have done some poking around already, and it appears that XScreenSaver creates its own virtual root window for rendering onto, and that's tricky with GLFW. This window may also be exposed with a
XSCREENSAVER_WINDOW
environment variable.I am not really aware of how the window initialization works in Ebiten, but if it's possible to hook into this, I'd like to make it available. Support for screensaver systems on other platforms may be possible as well.
Edit: for GLFW, #25 seems to be the relevant issue here.