diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-06-21 15:30:47 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-06-21 15:40:58 (GMT) |
commit | 7e5ddd5ffb23fa5ebd33b747f28ee20647b9325b (patch) | |
tree | fa856577d1be6d3add641a9364cccceb3c264108 /src/plugins | |
parent | dbbc370400922cf9963a9a80ac0d1396450e8ef3 (diff) | |
download | Qt-7e5ddd5ffb23fa5ebd33b747f28ee20647b9325b.zip Qt-7e5ddd5ffb23fa5ebd33b747f28ee20647b9325b.tar.gz Qt-7e5ddd5ffb23fa5ebd33b747f28ee20647b9325b.tar.bz2 |
Support multiple display IDs for Lighthouse QVFb plugin
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/qvfb/main.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/qvfb/qvfbintegration.cpp | 35 | ||||
-rw-r--r-- | src/plugins/platforms/qvfb/qvfbintegration.h | 4 |
3 files changed, 22 insertions, 19 deletions
diff --git a/src/plugins/platforms/qvfb/main.cpp b/src/plugins/platforms/qvfb/main.cpp index 206ece8..997e544 100644 --- a/src/plugins/platforms/qvfb/main.cpp +++ b/src/plugins/platforms/qvfb/main.cpp @@ -63,7 +63,7 @@ QPlatformIntegration* QVFbIntegrationPlugin::create(const QString& system, const { Q_UNUSED(paramList); if (system.toLower() == "qvfb") - return new QVFbIntegration; + return new QVFbIntegration(paramList); return 0; } diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp index 84ab9fb..a50763a 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.cpp +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -69,7 +69,7 @@ class QVFbScreenKeyboardHandler : public QObject { Q_OBJECT public: - QVFbScreenKeyboardHandler(); + QVFbScreenKeyboardHandler(int displayId); ~QVFbScreenKeyboardHandler(); private slots: @@ -83,9 +83,8 @@ private: QSocketNotifier *keyNotifier; }; -QVFbScreenKeyboardHandler::QVFbScreenKeyboardHandler() +QVFbScreenKeyboardHandler::QVFbScreenKeyboardHandler(int displayId) { - int displayId = 0; //TODO displayId const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId); @@ -165,7 +164,7 @@ class QVFbScreenMouseHandler : public QObject { Q_OBJECT public: - QVFbScreenMouseHandler(); + QVFbScreenMouseHandler(int displayId); ~QVFbScreenMouseHandler(); private slots: @@ -181,9 +180,8 @@ private: int oldButtonState; }; -QVFbScreenMouseHandler::QVFbScreenMouseHandler() +QVFbScreenMouseHandler::QVFbScreenMouseHandler(int displayId) { - int displayId = 0; //TODO: displayId QString mouseDev = QT_VFB_MOUSE_PIPE(displayId); mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY); @@ -257,10 +255,11 @@ void QVFbScreenMouseHandler::readMouseData() class QVFbScreenPrivate { public: - QVFbScreenPrivate(QVFbScreen *) + QVFbScreenPrivate(int id) : shmrgn(0), hdr(0), data(0), mouseHandler(0), keyboardHandler(0) { - connect(0); //for now we only handle one screen + displayId = id; + connect(displayId); } ~QVFbScreenPrivate() { disconnect(); } @@ -281,7 +280,7 @@ private: uchar *data; QVFbScreenMouseHandler *mouseHandler; QVFbScreenKeyboardHandler *keyboardHandler; - + int displayId; QImage img; }; @@ -296,7 +295,7 @@ void QVFbScreenPrivate::setDirty(const QRect &r) bool QVFbScreenPrivate::connect(int displayId) { - + qDebug() << "QVFbScreenPrivate::connect" << displayId; key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLatin1(), 'b'); if (key == -1) @@ -339,8 +338,8 @@ bool QVFbScreenPrivate::connect(int displayId) qDebug("connected %dx%d %d bpp", w, h, d); - mouseHandler = new QVFbScreenMouseHandler; - keyboardHandler = new QVFbScreenKeyboardHandler; + mouseHandler = new QVFbScreenMouseHandler(displayId); + keyboardHandler = new QVFbScreenKeyboardHandler(displayId); return true; } @@ -357,9 +356,9 @@ void QVFbScreenPrivate::disconnect() } -QVFbScreen::QVFbScreen() +QVFbScreen::QVFbScreen(int id) { - d_ptr = new QVFbScreenPrivate(this); + d_ptr = new QVFbScreenPrivate(id); } @@ -409,9 +408,13 @@ QImage *QVFbScreen::screenImage() return d_ptr->screenImage(); } -QVFbIntegration::QVFbIntegration() +QVFbIntegration::QVFbIntegration(const QStringList ¶mList) { - mPrimaryScreen = new QVFbScreen(); + int displayId = 0; + if (paramList.length() > 0) + displayId = paramList.at(0).toInt(); + + mPrimaryScreen = new QVFbScreen(displayId); mScreens.append(mPrimaryScreen); } diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h index ab44d46..e46e0da 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.h +++ b/src/plugins/platforms/qvfb/qvfbintegration.h @@ -53,7 +53,7 @@ class QVFbScreenPrivate; class QVFbScreen : public QPlatformScreen { public: - QVFbScreen(); + QVFbScreen(int id); ~QVFbScreen(); QRect geometry() const; @@ -76,7 +76,7 @@ class QVFbIntegrationPrivate; class QVFbIntegration : public QPlatformIntegration { public: - QVFbIntegration(); + QVFbIntegration(const QStringList ¶mList); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; |