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

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


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/120915/
-----------------------------------------------------------

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


Repository: kdelibs


Description
-------

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.


Diffs
-----

  kdeui/notifications/knotification.cpp d497c69 

Diff: https://git.reviewboard.kde.org/r/120915/diff/


Testing
-------

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


Thanks,

René J.V. Bertin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20141031/faaddcfe/attachment.htm>


More information about the kde-core-devel mailing list