Remove Scene::Window::{discard,update}Pixmap

They are used only by X11Client, so make X11Client call relevants
methods on the surface item directly instead. In hindsight, it will be a
really good idea to make SurfaceItemX11 and SurfaceItemXwayland(?)
automatically manage the window pixmap. However, it can be done once
an item freezing api is added and we fix the cross-fade animation.
This commit is contained in:
Vlad Zahorodnii 2021-05-19 09:22:05 +03:00
parent 9be862999e
commit 6f39d79d72
8 changed files with 14 additions and 54 deletions

View file

@ -607,8 +607,6 @@ void AbstractClient::setShade(ShadeMode mode)
GeometryUpdatesBlocker blocker(this); GeometryUpdatesBlocker blocker(this);
doSetShade(previousShadeMode); doSetShade(previousShadeMode);
discardWindowPixmap();
updateWindowRules(Rules::Shade); updateWindowRules(Rules::Shade);
emit shadeChanged(); emit shadeChanged();

View file

@ -824,40 +824,6 @@ void Scene::Window::unreferencePreviousPixmap_helper(SurfaceItem *item)
} }
} }
void Scene::Window::discardPixmap()
{
if (surfaceItem()) {
discardPixmap_helper(surfaceItem());
}
}
void Scene::Window::discardPixmap_helper(SurfaceItem *item)
{
item->discardPixmap();
const QList<Item *> children = item->childItems();
for (Item *child : children) {
discardPixmap_helper(static_cast<SurfaceItem *>(child));
}
}
void Scene::Window::updatePixmap()
{
if (surfaceItem()) {
updatePixmap_helper(surfaceItem());
}
}
void Scene::Window::updatePixmap_helper(SurfaceItem *item)
{
item->updatePixmap();
const QList<Item *> children = item->childItems();
for (Item *child : children) {
updatePixmap_helper(static_cast<SurfaceItem *>(child));
}
}
QRegion Scene::Window::decorationShape() const QRegion Scene::Window::decorationShape() const
{ {
return QRegion(toplevel->rect()) - toplevel->transparentRect(); return QRegion(toplevel->rect()) - toplevel->transparentRect();

View file

@ -311,9 +311,6 @@ public:
~Window() override; ~Window() override;
// perform the actual painting of the window // perform the actual painting of the window
virtual void performPaint(int mask, const QRegion &region, const WindowPaintData &data) = 0; virtual void performPaint(int mask, const QRegion &region, const WindowPaintData &data) = 0;
// do any cleanup needed when the window's composite pixmap is discarded
void discardPixmap();
void updatePixmap();
int x() const; int x() const;
int y() const; int y() const;
int width() const; int width() const;
@ -374,9 +371,6 @@ protected:
Toplevel* toplevel; Toplevel* toplevel;
ImageFilterType filter; ImageFilterType filter;
private: private:
void discardPixmap_helper(SurfaceItem *item);
void updatePixmap_helper(SurfaceItem *item);
void referencePreviousPixmap_helper(SurfaceItem *item); void referencePreviousPixmap_helper(SurfaceItem *item);
void unreferencePreviousPixmap_helper(SurfaceItem *item); void unreferencePreviousPixmap_helper(SurfaceItem *item);

View file

@ -31,6 +31,9 @@ public:
void resetDamage(); void resetDamage();
QRegion damage() const; QRegion damage() const;
void discardPixmap();
void updatePixmap();
SurfacePixmap *pixmap() const; SurfacePixmap *pixmap() const;
SurfacePixmap *previousPixmap() const; SurfacePixmap *previousPixmap() const;
@ -43,9 +46,6 @@ protected:
virtual SurfacePixmap *createPixmap() = 0; virtual SurfacePixmap *createPixmap() = 0;
void preprocess() override; void preprocess() override;
void discardPixmap();
void updatePixmap();
QRegion m_damage; QRegion m_damage;
QScopedPointer<SurfacePixmap> m_pixmap; QScopedPointer<SurfacePixmap> m_pixmap;
QScopedPointer<SurfacePixmap> m_previousPixmap; QScopedPointer<SurfacePixmap> m_previousPixmap;

View file

@ -282,12 +282,6 @@ void Toplevel::finishCompositing(ReleaseReason)
} }
} }
void Toplevel::discardWindowPixmap()
{
if (effectWindow() != nullptr && effectWindow()->sceneWindow() != nullptr)
effectWindow()->sceneWindow()->discardPixmap();
}
bool Toplevel::compositing() const bool Toplevel::compositing() const
{ {
if (!Workspace::self()) { if (!Workspace::self()) {

View file

@ -669,7 +669,6 @@ protected:
void detectShape(xcb_window_t id); void detectShape(xcb_window_t id);
virtual void propertyNotifyEvent(xcb_property_notify_event_t *e); virtual void propertyNotifyEvent(xcb_property_notify_event_t *e);
virtual void clientMessageEvent(xcb_client_message_event_t *e); virtual void clientMessageEvent(xcb_client_message_event_t *e);
void discardWindowPixmap();
Xcb::Property fetchWmClientLeader() const; Xcb::Property fetchWmClientLeader() const;
void readWmClientLeader(Xcb::Property &p); void readWmClientLeader(Xcb::Property &p);
void getWmClientLeader(); void getWmClientLeader();

View file

@ -1500,6 +1500,7 @@ void X11Client::doSetShade(ShadeMode previousShadeMode)
info->setState(isShown(false) ? NET::States() : NET::Hidden, NET::Hidden); info->setState(isShown(false) ? NET::States() : NET::Hidden, NET::Hidden);
updateVisibility(); updateVisibility();
updateAllowedActions(); updateAllowedActions();
discardWindowPixmap();
} }
void X11Client::updateVisibility() void X11Client::updateVisibility()
@ -4744,10 +4745,17 @@ void X11Client::damageNotifyEvent()
} }
} }
void X11Client::discardWindowPixmap()
{
if (auto item = surfaceItem()) {
item->discardPixmap();
}
}
void X11Client::updateWindowPixmap() void X11Client::updateWindowPixmap()
{ {
if (effectWindow() && effectWindow()->sceneWindow()) { if (auto item = surfaceItem()) {
effectWindow()->sceneWindow()->updatePixmap(); item->updatePixmap();
} }
} }

View file

@ -411,6 +411,7 @@ private:
void updateInputShape(); void updateInputShape();
void updateServerGeometry(); void updateServerGeometry();
void discardWindowPixmap();
void updateWindowPixmap(); void updateWindowPixmap();
xcb_timestamp_t readUserTimeMapTimestamp(const KStartupInfoId* asn_id, const KStartupInfoData* asn_data, xcb_timestamp_t readUserTimeMapTimestamp(const KStartupInfoId* asn_id, const KStartupInfoData* asn_data,