Add KStartupInfo::createNewStartupIdForTimestamp
KStartupInfo::createNewStartupId is supposed to return a new id with a properly setup user timestamp. But if QX11Info::appUserTime returns 0 this was included in the id and cannot be considered a properly setup user timestamp. An app user time of 0 is the case for klauncher. If an application uses this timestamp of 0 passed from the startup notification it causes problems with passing focus to it from KWin. The application sets the timestamp in the _NET_WM_USER_TIME property and the value "0" has the special meaning of requesting to not be initially mapped. KWin honors that and doesn't focus the window. An application is not supposed to interpret a 0 time stamp passed through the startup notification as a special value to get the current time. It is totally fine to expect that it gets a proper value passed. Thus one cannot blame applications for not interpreting this value accordingly. An example for an application passing the 0 to the _NET_WM_USER_TIME is Firefox. Starting Firefox in a Plasma 5 session through e.g. the launcher results in KWin not passing focus to it and instead demands attention. This is clearly wrong and not intended. The solution in this change is to get the current timestamp from the X server in case the appUserTime is 0. For this a new method createNewStartupIdForTimestamp is added which takes timestamp as an argument. ::createNewStartupId is changed to use this method and fetches the current timestamp from the X Server. On other platforms the value 0 is used. The change implies that for all current code the timestamp will be fetched from X. Due to the changes in the underlying stack triggering the bug in the first place, this is an important improvement. Instead of relying on potential incorrect data KStartupInfo ensures that an up to date value is used. Application knowing the up-to-date state can be adjusted to pass in the proper value. This change fixes the described problem with Firefox: it now gets properly focused on starting through a launcher. REVIEW: 121197 BUG: 337798 FIXED-IN: 5.5
parent
d9e99afc
Please register or sign in to comment