Only make startup notification change the virtual desktop if requested

Startup notifications optionally contain the target desktop the app should be launched to.

If present the window is sent to that desktop, if not it is sent to the current desktop.

Later in Workspace::activateWindow we check if the window is on the current desktop, and if not
we either move it to the current desktop or switch to the window's desktop depending on user preference.

However, this is broken because the window was already moved to the current desktop. To avoid this
only move the window if specifically requested by the startup id.

BUG: 462996
This commit is contained in:
Nicolas Fella 2022-12-31 00:59:29 +01:00 committed by Vlad Zahorodnii
parent b549776b68
commit a40dd9a158

View file

@ -767,13 +767,11 @@ void X11Window::startupIdChanged()
// If the ASN contains desktop, move it to the desktop, otherwise move it to the current
// desktop (since the new ASN should make the window act like if it's a new application
// launched). However don't affect the window's desktop if it's set to be on all desktops.
int desktop = VirtualDesktopManager::self()->current();
if (asn_data.desktop() != 0) {
desktop = asn_data.desktop();
}
if (!isOnAllDesktops()) {
workspace()->sendWindowToDesktop(this, desktop, true);
if (asn_data.desktop() != 0 && !isOnAllDesktops()) {
workspace()->sendWindowToDesktop(this, asn_data.desktop(), true);
}
if (asn_data.xinerama() != -1) {
Output *output = workspace()->xineramaIndexToOutput(asn_data.xinerama());
if (output) {
@ -783,9 +781,6 @@ void X11Window::startupIdChanged()
const xcb_timestamp_t timestamp = asn_id.timestamp();
if (timestamp != 0) {
bool activate = allowWindowActivation(timestamp);
if (asn_data.desktop() != 0 && !isOnCurrentDesktop()) {
activate = false; // it was started on different desktop than current one
}
if (activate) {
workspace()->activateWindow(this);
} else {