-
Notifications
You must be signed in to change notification settings - Fork 785
Description
(I'm using Rust.)
When teaching Slint, you call the exported component inheriting Window a ...Window:
MainWindow: https://releases.slint.dev/1.7.2/docs/slint/src/quickstart/getting_started#id3AppWindow: https://github.com/slint-ui/slint-rust-template/blob/main/src/main.rs
Then, this ...Window is indirectly called a "component" by the name of your SampleComponent (which inherits Window in .slint code), implements ComponentHandle, and, through that, has itself a window() getter, which returns a Window (giving you code like app_window.window()).
Exporting components not inheriting Window to Rust isn't allowed:
warning: [email protected]: Exported component 'AppWindow' doesn't inherit Window. This is deprecated
So, a ComponentHandle must always be a component narrowed down to a .slint Window.
The fact that a generated struct like AppWindow really only allows you to interact with the window's client area (disregarding the deeper window() -> Window), and "window" may not even be the most suitable term for the rendering surface of an Android app tops off the confusion.
Is the Window the window() getter returns even a real window on every platform?
Maybe, it would be justified to redefine and here and there switch or rename the terms for more clarity and presenting a more streamlined concept.
Possible improvement:
WindowComponentinstead ofComponentHandle, because it can only be one narrow kind of component.- Establish a convention of never calling a
componentinheritingWindowa...Window. For single-window apps, the recommendation could becomponent Main inherits Window. In Rust, this could belet main_component, although= Main::new();would be rather undesirable. Maybecomponent MainComponent inherits Windowwould be acceptable. OrAppComponent. But the user may want to useAppas their own struct that holds all of their business data and window components.- When an app implements more than a single window, the developer would semantically distinguish them through their names. These names also shouldn't have a
Windowsuffix. If it's a message box window, e.g., it could just becomponent MessageBox inherits Window.
- When an app implements more than a single window, the developer would semantically distinguish them through their names. These names also shouldn't have a
window()can be kept, because the struct providing the getter now is more recognizable as the property-based reactive client area of the window.- Would you like to keep
Windowin .slint code? Even if this isn't necessarily always the most natural term for the app surface in an Android context, there can be movable windows on Android, like with Samsung DeX when connecting your monitor to your phone. An app on a regular phone could be seen as in a fullscreen window.
Other way:
- Keep using names like
AppWindow, which would also be aWindowComponent(trait). This would be in harmony with these components presenting in dedicated associated windows. - Find a different name for
window()and its return typeWindow. But I don't know what that could be. (Perhaps something with "non-client"?)