diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f3c5a0b..3631a7e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -113,6 +113,16 @@ bool MainWindow::pinned(const QString &desktop) return m_appModel->isDesktopPinned(desktop); } +QRect MainWindow::primaryGeometry() const +{ + return geometry(); +} + +int MainWindow::direction() const +{ + return DockSettings::self()->direction(); +} + void MainWindow::setDirection(int direction) { DockSettings::self()->setDirection(static_cast(direction)); @@ -337,7 +347,7 @@ void MainWindow::onPositionChanged() updateViewStruts(); } - emit positionChanged(); + emit directionChanged(); } void MainWindow::onIconSizeChanged() @@ -350,10 +360,16 @@ void MainWindow::onIconSizeChanged() void MainWindow::onVisibilityChanged() { + if (m_activity->launchPad()) { + m_hideTimer->stop(); + clearViewStruts(); + setVisible(true); + return; + } + // Always show // Must remain displayed when launchpad is opened. - if (m_settings->visibility() == DockSettings::AlwaysShow - || m_activity->launchPad()) { + if (m_settings->visibility() == DockSettings::AlwaysShow) { m_hideTimer->stop(); setGeometry(windowRect()); @@ -366,9 +382,6 @@ void MainWindow::onVisibilityChanged() } } - if (m_activity->launchPad()) - return; - if (m_settings->visibility() == DockSettings::IntellHide) { clearViewStruts(); setGeometry(windowRect()); @@ -434,3 +447,10 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *e) return QQuickView::eventFilter(obj, e); } + +void MainWindow::resizeEvent(QResizeEvent *e) +{ + emit primaryGeometryChanged(); + + QQuickView::resizeEvent(e); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 238325a..18a4b95 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -32,6 +32,8 @@ class MainWindow : public QQuickView { Q_OBJECT + Q_PROPERTY(QRect primaryGeometry READ primaryGeometry NOTIFY primaryGeometryChanged) + Q_PROPERTY(int direction READ direction NOTIFY directionChanged) public: explicit MainWindow(QQuickView *parent = nullptr); @@ -42,6 +44,9 @@ public: void remove(const QString &desktop); bool pinned(const QString &desktop); + QRect primaryGeometry() const; + int direction() const; + void setDirection(int direction); void setIconSize(int iconSize); void setVisibility(int visibility); @@ -51,7 +56,8 @@ public: signals: void resizingFished(); void iconSizeChanged(); - void positionChanged(); + void directionChanged(); + void primaryGeometryChanged(); private: QRect windowRect() const; @@ -74,6 +80,7 @@ private slots: protected: bool eventFilter(QObject *obj, QEvent *e) override; + void resizeEvent(QResizeEvent *) override; private: Activity *m_activity; diff --git a/src/org.Cutefish.Dock.xml b/src/org.Cutefish.Dock.xml index 88f97f8..3134a0b 100644 --- a/src/org.Cutefish.Dock.xml +++ b/src/org.Cutefish.Dock.xml @@ -11,5 +11,14 @@ + + + + + + + + +