/*!
    \reimp
*/
bool QProxyScreen::connect(const QString &displaySpec)
{
    const int id = getDisplayId(displaySpec);
    realScreen = qt_get_screen(id, displaySpec.toLatin1().constData());
    configure();

    return true;
}
Exemple #2
0
bool QMultiScreen::connect(const QString &displaySpec)
{
    QString dSpec = displaySpec;
    if (dSpec.startsWith(QLatin1String("Multi:"), Qt::CaseInsensitive))
        dSpec = dSpec.mid(QString::fromLatin1("Multi:").size());

    const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId);
    if (dSpec.endsWith(displayIdSpec))
        dSpec = dSpec.left(dSpec.size() - displayIdSpec.size());

    QStringList specs = dSpec.split(QLatin1Char(' '), QString::SkipEmptyParts);
    foreach (QString spec, specs) {
        const int id = getDisplayId(spec);
        if (spec.startsWith("vnc:", Qt::CaseInsensitive)) {
            spec.append(":noDisablePainting");
        }
        const QPoint offset = filterDisplayOffset(spec);
        QScreen *s = qt_get_screen(id, spec.toLatin1().constData());
        s->setOffset(offset);
        addSubScreen(s);
    }

    QScreen *firstScreen = d_ptr->screens.at(0);
    Q_ASSERT(firstScreen);

    // XXX
    QScreen::d = firstScreen->depth();

    QScreen::lstep = 0;
    QScreen::data = 0;
    QScreen::size = 0;

    QScreen::w = d_ptr->region.boundingRect().width();
    QScreen::h = d_ptr->region.boundingRect().height();

    QScreen::dw = QScreen::w;
    QScreen::dh = QScreen::h;

    // XXX - Extend the physical size based on the first screen
    // to encompass all screens, so that code that uses the multi
    // screen to calculate dpi values will get the right numbers.
    QScreen::physWidth = firstScreen->physicalWidth() * w / firstScreen->width();
    QScreen::physHeight = firstScreen->physicalHeight() * h / firstScreen->height();

    // XXXXX
    qt_screen = this;

    return true;
}
/*!
    \reimp
*/
bool QTransformedScreen::connect(const QString &displaySpec)
{
    QString dspec = displaySpec.trimmed();
    if (dspec.startsWith(QLatin1String("Transformed:"), Qt::CaseInsensitive))
        dspec = dspec.mid(QString::fromLatin1("Transformed:").size());
    else if (!dspec.compare(QLatin1String("Transformed"), Qt::CaseInsensitive))
        dspec = QString();

    const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId);
    if (dspec.endsWith(displayIdSpec))
        dspec = dspec.left(dspec.size() - displayIdSpec.size());

    d_ptr->transformation = filterTransformation(dspec);

    QString driver = dspec;
    int colon = driver.indexOf(QLatin1Char(':'));
    if (colon >= 0)
        driver.truncate(colon);

    if (!QScreenDriverFactory::keys().contains(driver, Qt::CaseInsensitive))
        if (!dspec.isEmpty())
            dspec.prepend(QLatin1Char(':'));

    const int id = getDisplayId(dspec);
    QScreen *s = qt_get_screen(id, dspec.toLatin1().constData());
    setScreen(s);

#ifdef QT_QWS_DEPTH_GENERIC
    d_ptr->doGenericColors = dspec.contains(QLatin1String("genericcolors"));
#endif

    d_ptr->configure();

    // XXX
    qt_screen = this;

    return true;
}