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
icc-effect-5.26.4
Xaver Hugl 2021-08-29 17:08:43 +02:00
parent f4d63bb8ed
commit 42b516b567
3 changed files with 15 additions and 16 deletions

View File

@ -1953,6 +1953,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) {
@ -1965,17 +1979,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);
@ -1989,6 +1994,7 @@ public:
break;
case QEvent::MouseButtonRelease:
raiseDragTarget();
m_dragTarget = nullptr;
seat->notifyPointerButton(nativeButton, KWaylandServer::PointerButtonState::Released);
seat->notifyPointerFrame();
break;

View File

@ -87,7 +87,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;

View File

@ -191,11 +191,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
@ -277,7 +272,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());
}