summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBocklage, Jens <Jens_Bocklage@mentor.com>2016-12-16 15:18:34 +0100
committerBocklage, Jens <Jens_Bocklage@mentor.com>2016-12-16 15:18:34 +0100
commit88c577e3981f71f5d0aa88bcf095734855f66d06 (patch)
treec4f92ca201a53ebeb5848369b02ba6426d39f19a
parent36f4818cb31b406715ec0d52a2075611ec6fcdff (diff)
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 <Jens_Bocklage@mentor.com>
-rw-r--r--WindowManager/src/main.cpp23
-rw-r--r--WindowManager/src/windowmanager.cpp4
-rw-r--r--WindowManager/src/windowmanager.hpp2
3 files changed, 22 insertions, 7 deletions
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 <QCoreApplication>
+#include <QCommandLineParser>
#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 <id> 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<SimplePoint>();
qDBusRegisterMetaType<QList<SimplePoint> >();
@@ -36,7 +51,7 @@ int main(int argc, char *argv[])
qDBusRegisterMetaType<Layout>();
qDBusRegisterMetaType<QList<Layout> >();
- 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();