Remove Toplevel::compositing() and Workspace::compositing()
It is error-prone to have multiple sources for the same data. If the base implementation (Compositor::compositing()) changes, other helpers can get out of sync.
This commit is contained in:
parent
ae70b17c79
commit
c61085dc2e
8 changed files with 25 additions and 45 deletions
|
@ -40,10 +40,6 @@ public:
|
|||
void registerEventFilter(X11EventFilter *filter);
|
||||
void unregisterEventFilter(X11EventFilter *filter);
|
||||
|
||||
bool compositing() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
static Workspace *self();
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -351,7 +351,7 @@ bool X11Client::windowEvent(xcb_generic_event_t *e)
|
|||
if ((dirtyProperties2 & NET::WM2StartupId) != 0)
|
||||
startupIdChanged();
|
||||
if (dirtyProperties2 & NET::WM2Opacity) {
|
||||
if (compositing()) {
|
||||
if (Compositor::compositing()) {
|
||||
setOpacity(info->opacityF());
|
||||
} else {
|
||||
// forward to the frame if there's possibly another compositing manager running
|
||||
|
@ -1183,7 +1183,7 @@ bool Unmanaged::windowEvent(xcb_generic_event_t *e)
|
|||
NET::Properties2 dirtyProperties2;
|
||||
info->event(e, &dirtyProperties, &dirtyProperties2); // pass through the NET stuff
|
||||
if (dirtyProperties2 & NET::WM2Opacity) {
|
||||
if (compositing()) {
|
||||
if (Compositor::compositing()) {
|
||||
setOpacity(info->opacityF());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
#include "activities.h"
|
||||
#endif
|
||||
#include "composite.h"
|
||||
#include "x11client.h"
|
||||
#include "effects.h"
|
||||
#include "input.h"
|
||||
|
@ -282,8 +283,9 @@ TabBoxClientList TabBoxHandlerImpl::stackingOrder() const
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool TabBoxHandlerImpl::isKWinCompositing() const {
|
||||
return Workspace::self()->compositing();
|
||||
bool TabBoxHandlerImpl::isKWinCompositing() const
|
||||
{
|
||||
return Compositor::compositing();
|
||||
}
|
||||
|
||||
void TabBoxHandlerImpl::raiseClient(TabBoxClient* c) const
|
||||
|
|
|
@ -255,7 +255,7 @@ void Toplevel::setOpacity(qreal opacity)
|
|||
}
|
||||
const qreal oldOpacity = m_opacity;
|
||||
m_opacity = opacity;
|
||||
if (compositing()) {
|
||||
if (Compositor::compositing()) {
|
||||
addRepaintFull();
|
||||
Q_EMIT opacityChanged(this, oldOpacity);
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ void Toplevel::setOpacity(qreal opacity)
|
|||
|
||||
bool Toplevel::setupCompositing()
|
||||
{
|
||||
if (!compositing())
|
||||
if (!Compositor::compositing())
|
||||
return false;
|
||||
|
||||
effect_window = new EffectWindowImpl(this);
|
||||
|
@ -283,11 +283,6 @@ void Toplevel::finishCompositing(ReleaseReason)
|
|||
}
|
||||
}
|
||||
|
||||
bool Toplevel::compositing() const
|
||||
{
|
||||
return Compositor::compositing();
|
||||
}
|
||||
|
||||
void Toplevel::addRepaint(const QRect &rect)
|
||||
{
|
||||
addRepaint(QRegion(rect));
|
||||
|
@ -332,14 +327,14 @@ void Toplevel::addWorkspaceRepaint(int x, int y, int w, int h)
|
|||
|
||||
void Toplevel::addWorkspaceRepaint(const QRect& r2)
|
||||
{
|
||||
if (!compositing())
|
||||
if (!Compositor::compositing())
|
||||
return;
|
||||
Compositor::self()->addRepaint(r2);
|
||||
}
|
||||
|
||||
void Toplevel::addWorkspaceRepaint(const QRegion ®ion)
|
||||
{
|
||||
if (compositing()) {
|
||||
if (Compositor::compositing()) {
|
||||
Compositor::self()->addRepaint(region);
|
||||
}
|
||||
}
|
||||
|
@ -348,7 +343,7 @@ void Toplevel::setReadyForPainting()
|
|||
{
|
||||
if (!ready_for_painting) {
|
||||
ready_for_painting = true;
|
||||
if (compositing()) {
|
||||
if (Compositor::compositing()) {
|
||||
addRepaintFull();
|
||||
Q_EMIT windowShown(this);
|
||||
}
|
||||
|
|
|
@ -671,10 +671,6 @@ protected:
|
|||
void readWmClientLeader(Xcb::Property &p);
|
||||
void getWmClientLeader();
|
||||
void getWmClientMachine();
|
||||
/**
|
||||
* @returns Whether there is a compositor and it is active.
|
||||
*/
|
||||
bool compositing() const;
|
||||
|
||||
/**
|
||||
* This function fetches the opaque region from this Toplevel.
|
||||
|
|
|
@ -1214,7 +1214,7 @@ void Workspace::updateCurrentActivity(const QString &new_activity)
|
|||
|
||||
//if ( effects != NULL && old_desktop != 0 && old_desktop != new_desktop )
|
||||
// static_cast<EffectsHandlerImpl*>( effects )->desktopChanged( old_desktop );
|
||||
if (compositing() && m_compositor)
|
||||
if (Compositor::compositing() && m_compositor)
|
||||
m_compositor->addRepaintFull();
|
||||
#else
|
||||
Q_UNUSED(new_activity)
|
||||
|
@ -1889,11 +1889,6 @@ Toplevel *Workspace::findInternal(QWindow *w) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool Workspace::compositing() const
|
||||
{
|
||||
return Compositor::compositing();
|
||||
}
|
||||
|
||||
void Workspace::markXStackingOrderAsDirty()
|
||||
{
|
||||
m_xStackingDirty = true;
|
||||
|
|
|
@ -369,10 +369,6 @@ public:
|
|||
return movingClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns Whether we have a Compositor and it is active (Scene created)
|
||||
*/
|
||||
bool compositing() const;
|
||||
void markXStackingOrderAsDirty();
|
||||
|
||||
void quickTileWindow(QuickTileMode mode);
|
||||
|
|
|
@ -839,7 +839,7 @@ bool X11Client::manage(xcb_window_t w, bool isMapped)
|
|||
workspace()->restoreSessionStackingOrder(this);
|
||||
}
|
||||
|
||||
if (compositing())
|
||||
if (Compositor::compositing())
|
||||
// Sending ConfigureNotify is done when setting mapping state below,
|
||||
// Getting the first sync response means window is ready for compositing
|
||||
sendSyncRequest();
|
||||
|
@ -1135,7 +1135,7 @@ void X11Client::destroyDecoration()
|
|||
maybeDestroyX11DecorationRenderer();
|
||||
resize(adjustedSize());
|
||||
move(grav);
|
||||
if (compositing())
|
||||
if (Compositor::compositing())
|
||||
discardWindowPixmap();
|
||||
if (!isZombie()) {
|
||||
Q_EMIT geometryShapeChanged(this, oldgeom);
|
||||
|
@ -1149,7 +1149,7 @@ void X11Client::maybeCreateX11DecorationRenderer()
|
|||
if (kwinApp()->operationMode() != Application::OperationModeX11) {
|
||||
return;
|
||||
}
|
||||
if (!compositing() && decoratedClient()) {
|
||||
if (!Compositor::compositing() && decoratedClient()) {
|
||||
m_decorationRenderer.reset(new X11DecorationRenderer(decoratedClient()));
|
||||
decoration()->update();
|
||||
}
|
||||
|
@ -1170,7 +1170,7 @@ void X11Client::layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRe
|
|||
NETStrut strut = info->frameOverlap();
|
||||
|
||||
// Ignore the overlap strut when compositing is disabled
|
||||
if (!compositing())
|
||||
if (!Compositor::compositing())
|
||||
strut.left = strut.top = strut.right = strut.bottom = 0;
|
||||
else if (strut.left == -1 && strut.top == -1 && strut.right == -1 && strut.bottom == -1) {
|
||||
top = QRect(r.x(), r.y(), r.width(), r.height() / 3);
|
||||
|
@ -1196,7 +1196,7 @@ QRect X11Client::transparentRect() const
|
|||
|
||||
NETStrut strut = info->frameOverlap();
|
||||
// Ignore the strut when compositing is disabled or the decoration doesn't support it
|
||||
if (!compositing())
|
||||
if (!Compositor::compositing())
|
||||
strut.left = strut.top = strut.right = strut.bottom = 0;
|
||||
else if (strut.left == -1 && strut.top == -1 && strut.right == -1 && strut.bottom == -1)
|
||||
return QRect();
|
||||
|
@ -1374,7 +1374,7 @@ void X11Client::updateShape()
|
|||
// Decoration mask (i.e. 'else' here) setting is done in setMask()
|
||||
// when the decoration calls it or when the decoration is created/destroyed
|
||||
updateInputShape();
|
||||
if (compositing()) {
|
||||
if (Compositor::compositing()) {
|
||||
addRepaintFull();
|
||||
addWorkspaceRepaint(visibleGeometry()); // In case shape change removes part of this window
|
||||
}
|
||||
|
@ -1592,7 +1592,7 @@ void X11Client::updateVisibility()
|
|||
if (hidden) {
|
||||
info->setState(NET::Hidden, NET::Hidden);
|
||||
setSkipTaskbar(true); // Also hide from taskbar
|
||||
if (compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
|
||||
if (Compositor::compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
|
||||
internalKeep();
|
||||
else
|
||||
internalHide();
|
||||
|
@ -1601,7 +1601,7 @@ void X11Client::updateVisibility()
|
|||
setSkipTaskbar(originalSkipTaskbar()); // Reset from 'hidden'
|
||||
if (isMinimized()) {
|
||||
info->setState(NET::Hidden, NET::Hidden);
|
||||
if (compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
|
||||
if (Compositor::compositing() && options->hiddenPreviews() == HiddenPreviewsAlways)
|
||||
internalKeep();
|
||||
else
|
||||
internalHide();
|
||||
|
@ -1609,14 +1609,14 @@ void X11Client::updateVisibility()
|
|||
}
|
||||
info->setState(NET::States(), NET::Hidden);
|
||||
if (!isOnCurrentDesktop()) {
|
||||
if (compositing() && options->hiddenPreviews() != HiddenPreviewsNever)
|
||||
if (Compositor::compositing() && options->hiddenPreviews() != HiddenPreviewsNever)
|
||||
internalKeep();
|
||||
else
|
||||
internalHide();
|
||||
return;
|
||||
}
|
||||
if (!isOnCurrentActivity()) {
|
||||
if (compositing() && options->hiddenPreviews() != HiddenPreviewsNever)
|
||||
if (Compositor::compositing() && options->hiddenPreviews() != HiddenPreviewsNever)
|
||||
internalKeep();
|
||||
else
|
||||
internalHide();
|
||||
|
@ -1678,7 +1678,7 @@ void X11Client::internalHide()
|
|||
|
||||
void X11Client::internalKeep()
|
||||
{
|
||||
Q_ASSERT(compositing());
|
||||
Q_ASSERT(Compositor::compositing());
|
||||
if (mapping_state == Kept)
|
||||
return;
|
||||
MappingState old = mapping_state;
|
||||
|
@ -1703,7 +1703,7 @@ void X11Client::map()
|
|||
// XComposite invalidates backing pixmaps on unmap (minimize, different
|
||||
// virtual desktop, etc.). We kept the last known good pixmap around
|
||||
// for use in effects, but now we want to have access to the new pixmap
|
||||
if (compositing())
|
||||
if (Compositor::compositing())
|
||||
discardWindowPixmap();
|
||||
m_frame.map();
|
||||
if (!isShade()) {
|
||||
|
@ -4133,7 +4133,7 @@ void X11Client::updateServerGeometry()
|
|||
updateShape();
|
||||
} else {
|
||||
if (isInteractiveMoveResize()) {
|
||||
if (compositing()) { // Defer the X update until we leave this mode
|
||||
if (Compositor::compositing()) { // Defer the X update until we leave this mode
|
||||
needsXWindowMove = true;
|
||||
} else {
|
||||
m_frame.move(m_bufferGeometry.topLeft()); // sendSyntheticConfigureNotify() on finish shall be sufficient
|
||||
|
|
Loading…
Reference in a new issue