Open PatchMixolydic opened 2 years ago
For the sake of posterity, one can use Window::set_decorated
and Window::set_size
to attain borderless fullscreen, but this might not be usable for games that need more resources or low input latency.
I seem to be terrible at remembering and worse at reading. There is, in fact, a way to use ffi::glfwSetWindowMonitor
(the original issue used to claim that there wasn't) thanks to <Window as Context>::window_ptr
. However, doing so seems to give me an error from Xorg (which may be because the code I threw together to test this is unsound):
X Error of failed request: BadRRCrtc (invalid Crtc parameter)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 20 (RRGetCrtcInfo)
Crtc id in failed request: 0xef600101
Serial number of failed request: 990
Current serial number in output stream: 990
The recommended way to set a window to fullscreen after creating it seems to be
glfwSetWindowMonitor
. The wrapper for this,Glfw::set_monitor
, takes aWindowMode<'_>
. In order to useWindowMode::Fullscreen
, you need a reference to aMonitor
. The only ways to get such a reference seem to beGlfw::with_primary_monitor
orGlfw::with_connected_monitors
, both of which require a closure so that the&Monitor
they yield can only live within that closure.I'm designing a backend-agnostic graphics framework for a game engine. To that end, I have a trait like this:
When trying to implement this for GLFW, however, it quickly becomes apparent that the borrow checker isn't pleased with my harebrained scheme:
Due to this, I seem to be at an impasse. I can't recreate the window on the fly since my trait for
glfw::Glfw
and similar (Backend
) requires associated types and therefore would require generics to use it in a trait object.If the real issue is a severe design flaw on my end or if providing an API for this is intractable/impossible, please feel free to close this issue.