diff --git a/src/compositor/qml/Compositor.qml b/src/compositor/qml/Compositor.qml index 0e728abb..ad5e83d3 100644 --- a/src/compositor/qml/Compositor.qml +++ b/src/compositor/qml/Compositor.qml @@ -222,17 +222,13 @@ WaylandCompositor { LS.LiriShellV1 { id: shellHelper - property bool isReady: false - onShortcutBound: { shortcutComponent.incubateObject(keyBindings, { shortcut: shortcut }); } onReady: { - isReady = true; - shellHelperTimer.running = false; - - for (var i = 0; i < outputs.length; i++) - outputs[i].reveal(); + console.log("ready",output); + output.ready = true; + shellHelper.showPanel(output); } onTerminateRequested: { liriCompositor.quit(); @@ -243,17 +239,6 @@ WaylandCompositor { id: liriModal } - Timer { - id: shellHelperTimer - - interval: 15000 - running: true - onTriggered: { - for (var i = 0; i < outputs.length; i++) - outputs[i].reveal(); - } - } - LS.LiriOsdV1 { id: liriOsd } @@ -266,7 +251,7 @@ WaylandCompositor { context: Qt.ApplicationShortcut sequence: shortcut ? shortcut.sequence : "" - enabled: shellHelper.isReady + //enabled: shellHelper.isReady onActivated: { shortcut.activate(); } diff --git a/src/compositor/qml/desktop/Output.qml b/src/compositor/qml/desktop/Output.qml index 3bed2c0e..7a02915b 100644 --- a/src/compositor/qml/desktop/Output.qml +++ b/src/compositor/qml/desktop/Output.qml @@ -24,6 +24,8 @@ LS.WaylandOutput { property alias showFps: outputWindow.showFps property alias showInformation: outputWindow.showInformation + property bool ready: false + property var exportDmabufFrame: null property bool __idle: false @@ -43,10 +45,6 @@ LS.WaylandOutput { * Methods */ - function reveal() { - outputWindow.reveal(); - } - function wake() { if (!__idle) return; diff --git a/src/compositor/qml/desktop/OutputWindow.qml b/src/compositor/qml/desktop/OutputWindow.qml index e5b62aa8..3de51c2f 100644 --- a/src/compositor/qml/desktop/OutputWindow.qml +++ b/src/compositor/qml/desktop/OutputWindow.qml @@ -17,7 +17,6 @@ Window { readonly property alias layerSurfacesModel: layerSurfacesModel readonly property alias currentWorkspace: workspacesView.currentWorkspace - readonly property alias splashVisible: splash.visible property alias showFps: fpsIndicator.visible property alias showInformation: outputInfo.visible @@ -31,9 +30,7 @@ Window { height: output.geometry.height flags: Qt.Window | Qt.FramelessWindowHint screen: output.screen ? Qt.application.screens[output.screen.screenIndex] : null - color: splashVisible - ? Material.color(Material.BlueGrey, Material.Shade800) - : !splashVisible && shellHelper.isReady ? Material.color(Material.Grey, Material.Shade700) : "black" + color: output.ready ? Material.color(Material.Grey, Material.Shade700) : "black" visible: output.screen && output.screen.enabled // Keyboard handling @@ -252,18 +249,13 @@ Window { } // Splash screen - FluidControls.Wave { - id: splash - + Rectangle { anchors.fill: parent + color: "black" + visible: !ready - Rectangle { - anchors.fill: parent - color: Material.color(Material.BlueGrey, Material.Shade800) - } - - Component.onCompleted: { - openWave(0, 0); + HoverHandler { + cursorShape: Qt.BlankCursor } } @@ -328,10 +320,6 @@ Window { * Methods */ - function reveal() { - splash.closeWave(splash.width - splash.size, splash.height - splash.size); - } - function flash() { flash.flash(); } diff --git a/src/helper/helper.qrc b/src/helper/helper.qrc index 72d69d1c..bd0cf712 100644 --- a/src/helper/helper.qrc +++ b/src/helper/helper.qrc @@ -29,5 +29,6 @@ qml/launcher/PagedGrid.qml qml/panel/StatusMenu.qml qml/notifications/NotificationItem.qml + qml/SplashWindow.qml diff --git a/src/helper/qml/SplashWindow.qml b/src/helper/qml/SplashWindow.qml new file mode 100644 index 00000000..6628af8a --- /dev/null +++ b/src/helper/qml/SplashWindow.qml @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: 2023 Pier Luigi Fiorini +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick 2.15 +import QtQuick.Window 2.15 +import Fluid.Controls 1.0 as FluidControls +import Aurora.Client 1.0 as AuroraClient + +Window { + id: splashScreenWindow + + property bool ready: false + + color: "transparent" + visible: true + + AuroraClient.WlrLayerSurfaceV1 { + layer: AuroraClient.WlrLayerSurfaceV1.OverlayLayer + anchors: AuroraClient.WlrLayerSurfaceV1.TopAnchor | + AuroraClient.WlrLayerSurfaceV1.BottomAnchor | + AuroraClient.WlrLayerSurfaceV1.LeftAnchor | + AuroraClient.WlrLayerSurfaceV1.RightAnchor + keyboardInteractivity: AuroraClient.WlrLayerSurfaceV1.NoKeyboardInteractivity + exclusiveZone: -1 + role: "splash" + } + + Timer { + interval: 250 + running: workspaceReady + onTriggered: { + splash.closeWave(splash.width - splash.size, splash.height - splash.size); + splashScreenWindow.close(); + } + } + + // Disable mouse pointer + HoverHandler { + cursorShape: Qt.BlankCursor + } + + FluidControls.Wave { + id: splash + + anchors.fill: parent + size: 32 + + Rectangle { + anchors.fill: parent + color: "black" + } + + Component.onCompleted: { + openWave(0, 0); + ready = true; + } + } +} diff --git a/src/helper/qml/TopLayerWindow.qml b/src/helper/qml/TopLayerWindow.qml index 7801e927..1af25fee 100644 --- a/src/helper/qml/TopLayerWindow.qml +++ b/src/helper/qml/TopLayerWindow.qml @@ -21,14 +21,7 @@ Window { signal shutdownRequested() color: "transparent" - visible: false - - onVisibleChanged: { - if (visible) - panel.show(); - else - panel.hide(); - } + visible: true AuroraClient.WlrLayerSurfaceV1 { layer: AuroraClient.WlrLayerSurfaceV1.TopLayer @@ -153,10 +146,15 @@ Window { Panel.Panel { id: panel + x: 0 + y: topLayerWindow.height + width: topLayerWindow.width + + /* anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - anchors.bottomMargin: -height + anchors.bottomMargin: workspaceReady ? 0 : -height Behavior on anchors.bottomMargin { NumberAnimation { @@ -164,13 +162,24 @@ Window { duration: FluidControls.Units.longDuration } } + */ + } - function show() { - anchors.bottomMargin = 0; - } + YAnimator { + id: panelShowAnimation + + target: panel + from: topLayerWindow.height + to: topLayerWindow.height - panel.height + easing.type: Easing.InOutCubic + duration: FluidControls.Units.longDuration + } + + Connections { + target: shell - function hide() { - anchors.bottomMargin = -height; + function onShowPanelRequested() { + panelShowAnimation.start(); } } diff --git a/src/helper/qml/main.qml b/src/helper/qml/main.qml index d9fd5a37..12fb7b5c 100644 --- a/src/helper/qml/main.qml +++ b/src/helper/qml/main.qml @@ -3,9 +3,11 @@ // SPDX-License-Identifier: GPL-3.0-or-later import QtQml 2.1 +import QtQml.Models 2.15 import QtQuick 2.15 import QtQuick.Window 2.15 import QtGSettings 1.0 as Settings +import Fluid.Core 1.0 as FluidCore import Aurora.Client 1.0 as AuroraClient import Liri.Session 1.0 as Session import Liri.PolicyKit 1.0 as Polkit @@ -17,16 +19,6 @@ Item { primaryScreen = determinePrimaryScreen(); } - Timer { - id: readyTimer - - interval: 250 - onTriggered: { - shell.sendReady(); - topLayerWindow.show(); - } - } - /* * Primary screen */ @@ -58,26 +50,48 @@ Item { AuroraClient.LiriShellV1 { id: shell + } + + /* + Instantiator { + model: Qt.application.screens + active: !workspaceReady - onActiveChanged: { - if (active) - readyTimer.start(); + SplashWindow { + screen: modelData } } + */ - TopLayerWindow { - id: topLayerWindow - - screen: primaryScreen + Instantiator { + model: Qt.application.screens + active: shell.active - onLogoutRequested: { - logoutDialog.show(); + BackgroundWindow { + screen: modelData } - onLockRequested: { - Session.SessionManager.lock(); + } + + Instantiator { + model: Qt.application.screens + active: shell.active + + onObjectAdded: { + shell.sendReady(object); } - onShutdownRequested: { - powerOffDialog.show(); + + TopLayerWindow { + screen: modelData + + onLogoutRequested: { + logoutDialog.show(); + } + onLockRequested: { + Session.SessionManager.lock(); + } + onShutdownRequested: { + powerOffDialog.show(); + } } } @@ -109,14 +123,6 @@ Item { } } - Instantiator { - model: Qt.application.screens - - BackgroundWindow { - screen: modelData - } - } - /* * PolicyKit */ diff --git a/src/imports/compositor/CMakeLists.txt b/src/imports/compositor/CMakeLists.txt index 1bade9c0..19b70486 100644 --- a/src/imports/compositor/CMakeLists.txt +++ b/src/imports/compositor/CMakeLists.txt @@ -48,6 +48,7 @@ liri_add_qml_plugin(LiriShellCompositorQmlPlugin Qt::GuiPrivate Liri::AuroraPlatformHeaders Liri::AuroraCompositor + Liri::AuroraCompositorPrivate Liri::Xdg ) diff --git a/src/imports/compositor/desktoplayout.cpp b/src/imports/compositor/desktoplayout.cpp index 10ff2850..ac67c7b7 100644 --- a/src/imports/compositor/desktoplayout.cpp +++ b/src/imports/compositor/desktoplayout.cpp @@ -15,6 +15,7 @@ DesktopLayout::DesktopLayout(QQuickItem *parent) DesktopLayout::SurfaceRole DesktopLayout::getSurfaceRole(QQuickItem *item) const { static const QHash namespaceToRole { + { QStringLiteral("splash"), DesktopLayout::SplashRole }, { QStringLiteral("osd"), DesktopLayout::OsdRole }, { QStringLiteral("run-dialog"), DesktopLayout::RunDialogRole }, { QStringLiteral("auth-dialog"), DesktopLayout::AuthDialogRole }, diff --git a/src/imports/compositor/desktoplayout.h b/src/imports/compositor/desktoplayout.h index 6b5b5105..e054ab87 100644 --- a/src/imports/compositor/desktoplayout.h +++ b/src/imports/compositor/desktoplayout.h @@ -21,6 +21,7 @@ class DesktopLayout : public WaylandSurfaceLayout LogoutDialogRole, PowerOffDialogRole, WindowSwitcherRole, + SplashRole, }; Q_ENUM(SurfaceRole) @@ -33,7 +34,7 @@ class DesktopLayout : public WaylandSurfaceLayout DialogLayer, FullscreenLayer, LockScreenLayer, - OverlayLayer + OverlayLayer, }; Q_ENUM(Layer); diff --git a/src/imports/compositor/helperlauncher.cpp b/src/imports/compositor/helperlauncher.cpp index 77480f6d..6c3a91da 100644 --- a/src/imports/compositor/helperlauncher.cpp +++ b/src/imports/compositor/helperlauncher.cpp @@ -119,6 +119,9 @@ bool HelperLauncher::startProcess() case SessionLocker: cmd = QString::fromLocal8Bit(LIBEXECDIR "/liri-shell-lockscreen"); break; + case Greeter: + cmd = QString::fromLocal8Bit(LIBEXECDIR "/liri-shell-greeter"); + break; } auto args = QProcess::splitCommand(cmd); diff --git a/src/imports/compositor/helperlauncher.h b/src/imports/compositor/helperlauncher.h index e46a3ab3..db60bbda 100644 --- a/src/imports/compositor/helperlauncher.h +++ b/src/imports/compositor/helperlauncher.h @@ -22,7 +22,8 @@ class HelperLauncher : public QObject, public QQmlParserStatus public: enum Helper { Shell, - SessionLocker + SessionLocker, + Greeter }; Q_ENUM(Helper) diff --git a/src/imports/compositor/protocols/liri-shell-unstable-v1.xml b/src/imports/compositor/protocols/liri-shell-unstable-v1.xml index ca8c69de..edb9cf93 100644 --- a/src/imports/compositor/protocols/liri-shell-unstable-v1.xml +++ b/src/imports/compositor/protocols/liri-shell-unstable-v1.xml @@ -28,10 +28,19 @@ Tell the compositor that the shell has created all the layer surfaces and it can hide the splash screen - revealing the desktop. + revealing the desktop on the specified output. + + + + The compositor will emit this event when it wants to show + the panel on the specified output. + + + + Ask the compositor to quit. diff --git a/src/imports/compositor/waylandlirishellv1.cpp b/src/imports/compositor/waylandlirishellv1.cpp index 0abdb2ee..d7ebec77 100644 --- a/src/imports/compositor/waylandlirishellv1.cpp +++ b/src/imports/compositor/waylandlirishellv1.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "waylandlirishellv1_p.h" @@ -20,8 +21,8 @@ Q_LOGGING_CATEGORY(gLcLiriShellV1, "liri.shell.lirishellv1") */ WaylandLiriShellV1Private::WaylandLiriShellV1Private(WaylandLiriShellV1 *qq) - : PrivateServer::zliri_shell_v1() - , q_ptr(qq) + : WaylandCompositorExtensionPrivate(qq) + , PrivateServer::zliri_shell_v1() { } @@ -76,12 +77,16 @@ void WaylandLiriShellV1Private::zliri_shell_v1_bind_shortcut(Resource *resource, Q_EMIT q->shortcutBound(shortcut); } -void WaylandLiriShellV1Private::zliri_shell_v1_ready(Resource *resource) +void WaylandLiriShellV1Private::zliri_shell_v1_ready(Resource *resource, struct ::wl_resource *outputResource) { Q_UNUSED(resource) Q_Q(WaylandLiriShellV1); - emit q->ready(); + + auto *output = WaylandOutput::fromResource(outputResource); + Q_ASSERT(output); + qWarning()<<"@@@@@@@@@@@@@@@@"<ready(output); } void WaylandLiriShellV1Private::zliri_shell_v1_terminate(Resource *resource) @@ -97,14 +102,12 @@ void WaylandLiriShellV1Private::zliri_shell_v1_terminate(Resource *resource) */ WaylandLiriShellV1::WaylandLiriShellV1() - : WaylandCompositorExtensionTemplate() - , d_ptr(new WaylandLiriShellV1Private(this)) + : WaylandCompositorExtensionTemplate(*new WaylandLiriShellV1Private(this)) { } WaylandLiriShellV1::WaylandLiriShellV1(Aurora::Compositor::WaylandCompositor *compositor) - : WaylandCompositorExtensionTemplate(compositor) - , d_ptr(new WaylandLiriShellV1Private(this)) + : WaylandCompositorExtensionTemplate(compositor, *new WaylandLiriShellV1Private(this)) { } @@ -125,6 +128,17 @@ void WaylandLiriShellV1::initialize() d->init(compositor->display(), 1); } +void WaylandLiriShellV1::showPanel(WaylandOutput *output) +{ + Q_D(WaylandLiriShellV1); + + auto *outputResource = WaylandOutputPrivate::get(output)->resource()->handle; + + const auto values = d->resourceMap().values(); + for (auto *resource : values) + d->send_show_panel(resource->handle, outputResource); +} + void WaylandLiriShellV1::requestLogout() { Q_D(WaylandLiriShellV1); @@ -167,7 +181,8 @@ QByteArray WaylandLiriShellV1::interfaceName() */ WaylandLiriShortcutV1Private::WaylandLiriShortcutV1Private(WaylandLiriShortcutV1 *self) - : PrivateServer::zliri_shortcut_v1() + : AuroraObjectPrivate() + , PrivateServer::zliri_shortcut_v1() , q_ptr(self) { } @@ -190,11 +205,11 @@ void WaylandLiriShortcutV1Private::zliri_shortcut_v1_destroy(Resource *resource) WaylandLiriShortcutV1::WaylandLiriShortcutV1(const QString &sequence, WaylandCompositor *compositor, QObject *parent) - : QObject(parent) - , d_ptr(new WaylandLiriShortcutV1Private(this)) + : AuroraObject(*new WaylandLiriShortcutV1Private(this), parent) { - d_ptr->compositor = compositor; - d_ptr->sequence = sequence; + Q_D(WaylandLiriShortcutV1); + d->compositor = compositor; + d->sequence = sequence; } WaylandLiriShortcutV1::~WaylandLiriShortcutV1() @@ -223,8 +238,8 @@ void WaylandLiriShortcutV1::activate(WaylandSeat *seat) */ WaylandLiriOsdV1Private::WaylandLiriOsdV1Private(WaylandLiriOsdV1 *self) - : PrivateServer::zliri_osd_v1() - , q_ptr(self) + : WaylandCompositorExtensionPrivate(self) + , PrivateServer::zliri_osd_v1() { } @@ -233,14 +248,12 @@ WaylandLiriOsdV1Private::WaylandLiriOsdV1Private(WaylandLiriOsdV1 *self) */ WaylandLiriOsdV1::WaylandLiriOsdV1() - : WaylandCompositorExtensionTemplate() - , d_ptr(new WaylandLiriOsdV1Private(this)) + : WaylandCompositorExtensionTemplate(*new WaylandLiriOsdV1Private(this)) { } WaylandLiriOsdV1::WaylandLiriOsdV1(WaylandCompositor *compositor) - : WaylandCompositorExtensionTemplate(compositor) - , d_ptr(new WaylandLiriOsdV1Private(this)) + : WaylandCompositorExtensionTemplate(compositor, *new WaylandLiriOsdV1Private(this)) { } diff --git a/src/imports/compositor/waylandlirishellv1.h b/src/imports/compositor/waylandlirishellv1.h index 342b6deb..4247ecd1 100644 --- a/src/imports/compositor/waylandlirishellv1.h +++ b/src/imports/compositor/waylandlirishellv1.h @@ -13,6 +13,7 @@ namespace Aurora { namespace Compositor { +class WaylandOutput; class WaylandSeat; class WaylandSurface; @@ -24,7 +25,7 @@ class WaylandLiriShellV1Private; class WaylandLiriShortcutV1Private; class WaylandLiriOsdV1Private; -class WaylandLiriShortcutV1 : public QObject +class WaylandLiriShortcutV1 : public AuroraObject { Q_OBJECT Q_DECLARE_PRIVATE(WaylandLiriShortcutV1) @@ -38,9 +39,6 @@ class WaylandLiriShortcutV1 : public QObject QString sequence() const; Q_INVOKABLE void activate(Aurora::Compositor::WaylandSeat *seat = nullptr); - -private: - QScopedPointer const d_ptr; }; class WaylandLiriShellV1 @@ -55,6 +53,7 @@ class WaylandLiriShellV1 void initialize() override; + Q_INVOKABLE void showPanel(WaylandOutput *output); Q_INVOKABLE void requestLogout(); Q_INVOKABLE void requestShutdown(); Q_INVOKABLE void sendQuit(); @@ -64,11 +63,8 @@ class WaylandLiriShellV1 Q_SIGNALS: void shortcutBound(WaylandLiriShortcutV1 *shortcut); - void ready(); + void ready(WaylandOutput *output); void terminateRequested(); - -private: - QScopedPointer const d_ptr; }; class WaylandLiriOsdV1 @@ -88,9 +84,6 @@ class WaylandLiriOsdV1 static const struct wl_interface *interface(); static QByteArray interfaceName(); - -private: - QScopedPointer const d_ptr; }; #endif // LIRI_SHELL_COMPOSITOR_WAYLANDLIRISHELLV1_H diff --git a/src/imports/compositor/waylandlirishellv1_p.h b/src/imports/compositor/waylandlirishellv1_p.h index 786907d1..70c497a3 100644 --- a/src/imports/compositor/waylandlirishellv1_p.h +++ b/src/imports/compositor/waylandlirishellv1_p.h @@ -7,6 +7,8 @@ #include +#include + #include "waylandlirishellv1.h" #include "aurora-server-liri-shell-unstable-v1.h" @@ -24,7 +26,8 @@ Q_DECLARE_LOGGING_CATEGORY(gLcLiriShellV1) class LIRIAURORACOMPOSITOR_EXPORT WaylandLiriShellV1Private - : public PrivateServer::zliri_shell_v1 + : public WaylandCompositorExtensionPrivate + , public PrivateServer::zliri_shell_v1 { Q_DECLARE_PUBLIC(WaylandLiriShellV1) public: @@ -33,17 +36,15 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandLiriShellV1Private static WaylandLiriShellV1Private *get(WaylandLiriShellV1 *shell); protected: - WaylandLiriShellV1 *q_ptr; - -private: void zliri_shell_v1_bind_resource(Resource *r) override; void zliri_shell_v1_bind_shortcut(Resource *resource, uint32_t id, const QString &sequence) override; - void zliri_shell_v1_ready(Resource *resource) override; + void zliri_shell_v1_ready(Resource *resource, struct ::wl_resource *outputResource) override; void zliri_shell_v1_terminate(Resource *resource) override; }; class LIRIAURORACOMPOSITOR_EXPORT WaylandLiriShortcutV1Private - : public PrivateServer::zliri_shortcut_v1 + : public AuroraObjectPrivate + , public PrivateServer::zliri_shortcut_v1 { Q_DECLARE_PUBLIC(WaylandLiriShortcutV1) public: @@ -62,14 +63,12 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandLiriShortcutV1Private }; class LIRIAURORACOMPOSITOR_EXPORT WaylandLiriOsdV1Private - : public PrivateServer::zliri_osd_v1 + : public WaylandCompositorExtensionPrivate + , public PrivateServer::zliri_osd_v1 { Q_DECLARE_PUBLIC(WaylandLiriOsdV1) public: explicit WaylandLiriOsdV1Private(WaylandLiriOsdV1 *self); - -protected: - WaylandLiriOsdV1 *q_ptr; }; #endif // LIRI_SHELL_COMPOSITOR_WAYLANDLIRISHELLV1_P_H