Workspace::movingClient changed to AbstractClient

In events.cpp it's casted to Client as it's X11 specific.
In InputRedirections it's kind of broken, but window movement is
anyway broken.
This commit is contained in:
Martin Gräßlin 2015-03-06 12:38:07 +01:00
parent d2cdd3de1d
commit 4b41c33268
11 changed files with 21 additions and 17 deletions

View file

@ -27,6 +27,7 @@ namespace KWin
{
class TabGroup;
class WindowRules;
namespace TabBox
{
@ -68,6 +69,7 @@ public:
virtual void setShortcut(const QString &cut) = 0;
virtual bool performMouseCommand(Options::MouseCommand, const QPoint &globalPos) = 0;
virtual void setOnAllDesktops(bool set) = 0;
virtual void setDesktop(int) = 0;
virtual void minimize(bool avoid_animation = false) = 0;
virtual void setFullScreen(bool set, bool user = true) = 0;
virtual bool keepAbove() const = 0;
@ -95,6 +97,7 @@ public:
virtual bool userCanSetFullScreen() const = 0;
virtual bool userCanSetNoBorder() const = 0;
virtual void setOnAllActivities(bool set) = 0;
virtual const WindowRules* rules() const = 0;
// TODO: remove boolean trap
static bool belongToSameApplication(const AbstractClient* c1, const AbstractClient* c2, bool active_hack = false);

View file

@ -308,7 +308,7 @@ public:
Group* group();
void checkGroup(Group* gr = NULL, bool force = false);
void changeClientLeaderGroup(Group* gr);
const WindowRules* rules() const;
const WindowRules* rules() const override;
void removeRule(Rules* r);
void setupWindowRules(bool ignore_temporary);
void applyWindowRules();
@ -355,7 +355,7 @@ public:
void setActive(bool);
virtual int desktop() const;
void setDesktop(int);
void setDesktop(int) override;
void setOnAllDesktops(bool set) override;
void sendToScreen(int screen) override;

View file

@ -221,7 +221,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
connect(ws, &Workspace::showingDesktopChanged,
this, &EffectsHandlerImpl::showingDesktopChanged);
connect(ws, &Workspace::currentDesktopChanged, this,
[this](int old, Client *c) {
[this](int old, AbstractClient *c) {
const int newDesktop = VirtualDesktopManager::self()->current();
if (old != 0 && newDesktop != old) {
emit desktopChanged(old, newDesktop, c ? c->effectWindow() : 0);

View file

@ -312,8 +312,8 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
xcb_key_press_event_t *event = reinterpret_cast<xcb_key_press_event_t*>(e);
KKeyServer::xcbKeyPressEventToQt(event, &keyQt);
// qDebug() << "Workspace::keyPress( " << keyQt << " )";
if (movingClient) {
movingClient->keyPressEvent(keyQt, event->time);
if (Client *c = dynamic_cast<Client*>(movingClient)) {
c->keyPressEvent(keyQt, event->time);
return true;
}
#ifdef KWIN_BUILD_TABBOX
@ -366,9 +366,9 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
}
}
}
if (movingClient) {
if (Client *c = dynamic_cast<Client*>(movingClient)) {
if (eventType == XCB_BUTTON_PRESS || eventType == XCB_BUTTON_RELEASE || eventType == XCB_MOTION_NOTIFY) {
if (movingClient->moveResizeGrabWindow() == reinterpret_cast<xcb_button_press_event_t*>(e)->event && movingClient->windowEvent(e)) {
if (c->moveResizeGrabWindow() == reinterpret_cast<xcb_button_press_event_t*>(e)->event && c->windowEvent(e)) {
return true;
}
}

View file

@ -793,7 +793,7 @@ QRect Workspace::adjustClientSize(Client* c, QRect moveResizeGeom, int mode)
/*!
Marks the client as being moved around by the user.
*/
void Workspace::setClientIsMoving(Client *c)
void Workspace::setClientIsMoving(AbstractClient *c)
{
Q_ASSERT(!c || !movingClient); // Catch attempts to move a second
// window while still moving the first one.

View file

@ -534,7 +534,7 @@ void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::Keyboa
return;
}
if (workspace()) {
if (Client *c = workspace()->getMovingClient()) {
if (Client *c = dynamic_cast<Client*>(workspace()->getMovingClient())) {
// TODO: this does not yet fully support moving of the Client
// cursor events change the cursor and on Wayland pointer warping is not possible
c->keyPressEvent(m_xkb->toQtKey(m_xkb->toKeysym(key)));

View file

@ -285,7 +285,7 @@ void Edge::switchDesktop(const QPoint &cursorPos)
pos.setY(OFFSET);
}
#ifndef KWIN_UNIT_TEST
if (Client *c = Workspace::self()->getMovingClient()) {
if (AbstractClient *c = Workspace::self()->getMovingClient()) {
if (c->rules()->checkDesktop(desktop) != int(desktop)) {
// user attempts to move a client to another desktop where it is ruleforced to not be
return;

View file

@ -39,7 +39,7 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent)
KWin::Workspace *ws = KWin::Workspace::self();
KWin::VirtualDesktopManager *vds = KWin::VirtualDesktopManager::self();
connect(ws, SIGNAL(desktopPresenceChanged(KWin::Client*,int)), SIGNAL(desktopPresenceChanged(KWin::Client*,int)));
connect(ws, SIGNAL(currentDesktopChanged(int,KWin::Client*)), SIGNAL(currentDesktopChanged(int,KWin::Client*)));
connect(ws, &Workspace::currentDesktopChanged, this, &WorkspaceWrapper::currentDesktopChanged);
connect(ws, SIGNAL(clientAdded(KWin::Client*)), SIGNAL(clientAdded(KWin::Client*)));
connect(ws, SIGNAL(clientAdded(KWin::Client*)), SLOT(setupClientConnections(KWin::Client*)));
connect(ws, SIGNAL(clientRemoved(KWin::Client*)), SIGNAL(clientRemoved(KWin::Client*)));

View file

@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
// forward declarations
class AbstractClient;
class Client;
class WorkspaceWrapper : public QObject
@ -88,7 +89,7 @@ private:
Q_SIGNALS:
void desktopPresenceChanged(KWin::Client *client, int desktop);
void currentDesktopChanged(int desktop, KWin::Client *client);
void currentDesktopChanged(int desktop, KWin::AbstractClient *client);
void clientAdded(KWin::Client *client);
void clientRemoved(KWin::Client *client);
void clientManaging(KWin::Client *client);

View file

@ -189,7 +189,7 @@ Workspace::Workspace(bool restore)
} else {
m_compositor = Compositor::create(this);
}
connect(this, SIGNAL(currentDesktopChanged(int,KWin::Client*)), m_compositor, SLOT(addRepaintFull()));
connect(this, &Workspace::currentDesktopChanged, m_compositor, &Compositor::addRepaintFull);
auto decorationBridge = Decoration::DecorationBridge::create(this);
decorationBridge->init();

View file

@ -170,7 +170,7 @@ public:
/**
* Indicates that the client c is being moved around by the user.
*/
void setClientIsMoving(Client* c);
void setClientIsMoving(AbstractClient* c);
QPoint adjustClientPosition(Client* c, QPoint pos, bool unrestricted, double snapAdjust = 1.0);
QRect adjustClientSize(Client* c, QRect moveResizeGeom, int mode);
@ -327,7 +327,7 @@ public:
void updateFocusMousePosition(const QPoint& pos);
QPoint focusMousePosition() const;
Client* getMovingClient() {
AbstractClient* getMovingClient() {
return movingClient;
}
@ -442,7 +442,7 @@ Q_SIGNALS:
//Signals required for the scripting interface
void desktopPresenceChanged(KWin::Client*, int);
void currentDesktopChanged(int, KWin::Client*);
void currentDesktopChanged(int, KWin::AbstractClient*);
void clientAdded(KWin::Client*);
void clientRemoved(KWin::Client*);
void clientActivated(KWin::Client*);
@ -516,7 +516,7 @@ private:
Client* active_client;
Client* last_active_client;
AbstractClient* most_recently_raised; // Used ONLY by raiseOrLowerClient()
Client* movingClient;
AbstractClient* movingClient;
// Delay(ed) window focus timer and client
QTimer* delayFocusTimer;