Пример #1
0
void KateApp::initKate ()
{

  kDebug() << "Setting KATE_PID: '" << getpid() << "'";
  ::setenv( "KATE_PID", QString("%1").arg(getpid()).toLatin1(), 1 );

  // handle restore different
  if (isSessionRestored())
  {
    restoreKate ();
  }
  else
  {
    // let us handle our command line args and co ;)
    // we can exit here if session chooser decides
    if (!startupKate ())
    {
      kDebug() << "startupKate returned false";
      m_shouldExit = true;
      return ;
    }
  }

  // application dbus interface
  QDBusConnection::sessionBus().registerObject( QLatin1String("/MainApplication"), this );
}
Пример #2
0
Application::Application() : KApplication(), owner(screen_number)
{
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if(!config()->isImmutable() && args->isSet("lock"))
    {
        config()->setReadOnly(true);
        config()->reparseConfiguration();
    }

    if(screen_number == -1)
        screen_number = DefaultScreen(qt_xdisplay());

    if(!owner.claim(args->isSet("replace"), true))
    {
        fputs(i18n("kwin: unable to claim manager selection, another wm running? (try using --replace)\n").local8Bit(), stderr);
        ::exit(1);
    }
    connect(&owner, SIGNAL(lostOwnership()), SLOT(lostSelection()));

    // if there was already kwin running, it saved its configuration after loosing the selection -> reread
    config()->reparseConfiguration();

    initting = TRUE; // startup....

    // install X11 error handler
    XSetErrorHandler(x11ErrorHandler);

    // check  whether another windowmanager is running
    XSelectInput(qt_xdisplay(), qt_xrootwin(), SubstructureRedirectMask);
    syncX(); // trigger error now

    options = new Options;
    atoms = new Atoms;

    // create workspace.
    (void)new Workspace(isSessionRestored());

    syncX(); // trigger possible errors, there's still a chance to abort

    DCOPRef ref("kded", "kded");
    ref.send("unloadModule", QCString("kdetrayproxy"));

    initting = FALSE; // startup done, we are up and running now.

    dcopClient()->send("ksplash", "", "upAndRunning(QString)", QString("wm started"));
    XEvent e;
    e.xclient.type = ClientMessage;
    e.xclient.message_type = XInternAtom(qt_xdisplay(), "_KDE_SPLASH_PROGRESS", False);
    e.xclient.display = qt_xdisplay();
    e.xclient.window = qt_xrootwin();
    e.xclient.format = 8;
    strcpy(e.xclient.data.b, "wm started");
    XSendEvent(qt_xdisplay(), qt_xrootwin(), False, SubstructureNotifyMask, &e);
}
Пример #3
0
void MobileUiApplication::resumeSessionIfPossible() {
  // load all sessions
  if(isSessionRestored()) {
    qDebug() << QString("restoring from session %1").arg(sessionId());
    SessionSettings s(sessionId());
    s.sessionAging();
    s.setSessionAge(0);
    QtUi::mainWindow()->restoreStateFromSettings(s);
    s.cleanup();
  } else {
    SessionSettings s(QString("1"));
    s.sessionAging();
    s.cleanup();
  }
}