From a01dcdae19a645ccb2924d7c1003f4186696b48e Mon Sep 17 00:00:00 2001 From: wang_zhiqiang Date: Thu, 30 May 2019 16:42:52 +0800 Subject: change start sequence --- app/main.cpp | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'app/main.cpp') 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 +#include #endif #ifdef HAVE_QLIBWINDOWMANAGER #include @@ -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", ¶); - 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("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(root); - +#ifdef HAVE_LIBHOMESCREEN + qhs->setQuickWindow(window); +#endif //make the DBus connection info QString pathBase = "org.agl."; QString objBase = "/org/agl/"; -- cgit 1.2.3-korg