1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-26 11:21:40 +03:00

added support for windows with shade state and improving WindowInfoWrap

This commit is contained in:
Johan Smith Agudelo Rodriguez 2017-03-23 22:06:59 -05:00
parent 90b7d00d6e
commit e6374da532
3 changed files with 86 additions and 66 deletions

View File

@ -406,7 +406,9 @@ void VisibilityManagerPrivate::checkAllWindows()
inline bool VisibilityManagerPrivate::intersects(const WindowInfoWrap &winfo)
{
return (!winfo.isMinimized() && winfo.geometry().intersects(dockGeometry));
return (!winfo.isMinimized()
&& winfo.geometry().intersects(dockGeometry)
&& !winfo.isShaded());
}
inline void VisibilityManagerPrivate::saveConfig()

View File

@ -23,6 +23,7 @@
#include <QWindow>
#include <QRect>
#include <QDebug>
namespace Latte {
@ -30,80 +31,88 @@ class WindowInfoWrap {
Q_DISABLE_COPY(WindowInfoWrap)
public:
constexpr WindowInfoWrap()
constexpr WindowInfoWrap() noexcept
: m_isValid(false)
, m_isActive(false)
, m_isMinimized(false)
, m_isMaxVert(false)
, m_isMaxHorz(false)
, m_isFullscreen(false)
, m_isShaded(false)
, m_isPlasmaDesktop(false)
, m_wid(0) {
}
constexpr WindowInfoWrap(WindowInfoWrap &&other)
: m_isValid(other.m_isValid)
, m_isActive(other.m_isActive)
, m_isMinimized(other.m_isMinimized)
, m_isMaxVert(other.m_isMaxVert)
, m_isMaxHorz(other.m_isMaxHorz)
, m_isFullscreen(other.m_isFullscreen)
, m_isPlasmaDesktop(other.m_isPlasmaDesktop)
, m_wid(std::move(other.m_wid))
, m_geometry(std::move(other.m_geometry))
{
}
inline WindowInfoWrap &operator=(WindowInfoWrap &&rhs);
constexpr bool operator==(const WindowInfoWrap &rhs) const;
constexpr bool operator<(const WindowInfoWrap &rhs) const;
constexpr bool operator>(const WindowInfoWrap &rhs) const;
WindowInfoWrap(WindowInfoWrap &&o) noexcept
: m_wid(std::move(o.m_wid))
, m_geometry(std::move(o.m_geometry))
, m_isValid(o.m_isValid)
, m_isActive(o.m_isActive)
, m_isMinimized(o.m_isMinimized)
, m_isMaxVert(o.m_isMaxVert)
, m_isMaxHorz(o.m_isMaxHorz)
, m_isFullscreen(o.m_isFullscreen)
, m_isShaded(o.m_isShaded)
, m_isPlasmaDesktop(o.m_isPlasmaDesktop)
{
}
constexpr bool isValid() const;
inline void setIsValid(bool isValid);
inline WindowInfoWrap &operator=(WindowInfoWrap &&rhs) noexcept;
constexpr bool operator==(const WindowInfoWrap &rhs) const noexcept;
constexpr bool operator<(const WindowInfoWrap &rhs) const noexcept;
constexpr bool operator>(const WindowInfoWrap &rhs) const noexcept;
constexpr bool isActive() const;
inline void setIsActive(bool isActive);
constexpr bool isValid() const noexcept;
inline void setIsValid(bool isValid) noexcept;
constexpr bool isMinimized() const;
inline void setIsMinimized(bool isMinimized);
constexpr bool isActive() const noexcept;
inline void setIsActive(bool isActive) noexcept;
constexpr bool isMaximized() const;
constexpr bool isMinimized() const noexcept;
inline void setIsMinimized(bool isMinimized) noexcept;
constexpr bool isMaxVert() const;
inline void setIsMaxVert(bool isMaxVert);
constexpr bool isMaximized() const noexcept;
constexpr bool isMaxHoriz() const;
inline void setIsMaxHoriz(bool isMaxHoriz);
constexpr bool isMaxVert() const noexcept;
inline void setIsMaxVert(bool isMaxVert) noexcept;
constexpr bool isFullscreen() const;
inline void setIsFullscreen(bool isFullscreen);
constexpr bool isMaxHoriz() const noexcept;
inline void setIsMaxHoriz(bool isMaxHoriz) noexcept;
constexpr bool isPlasmaDesktop() const;
inline void setIsPlasmaDesktop(bool isPlasmaDesktop);
constexpr bool isFullscreen() const noexcept;
inline void setIsFullscreen(bool isFullscreen) noexcept;
constexpr QRect geometry() const;
inline void setGeometry(const QRect &geometry);
constexpr bool isShaded() const noexcept;
inline void setIsShaded(bool isShaded) noexcept;
constexpr WId wid() const;
inline void setWid(WId wid);
constexpr bool isPlasmaDesktop() const noexcept;
inline void setIsPlasmaDesktop(bool isPlasmaDesktop) noexcept;
constexpr QRect geometry() const noexcept;
inline void setGeometry(const QRect &geometry) noexcept;
constexpr WId wid() const noexcept;
inline void setWid(WId wid) noexcept;
private:
WId m_wid {0};
QRect m_geometry;
bool m_isValid : 1;
bool m_isActive : 1;
bool m_isMinimized : 1;
bool m_isMaxVert : 1;
bool m_isMaxHorz : 1;
bool m_isFullscreen : 1;
bool m_isShaded : 1;
bool m_isPlasmaDesktop : 1;
WId m_wid;
QRect m_geometry;
};
// BEGIN: definitions
inline WindowInfoWrap &WindowInfoWrap::operator=(WindowInfoWrap &&rhs)
inline WindowInfoWrap &WindowInfoWrap::operator=(WindowInfoWrap &&rhs) noexcept
{
m_wid = std::move(rhs.m_wid);
m_geometry = std::move(rhs.m_geometry);
m_isValid = rhs.m_isValid;
m_isActive = rhs.m_isActive;
m_isMinimized = rhs.m_isMinimized;
@ -111,117 +120,125 @@ inline WindowInfoWrap &WindowInfoWrap::operator=(WindowInfoWrap &&rhs)
m_isMaxHorz = rhs.m_isMaxHorz;
m_isFullscreen = rhs.m_isFullscreen;
m_isPlasmaDesktop = rhs.m_isPlasmaDesktop;
m_wid = rhs.m_wid;
m_geometry = std::move(rhs.m_geometry);
return *this;
}
constexpr bool WindowInfoWrap::operator==(const WindowInfoWrap &rhs) const
constexpr bool WindowInfoWrap::operator==(const WindowInfoWrap &rhs) const noexcept
{
return m_wid == rhs.m_wid;
}
constexpr bool WindowInfoWrap::operator<(const WindowInfoWrap &rhs) const
constexpr bool WindowInfoWrap::operator<(const WindowInfoWrap &rhs) const noexcept
{
return m_wid < rhs.m_wid;
}
constexpr bool WindowInfoWrap::operator>(const WindowInfoWrap &rhs) const
constexpr bool WindowInfoWrap::operator>(const WindowInfoWrap &rhs) const noexcept
{
return m_wid > rhs.m_wid;
}
constexpr bool WindowInfoWrap::isValid() const
constexpr bool WindowInfoWrap::isValid() const noexcept
{
return m_isValid;
}
inline void WindowInfoWrap::setIsValid(bool isValid)
inline void WindowInfoWrap::setIsValid(bool isValid) noexcept
{
m_isValid = isValid;
}
constexpr bool WindowInfoWrap::isActive() const
constexpr bool WindowInfoWrap::isActive() const noexcept
{
return m_isActive;
}
inline void WindowInfoWrap::setIsActive(bool isActive)
inline void WindowInfoWrap::setIsActive(bool isActive) noexcept
{
m_isActive = isActive;
}
constexpr bool WindowInfoWrap::isMinimized() const
constexpr bool WindowInfoWrap::isMinimized() const noexcept
{
return m_isMinimized;
}
inline void WindowInfoWrap::setIsMinimized(bool isMinimized)
inline void WindowInfoWrap::setIsMinimized(bool isMinimized) noexcept
{
m_isMinimized = isMinimized;
}
constexpr bool WindowInfoWrap::isMaximized() const
constexpr bool WindowInfoWrap::isMaximized() const noexcept
{
return m_isMaxVert || m_isMaxHorz;
}
constexpr bool WindowInfoWrap::isMaxVert() const
constexpr bool WindowInfoWrap::isMaxVert() const noexcept
{
return m_isMaxVert;
}
inline void WindowInfoWrap::setIsMaxVert(bool isMaxVert)
inline void WindowInfoWrap::setIsMaxVert(bool isMaxVert) noexcept
{
m_isMaxVert = isMaxVert;
}
constexpr bool WindowInfoWrap::isMaxHoriz() const
constexpr bool WindowInfoWrap::isMaxHoriz() const noexcept
{
return m_isMaxHorz;
}
inline void WindowInfoWrap::setIsMaxHoriz(bool isMaxHoriz)
inline void WindowInfoWrap::setIsMaxHoriz(bool isMaxHoriz) noexcept
{
m_isMaxHorz = isMaxHoriz;
}
constexpr bool WindowInfoWrap::isFullscreen() const
constexpr bool WindowInfoWrap::isFullscreen() const noexcept
{
return m_isFullscreen;
}
inline void WindowInfoWrap::setIsFullscreen(bool isFullscreen)
inline void WindowInfoWrap::setIsFullscreen(bool isFullscreen) noexcept
{
m_isFullscreen = isFullscreen;
}
constexpr bool WindowInfoWrap::isPlasmaDesktop() const
constexpr bool WindowInfoWrap::isShaded() const noexcept
{
return m_isShaded;
}
inline void WindowInfoWrap::setIsShaded(bool isShaded) noexcept
{
m_isShaded = isShaded;
}
constexpr bool WindowInfoWrap::isPlasmaDesktop() const noexcept
{
return m_isPlasmaDesktop;
}
inline void WindowInfoWrap::setIsPlasmaDesktop(bool isPlasmaDesktop)
inline void WindowInfoWrap::setIsPlasmaDesktop(bool isPlasmaDesktop) noexcept
{
m_isPlasmaDesktop = isPlasmaDesktop;
}
constexpr QRect WindowInfoWrap::geometry() const
constexpr QRect WindowInfoWrap::geometry() const noexcept
{
return m_geometry;
}
inline void WindowInfoWrap::setGeometry(const QRect &geometry)
inline void WindowInfoWrap::setGeometry(const QRect &geometry) noexcept
{
m_geometry = geometry;
}
constexpr WId WindowInfoWrap::wid() const
constexpr WId WindowInfoWrap::wid() const noexcept
{
return m_wid;
}
inline void WindowInfoWrap::setWid(WId wid)
inline void WindowInfoWrap::setWid(WId wid) noexcept
{
m_wid = wid;
}

View File

@ -220,6 +220,7 @@ WindowInfoWrap XWindowInterface::requestInfo(WId wid) const
winfoWrap.setIsMaxVert(winfo.hasState(NET::MaxVert));
winfoWrap.setIsMaxHoriz(winfo.hasState(NET::MaxHoriz));
winfoWrap.setIsFullscreen(winfo.hasState(NET::FullScreen));
winfoWrap.setIsShaded(winfo.hasState(NET::Shaded));
winfoWrap.setGeometry(winfo.frameGeometry());
} else if (m_desktopId == wid) {
winfoWrap.setIsValid(true);