From 053841f87fdf67faa1da3d213684eda514395ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 23 Jul 2013 07:27:40 +0200 Subject: [PATCH] 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. --- main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index ef21fbbc34..95b8a15a94 100644 --- a/main.cpp +++ b/main.cpp @@ -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();