Commit 37c9d43b authored by Xaver Hugl's avatar Xaver Hugl
Browse files

fix drag and drop raise with Xwayland windows

They shouldn't be raised immediately. The same strategy as with
Wayland native clients should be used.

BUG: 440534


(cherry picked from commit 42b516b5)
parent 9056eccd
......@@ -1923,6 +1923,20 @@ public:
const auto eventPos = event->globalPos();
// TODO: use InputDeviceHandler::at() here and check isClient()?
Toplevel *t = input()->findManagedToplevel(eventPos);
const auto dragTarget = qobject_cast<AbstractClient*>(t);
if (dragTarget) {
if (dragTarget != m_dragTarget) {
workspace()->takeActivity(dragTarget, Workspace::ActivityFlag::ActivityFocus);
m_raiseTimer.start();
}
if ((pos - m_lastPos).manhattanLength() > 10) {
m_lastPos = pos;
// reset timer to delay raising the window
m_raiseTimer.start();
}
}
m_dragTarget = dragTarget;
if (auto *xwl = xwayland()) {
const auto ret = xwl->dragMoveFilter(t, eventPos);
if (ret == Xwl::DragEventReply::Ignore) {
......@@ -1935,17 +1949,8 @@ public:
if (t) {
// TODO: consider decorations
if (t->surface() != seat->dragSurface()) {
if ((m_dragTarget = qobject_cast<AbstractClient*>(t))) {
workspace()->takeActivity(m_dragTarget, Workspace::ActivityFlag::ActivityFocus);
m_raiseTimer.start();
}
seat->setDragTarget(t->surface(), t->inputTransformation());
}
if ((pos - m_lastPos).manhattanLength() > 10) {
m_lastPos = pos;
// reset timer to delay raising the window
m_raiseTimer.start();
}
} else {
// no window at that place, if we have a surface we need to reset
seat->setDragTarget(nullptr);
......@@ -1959,6 +1964,7 @@ public:
break;
case QEvent::MouseButtonRelease:
raiseDragTarget();
m_dragTarget = nullptr;
seat->notifyPointerButton(nativeButton, KWaylandServer::PointerButtonState::Released);
seat->notifyPointerFrame();
break;
......
......@@ -59,7 +59,6 @@ DragEventReply WlToXDrag::moveFilter(Toplevel *target, const QPoint &pos)
return DragEventReply::Wayland;
}
// new target
workspace()->activateClient(ac, false);
seat->setDragTarget(DataBridge::self()->dnd()->surfaceIface(), pos, ac->inputTransformation());
m_visit = new Xvisit(this, ac);
return DragEventReply::Take;
......
......@@ -160,11 +160,6 @@ DragEventReply XToWlDrag::moveFilter(Toplevel *target, const QPoint &pos)
target->surface()->client() == waylandServer()->xWaylandConnection()) {
// currently there is no target or target is an Xwayland window
// handled here and by X directly
if (AbstractClient *ac = qobject_cast<AbstractClient*>(target)) {
if (workspace()->activeClient() != ac) {
workspace()->activateClient(ac);
}
}
if (hasCurrent) {
// last received enter event is now void,
// wait for the next one
......@@ -246,7 +241,6 @@ void XToWlDrag::offerCallback(const QString &mime)
void XToWlDrag::setDragTarget()
{
auto *ac = m_visit->target();
workspace()->activateClient(ac);
waylandServer()->seat()->setDragTarget(ac->surface(), ac->inputTransformation());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment