Closed dcnieho closed 1 year ago
Is it possible to make a window that is initially hidden?
... No. But you may want to look at internal/backend_impls/backend_window_helper/glfw_window_helper.cpp
and see if you can make an adaptation :-)
something like this, with corresponding changes to the app parameters, should do the trick:
diff --git a/src/hello_imgui/internal/backend_impls/backend_window_helper/glfw_window_helper.cpp b/src/hello_imgui/internal/backend_impls/backend_window_helper/glfw_window_helper.cpp
index 09590aa..4ecaa2c 100644
--- a/src/hello_imgui/internal/backend_impls/backend_window_helper/glfw_window_helper.cpp
+++ b/src/hello_imgui/internal/backend_impls/backend_window_helper/glfw_window_helper.cpp
@@ -81,6 +81,11 @@ namespace HelloImGui { namespace BackendApi
else
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
+ if (appWindowParams.hidden)
+ glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
+ else
+ glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE);
+
// GLFW_SCALE_TO_MONITOR is set to false: we set manually the window size in screen coordinates,
// then AbstractRunner::MakeWindowSizeRelativeTo96Ppi_IfRequired() may resize the window at the second frame
Does that look ok to you? Should i explore that further?
That or an extra entry Hidden in enum class WindowSizeState
. maybe thats more logical actually
tell me what you prefer and i'll try an implementation
I do not know yet what is the best possible location, between WindowSizeState or a hidden flag.
I will need to think about it in more details, but of course your help would be appreciated. Any change needs to be validated with glfw &sdl, on the different OS (windows, mac, linux, etc.); which makes this a bit complex (but I would handle the porting part ;-)
By the way: would using WindowSizeState.minimized be sufficient for you? Beware, it might be broken; this is yet another corner case that I did not explore intensively.
I understand that gets hairy. glfw at least just supports it, and if it then doesn't work on a platform thats kinda not your problem.
When setting params.app_window_params.window_geometry.window_size_state = hello_imgui.WindowSizeState.minimized
, the window still flashes briefly when its created.
Furthermore, later doing hello_imgui.get_runner_params().app_window_params.window_geometry.window_size_state = hello_imgui.WindowSizeState.standard
does nothing, so i can't unminimize it. And the autosize we discussed today doesn't work when in minimized state :p
After studying this, I think that WindowSizeState is not the appropriate place, and that a better solution would be either to add AppWindowParams::initiallyHidden
(if taken into account only at startup), or AppWindowParams::hidden
(if this is taken into account dynamically).
Hi,
Since this was also asked in https://github.com/pthom/hello_imgui/issues/41, I implemented a solution in https://github.com/pthom/hello_imgui/commit/d6af807aebc3cf9d87b2a3547402647f475b1054
Super, that should do the trick for me! Will test in the next week or so (let me know if you make a pypi release, that makes testing much quicker ;) )
Tested with 0.8.5: works!
I'd like to create a window that is initially hidden, i will only show it later. right now it flashes up before i get a chance to call
glfw.hide_window(self._glfw_window)
in thepost_init
callback. I tried:but it makes sense that wouldn't work since glfw isn't even initialized at this point, correct?
Is it possible to make a window that is initially hidden?