diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2023-04-13 11:22:58 +0300 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2023-04-20 21:34:19 +0300 |
commit | 74b01c721051068d485a0ab90b1df58c3ff09253 (patch) | |
tree | 8cfb1469f418ac226695d7fcca2f3be20584f584 /homescreen/src/main.cpp | |
parent | 444b2a68a503caaf0d58729d8297ef179215e3c1 (diff) |
homescreenhandler: Add support for starting apps on different outputs
Using the agl-shell protocol. This also needs a bump to version 8 of the
agl-shell protocol to be able to receive events.
Bug-AGL: SPEC-4529
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I2989ebc8eb36b8b1272782e5986017e9b557cab7
Diffstat (limited to 'homescreen/src/main.cpp')
-rw-r--r-- | homescreen/src/main.cpp | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp index 5d7e36d..d2967ca 100644 --- a/homescreen/src/main.cpp +++ b/homescreen/src/main.cpp @@ -36,6 +36,23 @@ #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif +QScreen * +find_screen(const char *screen_name) +{ + QList<QScreen *> screens = qApp->screens(); + QScreen *found = nullptr; + QString qstr_name = QString::fromUtf8(screen_name, -1); + + for (QScreen *xscreen : screens) { + if (qstr_name == xscreen->name()) { + found = xscreen; + break; + } + } + + return found; +} + struct shell_data { struct agl_shell *shell; HomescreenHandler *homescreenHandler; @@ -90,12 +107,28 @@ agl_shell_app_state(void *data, struct agl_shell *agl_shell, } } +static void +agl_shell_app_on_output(void *data, struct agl_shell *agl_shell, + const char *app_id, const char *output_name) +{ + struct shell_data *shell_data = static_cast<struct shell_data *>(data); + HomescreenHandler *homescreenHandler = shell_data->homescreenHandler; + + if (!homescreenHandler) + return; + + std::pair new_pending_app = std::pair(QString(app_id), + QString(output_name)); + homescreenHandler->pending_app_list.push_back(new_pending_app); +} + #ifdef AGL_SHELL_BOUND_OK_SINCE_VERSION static const struct agl_shell_listener shell_listener = { agl_shell_bound_ok, agl_shell_bound_fail, agl_shell_app_state, + agl_shell_app_on_output, }; #endif @@ -112,7 +145,7 @@ global_add(void *data, struct wl_registry *reg, uint32_t name, if (ver >= 2) { shell_data->shell = static_cast<struct agl_shell *>( - wl_registry_bind(reg, name, &agl_shell_interface, MIN(4, ver))); + wl_registry_bind(reg, name, &agl_shell_interface, MIN(8, ver))); #ifdef AGL_SHELL_BOUND_OK_SINCE_VERSION agl_shell_add_listener(shell_data->shell, &shell_listener, data); #endif @@ -192,22 +225,6 @@ create_component(QPlatformNativeInterface *native, QQmlComponent *comp, return getWlSurface(native, win); } -static QScreen * -find_screen(const char *screen_name) -{ - QList<QScreen *> screens = qApp->screens(); - QScreen *found = nullptr; - QString qstr_name = QString::fromUtf8(screen_name, -1); - - for (QScreen *xscreen : screens) { - if (qstr_name == xscreen->name()) { - found = xscreen; - break; - } - } - - return found; -} static void load_agl_shell(QPlatformNativeInterface *native, QQmlApplicationEngine *engine, |