refactor: rename ProxyShell/FloatingWindow to Shell/FloatingWindow

also make ProxyWindowBase visible in docs
This commit is contained in:
outfoxxed 2024-02-17 05:14:15 -08:00
parent 083fff57be
commit dc616923aa
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
5 changed files with 26 additions and 18 deletions

View file

@ -75,9 +75,9 @@ Q_ENUM_NS(Enum);
} // namespace Layer } // namespace Layer
/// Type of keyboard focus that will be accepted by a [ProxyShellWindow] /// Type of keyboard focus that will be accepted by a [ShellWindow]
/// ///
/// [ProxyShellWindow]: ../proxyshellwindow /// [ShellWindow]: ../shellwindow
namespace KeyboardFocus { // NOLINT namespace KeyboardFocus { // NOLINT
Q_NAMESPACE; Q_NAMESPACE;
QML_ELEMENT; QML_ELEMENT;
@ -117,7 +117,7 @@ Q_ENUM_NS(Enum);
/// The following snippet creates a white bar attached to the bottom of [TODO] screen. /// The following snippet creates a white bar attached to the bottom of [TODO] screen.
/// ///
/// ```qml /// ```qml
/// ProxyShellWindow { /// ShellWindow {
/// anchors { /// anchors {
/// left: true /// left: true
/// bottom: true /// bottom: true
@ -162,7 +162,7 @@ class ProxyShellWindow: public ProxyWindowBase {
/// The degree of keyboard focus taken. Defaults to `KeyboardFocus.None`. /// The degree of keyboard focus taken. Defaults to `KeyboardFocus.None`.
Q_PROPERTY(KeyboardFocus::Enum keyboardFocus READ keyboardFocus WRITE setKeyboardFocus NOTIFY keyboardFocusChanged); Q_PROPERTY(KeyboardFocus::Enum keyboardFocus READ keyboardFocus WRITE setKeyboardFocus NOTIFY keyboardFocusChanged);
Q_PROPERTY(ScreenConfiguration::Enum screenConfiguration READ screenConfiguration WRITE setScreenConfiguration); Q_PROPERTY(ScreenConfiguration::Enum screenConfiguration READ screenConfiguration WRITE setScreenConfiguration);
QML_ELEMENT; QML_NAMED_ELEMENT(ShellWindow);
// clang-format on // clang-format on
public: public:

View file

@ -17,10 +17,12 @@
// Proxy to an actual window exposing a limited property set with the ability to // Proxy to an actual window exposing a limited property set with the ability to
// transfer it to a new window. // transfer it to a new window.
// Detaching a window and touching any property is a use after free.
// ///! Base class for reloadable windows
// NOTE: setting an `id` in qml will point to the proxy window and not the real window so things /// Base class for reloadable windows. See [ShellWindow] and [FloatingWindow]
// like anchors must use `item`. ///
/// [ShellWindow]: ../shellwindow
/// [FloatingWindow]: ../floatingwindow
class ProxyWindowBase: public Reloadable { class ProxyWindowBase: public Reloadable {
Q_OBJECT; Q_OBJECT;
/// The QtQuick window backing this window. /// The QtQuick window backing this window.
@ -58,7 +60,7 @@ class ProxyWindowBase: public Reloadable {
/// If non null then the clickable areas of the window will be determined by the provided region. /// If non null then the clickable areas of the window will be determined by the provided region.
/// ///
/// ```qml /// ```qml
/// ProxyShellWindow { /// ShellWindow {
/// // The mask region is set to `rect`, meaning only `rect` is clickable. /// // The mask region is set to `rect`, meaning only `rect` is clickable.
/// // All other clicks pass through the window to ones behind it. /// // All other clicks pass through the window to ones behind it.
/// mask: Region { item: rect } /// mask: Region { item: rect }
@ -80,7 +82,7 @@ class ProxyWindowBase: public Reloadable {
/// the mask region not clickable and pass through clicks inside it through the window. /// the mask region not clickable and pass through clicks inside it through the window.
/// ///
/// ```qml /// ```qml
/// ProxyShellWindow { /// ShellWindow {
/// // The mask region is set to `rect`, but the intersection mode is set to `Xor`. /// // The mask region is set to `rect`, but the intersection mode is set to `Xor`.
/// // This inverts the mask causing all clicks inside `rect` to be passed to the window /// // This inverts the mask causing all clicks inside `rect` to be passed to the window
/// // behind this one. /// // behind this one.
@ -98,6 +100,8 @@ class ProxyWindowBase: public Reloadable {
Q_PROPERTY(PendingRegion* mask READ mask WRITE setMask NOTIFY maskChanged); Q_PROPERTY(PendingRegion* mask READ mask WRITE setMask NOTIFY maskChanged);
Q_PROPERTY(QQmlListProperty<QObject> data READ data); Q_PROPERTY(QQmlListProperty<QObject> data READ data);
Q_CLASSINFO("DefaultProperty", "data"); Q_CLASSINFO("DefaultProperty", "data");
QML_ELEMENT;
QML_UNCREATABLE("use ShellWindow or FloatingWindow");
public: public:
explicit ProxyWindowBase(QObject* parent = nullptr); explicit ProxyWindowBase(QObject* parent = nullptr);
@ -162,9 +166,11 @@ private:
// qt attempts to resize the window but fails because wayland // qt attempts to resize the window but fails because wayland
// and only resizes the graphics context which looks terrible. // and only resizes the graphics context which looks terrible.
///! Standard floating window.
class ProxyFloatingWindow: public ProxyWindowBase { class ProxyFloatingWindow: public ProxyWindowBase {
Q_OBJECT; Q_OBJECT;
QML_ELEMENT; QML_NAMED_ELEMENT(FloatingWindow);
public: public:
// Setting geometry while the window is visible makes the content item shrink but not the window // Setting geometry while the window is visible makes the content item shrink but not the window

View file

@ -19,7 +19,7 @@ class QuickShellGlobal: public QObject {
/// ```qml /// ```qml
/// ShellRoot { /// ShellRoot {
/// Variants { /// Variants {
/// ProxyShellWindow { /// ShellWindow {
/// // ... /// // ...
/// } /// }
/// ///

View file

@ -9,7 +9,7 @@
// unfortunately QQuickScreenInfo is private. // unfortunately QQuickScreenInfo is private.
/// Monitor object useful for setting the monitor for a [ProxyShellWindow] /// Monitor object useful for setting the monitor for a [ShellWindow]
/// or querying information about the monitor. /// or querying information about the monitor.
/// ///
/// > [!WARNING] If the monitor is disconnected than any stored copies of its ShellMonitor will /// > [!WARNING] If the monitor is disconnected than any stored copies of its ShellMonitor will
@ -18,7 +18,7 @@
/// ///
/// Due to some technical limitations, it was not possible to reuse the native qml [Screen] type. /// Due to some technical limitations, it was not possible to reuse the native qml [Screen] type.
/// ///
/// [ProxyShellWindow]: ../proxyshellwindow /// [ShellWindow]: ../shellwindow
/// [Screen]: https://doc.qt.io/qt-6/qml-qtquick-screen.html /// [Screen]: https://doc.qt.io/qt-6/qml-qtquick-screen.html
class QuickShellScreenInfo: public QObject { class QuickShellScreenInfo: public QObject {
Q_OBJECT; Q_OBJECT;

View file

@ -9,8 +9,10 @@
///! The base class of all types that can be reloaded. ///! The base class of all types that can be reloaded.
/// Reloadables will attempt to take specific state from previous config revisions if possible. /// Reloadables will attempt to take specific state from previous config revisions if possible.
/// Some examples are `ProxyShellWindow` and `ProxyFloatingWindow` which will attempt to find the /// Some examples are [ProxyWindowBase] and [PersistentProperties]
/// windows assigned to them in the previous configuration. ///
/// [ProxyWindowBase]: ../proxywindowbase
/// [PersistentProperties]: ../persistentproperties
class Reloadable: public QObject, public QQmlParserStatus { class Reloadable: public QObject, public QQmlParserStatus {
Q_OBJECT; Q_OBJECT;
Q_INTERFACES(QQmlParserStatus); Q_INTERFACES(QQmlParserStatus);
@ -32,8 +34,8 @@ class Reloadable: public QObject, public QQmlParserStatus {
/// ///
/// // any non `Reloadable` object /// // any non `Reloadable` object
/// QtObject { /// QtObject {
/// ProxyFloatingWindow { /// FloatingWindow {
/// // this ProxyFloatingWindow will now be matched to the same one in the previous /// // this FloatingWindow will now be matched to the same one in the previous
/// // widget tree for its variant. "myFloatingWindow" refers to both the variant in /// // widget tree for its variant. "myFloatingWindow" refers to both the variant in
/// // `foo: 1` and `foo: 2` for each tree. /// // `foo: 1` and `foo: 2` for each tree.
/// reloadableId: "myFloatingWindow" /// reloadableId: "myFloatingWindow"