Skip to content

Term confusion (Window / component / ComponentHandle / AppWindow ) #6027

Open
@Enyium

Description

@Enyium

(I'm using Rust.)

When teaching Slint, you call the exported component inheriting Window a ...Window:

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: slint-test@0.1.0: 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:

  • WindowComponent instead of ComponentHandle, because it can only be one narrow kind of component.
  • Establish a convention of never calling a component inheriting Window a ...Window. For single-window apps, the recommendation could be component Main inherits Window. In Rust, this could be let main_component, although = Main::new(); would be rather undesirable. Maybe component MainComponent inherits Window would be acceptable. Or AppComponent. But the user may want to use App as 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 Window suffix. If it's a message box window, e.g., it could just be component MessageBox inherits Window.
  • 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 Window in .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 a WindowComponent (trait). This would be in harmony with these components presenting in dedicated associated windows.
  • Find a different name for window() and its return type Window. But I don't know what that could be. (Perhaps something with "non-client"?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:language-rustRust API and codegen (mO,mS)a:language-slintCompiler for the .slint language (mO,bF)priority:lowLowest priority. The issue is kept open for tracking purpose, but noone is actively working on thisrfcRequest for comments: proposals for changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions