QtSingleApplication on OS X + Windows?

Kevin Funk kfunk at kde.org
Wed Jan 20 23:27:48 UTC 2016


On Wednesday, January 20, 2016 11:22:56 PM René J.V. Bertin wrote:
> On Wednesday January 20 2016 22:06:14 Kevin Funk wrote:
> > * Make KDevelopApplication inherit from QtSingleApplication on OS X + Win
> 
> Why not do this everywhere, and just make the DBus code optional? That
> should be possible, and it wouldn't oblige us to give up features requiring
> DBus on OS X (and MS Windows?) platforms where a DBus daemon is running
> anyway (MacPorts, Fink, ...). Not requiring DBus is probably a boon for
> standalone app bundle builds, but the opposite for more traditional,
> "distribution" builds.

Right, indeed, it's not "either or". For OS X it still might sense to make use 
of an existing DBus session. I just wouldn't like KDevelop to start a dbus-
daemon on its own, like it currently does on Windows.

I'm sure that's possible.

I'm going to disable DBus for Windows; but I'll leave it optional for OS X. 
You can then patch KDevelop to behave "nicely".

> > * Get file-open event handling for free on both OS X + Windows

> I'm not sure where you get that impression from: QtSingleApplication
> contains an alternative to the approach I use. It overrides
> QApplication::event(), but still catches QFileOpen events. The rest of the
> processing is different and simpler (though probably much more complex
> elsewhere ^^). OTOH, the patch I wrote for KDevelop is only as complex as
> it is because I want it to let files be opened through the Finder the same
> way that is done from the commandline: in a new or the single currently
> running session, or otherwise in the session picked from a list of open
> sessions. I don't think Qt Creator or Krita have that feature -- and I hope
> you're planning to preserve it?

If we have a DBus session available on OS X, then you can still use parts of 
your patch to implement the desired behavior, no? QtSingleApplication 
basically gives you a fileName which was requested; you could then still 
decide whether to open in a new or existing session.

> NB: I am not sure exactly if a new (KDevelop) process is always created when
> you open a document in an application through the Finder, even without an
> explicit Info.plist indication that only 1 instance should be active at any
> time. I've had no reason to investigate this, but the behaviour I've
> observed suggests that no new process is launched.

From what I read about QFileOpenEvent I think no new process is launched 
either. It's just that the existing process gets an event.

> I don't think there is
> any guarantee which instance is activated when multiple instances of an
> application are running (but it does appear to be the first launched most
> of the time)

I've tested QtCreator on Windows; there only the first launched QtC session 
handles file open requests (which is, as you noted, cumbersome...).

> If true, that means the application must always be ready to
> hand off a FileOpen request to another running session -- can that be done
> without DBus?

Probably not easily.

> R.

Thanks for your input, appreciated!

Note: I currently still favor porting towards QtSingleApplication.

Cheers,
Kevin

-- 
Kevin Funk | kfunk at kde.org | http://kfunk.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160121/32a0b8b5/attachment.sig>


More information about the KDevelop-devel mailing list