Make focus setters in InputDeviceHandler work as expected
This commit is contained in:
parent
9741b1db2f
commit
a02ca08d45
2 changed files with 7 additions and 12 deletions
|
@ -2918,8 +2918,9 @@ bool InputDeviceHandler::setHover(Toplevel *toplevel)
|
|||
|
||||
void InputDeviceHandler::setFocus(Toplevel *toplevel)
|
||||
{
|
||||
Toplevel *oldFocus = m_focus.window;
|
||||
m_focus.window = toplevel;
|
||||
//TODO: call focusUpdate?
|
||||
focusUpdate(oldFocus, m_focus.window);
|
||||
}
|
||||
|
||||
void InputDeviceHandler::setDecoration(Decoration::DecoratedClientImpl *decoration)
|
||||
|
@ -2932,13 +2933,14 @@ void InputDeviceHandler::setDecoration(Decoration::DecoratedClientImpl *decorati
|
|||
|
||||
void InputDeviceHandler::setInternalWindow(QWindow *window)
|
||||
{
|
||||
QWindow *oldFocus = m_focus.internalWindow;
|
||||
m_focus.internalWindow = window;
|
||||
//TODO: call internalWindowUpdate?
|
||||
cleanupInternalWindow(oldFocus, m_focus.internalWindow);
|
||||
}
|
||||
|
||||
void InputDeviceHandler::updateFocus()
|
||||
{
|
||||
auto oldFocus = m_focus.window;
|
||||
Toplevel *focus = m_hover.window;
|
||||
|
||||
if (m_hover.window && !m_hover.window->surface()) {
|
||||
// The surface has not yet been created (special XWayland case).
|
||||
|
@ -2947,12 +2949,10 @@ void InputDeviceHandler::updateFocus()
|
|||
m_hover.surfaceCreatedConnection = connect(m_hover.window, &Toplevel::surfaceChanged,
|
||||
this, &InputDeviceHandler::update);
|
||||
}
|
||||
m_focus.window = nullptr;
|
||||
} else {
|
||||
m_focus.window = m_hover.window;
|
||||
focus = nullptr;
|
||||
}
|
||||
|
||||
focusUpdate(oldFocus, m_focus.window);
|
||||
setFocus(focus);
|
||||
}
|
||||
|
||||
bool InputDeviceHandler::updateDecoration()
|
||||
|
|
|
@ -157,7 +157,6 @@ void PointerInputRedirection::init()
|
|||
connect(waylandServer()->seat(), &KWaylandServer::SeatInterface::dragEnded, this,
|
||||
[this] {
|
||||
// need to force a focused pointer change
|
||||
waylandServer()->seat()->setFocusedPointerSurface(nullptr);
|
||||
setFocus(nullptr);
|
||||
update();
|
||||
}
|
||||
|
@ -183,7 +182,6 @@ void PointerInputRedirection::updateOnStartMoveResize()
|
|||
breakPointerConstraints(focus() ? focus()->surface() : nullptr);
|
||||
disconnectPointerConstraintsConnection();
|
||||
setFocus(nullptr);
|
||||
waylandServer()->seat()->setFocusedPointerSurface(nullptr);
|
||||
}
|
||||
|
||||
void PointerInputRedirection::updateToReset()
|
||||
|
@ -210,7 +208,6 @@ void PointerInputRedirection::updateToReset()
|
|||
disconnectPointerConstraintsConnection();
|
||||
setFocus(nullptr);
|
||||
}
|
||||
waylandServer()->seat()->setFocusedPointerSurface(nullptr);
|
||||
}
|
||||
|
||||
class PositionUpdateBlocker
|
||||
|
@ -555,8 +552,6 @@ void PointerInputRedirection::cleanupDecoration(Decoration::DecoratedClientImpl
|
|||
return;
|
||||
}
|
||||
|
||||
waylandServer()->seat()->setFocusedPointerSurface(nullptr);
|
||||
|
||||
auto pos = m_pos - now->client()->pos();
|
||||
QHoverEvent event(QEvent::HoverEnter, pos, pos);
|
||||
QCoreApplication::instance()->sendEvent(now->decoration(), &event);
|
||||
|
|
Loading…
Reference in a new issue