Bug 416319 - forceActiveWindow() function raises window but may not give it focus.
Summary: forceActiveWindow() function raises window but may not give it focus.
Status: RESOLVED DUPLICATE of bug 419937
Alias: None
Product: frameworks-kwindowsystem
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.65.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-16 02:41 UTC by Xu Zhao
Modified: 2020-04-11 01:42 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
The screenshot showing the specified window is not getting focus (459.64 KB, image/png)
2020-01-16 02:41 UTC, Xu Zhao
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xu Zhao 2020-01-16 02:41:59 UTC
Created attachment 125159 [details]
The screenshot showing the specified window is not getting focus

SUMMARY
I discover this bug when developing a simple KRunner extension that switches windows on Plasma. 

In this extension, I use forceActiveWindow(Wid w) call to raise and focus a window, see https://github.com/xuzhao9/krunner-switcher/blob/master/src/switcher.cpp#L135

This function call successfully returns, the window specified in argument always raises, but may not get focus (non-deterministic).

STEPS TO REPRODUCE
1. Install the krunner-switcher plugin of KRunner
2. Use KRunner to activate a window

OBSERVED RESULT
The specified window is activated and gets focus.

EXPECTED RESULT
The specified window is raised to the front, but may not get focus (the old window keeps focus). If you call activeWindow() at this moment, it returns the new window, i.e., the one specified in the argument of forceActiveWindow().

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:   openSUSE Tumbleweed 20200113
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.65.0
Qt Version: 5.13.1

ADDITIONAL INFORMATION
This bug is non-deterministic. You may need to try it multiple times to reproduce it.
Comment 1 Xu Zhao 2020-04-11 01:42:23 UTC
Superseded by bug 419937.

*** This bug has been marked as a duplicate of bug 419937 ***