From 59e3e21c47bbd82a6ab46969a0682caebe5bddc3 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Fri, 20 Jul 2018 11:17:49 +0300 Subject: [PATCH] [effects/sheet] Drop IsSheetWindow hack Summary: When the Sheet effect was written, isModal worked only for Client windows, not Deleted windows: bool EffectWindowImpl::isModal() const { if( Client* c = dynamic_cast< Client* >( toplevel )) return c->isModal(); return false; } so the Sheet effect had to track windows by using WindowInfo class, e.g. class WindowInfo { public: bool deleted; bool added; bool closed; }; the biggest drawback of that method is that WindowInfo for each modal kept around as long as those modals existed. It also was adding little overhead, e.g. void SheetEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ) { if( windows.contains( w ) && ( windows[ w ].added || windows[ w ].closed ) ) Things changed with a8160b3c31afa1db24084147ad4ce50cf3c0314a. With that commit, WindowInfo kept only for modals that are currently being animated, but isModal still worked only with Client windows, so IsSheetWindow hack had been introduced. Long story short: we don't need IsSheetWindow hack anymore because isModal now works with Deleted windows. Test Plan: Pressed Ctrl+O in Kate. Reviewers: #kwin, graesslin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D14246 --- effects/sheet/sheet.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/effects/sheet/sheet.cpp b/effects/sheet/sheet.cpp index 463e25391c..79730278bb 100644 --- a/effects/sheet/sheet.cpp +++ b/effects/sheet/sheet.cpp @@ -31,8 +31,6 @@ along with this program. If not, see . namespace KWin { -static const int IsSheetWindow = 0x22A982D5; - SheetEffect::SheetEffect() { initConfig(); @@ -123,7 +121,6 @@ void SheetEffect::slotWindowAdded(EffectWindow* w) { if (!isSheetWindow(w)) return; - w->setData(IsSheetWindow, true); InfoMap::iterator it = windows.find(w); WindowInfo *info = (it == windows.end()) ? &windows[w] : &it.value(); @@ -181,7 +178,7 @@ void SheetEffect::slotWindowDeleted(EffectWindow* w) bool SheetEffect::isSheetWindow(EffectWindow* w) { - return (w->isModal() || w->data(IsSheetWindow).toBool()); + return w->isModal(); } bool SheetEffect::isActive() const