[wayland] Support move/resize mode in pointer move handling
This commit is contained in:
parent
545c8b190e
commit
4ca3734d12
6 changed files with 47 additions and 24 deletions
|
@ -458,4 +458,9 @@ QSize AbstractClient::minSize() const
|
|||
return rules()->checkMinSize(QSize(0, 0));
|
||||
}
|
||||
|
||||
void AbstractClient::updateMoveResize(const QPointF ¤tGlobalCursor)
|
||||
{
|
||||
Q_UNUSED(currentGlobalCursor)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -274,6 +274,7 @@ public:
|
|||
virtual void shrinkHorizontal();
|
||||
virtual void growVertical();
|
||||
virtual void shrinkVertical();
|
||||
virtual void updateMoveResize(const QPointF ¤tGlobalCursor);
|
||||
|
||||
/**
|
||||
* These values represent positions inside an area
|
||||
|
|
3
client.h
3
client.h
|
@ -510,6 +510,8 @@ public:
|
|||
**/
|
||||
void showOnScreenEdge();
|
||||
|
||||
void updateMoveResize(const QPointF ¤tGlobalCursor) override;
|
||||
|
||||
public Q_SLOTS:
|
||||
void closeWindow() override;
|
||||
void updateCaption();
|
||||
|
@ -649,6 +651,7 @@ private:
|
|||
void leaveMoveResize();
|
||||
void checkUnrestrictedMoveResize();
|
||||
void handleMoveResize(int x, int y, int x_root, int y_root);
|
||||
void handleMoveResize(const QPoint &local, const QPoint &global);
|
||||
void startDelayedMoveResize();
|
||||
void stopDelayedMoveResize();
|
||||
void positionGeometryTip();
|
||||
|
|
16
events.cpp
16
events.cpp
|
@ -1390,21 +1390,7 @@ bool Client::motionNotifyEvent(xcb_window_t w, int state, int x, int y, int x_ro
|
|||
y = this->y();
|
||||
}
|
||||
|
||||
const QRect oldGeo = geometry();
|
||||
handleMoveResize(x, y, x_root, y_root);
|
||||
if (!isFullScreen() && isMove()) {
|
||||
if (quick_tile_mode != QuickTileNone && oldGeo != geometry()) {
|
||||
GeometryUpdatesBlocker blocker(this);
|
||||
setQuickTileMode(QuickTileNone);
|
||||
moveOffset = QPoint(double(moveOffset.x()) / double(oldGeo.width()) * double(geom_restore.width()),
|
||||
double(moveOffset.y()) / double(oldGeo.height()) * double(geom_restore.height()));
|
||||
if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore)
|
||||
moveResizeGeom = geom_restore;
|
||||
handleMoveResize(x, y, x_root, y_root); // fix position
|
||||
} else if (quick_tile_mode == QuickTileNone && isResizable()) {
|
||||
checkQuickTilingMaximizationZones(x_root, y_root);
|
||||
}
|
||||
}
|
||||
handleMoveResize(QPoint(x, y), QPoint(x_root, y_root));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
24
geometry.cpp
24
geometry.cpp
|
@ -2710,6 +2710,30 @@ void Client::stopDelayedMoveResize()
|
|||
delayedMoveResizeTimer = NULL;
|
||||
}
|
||||
|
||||
void Client::updateMoveResize(const QPointF ¤tGlobalCursor)
|
||||
{
|
||||
handleMoveResize(pos(), currentGlobalCursor.toPoint());
|
||||
}
|
||||
|
||||
void Client::handleMoveResize(const QPoint &local, const QPoint &global)
|
||||
{
|
||||
const QRect oldGeo = geometry();
|
||||
handleMoveResize(local.x(), local.y(), global.x(), global.y());
|
||||
if (!isFullScreen() && isMove()) {
|
||||
if (quick_tile_mode != QuickTileNone && oldGeo != geometry()) {
|
||||
GeometryUpdatesBlocker blocker(this);
|
||||
setQuickTileMode(QuickTileNone);
|
||||
moveOffset = QPoint(double(moveOffset.x()) / double(oldGeo.width()) * double(geom_restore.width()),
|
||||
double(moveOffset.y()) / double(oldGeo.height()) * double(geom_restore.height()));
|
||||
if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore)
|
||||
moveResizeGeom = geom_restore;
|
||||
handleMoveResize(local.x(), local.y(), global.x(), global.y()); // fix position
|
||||
} else if (quick_tile_mode == QuickTileNone && isResizable()) {
|
||||
checkQuickTilingMaximizationZones(global.x(), global.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::handleMoveResize(int x, int y, int x_root, int y_root)
|
||||
{
|
||||
if (syncRequest.isPending && isResize())
|
||||
|
|
22
input.cpp
22
input.cpp
|
@ -517,15 +517,19 @@ void InputRedirection::processPointerMotion(const QPointF &pos, uint32_t time)
|
|||
// an effect grabbed the pointer, we do not forward the event to surfaces
|
||||
return;
|
||||
}
|
||||
QWeakPointer<Toplevel> old = m_pointerWindow;
|
||||
if (!areButtonsPressed()) {
|
||||
// update pointer window only if no button is pressed
|
||||
updatePointerWindow();
|
||||
} else if (m_pointerDecoration) {
|
||||
const QPointF p = m_globalPointer - m_pointerDecoration->client()->pos();
|
||||
QHoverEvent event(QEvent::HoverMove, p, p);
|
||||
QCoreApplication::instance()->sendEvent(m_pointerDecoration->decoration(), &event);
|
||||
m_pointerDecoration->client()->processDecorationMove();
|
||||
if (AbstractClient *c = workspace()->getMovingClient()) {
|
||||
c->updateMoveResize(m_globalPointer);
|
||||
} else {
|
||||
QWeakPointer<Toplevel> old = m_pointerWindow;
|
||||
if (!areButtonsPressed()) {
|
||||
// update pointer window only if no button is pressed
|
||||
updatePointerWindow();
|
||||
} else if (m_pointerDecoration) {
|
||||
const QPointF p = m_globalPointer - m_pointerDecoration->client()->pos();
|
||||
QHoverEvent event(QEvent::HoverMove, p, p);
|
||||
QCoreApplication::instance()->sendEvent(m_pointerDecoration->decoration(), &event);
|
||||
m_pointerDecoration->client()->processDecorationMove();
|
||||
}
|
||||
}
|
||||
#if HAVE_WAYLAND
|
||||
if (auto seat = findSeat()) {
|
||||
|
|
Loading…
Reference in a new issue