Specialize StateDragging for wayland

Introduces StateDraggingWayland. Wayland is the alien, so don't want
to introduce hacks in the existing clean code.

StateDraggingWayland will deal with the wayland workarounds.

Although the impl only has placeholders for now I'm committing it
because it's already an improvement: broken detachment is no longer
possible. Detached windows were going to a random place on screen.
This commit is contained in:
Sergio Martins
2020-10-14 18:12:25 +01:00
parent 52184ca72b
commit beef3c7fb5
2 changed files with 40 additions and 1 deletions

View File

@@ -294,13 +294,39 @@ bool StateDragging::handleMouseMove(QPoint globalPos)
return true;
}
StateDraggingWayland::StateDraggingWayland(DragController *parent)
: StateDragging(parent)
{
}
StateDraggingWayland::~StateDraggingWayland()
{
}
void StateDraggingWayland::onEntry(QEvent *)
{
// Create a QDrag here
}
bool StateDraggingWayland::handleMouseButtonRelease(QPoint /*globalPos*/)
{
Q_EMIT q->dragCanceled();
return true;
}
bool StateDraggingWayland::handleMouseMove(QPoint /*globalPos*/)
{
return true;
}
DragController::DragController(QObject *)
{
qCDebug(creation) << "DragController()";
auto stateNone = new StateNone(this);
auto statepreDrag = new StatePreDrag(this);
auto stateDragging = new StateDragging(this);
auto stateDragging = isWayland() ? new StateDraggingWayland(this)
: new StateDragging(this);
stateNone->addTransition(this, &DragController::mousePressed, statepreDrag);
statepreDrag->addTransition(this, &DragController::dragCanceled, stateNone);