diff --git a/launchercontroller.cpp b/launchercontroller.cpp index aeda1eea..fd19a7f5 100644 --- a/launchercontroller.cpp +++ b/launchercontroller.cpp @@ -9,6 +9,7 @@ #include #include #include +#include DGUI_USE_NAMESPACE @@ -16,6 +17,7 @@ LauncherController::LauncherController(QObject *parent) : QObject(parent) , optShow(QStringList{"s", "show"}, tr("Show launcher (hidden by default)")) , optToggle(QStringList{"t", "toggle"}, tr("Toggle launcher visibility")) + , m_regionMonitor(new DRegionMonitor(this)) , m_visible(false) { // TODO: settings should be managed in somewhere else. @@ -42,15 +44,24 @@ LauncherController::LauncherController(QObject *parent) } }); - // for dbus adapter signals. + // for dbus adapter signals, AND for m_regionMonitor. connect(this, &LauncherController::visibleChanged, this, [this](bool isVisible){ if (isVisible) { + m_regionMonitor->registerRegion(); emit Shown(); } else { + m_regionMonitor->unregisterRegion(); emit Closed(); } emit VisibleChanged(isVisible); }); + + // since the launcher window is tend to be x11bypassed + m_regionMonitor->setCoordinateType(Dtk::Gui::DRegionMonitor::Original); + + connect(m_regionMonitor, &DRegionMonitor::buttonPress, this, [](const QPoint &p, const int flag){ + qDebug() << p << flag << "do we really need x11bypass just for hidding launcher window?"; + }); } void LauncherController::Exit() diff --git a/launchercontroller.h b/launchercontroller.h index acf4592a..90cb8588 100644 --- a/launchercontroller.h +++ b/launchercontroller.h @@ -7,6 +7,11 @@ #include #include +namespace Dtk { +namespace Gui { +class DRegionMonitor; +} +} class LauncherController : public QObject { Q_OBJECT @@ -56,6 +61,7 @@ class LauncherController : public QObject private: explicit LauncherController(QObject *parent=nullptr); + Dtk::Gui::DRegionMonitor *m_regionMonitor; bool m_visible; QString m_currentFrame; }; diff --git a/qml/FullscreenFrame.qml b/qml/FullscreenFrame.qml index 9c7d9101..42db9004 100644 --- a/qml/FullscreenFrame.qml +++ b/qml/FullscreenFrame.qml @@ -63,7 +63,7 @@ Control { placeholder: qsTr("Search") onTextChanged: { - console.log(text) +// console.log(text) SearchFilterProxyModel.setFilterRegularExpression(text) } } diff --git a/qml/Main.qml b/qml/Main.qml index 2c273450..9d6908f3 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -33,6 +33,22 @@ ApplicationWindow { updateWindowVisibilityAndPosition() } + Timer { + id: delayHideTimer + interval: 500 + onTriggered: { + if (!DebugHelper.avoidHideWindow) { + LauncherController.visible = false + } + } + } + + onActiveChanged: { + if (!active) { + delayHideTimer.running = true + } + } + function launchApp(desktopId) { if (DebugHelper.avoidLaunchApp) { DTK.sendSystemMessage("dde-launchpad (debug)", @@ -71,7 +87,7 @@ ApplicationWindow { let dockGeometry = DesktopIntegration.dockGeometry if (dockGeometry.width > 0 && dockGeometry.height > 0) { - console.log(114514, dockGeometry) +// console.log(114514, dockGeometry) switch (DesktopIntegration.dockPosition) { case Qt.DownArrow: x = dockGeometry.left diff --git a/src/ddeintegration/appearance.cpp b/src/ddeintegration/appearance.cpp index e7a68a48..7711b636 100644 --- a/src/ddeintegration/appearance.cpp +++ b/src/ddeintegration/appearance.cpp @@ -53,10 +53,10 @@ void Appearance::updateCurrentWallpaperBlurhash() connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher* call){ QDBusPendingReply reply = *call; if (reply.isError()) { - qDebug() << "bbbbbbbbb" << reply.error(); + qDebug() << "Cannot get wallpaper from dbus:" << reply.error(); } else { QUrl wallpaperUrl(reply.value()); - qDebug() << "aaaaaaaaa" << wallpaperUrl; + qDebug() << "Got wallpaper URL from dbus:" << wallpaperUrl; QFuture blurhashFuture = QtConcurrent::run([wallpaperUrl](){ QImage image;