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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user