Properly implement window activation on X11
The current code is subtly broken in two ways:
-
KStartupInfo::startupId() will return an empty startup id. This is because QApplication reads the relevant environment variable and clears it afterwards. To access it we need to use QX11Info::nextStartupId
-
We are reading KStartupInfo::startupId() from the wrong instance. We need to read the id from the second instance and pass it via DBus to the first instance, like we do on Wayland with the activation token
The user-facing impact of this is minimal since KStartupInfo::setNewStartupId internally calls KWindowSystem::forceActiveWindow.
However, this code is more technically correct and may play nicer with focus stealing prevention