Commit da2731be authored by Martin Flöser's avatar Martin Flöser

Move Client::move to AbstractClient and add implementation in ShellClient

parent 48272a0d
......@@ -305,6 +305,10 @@ public:
virtual void setQuickTileMode(QuickTileMode mode, bool keyboard = false) = 0;
virtual void updateLayer();
enum ForceGeometry_t { NormalGeometrySet, ForceGeometrySet };
virtual void move(int x, int y, ForceGeometry_t force = NormalGeometrySet) = 0;
void move(const QPoint &p, ForceGeometry_t force = NormalGeometrySet);
// TODO: remove boolean trap
static bool belongToSameApplication(const AbstractClient* c1, const AbstractClient* c2, bool active_hack = false);
......@@ -401,6 +405,11 @@ private:
static std::shared_ptr<Decoration::DecorationPalette> s_defaultPalette;
};
inline void AbstractClient::move(const QPoint& p, ForceGeometry_t force)
{
move(p.x(), p.y(), force);
}
}
Q_DECLARE_METATYPE(KWin::AbstractClient*)
......
......@@ -330,11 +330,10 @@ public:
void updateShape();
enum ForceGeometry_t { NormalGeometrySet, ForceGeometrySet };
void setGeometry(int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet);
void setGeometry(const QRect& r, ForceGeometry_t force = NormalGeometrySet);
void move(int x, int y, ForceGeometry_t force = NormalGeometrySet);
void move(const QPoint& p, ForceGeometry_t force = NormalGeometrySet);
using AbstractClient::move;
void move(int x, int y, ForceGeometry_t force = NormalGeometrySet) override;
/// plainResize() simply resizes
void plainResize(int w, int h, ForceGeometry_t force = NormalGeometrySet);
void plainResize(const QSize& s, ForceGeometry_t force = NormalGeometrySet);
......@@ -1004,11 +1003,6 @@ inline void Client::setGeometry(const QRect& r, ForceGeometry_t force)
setGeometry(r.x(), r.y(), r.width(), r.height(), force);
}
inline void Client::move(const QPoint& p, ForceGeometry_t force)
{
move(p.x(), p.y(), force);
}
inline void Client::plainResize(const QSize& s, ForceGeometry_t force)
{
plainResize(s.width(), s.height(), force);
......
......@@ -18,8 +18,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "shell_client.h"
#include "composite.h"
#include "deleted.h"
#include "screens.h"
#include "wayland_server.h"
#include "workspace.h"
#include "virtualdesktops.h"
#include <KWayland/Client/surface.h>
......@@ -397,4 +400,25 @@ xcb_window_t ShellClient::window() const
return windowId();
}
void ShellClient::move(int x, int y, ForceGeometry_t force)
{
QPoint p(x, y);
if (force == NormalGeometrySet && geom.topLeft() == p) {
return;
}
const QRect oldGeom = visibleRect();
geom.moveTopLeft(p);
updateWindowRules(Rules::Position);
screens()->setCurrent(this);
workspace()->updateStackingOrder();
if (Compositor::isCreated()) {
// TODO: is this really needed here?
Compositor::self()->checkUnredirect();
}
addLayerRepaint(oldGeom);
addLayerRepaint(visibleRect());
emit geometryChanged();
}
}
......@@ -88,6 +88,8 @@ public:
bool userCanSetNoBorder() const override;
bool wantsInput() const override;
xcb_window_t window() const override;
using AbstractClient::move;
void move(int x, int y, ForceGeometry_t force = NormalGeometrySet) override;
quint32 windowId() const {
return m_windowId;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment