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