diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2020-04-23 23:52:57 +0300 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2020-06-24 17:51:41 +0300 |
commit | b872666cdd8c831a0d1de8facb0d816573fadd25 (patch) | |
tree | 222ac9cc45eb0e5d5ba270d4da611040ed34ae32 | |
parent | 0859af125169bf34a5b01f33a7b3831f031bfce2 (diff) |
agl-compositor: Adapt alexa-viewer to using the agl-shell-desktop proto
Do not hide the app, for the time being.
Bug-AGL: SPEC-3447
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I15e5f40b2d3864dd8e251f75b0a4ba05487c7649
-rw-r--r-- | app/CMakeLists.txt | 37 | ||||
-rw-r--r-- | app/Main.qml | 11 | ||||
-rw-r--r-- | app/main.cpp | 171 | ||||
-rw-r--r-- | app/protocol/agl-shell-desktop.xml | 115 | ||||
-rw-r--r-- | app/shell-desktop.cpp | 100 | ||||
-rw-r--r-- | app/shell-desktop.h | 61 | ||||
-rw-r--r-- | conf.d/wgt/config.xml.in | 4 |
7 files changed, 436 insertions, 63 deletions
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index a6f2986..9cdbaa9 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -24,24 +24,55 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(OE_QMAKE_PATH_EXTERNAL_HOST_BINS $ENV{OE_QMAKE_PATH_HOST_BINS}) find_package(Qt5 COMPONENTS Core Gui QuickControls2 QuickWidgets REQUIRED) +find_package(Qt5Gui ${QT_MIN_VERSION} CONFIG REQUIRED Private) find_package(PkgConfig REQUIRED) +find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner) qt5_add_resources(RESOURCES alexa-viewer.qrc) PROJECT_TARGET_ADD(alexa-viewer) +add_custom_command( + OUTPUT agl-shell-desktop-client-protocol.h + COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header + < ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml + > ${CMAKE_SOURCE_DIR}/app/agl-shell-desktop-client-protocol.h + DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml +) + + +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/app/agl-shell-desktop-client-protocol.h + COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header + < ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml + > ${CMAKE_SOURCE_DIR}/app/agl-shell-desktop-client-protocol.h + DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml +) + +add_custom_command( + OUTPUT agl-shell-desktop-protocol.c + COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code + < ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml + > ${CMAKE_BINARY_DIR}/app/agl-shell-desktop-protocol.c + DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml +) + add_executable(${TARGET_NAME} main.cpp + agl-shell-desktop-protocol.c + agl-shell-desktop-client-protocol.h + shell-desktop.cpp afbclient.cpp ${RESOURCES} ) -pkg_check_modules(QLIBWINDOWMGR REQUIRED qlibwindowmanager) pkg_check_modules(QLIBHOMESCREEN REQUIRED qlibhomescreen) pkg_check_modules(QTAPPFW REQUIRED qtappfw-voice-metadata) pkg_check_modules(LIBAFBWSC REQUIRED libafbwsc) +pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client) include_directories( + include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) ${QTAPPFW_INCLUDE_DIRS} ${LIBAFBWSC_INCLUDE_DIRS} ) @@ -49,7 +80,7 @@ include_directories( set_target_properties(${TARGET_NAME} PROPERTIES LABELS "EXECUTABLE" PREFIX "" - COMPILE_FLAGS "${QLIBWINDOWMGR_FLAGS} ${QLIBHOMESCREEN} ${QTAPPFW_FLAGS} ${EXTRAS_CFLAGS} -DFOR_AFB_BINDING" + COMPILE_FLAGS "${QLIBHOMESCREEN} ${QTAPPFW_FLAGS} ${EXTRAS_CFLAGS} -DFOR_AFB_BINDING" LINK_FLAGS "${BINDINGS_LINK_FLAG}" LINK_LIBRARIES "${EXTRAS_LIBRARIES}" OUTPUT_NAME "${TARGET_NAME}" @@ -58,9 +89,9 @@ set_target_properties(${TARGET_NAME} PROPERTIES target_link_libraries(${TARGET_NAME} Qt5::QuickControls2 Qt5::QuickWidgets - ${QLIBWINDOWMGR_LIBRARIES} ${QLIBHOMESCREEN_LIBRARIES} ${QTAPPFW_LIBRARIES} ${LIBAFBWSC_LIBRARIES} + ${WAYLAND_CLIENT_LIBRARIES} -lpthread ) diff --git a/app/Main.qml b/app/Main.qml index 7060b9b..4011107 100644 --- a/app/Main.qml +++ b/app/Main.qml @@ -22,8 +22,8 @@ import QtQuick.Extras 1.4 Window { id: root - width: 1080 - height: 1488 + width: 1000 + height: 1000 color: '#00000000' visible: true @@ -32,7 +32,7 @@ Window { BodyTemplateDialog { id: bodyTemplate anchors.centerIn: parent - visible: true + visible: false property string title: "" property string subtitle: "" @@ -62,6 +62,7 @@ Window { onRenderTemplate: { console.log("Received renderTemplate, type = " + GuiMetadata.type) + if(GuiMetadata.type == "BodyTemplate1" || GuiMetadata.type == "BodyTemplate2") { // Normally setting the target to visible would be after changes to the // content, but I was seeing better behavior during testing by doing it @@ -80,6 +81,7 @@ Window { bodyTemplate.imageContentSource = GuiMetadata.bodyImageSmallUrl } } else if(GuiMetadata.type == "WeatherTemplate") { + console.log("Received weather template") bodyTemplate.visible = false weatherTemplate.visible = true @@ -94,6 +96,7 @@ Window { weatherTemplate.highTemperatureArrowSource = GuiMetadata.weatherHighTemperatureArrowMediumDarkBgUrl } else { // Should not happen, but just in case + console.log("Received Unsupported Template?") bodyTemplate.title = "Unsupported Template" bodyTemplate.subtitle = "" bodyTemplate.textContent = "The display template for this response is currently unsupported." @@ -116,6 +119,6 @@ Window { function hide() { console.log("hiding window!") - homescreen.hideWindow("alexa-viewer") + homescreen.deactivate_app("alexa-viewer") } } diff --git a/app/main.cpp b/app/main.cpp index 669341e..035f2d9 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -15,6 +15,7 @@ * limitations under the License. */ +#include <QGuiApplication> #include <QtCore/QDebug> #include <QtCore/QCommandLineParser> #include <QtCore/QUrlQuery> @@ -24,17 +25,93 @@ #include <QtQml/qqml.h> #include <QQuickWindow> #include <QtQuickControls2/QQuickStyle> +#include <qpa/qplatformnativeinterface.h> #include <json-c/json.h> -#include <qlibwindowmanager.h> #include <qlibhomescreen.h> #include <guimetadata.h> #include "afbclient.h" +#include "shell-desktop.h" #include <iostream> -// Disable window activation at launch by default, but keep option -// for potential debug use. -#define HIDE_AT_LAUNCH +QString my_app_id = QString("alexa-viewer"); + +// this and the agl-shell extension should be added in some kind of a wrapper +// for easy usage +static void +global_add(void *data, struct wl_registry *reg, uint32_t name, + const char *interface, uint32_t version) +{ + struct agl_shell_desktop **shell = + static_cast<struct agl_shell_desktop **>(data); + + if (strcmp(interface, agl_shell_desktop_interface.name) == 0) { + *shell = static_cast<struct agl_shell_desktop *>( + wl_registry_bind(reg, name, &agl_shell_desktop_interface, version) + ); + } +} + +static void +global_remove(void *data, struct wl_registry *reg, uint32_t id) +{ + (void) data; + (void) reg; + (void) id; +} + +static const struct wl_registry_listener registry_listener = { + global_add, + global_remove, +}; + +static void +application_id_event(void *data, struct agl_shell_desktop *agl_shell_desktop, + const char *app_id) +{ + (void) data; + (void) agl_shell_desktop; + // un-used + qInfo() << "app_id: " << app_id; +} + +static void +application_id_state(void *data, struct agl_shell_desktop *agl_shell_desktop, + const char *app_id, const char *app_data, uint32_t app_state, uint32_t app_role) +{ + (void) data; + (void) app_data; + (void) app_role; + (void) app_state; + (void) app_id; + (void) agl_shell_desktop; + + // un-used +} + +static const struct agl_shell_desktop_listener agl_shell_desk_listener = { + application_id_event, + application_id_state, +}; + +static struct agl_shell_desktop * +register_agl_shell_desktop(void) +{ + struct wl_display *wl; + struct wl_registry *registry; + struct agl_shell_desktop *shell = nullptr; + + QPlatformNativeInterface *native = qApp->platformNativeInterface(); + wl = static_cast<struct wl_display *>(native->nativeResourceForIntegration("display")); + registry = wl_display_get_registry(wl); + + wl_registry_add_listener(registry, ®istry_listener, &shell); + // Roundtrip to get all globals advertised by the compositor + wl_display_roundtrip(wl); + wl_registry_destroy(registry); + + return shell; +} bool check_template_supported(json_object *data) { @@ -61,30 +138,32 @@ bool check_template_supported(json_object *data) void async_event_cb(const char *event, json_object *data, void *closure) { + Shell *aglShell; if(!data) return; + if (!closure) + return; + + aglShell = static_cast<Shell *>(closure); + + qDebug() << "got async_event_cb()"; if(!strcmp(event, "vshl-capabilities/setDestination")) { // Slight hack here, there's currently no convenient place to hook up raising // the navigation app when a route is set by Alexa, so do so here for now. - if(closure != nullptr) { - static_cast<QLibHomeScreen*>(closure)->showWindow("navigation", "normal"); - } + aglShell->activate_app(nullptr, "navigation", nullptr); } else if(!strcmp(event, "vshl-capabilities/render_template")) { // Raise ourselves, the UI code will receive the event as well and render it - if(closure != nullptr) { - if(!check_template_supported(data)) { - qDebug() << "Unsupported template type, ignoring!"; - return; - } - static_cast<QLibHomeScreen*>(closure)->showWindow("alexa-viewer", "on_screen"); + if(!check_template_supported(data)) { + qDebug() << "Unsupported template type, ignoring!"; + return; } + aglShell->activate_app(nullptr, my_app_id, nullptr); } else if(!strcmp(event, "vshl-capabilities/clear_template")) { // Hide ourselves - if(closure != nullptr) { - static_cast<QLibHomeScreen*>(closure)->hideWindow("alexa-viewer"); - } + aglShell->deactivate_app(my_app_id); } + } void subscribe_async_events(AfbClient &client) @@ -128,9 +207,8 @@ void subscribe_async_events(AfbClient &client) int main(int argc, char *argv[]) { - QString graphic_role = QString("on_screen"); - QGuiApplication app(argc, argv); + app.setDesktopFileName(my_app_id); QCommandLineParser parser; parser.addPositionalArgument("port", app.translate("main", "port for binding")); @@ -155,52 +233,37 @@ int main(int argc, char *argv[]) bindingAddress.setQuery(query); } - // QLibWM - QLibWindowmanager* qwmHandler = new QLibWindowmanager(); - int res; - if((res = qwmHandler->init(port, token)) != 0){ - qCritical("init qlibwm err(%d)", res); - return -1; - } - if((res = qwmHandler->requestSurface(graphic_role)) != 0) { - qCritical("requestSurface error(%d)", res); - return -1; + struct agl_shell_desktop *shell = register_agl_shell_desktop(); + if (!shell) { + qDebug() << "agl_shell_desktop extension missing"; + exit(EXIT_FAILURE); } - qwmHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw, - [qwmHandler, &graphic_role](json_object *object) { - qwmHandler->endDraw(graphic_role); - }); - - // QLibHS - QLibHomeScreen* qhsHandler = new QLibHomeScreen(); - qhsHandler->init(port, token.toStdString().c_str()); - qhsHandler->set_event_handler(QLibHomeScreen::Event_ShowWindow, - [qwmHandler, &graphic_role](json_object *object){ - qDebug("Surface %s got showWindow\n", graphic_role.toStdString().c_str()); - qwmHandler->activateWindow(graphic_role, "on_screen"); - }); - qhsHandler->set_event_handler(QLibHomeScreen::Event_HideWindow, - [qwmHandler, &graphic_role](json_object *object){ - qDebug("Surface %s got hideWindow\n", graphic_role.toStdString().c_str()); - qwmHandler->deactivateWindow(graphic_role); - }); + + agl_shell_desktop_add_listener(shell, &agl_shell_desk_listener, NULL); + + std::shared_ptr<struct agl_shell_desktop> agl_shell{shell, agl_shell_desktop_destroy}; + Shell *aglShell = new Shell(agl_shell, &app); + + // before loading the QML we can tell the compositor that we'd like to + // be a pop-up kind of window: we need to do this before creating the + // window itself (either engine load or any of the comp.create()), or + // we can use/designate another application to behave like that + // + // note that x and y initial positioning values have to be specified + // here (the last two args) + aglShell->set_window_props(nullptr, my_app_id, + AGL_SHELL_DESKTOP_APP_ROLE_POPUP, 0, 0); // Load qml QQmlApplicationEngine engine; QQmlContext *context = engine.rootContext(); - - context->setContextProperty("homescreen", qhsHandler); + context->setContextProperty("homescreen", aglShell); context->setContextProperty("GuiMetadata", new GuiMetadata(bindingAddress, context)); engine.load(QUrl(QStringLiteral("qrc:/Main.qml"))); -#ifndef HIDE_AT_LAUNCH - QObject *root = engine.rootObjects().first(); - QQuickWindow *window = qobject_cast<QQuickWindow *>(root); - QObject::connect(window, SIGNAL(frameSwapped()), qwmHandler, SLOT(slotActivateWindow())); -#endif // Create app framework client to handle events when window is not visible AfbClient client(port, token.toStdString()); - client.set_event_callback(async_event_cb, (void*) qhsHandler); + client.set_event_callback(async_event_cb, static_cast<void *>(aglShell)); subscribe_async_events(client); return app.exec(); diff --git a/app/protocol/agl-shell-desktop.xml b/app/protocol/agl-shell-desktop.xml new file mode 100644 index 0000000..9ef4cca --- /dev/null +++ b/app/protocol/agl-shell-desktop.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<protocol name="agl_shell_desktop"> + <copyright> + Copyright © 2020 Collabora, Ltd. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + </copyright> + <interface name="agl_shell_desktop" version="1"> + <description summary="Private extension to allow applications activate other apps"> + This extension can be used by regular application to instruct to compositor + to activate or switch to other running (regular) applications. The client + is responsbile for filtering their own app_id when receiving application id. + + Note that other (regular) applications can bind to this interface and there is + no mechanism to place to restrict or limit that. + </description> + + <enum name="app_role"> + <entry name="popup" value="0"/> + <entry name="fullscreen" value="1"/> + <entry name="split_vertical" value="2"/> + <entry name="split_horizontal" value="3"/> + </enum> + + <enum name="app_state"> + <entry name="activated" value="0"/> + <entry name="deactivated" value="1"/> + </enum> + + <event name="application"> + <description summary="advertise application id"> + The compositor may choose to advertise one or more application ids which + can be used to activate/switch to. + + When this global is bound, the compositor will send all application ids + available for activation, but may send additional application id at any + time (when they've been mapped in the compositor). + </description> + <arg name="app_id" type="string"/> + </event> + + <request name="activate_app"> + <description summary="make client current window"> + Ask the compositor to make a toplevel to become the current/focused + window for window management purposes. + + See xdg_toplevel.set_app_id from the xdg-shell protocol for a + description of app_id. + </description> + <arg name="app_id" type="string"/> + <arg name="app_data" type="string" allow-null="true"/> + <arg name="output" type="object" interface="wl_output"/> + </request> + + <request name="set_app_property"> + <description summary="set properties for a client identified by app_id"> + Ask the compositor to make a toplevel obey the app_role and, depending + on the role, to use the the x and y values as initial positional values. + The x and y values would only make sense for certain roles. + + See xdg_toplevel.set_app_id from the xdg-shell protocol for a + description of app_id. + </description> + <arg name="app_id" type="string"/> + <arg name="role" type="uint" enum="app_role"/> + <arg name="x" type="int"/> + <arg name="y" type="int"/> + <arg name="output" type="object" interface="wl_output"/> + </request> + + <request name="deactivate_app"> + <description summary="de-activate/hide window identified by app_id"> + Ask the compositor to hide the toplevel window for window + management purposes. Depending on the window role, this request + will either display the previously active window (or the background + in case there's no previously activate surface) or temporarly (or + until a 'activate_app' is called upon) hide the surface. All + the surfaces are identifiable by using the app_id, and no actions are + taken in case the app_id is not/was not present. + + See xdg_toplevel.set_app_id from the xdg-shell protocol for a + description of app_id. + </description> + <arg name="app_id" type="string"/> + </request> + + <event name="state_app"> + <description summary="event sent when application has suffered state modification"> + Notifies application(s) when other application have suffered state modifications. + </description> + <arg name="app_id" type="string"/> + <arg name="app_data" type="string" allow-null="true"/> + <arg name="state" type="uint" enum="app_state"/> + <arg name="role" type="uint" enum="app_role"/> + </event> + + </interface> +</protocol> diff --git a/app/shell-desktop.cpp b/app/shell-desktop.cpp new file mode 100644 index 0000000..2aa5ee1 --- /dev/null +++ b/app/shell-desktop.cpp @@ -0,0 +1,100 @@ +/* + * Copyright © 2020 Collabora Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include <QGuiApplication> +#include <QDebug> +#include "shell-desktop.h" +#include <qpa/qplatformnativeinterface.h> +#include <stdio.h> + +static struct wl_output * +getWlOutput(QScreen *screen) +{ + QPlatformNativeInterface *native = qApp->platformNativeInterface(); + + void *output = native->nativeResourceForScreen("output", screen); + return static_cast<struct ::wl_output*>(output); +} + +static void +flush_connection(void) +{ + QPlatformNativeInterface *native = qApp->platformNativeInterface(); + struct wl_display *wl = static_cast<struct wl_display *>(native->nativeResourceForIntegration("display")); + + wl_display_roundtrip(wl); +} + +void Shell::activate_app(QWindow *win, const QString &app_id, const QString &app_data) +{ + QScreen *screen = nullptr; + struct wl_output *output; + + if (!win || !win->screen()) { + screen = qApp->screens().first(); + } else { + screen = win->screen(); + } + + if (!screen) { + return; + } + + output = getWlOutput(screen); + agl_shell_desktop_activate_app(this->shell.get(), + app_id.toStdString().c_str(), + app_data.toStdString().c_str(), output); + + flush_connection(); +} + +void Shell::deactivate_app(const QString &app_id) +{ + agl_shell_desktop_deactivate_app(this->shell.get(), + app_id.toStdString().c_str()); + flush_connection(); +} + +void Shell::set_window_props(QWindow *win, const QString &app_id, uint32_t props, int x, int y) +{ + QScreen *screen = nullptr; + struct wl_output *output; + + if (!win || !win->screen()) { + screen = qApp->screens().first(); + } else { + screen = win->screen(); + } + + if (!screen) { + return; + } + + output = getWlOutput(screen); + agl_shell_desktop_set_app_property(this->shell.get(), + app_id.toStdString().c_str(), + props, x, y, output); + flush_connection(); +} diff --git a/app/shell-desktop.h b/app/shell-desktop.h new file mode 100644 index 0000000..0b1c6be --- /dev/null +++ b/app/shell-desktop.h @@ -0,0 +1,61 @@ +/* + * Copyright © 2019 Collabora Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SHELLDESKTOP_H +#define SHELLDESKTOP_H + +#include <QObject> +#include <QString> +#include <QScreen> +#include <QWindow> +#include <memory> +#include "agl-shell-desktop-client-protocol.h" + +/* + * Basic type to wrap the agl_shell wayland object into a QObject, so that it + * can be used in callbacks from QML. + */ + +class Shell : public QObject +{ +Q_OBJECT + std::shared_ptr<struct agl_shell_desktop> shell; + +public: + Shell(std::shared_ptr<struct agl_shell_desktop> shell, QObject *parent = nullptr) : + QObject(parent), shell(shell) + {} + +signals: + // using Qobject::connect(), callins into qml + void showOnScreen(); + +public slots: // calls out of qml into CPP + void activate_app(QWindow *win, const QString &app_id, const QString &app_data); + void deactivate_app(const QString &app_id); + void set_window_props(QWindow *win, const QString &app_id, uint32_t props, int x, int y); +}; + +#endif // SHELLDESKTOP_H diff --git a/conf.d/wgt/config.xml.in b/conf.d/wgt/config.xml.in index a374f28..d55826c 100644 --- a/conf.d/wgt/config.xml.in +++ b/conf.d/wgt/config.xml.in @@ -7,7 +7,7 @@ <author>@PROJECT_AUTHOR@ <@PROJECT_AUTHOR_MAIL@></author> <license>@PROJECT_LICENSE@</license> <feature name="urn:AGL:widget:required-api"> - <param name="windowmanager" value="ws" /> + <!-- <param name="windowmanager" value="ws" /> --> <param name="homescreen" value="ws" /> <param name="vshl-capabilities" value="ws" /> <param name="signal-composer" value="ws" /> @@ -16,6 +16,6 @@ <param name="urn:AGL:permission::public:display" value="required" /> <param name="urn:AGL:permission::public:no-htdocs" value="required" /> <param name="urn:AGL:permission::system:run-by-default" value="required" /> - <param name="urn:AGL:permission::public:hidden" value="required" /> + <!-- <param name="urn:AGL:permission::public:hidden" value="required" /> --> </feature> </widget> |