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)
|
void InputDeviceHandler::setFocus(Toplevel *toplevel)
|
||||||
{
|
{
|
||||||
|
Toplevel *oldFocus = m_focus.window;
|
||||||
m_focus.window = toplevel;
|
m_focus.window = toplevel;
|
||||||
//TODO: call focusUpdate?
|
focusUpdate(oldFocus, m_focus.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputDeviceHandler::setDecoration(Decoration::DecoratedClientImpl *decoration)
|
void InputDeviceHandler::setDecoration(Decoration::DecoratedClientImpl *decoration)
|
||||||
|
@ -2932,13 +2933,14 @@ void InputDeviceHandler::setDecoration(Decoration::DecoratedClientImpl *decorati
|
||||||
|
|
||||||
void InputDeviceHandler::setInternalWindow(QWindow *window)
|
void InputDeviceHandler::setInternalWindow(QWindow *window)
|
||||||
{
|
{
|
||||||
|
QWindow *oldFocus = m_focus.internalWindow;
|
||||||
m_focus.internalWindow = window;
|
m_focus.internalWindow = window;
|
||||||
//TODO: call internalWindowUpdate?
|
cleanupInternalWindow(oldFocus, m_focus.internalWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputDeviceHandler::updateFocus()
|
void InputDeviceHandler::updateFocus()
|
||||||
{
|
{
|
||||||
auto oldFocus = m_focus.window;
|
Toplevel *focus = m_hover.window;
|
||||||
|
|
||||||
if (m_hover.window && !m_hover.window->surface()) {
|
if (m_hover.window && !m_hover.window->surface()) {
|
||||||
// The surface has not yet been created (special XWayland case).
|
// 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,
|
m_hover.surfaceCreatedConnection = connect(m_hover.window, &Toplevel::surfaceChanged,
|
||||||
this, &InputDeviceHandler::update);
|
this, &InputDeviceHandler::update);
|
||||||
}
|
}
|
||||||
m_focus.window = nullptr;
|
focus = nullptr;
|
||||||
} else {
|
|
||||||
m_focus.window = m_hover.window;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
focusUpdate(oldFocus, m_focus.window);
|
setFocus(focus);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputDeviceHandler::updateDecoration()
|
bool InputDeviceHandler::updateDecoration()
|
||||||
|
|
|
@ -157,7 +157,6 @@ void PointerInputRedirection::init()
|
||||||
connect(waylandServer()->seat(), &KWaylandServer::SeatInterface::dragEnded, this,
|
connect(waylandServer()->seat(), &KWaylandServer::SeatInterface::dragEnded, this,
|
||||||
[this] {
|
[this] {
|
||||||
// need to force a focused pointer change
|
// need to force a focused pointer change
|
||||||
waylandServer()->seat()->setFocusedPointerSurface(nullptr);
|
|
||||||
setFocus(nullptr);
|
setFocus(nullptr);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -183,7 +182,6 @@ void PointerInputRedirection::updateOnStartMoveResize()
|
||||||
breakPointerConstraints(focus() ? focus()->surface() : nullptr);
|
breakPointerConstraints(focus() ? focus()->surface() : nullptr);
|
||||||
disconnectPointerConstraintsConnection();
|
disconnectPointerConstraintsConnection();
|
||||||
setFocus(nullptr);
|
setFocus(nullptr);
|
||||||
waylandServer()->seat()->setFocusedPointerSurface(nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PointerInputRedirection::updateToReset()
|
void PointerInputRedirection::updateToReset()
|
||||||
|
@ -210,7 +208,6 @@ void PointerInputRedirection::updateToReset()
|
||||||
disconnectPointerConstraintsConnection();
|
disconnectPointerConstraintsConnection();
|
||||||
setFocus(nullptr);
|
setFocus(nullptr);
|
||||||
}
|
}
|
||||||
waylandServer()->seat()->setFocusedPointerSurface(nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PositionUpdateBlocker
|
class PositionUpdateBlocker
|
||||||
|
@ -555,8 +552,6 @@ void PointerInputRedirection::cleanupDecoration(Decoration::DecoratedClientImpl
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
waylandServer()->seat()->setFocusedPointerSurface(nullptr);
|
|
||||||
|
|
||||||
auto pos = m_pos - now->client()->pos();
|
auto pos = m_pos - now->client()->pos();
|
||||||
QHoverEvent event(QEvent::HoverEnter, pos, pos);
|
QHoverEvent event(QEvent::HoverEnter, pos, pos);
|
||||||
QCoreApplication::instance()->sendEvent(now->decoration(), &event);
|
QCoreApplication::instance()->sendEvent(now->decoration(), &event);
|
||||||
|
|
Loading…
Reference in a new issue