|
|
|
@ -13,11 +13,11 @@ VisibilityManagerPrivate::VisibilityManagerPrivate(PlasmaQuick::ContainmentView
|
|
|
|
|
: QObject(q), q(q), view(view), wm(AbstractWindowInterface::getInstance(view, nullptr))
|
|
|
|
|
{
|
|
|
|
|
DockView *dockView = qobject_cast<DockView *>(view);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dockView) {
|
|
|
|
|
connect(dockView, &DockView::eventTriggered, this, &VisibilityManagerPrivate::event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
timerCheckWindows.setInterval(350);
|
|
|
|
|
timerCheckWindows.setSingleShot(true);
|
|
|
|
|
|
|
|
|
@ -42,11 +42,11 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
|
|
|
|
{
|
|
|
|
|
if (this->mode == mode)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// clear mode
|
|
|
|
|
if (this->mode == Dock::AlwaysVisible)
|
|
|
|
|
wm->removeDockStruts();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (auto &c : connections) {
|
|
|
|
|
disconnect(c);
|
|
|
|
|
}
|
|
|
|
@ -68,31 +68,31 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
|
|
|
|
raiseDock(!containsMouse);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case Dock::DodgeActive: {
|
|
|
|
|
connections[0] = connect(wm.get(), &AbstractWindowInterface::activeWindowChanged
|
|
|
|
|
, this, &VisibilityManagerPrivate::dodgeActive);
|
|
|
|
|
connections[1] = connect(wm.get(), &AbstractWindowInterface::windowChanged
|
|
|
|
|
, this, &VisibilityManagerPrivate::dodgeActive);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dodgeActive(wm->activeWindow());
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case Dock::DodgeMaximized: {
|
|
|
|
|
connections[0] = connect(wm.get(), &AbstractWindowInterface::windowChanged
|
|
|
|
|
, this, &VisibilityManagerPrivate::dodgeMaximized);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case Dock::DodgeAllWindows: {
|
|
|
|
|
for (const auto &wid : wm->windows()) {
|
|
|
|
|
windows.insert({wid, wm->requestInfo(wid)});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connections[0] = connect(wm.get(), &AbstractWindowInterface::windowChanged
|
|
|
|
|
, this, &VisibilityManagerPrivate::dodgeWindows);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connections[1] = connect(wm.get(), &AbstractWindowInterface::windowRemoved
|
|
|
|
|
, this, [&](WId wid) {
|
|
|
|
|
windows.erase(wid);
|
|
|
|
@ -107,7 +107,7 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveConfig();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
emit q->modeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -115,7 +115,7 @@ inline void VisibilityManagerPrivate::setIsHidden(bool isHidden)
|
|
|
|
|
{
|
|
|
|
|
if (this->isHidden == isHidden)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->isHidden = isHidden;
|
|
|
|
|
emit q->isHiddenChanged();
|
|
|
|
|
}
|
|
|
|
@ -140,7 +140,7 @@ inline void VisibilityManagerPrivate::raiseDock(bool raise)
|
|
|
|
|
/* if (!isHidden == raise) {
|
|
|
|
|
return;
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (raise) {
|
|
|
|
|
timerHide.stop();
|
|
|
|
|
|
|
|
|
@ -149,7 +149,7 @@ inline void VisibilityManagerPrivate::raiseDock(bool raise)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
timerShow.stop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!timerHide.isActive() && view->containment()->immutability() != Plasma::Types::Mutable)
|
|
|
|
|
timerHide.start();
|
|
|
|
|
}
|
|
|
|
@ -159,7 +159,7 @@ inline void VisibilityManagerPrivate::setDockRect(const QRect &dockRect)
|
|
|
|
|
{
|
|
|
|
|
if (!view->containment() || this->dockRect == dockRect)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->dockRect = dockRect;
|
|
|
|
|
|
|
|
|
|
if (mode == Dock::AlwaysVisible) {
|
|
|
|
@ -171,7 +171,7 @@ void VisibilityManagerPrivate::dodgeActive(WId wid)
|
|
|
|
|
{
|
|
|
|
|
if (wid != wm->activeWindow())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto winfo = wm->requestInfo(wid);
|
|
|
|
|
|
|
|
|
|
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
|
|
|
|
@ -184,7 +184,7 @@ void VisibilityManagerPrivate::dodgeMaximized(WId wid)
|
|
|
|
|
{
|
|
|
|
|
if (wid != wm->activeWindow())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto winfo = wm->requestInfo(wid);
|
|
|
|
|
|
|
|
|
|
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
|
|
|
|
@ -199,7 +199,7 @@ void VisibilityManagerPrivate::dodgeWindows(WId wid)
|
|
|
|
|
|
|
|
|
|
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (intersects(winfo))
|
|
|
|
|
raiseDock(false);
|
|
|
|
|
else
|
|
|
|
@ -214,7 +214,7 @@ void VisibilityManagerPrivate::checkAllWindows()
|
|
|
|
|
//! std::pair<WId, WindowInfoWrap>
|
|
|
|
|
if (!std::get<1>(winfo).isValid() || !std::get<1>(winfo).isOnCurrentDesktop())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (std::get<1>(winfo).isFullscreen()) {
|
|
|
|
|
raise = false;
|
|
|
|
|
break;
|
|
|
|
@ -240,7 +240,7 @@ inline void VisibilityManagerPrivate::saveConfig()
|
|
|
|
|
{
|
|
|
|
|
if (!view->containment())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto config = view->containment()->config();
|
|
|
|
|
|
|
|
|
|
config.writeEntry("visibility", static_cast<int>(mode));
|
|
|
|
@ -254,7 +254,7 @@ inline void VisibilityManagerPrivate::restoreConfig()
|
|
|
|
|
{
|
|
|
|
|
if (!view->containment())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto config = view->containment()->config();
|
|
|
|
|
|
|
|
|
|
mode = static_cast<Dock::Visibility>(config.readEntry("visibility", static_cast<int>(Dock::DodgeActive)));
|
|
|
|
@ -271,13 +271,25 @@ bool VisibilityManagerPrivate::event(QEvent *ev)
|
|
|
|
|
containsMouse = true;
|
|
|
|
|
emit q->containsMouseChanged();
|
|
|
|
|
|
|
|
|
|
<<< <<< < HEAD
|
|
|
|
|
raiseDock(true);
|
|
|
|
|
== == == =
|
|
|
|
|
|
|
|
|
|
if (mode == Dock::AutoHide)
|
|
|
|
|
raiseDock(true);
|
|
|
|
|
|
|
|
|
|
>>> >>> > code formatted
|
|
|
|
|
} else if (ev->type() == QEvent::Leave && containsMouse) {
|
|
|
|
|
containsMouse = false;
|
|
|
|
|
emit q->containsMouseChanged();
|
|
|
|
|
|
|
|
|
|
if (mode == Dock::AutoHide)
|
|
|
|
|
raiseDock(false);
|
|
|
|
|
|
|
|
|
|
<<< <<< <HEAD
|
|
|
|
|
== == == =
|
|
|
|
|
|
|
|
|
|
>>>>>>> code formatted
|
|
|
|
|
} else if (ev->type() == QEvent::Show) {
|
|
|
|
|
wm->setDockDefaultFlags();
|
|
|
|
|
}
|
|
|
|
@ -350,4 +362,3 @@ void VisibilityManager::updateDockGeometry(const QRect &geometry)
|
|
|
|
|
//! END: VisibilityManager implementation
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|