Do not call setActive(true) when request input panel to show
Observed in kdevelop, that isEnabled() could be false when switching between different tabs with Ctrl+Tab. But Qt may still call show() if you click on the texteditor widget. This leads to isEnabled == false but setActive(true) is called. This causes kdevelop in a usable state because keyboard grab will be created and no key event will reach application because isEnabled == false. Under normal circumstances, key will reach widget first and triggers another text_input_v2 enable to make input method work properly.
This commit is contained in:
parent
c074e2eb42
commit
8a2f64fbe1
2 changed files with 33 additions and 2 deletions
|
@ -58,6 +58,7 @@ private Q_SLOTS:
|
|||
void testHidePanel();
|
||||
void testSwitchFocusedSurfaces();
|
||||
void testV3Styling();
|
||||
void testDisableShowInputPanel();
|
||||
|
||||
private:
|
||||
void touchNow() {
|
||||
|
@ -101,7 +102,6 @@ void InputMethodTest::init()
|
|||
Test::AdditionalWaylandInterface::InputMethodV1 |
|
||||
Test::AdditionalWaylandInterface::TextInputManagerV3));
|
||||
|
||||
|
||||
workspace()->setActiveOutput(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
|
||||
|
@ -430,6 +430,38 @@ void InputMethodTest::testV3Styling()
|
|||
QCOMPARE(textInputPreeditSpy.last().at(2), 6);
|
||||
}
|
||||
|
||||
void InputMethodTest::testDisableShowInputPanel()
|
||||
{
|
||||
// Create an xdg_toplevel surface and wait for the compositor to catch up.
|
||||
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
|
||||
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::red);
|
||||
QVERIFY(client);
|
||||
QVERIFY(client->isActive());
|
||||
QCOMPARE(client->frameGeometry().size(), QSize(1280, 1024));
|
||||
|
||||
QScopedPointer<KWayland::Client::TextInput> textInputV2(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
|
||||
|
||||
QSignalSpy inputMethodActiveSpy(InputMethod::self(), &InputMethod::activeChanged);
|
||||
// just enabling the text-input should not show it but rather on commit
|
||||
QVERIFY(!InputMethod::self()->isActive());
|
||||
textInputV2->enable(surface.get());
|
||||
QVERIFY(inputMethodActiveSpy.count() || inputMethodActiveSpy.wait());
|
||||
QVERIFY(InputMethod::self()->isActive());
|
||||
|
||||
// disable text input and ensure that it is not hiding input panel without commit
|
||||
inputMethodActiveSpy.clear();
|
||||
QVERIFY(InputMethod::self()->isActive());
|
||||
textInputV2->disable(surface.get());
|
||||
QVERIFY(inputMethodActiveSpy.count() || inputMethodActiveSpy.wait());
|
||||
QVERIFY(!InputMethod::self()->isActive());
|
||||
|
||||
QSignalSpy requestShowInputPanelSpy(waylandServer()->seat()->textInputV2(), &KWaylandServer::TextInputV2Interface::requestShowInputPanel);
|
||||
textInputV2->showInputPanel();
|
||||
QVERIFY(requestShowInputPanelSpy.count() || requestShowInputPanelSpy.wait());
|
||||
QVERIFY(!InputMethod::self()->isActive());
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(InputMethodTest)
|
||||
|
||||
#include "inputmethod_test.moc"
|
||||
|
|
|
@ -115,7 +115,6 @@ void InputMethod::show()
|
|||
m_inputClient->showClient();
|
||||
updateInputPanelState();
|
||||
}
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
void InputMethod::hide()
|
||||
|
|
Loading…
Reference in a new issue