Drop redundant Compositor::hasScene()

Summary:
Compositor::hasScene() is redundant. Depending on use case, it can be
replaced by checking either m_state or Compositor::scene().

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23744
This commit is contained in:
Vlad Zagorodniy 2019-09-05 19:06:03 +03:00
parent 7f9dc8625b
commit 96ac6a506b
5 changed files with 13 additions and 12 deletions

View file

@ -534,32 +534,36 @@ void Compositor::reinitialize()
void Compositor::addRepaint(int x, int y, int w, int h)
{
if (!hasScene())
if (m_state != State::On) {
return;
}
repaints_region += QRegion(x, y, w, h);
scheduleRepaint();
}
void Compositor::addRepaint(const QRect& r)
{
if (!hasScene())
if (m_state != State::On) {
return;
}
repaints_region += r;
scheduleRepaint();
}
void Compositor::addRepaint(const QRegion& r)
{
if (!hasScene())
if (m_state != State::On) {
return;
}
repaints_region += r;
scheduleRepaint();
}
void Compositor::addRepaintFull()
{
if (!hasScene())
if (m_state != State::On) {
return;
}
const QSize &s = screens()->size();
repaints_region = QRegion(0, 0, s.width(), s.height());
scheduleRepaint();
@ -976,7 +980,7 @@ void X11Compositor::performCompositing()
bool X11Compositor::checkForOverlayWindow(WId w) const
{
if (!hasScene()) {
if (!scene()) {
// No scene, so it cannot be the overlay window.
return false;
}
@ -990,7 +994,7 @@ bool X11Compositor::checkForOverlayWindow(WId w) const
bool X11Compositor::isOverlayWindowVisible() const
{
if (!hasScene()) {
if (!scene()) {
return false;
}
if (!scene()->overlayWindow()) {

View file

@ -92,9 +92,6 @@ public:
bool isActive();
virtual int refreshRate() const = 0;
bool hasScene() const {
return m_scene != NULL;
}
Scene *scene() const {
return m_scene;
}

View file

@ -267,7 +267,7 @@ QString CompositorDBusInterface::compositingNotPossibleReason() const
QString CompositorDBusInterface::compositingType() const
{
if (!m_compositor->hasScene()) {
if (!m_compositor->scene()) {
return QStringLiteral("none");
}
switch (m_compositor->scene()->compositingType()) {

View file

@ -529,7 +529,7 @@ OutlineVisual *Platform::createOutline(Outline *outline)
Decoration::Renderer *Platform::createDecorationRenderer(Decoration::DecoratedClientImpl *client)
{
if (Compositor::self()->hasScene()) {
if (Compositor::self()->scene()) {
return Compositor::self()->scene()->createDecorationRenderer(client);
}
return nullptr;

View file

@ -1759,7 +1759,7 @@ Toplevel *Workspace::findInternal(QWindow *w) const
bool Workspace::compositing() const
{
return m_compositor && m_compositor->hasScene();
return m_compositor && m_compositor->scene();
}
void Workspace::markXStackingOrderAsDirty()