Add virtual AbstractClient::updateTabGroupStates(TabGroup::States)

Method added so that we can call into TabGroup::updateStates from code
in AbstractClient. Default implementation does nothing, implementation
in Client performs the actuall call.

As a first case added to Client::move in order to be able to move the
implementation to AbstractClient.
This commit is contained in:
Martin Gräßlin 2015-10-15 13:39:49 +02:00
parent d7b4d8fe82
commit c578720615
5 changed files with 21 additions and 4 deletions

View file

@ -1051,4 +1051,8 @@ void AbstractClient::updateGeometryBeforeUpdateBlocking()
m_geometryBeforeUpdateBlocking = geom;
}
void AbstractClient::updateTabGroupStates(TabGroup::States)
{
}
}

View file

@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "toplevel.h"
#include "options.h"
#include "rules.h"
#include "tabgroup.h"
#include <memory>
@ -37,8 +38,6 @@ class PlasmaWindowInterface;
namespace KWin
{
class TabGroup;
namespace TabBox
{
class TabBoxClientImpl;
@ -588,6 +587,13 @@ protected:
**/
void addRepaintDuringGeometryUpdates();
/**
* Convenient method to update the TabGroup states if there is one present.
* Marked as virtual as TabGroup does not yet handle AbstractClient, but only
* subclasses of AbstractClient. Given that the default implementation does nothing.
**/
virtual void updateTabGroupStates(TabGroup::States states);
private:
void handlePaletteChange();
QSharedPointer<TabBox::TabBoxClientImpl> m_tabBoxClient;

View file

@ -2295,6 +2295,13 @@ void Client::processDecorationMove()
}
}
void Client::updateTabGroupStates(TabGroup::States states)
{
if (auto t = tabGroup()) {
t->updateStates(this, states);
}
}
} // namespace
#include "client.moc"

View file

@ -487,6 +487,7 @@ protected:
bool belongsToDesktop() const override;
bool isActiveFullScreen() const override;
void setGeometryRestore(const QRect &geo) override;
void updateTabGroupStates(TabGroup::States states) override;
private Q_SLOTS:
void delayedSetShortcut();

View file

@ -2078,8 +2078,7 @@ void Client::move(int x, int y, ForceGeometry_t force)
updateGeometryBeforeUpdateBlocking();
// Update states of all other windows in this group
if (tabGroup())
tabGroup()->updateStates(this, TabGroup::Geometry);
updateTabGroupStates(TabGroup::Geometry);
emit geometryChanged();
}