Here's a patch making the single instance handling use the 
director interface. The patch assumes that the patch about exit 
functions has already been applied.

The new behaviour is the following:
It tries to find a pipe in the current temporary directory (ie 
usually /tmp) to communicate with an existing instance. The 
messages sent use the director API - that is "open:" for now,
but I'll add "focus:" soon. If NO_FILER is defined, then we have
a callback function. Otherwise, the director extension takes care
of it. I also solved the startup notification issue mentionned
in a previous email (the first in this thread). Read the code
for more details.

As for the director extension itself, it seems to be working 
pretty well, good job. I'll play with it a bit more, but for now
there's only one thing I'd like to change: instead of hardcoding
/tmp, use g_get_tmp_dir(), e.g.:

sprintf(requestPipeName,"/%s/SciTE.%d.in", g_get_tmp_dir(), getpid());

I think there are about 3 lines to change, or something like that.

We should also add the following:

bool DirectorExtension::OnClose(const char *path) {
        CheckEnvironment(host);
        if (not_empty(path)) {
                ::SendDirector("closed", path);
        }
        return false;
}

which would make the Extension's new event OnClose available in
the director interface as well. It should be added to the Windows
version as well.

One last thing, I'm confused by the following:

// but do crash out if we failed and were started by an external director.

if (!fdReceiver && startedByDirector)

    ::exit(FALSE);

What does this call?

Okay, I'm tired, going to sleep now.
Nicolas

Attachment: single-instance.diff
Description: Binary data

_______________________________________________
Scite-interest mailing list
Scite-interest@lyra.org
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to