shell: move keyboard focus code from frontend to backend

It makes the code easier to be maintained across different platforms.

CCBUG: 453166
CCBUG: 352476
wilder-5.26
Fushan Wen 4 years ago committed by Nate Graham
parent 19084358c7
commit bad07cde13
  1. 20
      shell/shellcorona.cpp

@ -265,18 +265,18 @@ void ShellCorona::init()
return;
}
PanelView *activePanel = qobject_cast<PanelView *>(qGuiApp->focusWindow());
Plasma::Containment *containmentToActivate = nullptr;
if (activePanel) {
auto it = m_panelViews.constFind(activePanel->containment());
it++;
if (it != m_panelViews.constEnd()) {
containmentToActivate = it.value()->containment();
}
if (!activePanel) {
activePanel = m_panelViews.values().first();
}
if (!containmentToActivate) {
containmentToActivate = m_panelViews.values().first()->containment();
if (activePanel->containment()->status() != Plasma::Types::AcceptingInputStatus) {
activePanel->containment()->setStatus(Plasma::Types::AcceptingInputStatus);
auto nextItem = activePanel->rootObject()->nextItemInFocusChain();
if (nextItem) {
nextItem->forceActiveFocus();
}
}
emit containmentToActivate->activated();
});
}

Loading…
Cancel
Save