QGuiApplication::focusWindow() always return null in wayland platform
-
Hi everyone,
I'm executing the Qt auto test (v 5.15.2) on a Linux platform that uses Wayland, Weston compositor, and Weston ivi-shell.
And when executing any test suite that active a windows, they are all failed.
Example for qt5/qtdeclarative/tests/auto/quick/qquickitem2/tst_qquickitem2 test suite,
when I run: ./tst_qquickitem2 -platform wayland, I receive the log as below:Loc: [tst_qquickitem.cpp(483)] QWARN : tst_QQuickItem::activeFocusOnTab3() qt.qpa.wayland: Wayland does not support QWindow::requestActivate() QWARN : tst_QQuickItem::activeFocusOnTab3() qWaitForWindowActive was called on a platform that doesn't support window activation. This means there is an error in the test and it should either check for the WindowActivation platform capability before calling qWaitForWindowActivate, use qWaitForWindowExposed instead, or skip the test. Falling back to qWaitForWindowExposed. FAIL! : tst_QQuickItem::activeFocusOnTab3() Compared pointers are not the same Loc: [tst_qquickitem.cpp(523)
More information:
I checked the test suite source code and added some debug there, then I recognized that the function QGuiApplication::focusWindow() always returns null, which leads to the test case failing.
I also tried to build with xcb and execute the test suite in the X11 environment, then everything is OK.I also tried to google but cannot find any useful information to solve it.
Can anyone give me some hints?Thanks,
-
I found something, just want to post it here so that it can help someone.
The warnings in my post are not the root cause of the issue.
I got the error "Compared pointers are not the same" due to the "input focus" is not set in the surfaces created by the test suite.
If I modify the test case to wail for a few seconds and then use LayerManagerControl to set the input focus, I see the test cases are passed.
Command: "LayerManagerControl set surfaces [surfaced] input focus all" -
I have the same problem with Qt QApplication::focusWindow() and QApplication::focusWindowChanged signal. Regardless of the platform (Linux X11, Wayland) QApplication::focusWindow() is always nullptr because of this I should use X11 and Wayland native libraries. I didnt find any solve for this problem.
That is my simple code, may be it support find and solve the bug/problem. -
I have the same problem with Qt QApplication::focusWindow() and QApplication::focusWindowChanged signal. Regardless of the platform (Linux X11, Wayland) QApplication::focusWindow() is always nullptr because of this I should use X11 and Wayland native libraries. I didnt find any solve for this problem.
That is my simple code, may be it support find and solve the bug/problem.