From 88c577e3981f71f5d0aa88bcf095734855f66d06 Mon Sep 17 00:00:00 2001 From: "Bocklage, Jens" Date: Fri, 16 Dec 2016 15:18:34 +0100 Subject: Add app parameter to set display id On systems with more then one display, you may want to set the display that will be managed. The default display is 0. Signed-off-by: Bocklage, Jens --- WindowManager/src/main.cpp | 23 +++++++++++++++++++---- WindowManager/src/windowmanager.cpp | 4 ++-- WindowManager/src/windowmanager.hpp | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) (limited to 'WindowManager/src') diff --git a/WindowManager/src/main.cpp b/WindowManager/src/main.cpp index 4f3874d..5af8be1 100644 --- a/WindowManager/src/main.cpp +++ b/WindowManager/src/main.cpp @@ -15,19 +15,34 @@ */ #include +#include #include "windowmanager.hpp" int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); - // used for application settings (QSettings) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("WindowManager"); - QCoreApplication::setApplicationVersion("0.6.0"); + QCoreApplication::setApplicationVersion("0.7.0"); - qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); + QCommandLineParser parser; + parser.setApplicationDescription("AGL WindowManager - see wwww... for more details"); + parser.addHelpOption(); + parser.addVersionOption(); + QCommandLineOption displayOption(QStringList() << "d" << "display-id", + QCoreApplication::translate("main", "The display with this to manage. Default=0"), + QCoreApplication::translate("main", "id")); + parser.addOption(displayOption); + parser.process(a); + + int displayId = 0; + if (parser.isSet(displayOption)) + { + displayId = parser.value(displayOption).toInt(); + } + qDebug() << "Using display" << displayId; qDBusRegisterMetaType(); qDBusRegisterMetaType >(); @@ -36,7 +51,7 @@ int main(int argc, char *argv[]) qDBusRegisterMetaType(); qDBusRegisterMetaType >(); - WindowManager *windowManager = new WindowManager(); + WindowManager *windowManager = new WindowManager(displayId); windowManager->start(); #ifdef __arm__ diff --git a/WindowManager/src/windowmanager.cpp b/WindowManager/src/windowmanager.cpp index 101f5b3..38889c7 100644 --- a/WindowManager/src/windowmanager.cpp +++ b/WindowManager/src/windowmanager.cpp @@ -40,13 +40,13 @@ void* WindowManager::myThis = 0; -WindowManager::WindowManager(QObject *parent) : +WindowManager::WindowManager(int displayId, QObject *parent) : QObject(parent), m_layouts(), // m_appSurfaces(), mp_layoutAreaToSurfaceIdAssignment(0), m_currentLayout(-1), - m_screenId(0), // use screen "0" + m_screenId(displayId), m_screenWidth(0), m_screenHeight(0) #ifdef HAVE_IVI_LAYERMANAGEMENT_API diff --git a/WindowManager/src/windowmanager.hpp b/WindowManager/src/windowmanager.hpp index 5cc536b..d2c9c9b 100644 --- a/WindowManager/src/windowmanager.hpp +++ b/WindowManager/src/windowmanager.hpp @@ -32,7 +32,7 @@ class WindowManager : public QObject Q_OBJECT public: - explicit WindowManager(QObject *parent = 0); + explicit WindowManager(int displayId, QObject *parent = 0); ~WindowManager(); void start(); -- cgit 1.2.3-korg