X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=homescreen%2Fsrc%2Fmain.cpp;fp=homescreen%2Fsrc%2Fmain.cpp;h=d2967ca264edfc352be12d4415fca42833af1324;hb=74b01c721051068d485a0ab90b1df58c3ff09253;hp=5d7e36d66a83f61e9974bbb315d2769e181c4d94;hpb=444b2a68a503caaf0d58729d8297ef179215e3c1;p=apps%2Fhomescreen.git 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 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(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( - 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 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,