Workspace::performWindowOperation operates on AbstractClient

Only exception is the call to ::takeActivity which still expects a
Client.
This commit is contained in:
Martin Gräßlin 2015-03-06 10:05:40 +01:00
parent bfb52b20c9
commit 519006ffa4
5 changed files with 47 additions and 18 deletions

View file

@ -43,4 +43,16 @@ bool AbstractClient::isTransient() const
return false;
}
TabGroup *AbstractClient::tabGroup() const
{
return nullptr;
}
bool AbstractClient::untab(const QRect &toGeometry, bool clientRemoved)
{
Q_UNUSED(toGeometry)
Q_UNUSED(clientRemoved)
return false;
}
}

View file

@ -21,10 +21,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KWIN_ABSTRACT_CLIENT_H
#include "toplevel.h"
#include "options.h"
namespace KWin
{
class TabGroup;
namespace TabBox
{
class TabBoxClientImpl;
@ -63,6 +66,20 @@ public:
virtual void sendToScreen(int screen) = 0;
virtual const QKeySequence &shortcut() const = 0;
virtual void setShortcut(const QString &cut) = 0;
virtual bool performMouseCommand(Options::MouseCommand, const QPoint &globalPos) = 0;
virtual void setOnAllDesktops(bool set) = 0;
virtual void minimize(bool avoid_animation = false) = 0;
virtual void setFullScreen(bool set, bool user = true) = 0;
virtual bool keepAbove() const = 0;
virtual void setKeepAbove(bool) = 0;
virtual bool keepBelow() const = 0;
virtual void setKeepBelow(bool) = 0;
virtual TabGroup *tabGroup() const;
Q_INVOKABLE virtual bool untab(const QRect &toGeometry = QRect(), bool clientRemoved = false);
virtual MaximizeMode maximizeMode() const = 0;
virtual void maximize(MaximizeMode) = 0;
virtual bool noBorder() const = 0;
virtual void setNoBorder(bool set) = 0;
// TODO: remove boolean trap
static bool belongToSameApplication(const AbstractClient* c1, const AbstractClient* c2, bool active_hack = false);

View file

@ -356,7 +356,7 @@ public:
virtual int desktop() const;
void setDesktop(int);
void setOnAllDesktops(bool set);
void setOnAllDesktops(bool set) override;
void sendToScreen(int screen) override;
@ -380,7 +380,7 @@ public:
bool isMinimized() const override;
bool isMaximizable() const;
QRect geometryRestore() const;
MaximizeMode maximizeMode() const;
MaximizeMode maximizeMode() const override;
enum QuickTileFlag {
QuickTileNone = 0,
@ -399,7 +399,7 @@ public:
void setMaximize(bool vertically, bool horizontally);
QRect iconGeometry() const;
void setFullScreen(bool set, bool user = true);
void setFullScreen(bool set, bool user = true) override;
bool isFullScreen() const override;
bool isFullScreenable(bool fullscreen_hack = false) const;
bool isActiveFullScreen() const;
@ -411,8 +411,8 @@ public:
return fullscreen_mode; // only for session saving
}
bool noBorder() const;
void setNoBorder(bool set);
bool noBorder() const override;
void setNoBorder(bool set) override;
bool userCanSetNoBorder() const;
void checkNoBorder();
@ -425,10 +425,10 @@ public:
bool skipSwitcher() const override;
void setSkipSwitcher(bool set);
bool keepAbove() const;
void setKeepAbove(bool);
bool keepBelow() const;
void setKeepBelow(bool);
bool keepAbove() const override;
void setKeepAbove(bool) override;
bool keepBelow() const override;
void setKeepBelow(bool) override;
virtual Layer layer() const;
Layer belongsToLayer() const;
void invalidateLayer();
@ -493,7 +493,7 @@ public:
void setShortcut(const QString& cut) override;
Options::WindowOperation mouseButtonToWindowOperation(Qt::MouseButtons button);
bool performMouseCommand(Options::MouseCommand, const QPoint& globalPos);
bool performMouseCommand(Options::MouseCommand, const QPoint& globalPos) override;
QRect adjustedClientArea(const QRect& desktop, const QRect& area) const;
@ -537,10 +537,10 @@ public:
static bool sameAppWindowRoleMatch(const Client* c1, const Client* c2, bool active_hack);
void setMinimized(bool set);
void minimize(bool avoid_animation = false);
void minimize(bool avoid_animation = false) override;
void unminimize(bool avoid_animation = false);
void killWindow();
void maximize(MaximizeMode);
void maximize(MaximizeMode) override;
void toggleShade();
void showContextHelp();
void cancelShadeHoverTimer();
@ -551,7 +551,7 @@ public:
bool hasStrut() const;
// Tabbing functions
TabGroup* tabGroup() const; // Returns a pointer to client_group
TabGroup* tabGroup() const override; // Returns a pointer to client_group
Q_INVOKABLE inline bool tabBefore(Client *other, bool activate) { return tabTo(other, false, activate); }
Q_INVOKABLE inline bool tabBehind(Client *other, bool activate) { return tabTo(other, true, activate); }
/**
@ -566,7 +566,7 @@ public:
* WARNING: non dynamic properties are ignored - you're not supposed to alter/update such explicitly
*/
Q_INVOKABLE void syncTabGroupFor(QString property, bool fromThisClient = false);
Q_INVOKABLE bool untab(const QRect &toGeometry = QRect(), bool clientRemoved = false);
Q_INVOKABLE bool untab(const QRect &toGeometry = QRect(), bool clientRemoved = false) override;
/**
* Set tab group - this is to be invoked by TabGroup::add/remove(client) and NO ONE ELSE
*/

View file

@ -735,7 +735,7 @@ void UserActionsMenu::slotWindowOperation(QAction *action)
qRegisterMetaType<Options::WindowOperation>();
QMetaObject::invokeMethod(workspace(), "performWindowOperation",
Qt::QueuedConnection,
Q_ARG(KWin::Client*, c.data()),
Q_ARG(KWin::AbstractClient*, c.data()),
Q_ARG(Options::WindowOperation, op));
}
@ -1019,7 +1019,7 @@ void Workspace::clientShortcutUpdated(Client* c)
}
}
void Workspace::performWindowOperation(Client* c, Options::WindowOperation op)
void Workspace::performWindowOperation(AbstractClient* c, Options::WindowOperation op)
{
if (!c)
return;
@ -1107,7 +1107,7 @@ void Workspace::performWindowOperation(Client* c, Options::WindowOperation op)
break;
case Options::RemoveTabFromGroupOp:
if (c->untab(c->geometry().translated(cascadeOffset(c))) && options->focusPolicyIsReasonable())
takeActivity(c, ActivityFocus | ActivityRaise);
takeActivity(dynamic_cast<Client*>(c), ActivityFocus | ActivityRaise);
break;
case Options::ActivateNextTabOp:
if (c->tabGroup())

View file

@ -340,7 +340,7 @@ public:
void unregisterEventFilter(X11EventFilter *filter);
public Q_SLOTS:
void performWindowOperation(KWin::Client* c, Options::WindowOperation op);
void performWindowOperation(KWin::AbstractClient* c, Options::WindowOperation op);
// Keybindings
//void slotSwitchToWindow( int );
void slotWindowToDesktop();