Workspace::activeClient returns an AbstractClient

Still a few casts in some areas as setting activeClient still takes
a Client.
icc-effect-5.14.5
Martin Gräßlin 2015-03-06 13:37:56 +01:00
parent 4b41c33268
commit 3ad117ac28
8 changed files with 19 additions and 19 deletions

View File

@ -381,7 +381,7 @@ void Edge::checkBlocking()
return;
}
bool newValue = false;
if (Client *client = Workspace::self()->activeClient()) {
if (AbstractClient *client = Workspace::self()->activeClient()) {
newValue = client->isFullScreen() && client->geometry().contains(m_geometry.center());
}
if (newValue == m_blocked) {

View File

@ -155,7 +155,7 @@ int Screens::current() const
if (m_currentFollowsMouse) {
return number(Cursor::pos());
}
Client *client = Workspace::self()->activeClient();
AbstractClient *client = Workspace::self()->activeClient();
if (client && !client->isOnScreen(m_current)) {
return client->screen();
}

View File

@ -93,7 +93,7 @@ void WorkspaceWrapper::setNumberOfDesktops(int count)
rettype WorkspaceWrapper::getterName( ) const { \
return Workspace::self()->getterName(); \
}
GETTER(KWin::Client*, activeClient)
GETTER(KWin::AbstractClient*, activeClient)
GETTER(QList< KWin::Client* >, clientList)
#undef GETTER
@ -192,9 +192,9 @@ SLOTWRAPPER(slotSwitchDesktopDown,DesktopBelow)
#undef SLOTWRAPPER
void WorkspaceWrapper::setActiveClient(KWin::Client* client)
void WorkspaceWrapper::setActiveClient(KWin::AbstractClient* client)
{
KWin::Workspace::self()->activateClient(client);
KWin::Workspace::self()->activateClient(dynamic_cast<Client*>(client));
}
QSize WorkspaceWrapper::workspaceSize() const

View File

@ -40,7 +40,7 @@ class WorkspaceWrapper : public QObject
Q_ENUMS(ClientAreaOption)
Q_ENUMS(ElectricBorder)
Q_PROPERTY(int currentDesktop READ currentDesktop WRITE setCurrentDesktop NOTIFY currentDesktopChanged)
Q_PROPERTY(KWin::Client *activeClient READ activeClient WRITE setActiveClient NOTIFY clientActivated)
Q_PROPERTY(KWin::AbstractClient *activeClient READ activeClient WRITE setActiveClient NOTIFY clientActivated)
// TODO: write and notify?
Q_PROPERTY(QSize desktopGridSize READ desktopGridSize NOTIFY desktopLayoutChanged)
Q_PROPERTY(int desktopGridWidth READ desktopGridWidth NOTIFY desktopLayoutChanged)
@ -204,7 +204,7 @@ rettype getter() const; \
void setter( rettype val );
GETTERSETTERDEF(int, numberOfDesktops, setNumberOfDesktops)
GETTERSETTERDEF(int, currentDesktop, setCurrentDesktop)
GETTERSETTERDEF(KWin::Client*, activeClient, setActiveClient)
GETTERSETTERDEF(KWin::AbstractClient*, activeClient, setActiveClient)
#undef GETTERSETTERDEF
QSize desktopGridSize() const;
int desktopGridWidth() const;

View File

@ -1593,8 +1593,8 @@ bool TabBox::establishTabBoxGrab()
// the active client, which may not have it.
assert(!m_forcedGlobalMouseGrab);
m_forcedGlobalMouseGrab = true;
if (Workspace::self()->activeClient() != nullptr)
Workspace::self()->activeClient()->updateMouseGrab();
if (Client *c = dynamic_cast<Client*>(Workspace::self()->activeClient()))
c->updateMouseGrab();
return true;
}
@ -1604,8 +1604,8 @@ void TabBox::removeTabBoxGrab()
ungrabXKeyboard();
assert(m_forcedGlobalMouseGrab);
m_forcedGlobalMouseGrab = false;
if (Workspace::self()->activeClient() != nullptr)
Workspace::self()->activeClient()->updateMouseGrab();
if (Client *c = dynamic_cast<Client*>(Workspace::self()->activeClient()))
c->updateMouseGrab();
}
} // namespace TabBox
} // namespace

View File

@ -222,7 +222,7 @@ void TabGroup::move(Client *c, Client *other, bool after)
bool TabGroup::isActive() const
{
return contains(Workspace::self()->activeClient());
return contains(dynamic_cast<Client*>(Workspace::self()->activeClient()));
}
void TabGroup::setCurrent(Client* c, bool force)

View File

@ -87,7 +87,7 @@ ColorMapper::~ColorMapper()
void ColorMapper::update()
{
xcb_colormap_t cmap = m_default;
if (Client *c = Workspace::self()->activeClient()) {
if (Client *c = dynamic_cast<Client*>(Workspace::self()->activeClient())) {
if (c->colormap() != XCB_COLORMAP_NONE) {
cmap = c->colormap();
}
@ -1663,6 +1663,11 @@ bool Workspace::hasClient(const AbstractClient *c)
return false;
}
AbstractClient *Workspace::activeClient() const
{
return active_client;
}
} // namespace
#include "workspace.moc"

View File

@ -138,7 +138,7 @@ public:
* Returns the active client, i.e. the client that has the focus (or None
* if no client has the focus)
*/
Client* activeClient() const;
AbstractClient* activeClient() const;
/**
* Client that was activated, but it's not yet really activeClient(), because
* we didn't process yet the matching FocusIn event. Used mostly in focus
@ -634,11 +634,6 @@ inline bool Workspace::initializing() const
return workspaceInit;
}
inline Client* Workspace::activeClient() const
{
return active_client;
}
inline Client* Workspace::mostRecentlyActivatedClient() const
{
return should_get_focus.count() > 0 ? should_get_focus.last() : active_client;