-
Notifications
You must be signed in to change notification settings - Fork 237
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
Window control methods #285
Comments
Note: this is similar to #125 feature request, though in my case |
Also in #125 you are talking about |
yep, at first I thought was a duplicate but it's not |
Let's do this! |
I'll probably follow GLFW's: https://www.glfw.org/docs/latest/window_guide.html#window_properties |
Hey @djowel, any updates on this? I have a project which involves to have several windows, but now it's currently impossible due to the same reasons as the OP |
No update yet, But as always, I welcome a PR. |
Alright, if there are no takers, I'll take this. |
@johannphilippe works on MacOS. I'll try Windows and Linux. Which platform have you tested with? |
I've already dealt with this in the past with gtk3 and win32, but was many years ago, if needed I can help with gtk3 ATM. 2 things:
I think element or host (window/view) we are dealing with "widgets" in general, so the concept should be consistent for both. Second: don't want to be picky but some things are not clear to me now, in my opinion the logic in general should be:
but, how to deal with the widget destruction when the "close event" is accepted? |
GLFW does not have widgets
That is obvious. |
Let me be more clear: Element's window does not own its view. Only the view destroys the elements it contains. |
But also take note that even child elements in a view can be shared. Anyway, in short: lifetime management is not a concern of |
That would be great. Thanks for the offer! I'll start with MacOS. |
Any takers for windows? |
I'm pretty sure it was Linux (Mint 20) since it was/is my dev platform. |
I think the window should automatically open when constructed and close (destroyed) when destructed (C++ RAII). Then there should be |
The window is "opened" (whatever it means in a UI context, to me could mean "alive") when constructed, it's just not visible in some cases (like GTK and maybe also win32). |
I agree with you. An explicit For exemple I want to have a splash screen that does background initialization of my app. I will think to (maybe not the best way) create the 2 windows (splash screen and main window) first, do initialization in another thread (which involves to set some state values to the main window instance), and when everything is OK just Automatically |
A few methods could be added to improve the control over
window
, particularly when user handles several windows in the application.close()
: simply closes the window. I could make it work easily withgtk_window_close(GTK_WINDOW(_window->host));
on linux.open()
: opens the window that has been closed (or that has been created)hide()
: minimizes the window without closing itshow()
: shows a minimized window.Those could be renamed to be more expressive.
That would imply to have a window object that does not necessarily displays when created so the user can decide when to display it or not.
Also, I could run several windows in one app fine, if the process to create a second window is delayed (responding to a click event for example), the second window displays, but the view content is not drawn.
For example :
The text was updated successfully, but these errors were encountered: