Add resizeWithChecks to AbstractClient
The virtual method does not take the xcb_gravity_t - that's only added in a variant in Client.icc-effect-5.14.5
parent
670787086b
commit
007e1253c6
|
@ -308,6 +308,8 @@ public:
|
|||
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);
|
||||
virtual void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) = 0;
|
||||
void resizeWithChecks(const QSize& s, ForceGeometry_t force = NormalGeometrySet);
|
||||
|
||||
// TODO: remove boolean trap
|
||||
static bool belongToSameApplication(const AbstractClient* c1, const AbstractClient* c2, bool active_hack = false);
|
||||
|
@ -410,6 +412,11 @@ inline void AbstractClient::move(const QPoint& p, ForceGeometry_t force)
|
|||
move(p.x(), p.y(), force);
|
||||
}
|
||||
|
||||
inline void AbstractClient::resizeWithChecks(const QSize& s, AbstractClient::ForceGeometry_t force)
|
||||
{
|
||||
resizeWithChecks(s.width(), s.height(), force);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(KWin::AbstractClient*)
|
||||
|
|
11
client.h
11
client.h
|
@ -338,8 +338,10 @@ public:
|
|||
void plainResize(int w, int h, ForceGeometry_t force = NormalGeometrySet);
|
||||
void plainResize(const QSize& s, ForceGeometry_t force = NormalGeometrySet);
|
||||
/// resizeWithChecks() resizes according to gravity, and checks workarea position
|
||||
void resizeWithChecks(int w, int h, xcb_gravity_t gravity = XCB_GRAVITY_BIT_FORGET, ForceGeometry_t force = NormalGeometrySet);
|
||||
void resizeWithChecks(const QSize& s, xcb_gravity_t gravity = XCB_GRAVITY_BIT_FORGET, ForceGeometry_t force = NormalGeometrySet);
|
||||
using AbstractClient::resizeWithChecks;
|
||||
void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override;
|
||||
void resizeWithChecks(int w, int h, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet);
|
||||
void resizeWithChecks(const QSize& s, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet);
|
||||
void keepInArea(QRect area, bool partial = false);
|
||||
void setElectricBorderMode(QuickTileMode mode);
|
||||
QuickTileMode electricBorderMode() const;
|
||||
|
@ -1008,6 +1010,11 @@ inline void Client::plainResize(const QSize& s, ForceGeometry_t force)
|
|||
plainResize(s.width(), s.height(), force);
|
||||
}
|
||||
|
||||
inline void Client::resizeWithChecks(int w, int h, AbstractClient::ForceGeometry_t force)
|
||||
{
|
||||
resizeWithChecks(w, h, XCB_GRAVITY_BIT_FORGET, force);
|
||||
}
|
||||
|
||||
inline void Client::resizeWithChecks(const QSize& s, xcb_gravity_t gravity, ForceGeometry_t force)
|
||||
{
|
||||
resizeWithChecks(s.width(), s.height(), gravity, force);
|
||||
|
|
|
@ -421,4 +421,18 @@ void ShellClient::move(int x, int y, ForceGeometry_t force)
|
|||
emit geometryChanged();
|
||||
}
|
||||
|
||||
void ShellClient::resizeWithChecks(int w, int h, ForceGeometry_t force)
|
||||
{
|
||||
Q_UNUSED(force)
|
||||
QRect area = workspace()->clientArea(WorkArea, this);
|
||||
// don't allow growing larger than workarea
|
||||
if (w > area.width()) {
|
||||
w = area.width();
|
||||
}
|
||||
if (h > area.height()) {
|
||||
h = area.height();
|
||||
}
|
||||
m_shellSurface->requestSize(QSize(w, h));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@ public:
|
|||
xcb_window_t window() const override;
|
||||
using AbstractClient::move;
|
||||
void move(int x, int y, ForceGeometry_t force = NormalGeometrySet) override;
|
||||
using AbstractClient::resizeWithChecks;
|
||||
void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override;
|
||||
|
||||
quint32 windowId() const {
|
||||
return m_windowId;
|
||||
|
|
Loading…
Reference in New Issue