KManagerSelection::claim() emits signal in case it fails

We need to connect to this signal instead of waiting for it to time out.
This means we are already starting the window manager while it might be
that we fail.
This commit is contained in:
Martin Gräßlin 2013-07-23 07:27:40 +02:00
parent 1e0600bbc7
commit 053841f87f

View file

@ -323,11 +323,12 @@ Application::Application()
if (screen_number == -1)
screen_number = DefaultScreen(display());
if (!owner.claim(args->isSet("replace"), true)) {
connect(&owner, &KSelectionOwner::failedToClaimOwnership, []{
fputs(i18n("kwin: unable to claim manager selection, another wm running? (try using --replace)\n").toLocal8Bit().constData(), stderr);
::exit(1);
}
});
connect(&owner, SIGNAL(lostOwnership()), SLOT(lostSelection()));
owner.claim(args->isSet("replace"), true);
KCrash::setEmergencySaveFunction(Application::crashHandler);
crashes = args->getOption("crashes").toInt();