Review Request 120915: [OS X] KNotification: return focus to previously active application

René J.V. Bertin rjvbertin at
Fri Oct 31 12:43:09 GMT 2014

This is an automatically generated e-mail. To reply, visit:

Review request for KDE Software on Mac OS X and kdelibs.

Repository: kdelibs


KDE4 notifications on OS X steal focus and don't return it when they are spawned from a background process, at least when that background process is configured to run as an "agent" (i.e. not showing up in Dock, menubar and app switcher).
Ideally the code should use KWindowSystem to determine the active (focus/key) window and make it key again in the KNotification dtor, but that does not appear to be feasible without changing the API so that KWindowSystem::activeWindow returns an OS X "window number" instead of a Qt WId.

This patch works around the issue by recording the active (front) *application* (through its `ProcessSerialNumber` when calling `sendEvent` for the first time (and whenever `raiseWindow` is called), and bringing it back to the front in the KNotification dtor. Interestingly that application is still the one that *appears* to be the front application (= it owns the menubar) without this patch, but that's probably because the actual frontmost application is the agent that spawned the notification.


  kdeui/notifications/knotification.cpp d497c69 



On OS X 10.6.8 with kdelibs git/4.14, akonadi git/1.13 and kdepim 4.13.3


René J.V. Bertin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the kde-core-devel mailing list