aboutsummaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/app/main.cpp b/app/main.cpp
index 6194c25..05eaf31 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -13,7 +13,7 @@
#include "file_operation.h"
#ifdef HAVE_LIBHOMESCREEN
-#include <libhomescreen.hpp>
+#include <qlibhomescreen.h>
#endif
#ifdef HAVE_QLIBWINDOWMANAGER
#include <qlibwindowmanager.h>
@@ -65,28 +65,13 @@ int main(int argc, char *argv[])
#ifdef HAVE_LIBHOMESCREEN
// HomeScreen
- LibHomeScreen* hs = new LibHomeScreen();
+ QLibHomeScreen* qhs = new QLibHomeScreen();
std::string token = secret.toStdString();
- hs->init(port, token.c_str());
+ qhs->init(port, token.c_str());
// Set the event handler for Event_TapShortcut which will activate the surface for windowmanager
- hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [qwm, myname](json_object *object){
-
- json_object *appnameJ = nullptr;
- if(json_object_object_get_ex(object, "application_name", &appnameJ))
- {
- const char *appname = json_object_get_string(appnameJ);
- if(QString::compare(myname, appname, Qt::CaseInsensitive) == 0)
- {
- qDebug("Surface %s got tapShortcut\n", appname);
- json_object *para, *area;
- json_object_object_get_ex(object, "parameter", &para);
- json_object_object_get_ex(para, "area", &area);
- const char *displayArea = json_object_get_string(area);
- qDebug("Surface %s got tapShortcut area\n", displayArea);
-// qwm->activateWindow(myname, QString(QLatin1String(displayArea)));
- qwm->activateWindow(myname, "master.split.sub");
- }
- }
+ qhs->set_event_handler(QLibHomeScreen::Event_ShowWindow, [qwm, myname](json_object *object){
+ qDebug("Surface %s got tapShortcut\n", myname);
+ qwm->activateWindow(myname);
});
#endif
qmlRegisterType<QCheapRuler>("com.mapbox.cheap_ruler", 1, 0, "CheapRuler");
@@ -98,7 +83,9 @@ int main(int argc, char *argv[])
QObject *root = engine.rootObjects().first();
QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
-
+#ifdef HAVE_LIBHOMESCREEN
+ qhs->setQuickWindow(window);
+#endif
//make the DBus connection info
QString pathBase = "org.agl.";
QString objBase = "/org/agl/";