closest equivalent to KApplicationPrivate::init() ?

David Faure faure at kde.org
Sat Jan 2 13:14:19 UTC 2016


On Saturday 02 January 2016 13:46:17 René J.V. Bertin wrote:
> On Saturday January 02 2016 12:50:59 David Faure wrote:
> 
> > > I added a "bring application to the foreground" call (to a KWindowSystem helper function) in there, which alleviated the issue of applications remaining somewhere in the background on OS X. 
> > > I'm still keeping an eye out for central locations where I could call that helper function.
> > 
> > This would break focus-stealing-prevention.
> > Apps started while the user is typing elsewhere shouldn't be brought to the foreground.
> 
> Yeah, well, there's a fine line to walk there. It's not like it never happens on Linux either. In fact, it happens much more often on Linux than with native OS X applications, even if OS X didn't always do so well. You can (again) start an app (via Dock or Finder) and then switch back immediately to whatever other app you were using, and the new app will open just behind the one you switched back to.
> I *think* that this is something LaunchServices takes care of.
> 
> Of course that all doesn't apply to popup messages, password dialogs and the like. Hence the fine line remark: I think everyone is used to focus being stolen in certain circumstances. I won't call it a small price to pay, but you can also consider that a "feature" causing new applications to open in the background systematically is a form of focus stealing - a more annoying one at that because most of the time you don't notice that it's happening.

Sounds to me like you're saying "better bring all apps to front than none".

Maybe, maybe not, but what we need to continue this discussion is hard data.
1) what does QProcess on Mac do (always in front, always in background, depends on whether the user is typing)
2) can QProcess be improved
3) can we use QProcess from KF5 instead of kdeinit (because, again, kdeinit's only purpose is fork+exec
which is apparently not a good solution on Mac). I'm pretty sure the answer to this one is yes.
E.g. if you set bool useKToolInvocation to false in krun.cpp:724, you'll get into the code path that uses QProcess.
(which btw shows another reason to ensure QProcess works: kdeinit isn't even always used, even on Linux,
see the conditional for useKToolInvocation).

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list