|
|
|
@ -318,45 +318,71 @@ bool WaylandInterface::isOnCurrentActivity(WindowId wid) const
|
|
|
|
|
|
|
|
|
|
WindowInfoWrap WaylandInterface::requestInfo(WindowId wid) const
|
|
|
|
|
{
|
|
|
|
|
auto it = std::find_if(m_windowManagement->windows().constBegin(), m_windowManagement->windows().constEnd(), [&wid](PlasmaWindow * w) noexcept {
|
|
|
|
|
return w->isValid() && w->internalId() == wid;
|
|
|
|
|
});
|
|
|
|
|
WindowInfoWrap winfoWrap;
|
|
|
|
|
|
|
|
|
|
if (it == m_windowManagement->windows().constEnd())
|
|
|
|
|
auto w = windowFor(wid);
|
|
|
|
|
|
|
|
|
|
if (w) {
|
|
|
|
|
if (isValidWindow(w)) {
|
|
|
|
|
winfoWrap.setIsValid(true);
|
|
|
|
|
winfoWrap.setWid(wid);
|
|
|
|
|
winfoWrap.setIsActive(w->isActive());
|
|
|
|
|
winfoWrap.setIsMinimized(w->isMinimized());
|
|
|
|
|
winfoWrap.setIsMaxVert(w->isMaximized());
|
|
|
|
|
winfoWrap.setIsMaxHoriz(w->isMaximized());
|
|
|
|
|
winfoWrap.setIsFullscreen(w->isFullscreen());
|
|
|
|
|
winfoWrap.setIsShaded(w->isShaded());
|
|
|
|
|
winfoWrap.setGeometry(w->geometry());
|
|
|
|
|
winfoWrap.setHasSkipTaskbar(w->skipTaskbar());
|
|
|
|
|
} else if (w->appId() == QLatin1String("org.kde.plasmashell")) {
|
|
|
|
|
winfoWrap.setIsValid(true);
|
|
|
|
|
winfoWrap.setIsPlasmaDesktop(true);
|
|
|
|
|
winfoWrap.setWid(wid);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WindowInfoWrap winfoWrap;
|
|
|
|
|
return winfoWrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KWayland::Client::PlasmaWindow *WaylandInterface::windowFor(WindowId wid) const
|
|
|
|
|
{
|
|
|
|
|
auto it = std::find_if(m_windowManagement->windows().constBegin(), m_windowManagement->windows().constEnd(), [&wid](PlasmaWindow * w) noexcept {
|
|
|
|
|
return w->isValid() && w->internalId() == wid;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
auto w = *it;
|
|
|
|
|
|
|
|
|
|
if (isValidWindow(w)) {
|
|
|
|
|
winfoWrap.setIsValid(true);
|
|
|
|
|
winfoWrap.setWid(wid);
|
|
|
|
|
winfoWrap.setIsActive(w->isActive());
|
|
|
|
|
winfoWrap.setIsMinimized(w->isMinimized());
|
|
|
|
|
winfoWrap.setIsMaxVert(w->isMaximized());
|
|
|
|
|
winfoWrap.setIsMaxHoriz(w->isMaximized());
|
|
|
|
|
winfoWrap.setIsFullscreen(w->isFullscreen());
|
|
|
|
|
winfoWrap.setIsShaded(w->isShaded());
|
|
|
|
|
winfoWrap.setGeometry(w->geometry());
|
|
|
|
|
} else if (w->appId() == QLatin1String("org.kde.plasmashell")) {
|
|
|
|
|
winfoWrap.setIsValid(true);
|
|
|
|
|
winfoWrap.setIsPlasmaDesktop(true);
|
|
|
|
|
winfoWrap.setWid(wid);
|
|
|
|
|
if (it == m_windowManagement->windows().constEnd()) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return winfoWrap;
|
|
|
|
|
return *it;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool WaylandInterface::windowCanBeDragged(WindowId wid) const
|
|
|
|
|
{
|
|
|
|
|
WindowInfoWrap winfo = requestInfo(wid);
|
|
|
|
|
return (winfo.isValid() && !winfo.isPlasmaDesktop() && !winfo.hasSkipTaskbar());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool WaylandInterface::activeWindowCanBeDragged() const
|
|
|
|
|
void WaylandInterface::requestMoveWindow(WindowId wid, QPoint from) const
|
|
|
|
|
{
|
|
|
|
|
WindowInfoWrap activeInfo = requestInfoActive();
|
|
|
|
|
return (activeInfo.isValid() && !activeInfo.isPlasmaDesktop() && !activeInfo.hasSkipTaskbar());
|
|
|
|
|
if (windowCanBeDragged(wid)) {
|
|
|
|
|
auto w = windowFor(wid);
|
|
|
|
|
|
|
|
|
|
if (w && isValidWindow(w)) {
|
|
|
|
|
w->requestMove();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WaylandInterface::requestMoveActiveWindow(QPoint from) const
|
|
|
|
|
void WaylandInterface::requestToggleMaximized(WindowId wid) const
|
|
|
|
|
{
|
|
|
|
|
//to be supported
|
|
|
|
|
auto w = windowFor(wid);
|
|
|
|
|
|
|
|
|
|
if (w && isValidWindow(w)) {
|
|
|
|
|
w->requestToggleMaximized();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline bool WaylandInterface::isValidWindow(const KWayland::Client::PlasmaWindow *w) const
|
|
|
|
|