2 * Copyright (c) 2017, 2018, 2019 TOYOTA MOTOR CORPORATION
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <QGuiApplication>
19 #include "homescreenhandler.h"
22 #include <qpa/qplatformnativeinterface.h>
24 void* HomescreenHandler::myThis = 0;
26 HomescreenHandler::HomescreenHandler(Shell *_aglShell, ApplicationLauncher *launcher, QObject *parent) :
30 mp_launcher = launcher;
33 HomescreenHandler::~HomescreenHandler()
37 void HomescreenHandler::init()
41 static struct wl_output *
42 getWlOutput(QPlatformNativeInterface *native, QScreen *screen)
44 void *output = native->nativeResourceForScreen("output", screen);
45 return static_cast<struct ::wl_output*>(output);
48 void HomescreenHandler::tapShortcut(QString application_id)
50 struct agl_shell *agl_shell = aglShell->shell.get();
51 QPlatformNativeInterface *native = qApp->platformNativeInterface();
52 struct wl_output *output = getWlOutput(native, qApp->screens().first());
54 // start the application here, or do in the WM!
56 // this works (and it is redundant the first time), due to the default
57 // policy engine installed which actives the application, when starting
58 // the first time. Later calls to HomescreenHandler::tapShortcut will
59 // require calling 'agl_shell_activate_app'
60 agl_shell_activate_app(agl_shell, application_id.toStdString().c_str(), output);
62 // keep this for having animations working
64 mp_launcher->setCurrent(application_id);
68 void HomescreenHandler::onRep_static(struct json_object* reply_contents)
70 (void) reply_contents;
73 void HomescreenHandler::onEv_static(const string& event, struct json_object* event_contents)
76 (void) event_contents;
79 void HomescreenHandler::onRep(struct json_object* reply_contents)
81 (void) reply_contents;
84 void HomescreenHandler::onEv(const string& event, struct json_object* event_contents)
87 (void) event_contents;