Remove BasicScreens class
Summary: After porting all platforms to using AbstractOutput the BasicScreens class is not needed anymore. Test Plan: Compiles Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: kwin Tags: #kwin Maniphest Tasks: T11098 Differential Revision: https://phabricator.kde.org/D21800
This commit is contained in:
parent
6ac1585e12
commit
a39c74059e
2 changed files with 0 additions and 94 deletions
71
screens.cpp
71
screens.cpp
|
@ -246,75 +246,4 @@ void Screens::setConfig(KSharedConfig::Ptr config)
|
|||
}
|
||||
}
|
||||
|
||||
BasicScreens::BasicScreens(Platform *backend, QObject *parent)
|
||||
: Screens(parent)
|
||||
, m_backend(backend)
|
||||
{
|
||||
}
|
||||
|
||||
BasicScreens::~BasicScreens() = default;
|
||||
|
||||
void BasicScreens::init()
|
||||
{
|
||||
updateCount();
|
||||
KWin::Screens::init();
|
||||
#ifndef KWIN_UNIT_TEST
|
||||
connect(m_backend, &Platform::screenSizeChanged,
|
||||
this, &BasicScreens::startChangedTimer);
|
||||
#endif
|
||||
emit changed();
|
||||
}
|
||||
|
||||
QRect BasicScreens::geometry(int screen) const
|
||||
{
|
||||
if (screen < m_geometries.count()) {
|
||||
return m_geometries.at(screen);
|
||||
}
|
||||
return QRect();
|
||||
}
|
||||
|
||||
QSize BasicScreens::size(int screen) const
|
||||
{
|
||||
if (screen < m_geometries.count()) {
|
||||
return m_geometries.at(screen).size();
|
||||
}
|
||||
return QSize();
|
||||
}
|
||||
|
||||
qreal BasicScreens::scale(int screen) const
|
||||
{
|
||||
if (screen < m_scales.count()) {
|
||||
return m_scales.at(screen);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void BasicScreens::updateCount()
|
||||
{
|
||||
m_geometries = m_backend->screenGeometries();
|
||||
m_scales = m_backend->screenScales();
|
||||
setCount(m_geometries.count());
|
||||
}
|
||||
|
||||
int BasicScreens::number(const QPoint &pos) const
|
||||
{
|
||||
int bestScreen = 0;
|
||||
int minDistance = INT_MAX;
|
||||
for (int i = 0; i < m_geometries.count(); ++i) {
|
||||
const QRect &geo = m_geometries.at(i);
|
||||
if (geo.contains(pos)) {
|
||||
return i;
|
||||
}
|
||||
int distance = QPoint(geo.topLeft() - pos).manhattanLength();
|
||||
distance = qMin(distance, QPoint(geo.topRight() - pos).manhattanLength());
|
||||
distance = qMin(distance, QPoint(geo.bottomRight() - pos).manhattanLength());
|
||||
distance = qMin(distance, QPoint(geo.bottomLeft() - pos).manhattanLength());
|
||||
if (distance < minDistance) {
|
||||
minDistance = distance;
|
||||
bestScreen = i;
|
||||
}
|
||||
}
|
||||
return bestScreen;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
23
screens.h
23
screens.h
|
@ -214,29 +214,6 @@ private:
|
|||
KWIN_SINGLETON(Screens)
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A base implementation for backends with just a (nested) window
|
||||
**/
|
||||
class KWIN_EXPORT BasicScreens : public Screens
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BasicScreens(Platform *backend, QObject *parent = nullptr);
|
||||
virtual ~BasicScreens();
|
||||
|
||||
void init() override;
|
||||
QRect geometry(int screen) const override;
|
||||
int number(const QPoint &pos) const override;
|
||||
QSize size(int screen) const override;
|
||||
qreal scale(int screen) const override;
|
||||
void updateCount() override;
|
||||
|
||||
private:
|
||||
Platform *m_backend;
|
||||
QVector<QRect> m_geometries;
|
||||
QVector<qreal> m_scales;
|
||||
};
|
||||
|
||||
inline
|
||||
int Screens::count() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue