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

@@ -128,6 +128,7 @@ public:
bool handleMouseButtonRelease(QPoint) override;
};
// Used on all platforms except Wayland. @see StateDraggingWayland
class StateDragging : public StateBase
{
Q_OBJECT
@@ -139,6 +140,18 @@ public:
bool handleMouseMove(QPoint globalPos) override;
};
// Used on wayland only to use QDrag instead of setting geometry on mouse-move.
class StateDraggingWayland : public StateDragging
{
Q_OBJECT
public:
explicit StateDraggingWayland(DragController *parent);
~StateDraggingWayland() override;
void onEntry(QEvent *) override;
bool handleMouseButtonRelease(QPoint globalPos) override;
bool handleMouseMove(QPoint globalPos) override;
};
}
#endif