Design of window state API #1884
Replies: 8 comments 58 replies
-
I'm broadly in agreement that window state is a window API, and app-level state control is at least questionable. The two exceptions I can see to this are:
I'm definitely in favour of exposing better APIs for exposing screens/displays, and incorporating that representation into APIs that allow a window move to a different screen. Having this representation would definitely make the existing The core window state API is less controversial - I agree As with the cursor API discussion, we also have a question about the backend API - but we should sort out the public API first. |
Beta Was this translation helpful? Give feedback.
-
If its easy to do then we can expose the window state API at window level only. This would provide a singular way to do a thing, which is good for bug fixing. For screen/display API, we can have a registry like The
The usage of the API can be:
What do you think about this? |
Beta Was this translation helpful? Give feedback.
-
There's two parts here. Firstly: renaming Secondly: Most of your commentary about the implementation seems to be working around the fact that you're setting Essentially, there shouldn't ever be any ambiguity about which display a window is on, or what state the window is in. Property getters should be using the native API as the source of truth - so no matter which state you're in, you should be able to ask for the windows current state, and the native API will tell you the current state of the window. |
Beta Was this translation helpful? Give feedback.
-
For the frontend:At the app level:
At the window level:
For the backend:At the app level: a) For list of displays:
b) For name of the display: On WinForms: At the window level:
No shadow variables will be used for getting and setting window states. @freakboy3742 Does this look good? |
Beta Was this translation helpful? Give feedback.
-
@freakboy3742 I have created a new PR: #1911 that implements: #1884 (comment) . If you need any changes, let me know. |
Beta Was this translation helpful? Give feedback.
-
For the frontend:At the app level:
At the window level:
For setting windows FullScreen, existing APIs: For the backend:At the app level: a) For list of displays:
b) For name of the display: On WinForms: At the window level:
No shadow variables will be used for getting and setting window states. @freakboy3742 Does this look good? |
Beta Was this translation helpful? Give feedback.
-
I had choosen tuple to prevent users from modifying
I agree. I will modify the
So, it should just return the
No particular reason. I had just mentioned it since it is the return type of
I agree, all 3 formats should be permitted.
We can change the name, if you want.
I'll research more and will update you with what I come up with. |
Beta Was this translation helpful? Give feedback.
-
Now that #1930 is completed, we need to discuss the design for window state API. Earlier, we had discussed about the possibility of a
For setting in full screen mode:
On the backend:
Do you think this is good or do we need any changes? Let me know. |
Beta Was this translation helpful? Give feedback.
-
As per our discussion until now, here is what I think the window state API should look like:
Window by Window Basis'
App wide Basis:
I am not too keen about the app wide property.
An app is made up of windows. A window has a state, i.e., Maximimized, Minimized, Full Screened, etc. But an app doesn't have such a state. An app state can be Running, Sleeping, Paused, etc., which is totally different from window state.
Besides, if a user wants to set all the windows of an app to a particular window state then they can do it themselves:
Hence, I think an app wide exposure of window state API is not logical nor good. The only reason why I had implemented it app-wide is because the previous API, i.e.,
set_full_screen()
andexit_full_screen()
were exposed at the app level. But I think this is fundamentally wrong. Apps contain Windows. Apps are not Windows. Doing Window state operations on them doesn't make any sense. So, if we could remove the app wide property then it would become much more logical and clear.Questions about the cocoa implementation:
From the code of cocoa implementation of
set_full_screen()
, I think, it is setting the given windows full screen on the different screens according to the order in which they are passed into the method.From looking at the podium source code, the above seems to be true. In the source code, you are changing the order in which the windows are passed to
set_full_screen()
to set the windows full screen on a particular display among the available displays.If the above is true, then I think setting a windows to a particular display should be a separate API. This would allow more flexibility and bring clarity to the API as they do not need to juggle and pass windows to set the window on a particular display. So, we can have another registry like
app.screens
orapp.displays
which would be similar toapp.windows
and will hold a handle to all the available displays on the system on which the app is running.@freakboy3742 Let me know how do you feel about this.
Beta Was this translation helpful? Give feedback.
All reactions