mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-21 10:50:30 +03:00
ignore fullscreen windows from Plasma and Latte
--drop isPlasmaDesktop flag for windows and use the new wm approach for plasmaIgnoredWindows
This commit is contained in:
parent
4971655a2c
commit
5363433b00
@ -108,7 +108,7 @@ bool AbstractWindowInterface::isIgnored(const WindowId &wid)
|
||||
return m_ignoredWindows.contains(wid);
|
||||
}
|
||||
|
||||
bool AbstractWindowInterface::isPlasmaDesktop(const QRect &wGeometry) const
|
||||
bool AbstractWindowInterface::isFullScreenWindow(const QRect &wGeometry) const
|
||||
{
|
||||
if (wGeometry.isEmpty()) {
|
||||
return false;
|
||||
@ -156,9 +156,9 @@ bool AbstractWindowInterface::isPlasmaPanel(const QRect &wGeometry) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AbstractWindowInterface::isRegisteredPlasmaPanel(const WindowId &wid)
|
||||
bool AbstractWindowInterface::isRegisteredPlasmaIgnoredWindow(const WindowId &wid)
|
||||
{
|
||||
return m_plasmaPanels.contains(wid);
|
||||
return m_plasmaIgnoredWindows.contains(wid);
|
||||
}
|
||||
|
||||
bool AbstractWindowInterface::inCurrentDesktopActivity(const WindowInfoWrap &winfo) const
|
||||
@ -183,25 +183,25 @@ void AbstractWindowInterface::unregisterIgnoredWindow(WindowId wid)
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractWindowInterface::registerPlasmaPanel(WindowId wid)
|
||||
void AbstractWindowInterface::registerPlasmaIgnoredWindow(WindowId wid)
|
||||
{
|
||||
if (!wid.isNull() && !m_plasmaPanels.contains(wid)) {
|
||||
m_plasmaPanels.append(wid);
|
||||
if (!wid.isNull() && !m_plasmaIgnoredWindows.contains(wid)) {
|
||||
m_plasmaIgnoredWindows.append(wid);
|
||||
emit windowChanged(wid);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractWindowInterface::unregisterPlasmaPanel(WindowId wid)
|
||||
void AbstractWindowInterface::unregisterPlasmaIgnoredWindow(WindowId wid)
|
||||
{
|
||||
if (m_plasmaPanels.contains(wid)) {
|
||||
m_plasmaPanels.removeAll(wid);
|
||||
if (m_plasmaIgnoredWindows.contains(wid)) {
|
||||
m_plasmaIgnoredWindows.removeAll(wid);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractWindowInterface::windowRemovedSlot(WindowId wid)
|
||||
{
|
||||
if (m_plasmaPanels.contains(wid)) {
|
||||
unregisterPlasmaPanel(wid);
|
||||
if (m_plasmaIgnoredWindows.contains(wid)) {
|
||||
unregisterPlasmaIgnoredWindow(wid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
bool inCurrentDesktopActivity(const WindowInfoWrap &winfo) const;
|
||||
|
||||
bool isIgnored(const WindowId &wid);
|
||||
bool isRegisteredPlasmaPanel(const WindowId &wid);
|
||||
bool isRegisteredPlasmaIgnoredWindow(const WindowId &wid);
|
||||
|
||||
QString currentDesktop() const;
|
||||
QString currentActivity() const;
|
||||
@ -125,8 +125,8 @@ public:
|
||||
virtual void registerIgnoredWindow(WindowId wid);
|
||||
virtual void unregisterIgnoredWindow(WindowId wid);
|
||||
|
||||
void registerPlasmaPanel(WindowId wid);
|
||||
void unregisterPlasmaPanel(WindowId wid);
|
||||
void registerPlasmaIgnoredWindow(WindowId wid);
|
||||
void unregisterPlasmaIgnoredWindow(WindowId wid);
|
||||
|
||||
void switchToNextActivity();
|
||||
void switchToPreviousActivity();
|
||||
@ -156,7 +156,7 @@ protected:
|
||||
//! their Configuration windows
|
||||
QList<WindowId> m_ignoredWindows;
|
||||
//! identified plasma panels
|
||||
QList<WindowId> m_plasmaPanels;
|
||||
QList<WindowId> m_plasmaIgnoredWindows;
|
||||
|
||||
QPointer<KActivities::Consumer> m_activities;
|
||||
|
||||
@ -171,7 +171,7 @@ protected:
|
||||
|
||||
void considerWindowChanged(WindowId wid);
|
||||
|
||||
bool isPlasmaDesktop(const QRect &wGeometry) const;
|
||||
bool isFullScreenWindow(const QRect &wGeometry) const;
|
||||
bool isPlasmaPanel(const QRect &wGeometry) const;
|
||||
|
||||
private slots:
|
||||
|
@ -156,7 +156,6 @@ bool TrackedGeneralInfo::isTracking(const WindowInfoWrap &winfo) const
|
||||
{
|
||||
return (winfo.isValid()
|
||||
&& isTrackingCurrentActivity()
|
||||
&& !winfo.isPlasmaDesktop()
|
||||
&& !winfo.isMinimized()
|
||||
&& winfo.isOnDesktop(m_wm->currentDesktop())
|
||||
&& winfo.isOnActivity(m_wm->currentActivity()));
|
||||
|
@ -568,7 +568,7 @@ bool Windows::isValidFor(const WindowId &wid) const
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_windows[wid].isValid() && !m_windows[wid].isPlasmaDesktop();
|
||||
return m_windows[wid].isValid();
|
||||
}
|
||||
|
||||
QIcon Windows::iconFor(const WindowId &wid)
|
||||
@ -662,32 +662,20 @@ bool Windows::intersects(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
|
||||
bool Windows::isActive(const WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && winfo.isActive() && !winfo.isPlasmaDesktop() && !winfo.isMinimized());
|
||||
return (winfo.isValid() && winfo.isActive() && !winfo.isMinimized());
|
||||
}
|
||||
|
||||
bool Windows::isActiveInViewScreen(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && winfo.isActive() && !winfo.isPlasmaDesktop() && !winfo.isMinimized()
|
||||
return (winfo.isValid() && winfo.isActive() && !winfo.isMinimized()
|
||||
&& m_views[view]->availableScreenGeometry().contains(winfo.geometry().center()));
|
||||
}
|
||||
|
||||
bool Windows::isMaximizedInViewScreen(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
{
|
||||
/* auto viewIntersectsMaxVert = [&]() noexcept -> bool {
|
||||
return ((winfo.isMaxVert()
|
||||
|| (view->screen() && view->screen()->availableSize().height() <= winfo.geometry().height()))
|
||||
&& intersects(view, winfo));
|
||||
};
|
||||
|
||||
auto viewIntersectsMaxHoriz = [&]() noexcept -> bool {
|
||||
return ((winfo.isMaxHoriz()
|
||||
|| (view->screen() && view->screen()->availableSize().width() <= winfo.geometry().width()))
|
||||
&& intersects(view, winfo));
|
||||
};*/
|
||||
|
||||
//! updated implementation to identify the screen that the maximized window is present
|
||||
//! in order to avoid: https://bugs.kde.org/show_bug.cgi?id=397700
|
||||
return (winfo.isValid() && !winfo.isPlasmaDesktop() && !winfo.isMinimized()
|
||||
return (winfo.isValid() && !winfo.isMinimized()
|
||||
&& !winfo.isShaded()
|
||||
&& winfo.isMaximized()
|
||||
&& m_views[view]->availableScreenGeometry().contains(winfo.geometry().center()));
|
||||
@ -695,12 +683,12 @@ bool Windows::isMaximizedInViewScreen(Latte::View *view, const WindowInfoWrap &w
|
||||
|
||||
bool Windows::isTouchingView(Latte::View *view, const WindowSystem::WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && !winfo.isPlasmaDesktop() && intersects(view, winfo));
|
||||
return (winfo.isValid() && intersects(view, winfo));
|
||||
}
|
||||
|
||||
bool Windows::isTouchingViewEdge(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
{
|
||||
if (winfo.isValid() && !winfo.isPlasmaDesktop() && !winfo.isMinimized()) {
|
||||
if (winfo.isValid() && !winfo.isMinimized()) {
|
||||
bool inViewThicknessEdge{false};
|
||||
bool inViewLengthBoundaries{false};
|
||||
|
||||
@ -776,19 +764,6 @@ void Windows::updateAvailableScreenGeometries()
|
||||
}
|
||||
}
|
||||
|
||||
void Windows::setPlasmaDesktop(WindowId wid)
|
||||
{
|
||||
if (!m_windows.contains(wid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_windows[wid].isPlasmaDesktop()) {
|
||||
m_windows[wid].setIsPlasmaDesktop(true);
|
||||
qDebug() << " plasmashell updated...";
|
||||
updateAllHints();
|
||||
}
|
||||
}
|
||||
|
||||
void Windows::updateAllHints()
|
||||
{
|
||||
for (const auto view : m_views.keys()) {
|
||||
@ -868,7 +843,7 @@ void Windows::updateHints(Latte::View *view)
|
||||
existsFaultyWindow = true;
|
||||
}
|
||||
|
||||
if (winfo.isPlasmaDesktop() || !m_wm->inCurrentDesktopActivity(winfo) || m_wm->isRegisteredPlasmaPanel(winfo.wid())) {
|
||||
if (!m_wm->inCurrentDesktopActivity(winfo) || m_wm->isRegisteredPlasmaIgnoredWindow(winfo.wid())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -922,7 +897,7 @@ void Windows::updateHints(Latte::View *view)
|
||||
WindowId mainWindowId = activeInfo.isChildWindow() ? activeInfo.parentId() : activeWinId;
|
||||
|
||||
for (const auto &winfo : m_windows) {
|
||||
if (winfo.isPlasmaDesktop() || !m_wm->inCurrentDesktopActivity(winfo) || m_wm->isRegisteredPlasmaPanel(winfo.wid())) {
|
||||
if (!m_wm->inCurrentDesktopActivity(winfo) || m_wm->isRegisteredPlasmaIgnoredWindow(winfo.wid())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1007,7 +982,7 @@ void Windows::updateHints(Latte::Layout::GenericLayout *layout) {
|
||||
existsFaultyWindow = true;
|
||||
}
|
||||
|
||||
if (winfo.isPlasmaDesktop() || !m_wm->inCurrentDesktopActivity(winfo) || m_wm->isRegisteredPlasmaPanel(winfo.wid())) {
|
||||
if (!m_wm->inCurrentDesktopActivity(winfo) || m_wm->isRegisteredPlasmaIgnoredWindow(winfo.wid())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -88,8 +88,6 @@ public:
|
||||
QString appNameFor(const WindowId &wid);
|
||||
WindowInfoWrap infoFor(const WindowId &wid) const;
|
||||
|
||||
void setPlasmaDesktop(WindowId wid);
|
||||
|
||||
AbstractWindowInterface *wm();
|
||||
|
||||
signals:
|
||||
|
@ -151,12 +151,12 @@ void WaylandInterface::initWindowManagement(KWayland::Client::PlasmaWindowManage
|
||||
|
||||
connect(m_windowManagement, &PlasmaWindowManagement::windowCreated, this, &WaylandInterface::windowCreatedProxy);
|
||||
connect(m_windowManagement, &PlasmaWindowManagement::activeWindowChanged, this, [&]() noexcept {
|
||||
auto w = m_windowManagement->activeWindow();
|
||||
if (!w || (w && (!m_ignoredWindows.contains(w->internalId() && !isPlasmaDesktop(w)))) ) {
|
||||
emit activeWindowChanged(w ? w->internalId() : 0);
|
||||
}
|
||||
auto w = m_windowManagement->activeWindow();
|
||||
if (!w || (w && (!m_ignoredWindows.contains(w->internalId()))) ) {
|
||||
emit activeWindowChanged(w ? w->internalId() : 0);
|
||||
}
|
||||
|
||||
}, Qt::QueuedConnection);
|
||||
}, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
#if KF5_VERSION_MINOR >= 52
|
||||
@ -472,58 +472,39 @@ WindowInfoWrap WaylandInterface::requestInfo(WindowId wid) const
|
||||
|
||||
auto w = windowFor(wid);
|
||||
|
||||
if (w) {
|
||||
if (isPlasmaDesktop(w)) {
|
||||
winfoWrap.setIsValid(true);
|
||||
winfoWrap.setIsPlasmaDesktop(true);
|
||||
winfoWrap.setWid(wid);
|
||||
if (w && isValidWindow(w)) {
|
||||
winfoWrap.setIsValid(true);
|
||||
winfoWrap.setWid(wid);
|
||||
winfoWrap.setParentId(w->parentWindow() ? w->parentWindow()->internalId() : 0);
|
||||
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.setIsOnAllDesktops(w->isOnAllDesktops());
|
||||
winfoWrap.setIsOnAllActivities(true);
|
||||
winfoWrap.setIsKeepAbove(w->isKeepAbove());
|
||||
winfoWrap.setIsKeepBelow(w->isKeepBelow());
|
||||
winfoWrap.setGeometry(w->geometry());
|
||||
winfoWrap.setHasSkipTaskbar(w->skipTaskbar());
|
||||
|
||||
//! Window Abilities
|
||||
winfoWrap.setIsClosable(false);
|
||||
winfoWrap.setIsFullScreenable(false);
|
||||
winfoWrap.setIsGroupable(false);
|
||||
winfoWrap.setIsMaximizable(false);
|
||||
winfoWrap.setIsMinimizable(false);
|
||||
winfoWrap.setIsMovable(false);
|
||||
winfoWrap.setIsResizable(false);
|
||||
winfoWrap.setIsShadeable(false);
|
||||
winfoWrap.setIsVirtualDesktopsChangeable(false);
|
||||
//! Window Abilities
|
||||
//! BEGIN:Window Abilities
|
||||
winfoWrap.setIsClosable(w->isCloseable());
|
||||
winfoWrap.setIsFullScreenable(w->isFullscreenable());
|
||||
winfoWrap.setIsMaximizable(w->isMaximizeable());
|
||||
winfoWrap.setIsMinimizable(w->isMinimizeable());
|
||||
winfoWrap.setIsMovable(w->isMovable());
|
||||
winfoWrap.setIsResizable(w->isResizable());
|
||||
winfoWrap.setIsShadeable(w->isShadeable());
|
||||
winfoWrap.setIsVirtualDesktopsChangeable(w->isVirtualDesktopChangeable());
|
||||
//! END:Window Abilities
|
||||
|
||||
} else if (isValidWindow(w)) {
|
||||
winfoWrap.setIsValid(true);
|
||||
winfoWrap.setWid(wid);
|
||||
winfoWrap.setParentId(w->parentWindow() ? w->parentWindow()->internalId() : 0);
|
||||
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.setIsOnAllDesktops(w->isOnAllDesktops());
|
||||
winfoWrap.setIsOnAllActivities(true);
|
||||
winfoWrap.setIsKeepAbove(w->isKeepAbove());
|
||||
winfoWrap.setIsKeepBelow(w->isKeepBelow());
|
||||
winfoWrap.setGeometry(w->geometry());
|
||||
winfoWrap.setHasSkipTaskbar(w->skipTaskbar());
|
||||
|
||||
//! Window Abilities
|
||||
winfoWrap.setIsClosable(w->isCloseable());
|
||||
winfoWrap.setIsFullScreenable(w->isFullscreenable());
|
||||
winfoWrap.setIsMaximizable(w->isMaximizeable());
|
||||
winfoWrap.setIsMinimizable(w->isMinimizeable());
|
||||
winfoWrap.setIsMovable(w->isMovable());
|
||||
winfoWrap.setIsResizable(w->isResizable());
|
||||
winfoWrap.setIsShadeable(w->isShadeable());
|
||||
winfoWrap.setIsVirtualDesktopsChangeable(w->isVirtualDesktopChangeable());
|
||||
//! Window Abilities
|
||||
|
||||
winfoWrap.setDisplay(w->title());
|
||||
winfoWrap.setDisplay(w->title());
|
||||
#if KF5_VERSION_MINOR >= 52
|
||||
winfoWrap.setDesktops(w->plasmaVirtualDesktops());
|
||||
winfoWrap.setDesktops(w->plasmaVirtualDesktops());
|
||||
#endif
|
||||
winfoWrap.setActivities(QStringList());
|
||||
}
|
||||
winfoWrap.setActivities(QStringList());
|
||||
} else {
|
||||
winfoWrap.setIsValid(false);
|
||||
}
|
||||
@ -595,8 +576,7 @@ bool WaylandInterface::windowCanBeDragged(WindowId wid) const
|
||||
return (winfo.isValid()
|
||||
&& w->isMovable()
|
||||
&& !winfo.isMinimized()
|
||||
&& inCurrentDesktopActivity(winfo)
|
||||
&& !winfo.isPlasmaDesktop());
|
||||
&& inCurrentDesktopActivity(winfo));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -611,8 +591,7 @@ bool WaylandInterface::windowCanBeMaximized(WindowId wid) const
|
||||
return (winfo.isValid()
|
||||
&& w->isMaximizeable()
|
||||
&& !winfo.isMinimized()
|
||||
&& inCurrentDesktopActivity(winfo)
|
||||
&& !winfo.isPlasmaDesktop());
|
||||
&& inCurrentDesktopActivity(winfo));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -742,15 +721,6 @@ void WaylandInterface::requestToggleMaximized(WindowId wid) const
|
||||
}
|
||||
}
|
||||
|
||||
bool WaylandInterface::isPlasmaDesktop(const KWayland::Client::PlasmaWindow *w) const
|
||||
{
|
||||
if (!w || (w->appId() != QLatin1String("org.kde.plasmashell"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return AbstractWindowInterface::isPlasmaDesktop(w->geometry());
|
||||
}
|
||||
|
||||
bool WaylandInterface::isPlasmaPanel(const KWayland::Client::PlasmaWindow *w) const
|
||||
{
|
||||
if (!w || (w->appId() != QLatin1String("org.kde.plasmashell"))) {
|
||||
@ -760,6 +730,15 @@ bool WaylandInterface::isPlasmaPanel(const KWayland::Client::PlasmaWindow *w) co
|
||||
return AbstractWindowInterface::isPlasmaPanel(w->geometry());
|
||||
}
|
||||
|
||||
bool WaylandInterface::isFullScreenWindow(const KWayland::Client::PlasmaWindow *w) const
|
||||
{
|
||||
if (!w) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return w->isFullscreen() || AbstractWindowInterface::isFullScreenWindow(w->geometry());
|
||||
}
|
||||
|
||||
bool WaylandInterface::isValidWindow(const KWayland::Client::PlasmaWindow *w) const
|
||||
{
|
||||
//! DEPRECATED comment is case we must reenable this
|
||||
@ -769,19 +748,21 @@ bool WaylandInterface::isValidWindow(const KWayland::Client::PlasmaWindow *w) co
|
||||
//! e.g. widgets explorer, Activities etc. that are not used to hide
|
||||
//! the dodge views appropriately
|
||||
|
||||
return w->isValid() && !isPlasmaDesktop(w) && !m_plasmaPanels.contains(w->internalId()) && !m_ignoredWindows.contains(w->internalId());
|
||||
return w->isValid() && !m_plasmaIgnoredWindows.contains(w->internalId()) && !m_ignoredWindows.contains(w->internalId());
|
||||
}
|
||||
|
||||
void WaylandInterface::updateWindow()
|
||||
{
|
||||
PlasmaWindow *pW = qobject_cast<PlasmaWindow*>(QObject::sender());
|
||||
|
||||
if (pW && !m_ignoredWindows.contains(pW->internalId() && !isPlasmaDesktop(pW) )) {
|
||||
if (pW && !m_ignoredWindows.contains(pW->internalId())) {
|
||||
if (pW->appId() == QLatin1String("org.kde.plasmashell")) {
|
||||
if (isPlasmaDesktop(pW)) {
|
||||
return;
|
||||
} else if (isPlasmaPanel(pW)) {
|
||||
registerIgnoredWindow(pW->internalId());
|
||||
if (isPlasmaPanel(pW) || isFullScreenWindow(pW)) {
|
||||
registerPlasmaIgnoredWindow(pW->internalId());
|
||||
}
|
||||
} else if (pW->appId() == QLatin1String("latte-dock")) {
|
||||
if (isFullScreenWindow(pW)) {
|
||||
registerPlasmaIgnoredWindow(pW->internalId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -860,13 +841,21 @@ void WaylandInterface::windowCreatedProxy(KWayland::Client::PlasmaWindow *w)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((w->appId() == QLatin1String("org.kde.plasmashell")) && isPlasmaPanel(w)) {
|
||||
registerPlasmaPanel(w->internalId());
|
||||
} else {
|
||||
trackWindow(w);
|
||||
emit windowAdded(w->internalId());
|
||||
if ((w->appId() == QLatin1String("org.kde.plasmashell"))) {
|
||||
if (isPlasmaPanel(w) || isFullScreenWindow(w)) {
|
||||
registerPlasmaIgnoredWindow(w->internalId());
|
||||
return;
|
||||
}
|
||||
} else if (w->appId() == QLatin1String("latte-dock")) {
|
||||
if (isFullScreenWindow(w)) {
|
||||
registerPlasmaIgnoredWindow(w->internalId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
trackWindow(w);
|
||||
emit windowAdded(w->internalId());
|
||||
|
||||
if (w->appId() == "latte-dock") {
|
||||
emit latteWindowAdded();
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ private slots:
|
||||
private:
|
||||
void init();
|
||||
bool isValidWindow(const KWayland::Client::PlasmaWindow *w) const;
|
||||
bool isPlasmaDesktop(const KWayland::Client::PlasmaWindow *w) const;
|
||||
bool isFullScreenWindow(const KWayland::Client::PlasmaWindow *w) const;
|
||||
bool isPlasmaPanel(const KWayland::Client::PlasmaWindow *w) const;
|
||||
void windowCreatedProxy(KWayland::Client::PlasmaWindow *w);
|
||||
void trackWindow(KWayland::Client::PlasmaWindow *w);
|
||||
|
@ -44,7 +44,6 @@ public:
|
||||
, m_isMaxHoriz(false)
|
||||
, m_isFullscreen(false)
|
||||
, m_isShaded(false)
|
||||
, m_isPlasmaDesktop(false)
|
||||
, m_isKeepAbove(false)
|
||||
, m_isKeepBelow(false)
|
||||
, m_hasSkipTaskbar(false)
|
||||
@ -73,7 +72,6 @@ public:
|
||||
, m_isMaxHoriz(o.m_isMaxHoriz)
|
||||
, m_isFullscreen(o.m_isFullscreen)
|
||||
, m_isShaded(o.m_isShaded)
|
||||
, m_isPlasmaDesktop(o.m_isPlasmaDesktop)
|
||||
, m_isKeepAbove(o.m_isKeepAbove)
|
||||
, m_isKeepBelow(o.m_isKeepBelow)
|
||||
, m_hasSkipTaskbar(o.m_hasSkipTaskbar)
|
||||
@ -104,7 +102,6 @@ public:
|
||||
, m_isMaxHoriz(o.m_isMaxHoriz)
|
||||
, m_isFullscreen(o.m_isFullscreen)
|
||||
, m_isShaded(o.m_isShaded)
|
||||
, m_isPlasmaDesktop(o.m_isPlasmaDesktop)
|
||||
, m_isKeepAbove(o.m_isKeepAbove)
|
||||
, m_isKeepBelow(o.m_isKeepBelow)
|
||||
, m_hasSkipTaskbar(o.m_hasSkipTaskbar)
|
||||
@ -153,9 +150,6 @@ public:
|
||||
inline bool isShaded() const noexcept;
|
||||
inline void setIsShaded(bool isShaded) noexcept;
|
||||
|
||||
inline bool isPlasmaDesktop() const noexcept;
|
||||
inline void setIsPlasmaDesktop(bool isPlasmaDesktop) noexcept;
|
||||
|
||||
inline bool isKeepAbove() const noexcept;
|
||||
inline void setIsKeepAbove(bool isKeepAbove) noexcept;
|
||||
|
||||
@ -243,7 +237,6 @@ private:
|
||||
bool m_isMaxHoriz : 1;
|
||||
bool m_isFullscreen : 1;
|
||||
bool m_isShaded : 1;
|
||||
bool m_isPlasmaDesktop : 1;
|
||||
bool m_isKeepAbove: 1;
|
||||
bool m_isKeepBelow: 1;
|
||||
bool m_hasSkipTaskbar: 1;
|
||||
@ -284,7 +277,6 @@ inline WindowInfoWrap &WindowInfoWrap::operator=(WindowInfoWrap &&rhs) noexcept
|
||||
m_isMaxHoriz = rhs.m_isMaxHoriz;
|
||||
m_isFullscreen = rhs.m_isFullscreen;
|
||||
m_isShaded = rhs.m_isShaded;
|
||||
m_isPlasmaDesktop = rhs.m_isPlasmaDesktop;
|
||||
m_isKeepAbove = rhs.m_isKeepAbove;
|
||||
m_isKeepBelow = rhs.m_isKeepBelow;
|
||||
m_hasSkipTaskbar = rhs.m_hasSkipTaskbar;
|
||||
@ -318,7 +310,6 @@ inline WindowInfoWrap &WindowInfoWrap::operator=(const WindowInfoWrap &rhs) noex
|
||||
m_isMaxHoriz = rhs.m_isMaxHoriz;
|
||||
m_isFullscreen = rhs.m_isFullscreen;
|
||||
m_isShaded = rhs.m_isShaded;
|
||||
m_isPlasmaDesktop = rhs.m_isPlasmaDesktop;
|
||||
m_isKeepAbove = rhs.m_isKeepAbove;
|
||||
m_isKeepBelow = rhs.m_isKeepBelow;
|
||||
m_hasSkipTaskbar = rhs.m_hasSkipTaskbar;
|
||||
@ -430,16 +421,6 @@ inline void WindowInfoWrap::setIsShaded(bool isShaded) noexcept
|
||||
m_isShaded = isShaded;
|
||||
}
|
||||
|
||||
inline bool WindowInfoWrap::isPlasmaDesktop() const noexcept
|
||||
{
|
||||
return m_isPlasmaDesktop;
|
||||
}
|
||||
|
||||
inline void WindowInfoWrap::setIsPlasmaDesktop(bool isPlasmaDesktop) noexcept
|
||||
{
|
||||
m_isPlasmaDesktop = isPlasmaDesktop;
|
||||
}
|
||||
|
||||
inline bool WindowInfoWrap::isKeepAbove() const noexcept
|
||||
{
|
||||
return m_isKeepAbove;
|
||||
|
@ -351,17 +351,11 @@ WindowInfoWrap XWindowInterface::requestInfo(WindowId wid) const
|
||||
| NET::WM2AllowedActions
|
||||
| NET::WM2TransientFor};
|
||||
|
||||
//! update desktop id
|
||||
bool isDesktop{false};
|
||||
if (winfo.windowClassName() == "plasmashell" && isPlasmaDesktop(winfo.geometry())) {
|
||||
isDesktop = true;
|
||||
windowsTracker()->setPlasmaDesktop(wid);
|
||||
}
|
||||
WindowInfoWrap winfoWrap;
|
||||
|
||||
if (!winfo.valid()) {
|
||||
winfoWrap.setIsValid(false);
|
||||
} else if (isValidWindow(winfo) && !isDesktop) {
|
||||
} else if (isValidWindow(winfo)) {
|
||||
winfoWrap.setIsValid(true);
|
||||
winfoWrap.setWid(wid);
|
||||
winfoWrap.setParentId(winfo.transientFor());
|
||||
@ -378,7 +372,7 @@ WindowInfoWrap XWindowInterface::requestInfo(WindowId wid) const
|
||||
winfoWrap.setIsKeepBelow(winfo.hasState(NET::KeepBelow));
|
||||
winfoWrap.setHasSkipTaskbar(winfo.hasState(NET::SkipTaskbar));
|
||||
|
||||
//! Window Abilities
|
||||
//! BEGIN:Window Abilities
|
||||
winfoWrap.setIsClosable(winfo.actionSupported(NET::ActionClose));
|
||||
winfoWrap.setIsFullScreenable(winfo.actionSupported(NET::ActionFullScreen));
|
||||
winfoWrap.setIsMaximizable(winfo.actionSupported(NET::ActionMax));
|
||||
@ -387,29 +381,11 @@ WindowInfoWrap XWindowInterface::requestInfo(WindowId wid) const
|
||||
winfoWrap.setIsResizable(winfo.actionSupported(NET::ActionResize));
|
||||
winfoWrap.setIsShadeable(winfo.actionSupported(NET::ActionShade));
|
||||
winfoWrap.setIsVirtualDesktopsChangeable(winfo.actionSupported(NET::ActionChangeDesktop));
|
||||
//! Window Abilities
|
||||
//! END:Window Abilities
|
||||
|
||||
winfoWrap.setDisplay(winfo.visibleName());
|
||||
winfoWrap.setDesktops({QString(winfo.desktop())});
|
||||
winfoWrap.setActivities(winfo.activities());
|
||||
} else if (m_desktopId == wid) {
|
||||
winfoWrap.setIsValid(true);
|
||||
winfoWrap.setIsPlasmaDesktop(true);
|
||||
winfoWrap.setWid(wid);
|
||||
winfoWrap.setParentId(0);
|
||||
winfoWrap.setHasSkipTaskbar(true);
|
||||
|
||||
//! Window Abilities
|
||||
winfoWrap.setIsClosable(false);
|
||||
winfoWrap.setIsFullScreenable(false);
|
||||
winfoWrap.setIsGroupable(false);
|
||||
winfoWrap.setIsMaximizable(false);
|
||||
winfoWrap.setIsMinimizable(false);
|
||||
winfoWrap.setIsMovable(false);
|
||||
winfoWrap.setIsResizable(false);
|
||||
winfoWrap.setIsShadeable(false);
|
||||
winfoWrap.setIsVirtualDesktopsChangeable(false);
|
||||
//! Window Abilities
|
||||
}
|
||||
|
||||
return winfoWrap;
|
||||
@ -455,6 +431,14 @@ QUrl XWindowInterface::windowUrl(WindowId wid) const
|
||||
rulesConfig, info.windowClassName());
|
||||
}
|
||||
|
||||
bool XWindowInterface::isFullScreenWindow(WindowId wid) const
|
||||
{
|
||||
WindowInfoWrap winfo = requestInfo(wid);
|
||||
|
||||
return (winfo.isValid()
|
||||
&& !winfo.isMinimized()
|
||||
&& (winfo.isFullscreen() || AbstractWindowInterface::isFullScreenWindow(winfo.geometry())));
|
||||
}
|
||||
|
||||
bool XWindowInterface::windowCanBeDragged(WindowId wid) const
|
||||
{
|
||||
@ -462,19 +446,16 @@ bool XWindowInterface::windowCanBeDragged(WindowId wid) const
|
||||
return (winfo.isValid()
|
||||
&& !winfo.isMinimized()
|
||||
&& winfo.isMovable()
|
||||
&& inCurrentDesktopActivity(winfo)
|
||||
&& !winfo.isPlasmaDesktop());
|
||||
&& inCurrentDesktopActivity(winfo));
|
||||
}
|
||||
|
||||
bool XWindowInterface::windowCanBeMaximized(WindowId wid) const
|
||||
{
|
||||
|
||||
WindowInfoWrap winfo = requestInfo(wid);
|
||||
return (winfo.isValid()
|
||||
&& !winfo.isMinimized()
|
||||
&& winfo.isMaximizable()
|
||||
&& inCurrentDesktopActivity(winfo)
|
||||
&& !winfo.isPlasmaDesktop());
|
||||
&& inCurrentDesktopActivity(winfo));
|
||||
}
|
||||
|
||||
void XWindowInterface::requestActivate(WindowId wid) const
|
||||
@ -503,7 +484,7 @@ void XWindowInterface::requestClose(WindowId wid) const
|
||||
{
|
||||
WindowInfoWrap wInfo = requestInfo(wid);
|
||||
|
||||
if (!wInfo.isValid() || wInfo.isPlasmaDesktop()) {
|
||||
if (!wInfo.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -515,7 +496,7 @@ void XWindowInterface::requestMoveWindow(WindowId wid, QPoint from) const
|
||||
{
|
||||
WindowInfoWrap wInfo = requestInfo(wid);
|
||||
|
||||
if (!wInfo.isValid() || wInfo.isPlasmaDesktop() || !inCurrentDesktopActivity(wInfo)) {
|
||||
if (!wInfo.isValid() || !inCurrentDesktopActivity(wInfo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -541,7 +522,7 @@ void XWindowInterface::requestToggleIsOnAllDesktops(WindowId wid) const
|
||||
{
|
||||
WindowInfoWrap wInfo = requestInfo(wid);
|
||||
|
||||
if (!wInfo.isValid() || wInfo.isPlasmaDesktop()) {
|
||||
if (!wInfo.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -561,7 +542,7 @@ void XWindowInterface::requestToggleKeepAbove(WindowId wid) const
|
||||
{
|
||||
WindowInfoWrap wInfo = requestInfo(wid);
|
||||
|
||||
if (!wInfo.isValid() || wInfo.isPlasmaDesktop()) {
|
||||
if (!wInfo.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -607,7 +588,7 @@ void XWindowInterface::requestToggleMinimized(WindowId wid) const
|
||||
{
|
||||
WindowInfoWrap wInfo = requestInfo(wid);
|
||||
|
||||
if (!wInfo.isValid() || wInfo.isPlasmaDesktop() || !inCurrentDesktopActivity(wInfo)) {
|
||||
if (!wInfo.isValid() || !inCurrentDesktopActivity(wInfo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -664,19 +645,15 @@ bool XWindowInterface::isValidWindow(const KWindowInfo &winfo) const
|
||||
return true;
|
||||
}
|
||||
|
||||
//! ignored windows from tracking
|
||||
if (m_ignoredWindows.contains(winfo.win()) || m_plasmaIgnoredWindows.contains(winfo.win())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
constexpr auto types = NET::DockMask | NET::MenuMask | NET::SplashMask | NET::PopupMenuMask | NET::NormalMask | NET::DialogMask;
|
||||
NET::WindowType winType = winfo.windowType(types);
|
||||
const auto winClass = KWindowInfo(winfo.win(), 0, NET::WM2WindowClass).windowClassName();
|
||||
|
||||
//! ignored windows from tracking
|
||||
if (m_ignoredWindows.contains(winfo.win())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_desktopId == winfo.win()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (winType == -1) {
|
||||
// Trying to get more types for verify if the window have any other type
|
||||
winType = winfo.windowType(~types & NET::AllTypesMask);
|
||||
@ -706,19 +683,18 @@ void XWindowInterface::windowChangedProxy(WId wid, NET::Properties prop1, NET::P
|
||||
const auto winClass = info.windowClassName();
|
||||
|
||||
//! ignored windows do not trackd
|
||||
if (m_ignoredWindows.contains(wid)) {
|
||||
if (m_ignoredWindows.contains(wid) || m_plasmaIgnoredWindows.contains(wid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (winClass == "plasmashell") {
|
||||
//! update desktop id
|
||||
if (isPlasmaDesktop(info.geometry())) {
|
||||
m_desktopId = wid;
|
||||
windowsTracker()->setPlasmaDesktop(wid);
|
||||
considerWindowChanged(wid);
|
||||
if (isPlasmaPanel(info.geometry()) || isFullScreenWindow(wid)) {
|
||||
registerPlasmaIgnoredWindow(wid);
|
||||
return;
|
||||
} else if (isPlasmaPanel(info.geometry())) {
|
||||
registerPlasmaPanel(wid);
|
||||
}
|
||||
} else if (winClass == "latte-dock") {
|
||||
if (isFullScreenWindow(wid)) {
|
||||
registerPlasmaIgnoredWindow(wid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -83,12 +83,12 @@ public:
|
||||
private:
|
||||
bool isValidWindow(WindowId wid) const;
|
||||
bool isValidWindow(const KWindowInfo &winfo) const;
|
||||
bool isFullScreenWindow(WindowId wid) const;
|
||||
|
||||
void windowChangedProxy(WId wid, NET::Properties prop1, NET::Properties2 prop2);
|
||||
|
||||
QUrl windowUrl(WindowId wid) const;
|
||||
|
||||
private:
|
||||
WindowId m_desktopId{-1};
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user