wayland: Port to XdgToplevelInterface::ResizeAnchor
This commit is contained in:
parent
9a4a960886
commit
b15681fd9c
2 changed files with 33 additions and 17 deletions
|
@ -1122,7 +1122,7 @@ void XdgToplevelClient::handleMoveRequested(SeatInterface *seat, quint32 serial)
|
|||
}
|
||||
}
|
||||
|
||||
void XdgToplevelClient::handleResizeRequested(SeatInterface *seat, Qt::Edges edges, quint32 serial)
|
||||
void XdgToplevelClient::handleResizeRequested(SeatInterface *seat, XdgToplevelInterface::ResizeAnchor anchor, quint32 serial)
|
||||
{
|
||||
if (!seat->hasImplicitPointerGrab(serial) && !seat->hasImplicitTouchGrab(serial)) {
|
||||
return;
|
||||
|
@ -1143,21 +1143,37 @@ void XdgToplevelClient::handleResizeRequested(SeatInterface *seat, Qt::Edges edg
|
|||
setInteractiveMoveOffset(cursorPos - pos()); // map from global
|
||||
setInvertedInteractiveMoveOffset(rect().bottomRight() - interactiveMoveOffset());
|
||||
setUnrestrictedInteractiveMoveResize(false);
|
||||
auto toPosition = [edges] {
|
||||
Position position = PositionCenter;
|
||||
if (edges.testFlag(Qt::TopEdge)) {
|
||||
Position position;
|
||||
switch (anchor) {
|
||||
case XdgToplevelInterface::ResizeAnchor::TopLeft:
|
||||
position = PositionTopLeft;
|
||||
break;
|
||||
case XdgToplevelInterface::ResizeAnchor::Top:
|
||||
position = PositionTop;
|
||||
} else if (edges.testFlag(Qt::BottomEdge)) {
|
||||
break;
|
||||
case XdgToplevelInterface::ResizeAnchor::TopRight:
|
||||
position = PositionTopRight;
|
||||
break;
|
||||
case XdgToplevelInterface::ResizeAnchor::Right:
|
||||
position = PositionRight;
|
||||
break;
|
||||
case XdgToplevelInterface::ResizeAnchor::BottomRight:
|
||||
position = PositionBottomRight;
|
||||
break;
|
||||
case XdgToplevelInterface::ResizeAnchor::Bottom:
|
||||
position = PositionBottom;
|
||||
break;
|
||||
case XdgToplevelInterface::ResizeAnchor::BottomLeft:
|
||||
position = PositionBottomLeft;
|
||||
break;
|
||||
case XdgToplevelInterface::ResizeAnchor::Left:
|
||||
position = PositionLeft;
|
||||
break;
|
||||
default:
|
||||
position = PositionCenter;
|
||||
break;
|
||||
}
|
||||
if (edges.testFlag(Qt::LeftEdge)) {
|
||||
position = Position(position | PositionLeft);
|
||||
} else if (edges.testFlag(Qt::RightEdge)) {
|
||||
position = Position(position | PositionRight);
|
||||
}
|
||||
return position;
|
||||
};
|
||||
setInteractiveMoveResizePointerMode(toPosition());
|
||||
setInteractiveMoveResizePointerMode(position);
|
||||
if (!startInteractiveMoveResize()) {
|
||||
setInteractiveMoveResizePointerButtonDown(false);
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ private:
|
|||
void handleWindowMenuRequested(KWaylandServer::SeatInterface *seat,
|
||||
const QPoint &surfacePos, quint32 serial);
|
||||
void handleMoveRequested(KWaylandServer::SeatInterface *seat, quint32 serial);
|
||||
void handleResizeRequested(KWaylandServer::SeatInterface *seat, Qt::Edges, quint32 serial);
|
||||
void handleResizeRequested(KWaylandServer::SeatInterface *seat, KWaylandServer::XdgToplevelInterface::ResizeAnchor anchor, quint32 serial);
|
||||
void handleStatesAcknowledged(const KWaylandServer::XdgToplevelInterface::States &states);
|
||||
void handleMaximizeRequested();
|
||||
void handleUnmaximizeRequested();
|
||||
|
|
Loading…
Reference in a new issue