diff options
author | Nick Diego Yamane <nick@igalia.com> | 2018-12-20 20:55:11 -0400 |
---|---|---|
committer | Nick Diego Yamane <nick@igalia.com> | 2019-01-02 08:37:51 -0400 |
commit | e9e1d37d422da00f6b4c53fce9dccfd0ca7138db (patch) | |
tree | 0b1fcc40c1230b86df76be21421ad8c138b1e1d5 /src | |
parent | bf18cd6b272f7975e77a577e0b0d246bb2c62964 (diff) |
[backport] Force set/unset keyboard focusflounder_6.0.4flounder/6.0.46.0.4
This is work around which control keyboard focus for some
applications on behalf of windowmanager or LayerManagerControl.
Cherry-picked from (guppy branch):
https://gerrit.automotivelinux.org/gerrit/gitweb?p=staging/xdg-launcher.git;a=commit;h=415e5cbb5787aa0429558b5256bf912231297431
Change-Id: I8e73b3fd34c076d1023060dbeef7225eebb243ca
Original Author: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Signed-off-by: Nick Diego Yamane <nick@igalia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/runxdg.cpp | 22 | ||||
-rw-r--r-- | src/runxdg.hpp | 5 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/runxdg.cpp b/src/runxdg.cpp index 3ff942c..356e24f 100644 --- a/src/runxdg.cpp +++ b/src/runxdg.cpp @@ -83,7 +83,8 @@ void RunXDG::notify_ivi_control_cb (ilmObjectType object, t_ilm_uint id, m_launcher->register_surfpid(surf_pid); if (m_launcher->m_rid && surf_pid == m_launcher->find_surfpid_by_rid(m_launcher->m_rid)) { - setup_surface(id); + m_ivi_id = id; + setup_surface(); } m_surfaces[surf_pid] = id; } else if (object == ILM_LAYER) { @@ -279,12 +280,16 @@ int RunXDG::init_wm (void) return -1; } - std::function< void(json_object*) > h_active = [](json_object* object) { + std::function< void(json_object*) > h_active = [this](json_object* object) { AGL_DEBUG("Got Event_Active"); + t_ilm_surface s_ids[1] = { this->m_ivi_id }; + ilm_setInputFocus(s_ids, 1, ILM_INPUT_DEVICE_KEYBOARD, ILM_TRUE); }; - std::function< void(json_object*) > h_inactive = [](json_object* object) { + std::function< void(json_object*) > h_inactive = [this](json_object* object) { AGL_DEBUG("Got Event_Inactive"); + t_ilm_surface s_ids[1] = { this->m_ivi_id }; + ilm_setInputFocus(s_ids, 1, ILM_INPUT_DEVICE_KEYBOARD, ILM_FALSE); }; std::function< void(json_object*) > h_visible = [](json_object* object) { @@ -471,9 +476,9 @@ RunXDG::RunXDG (int port, const char* token, const char* id) AGL_DEBUG("RunXDG created."); } -void RunXDG::setup_surface (int id) +void RunXDG::setup_surface (void) { - std::string sid = std::to_string(id); + std::string sid = std::to_string(m_ivi_id); // This surface is mine, register pair app_name and ivi id. json_object *obj = json_object_new_object(); @@ -588,6 +593,8 @@ void RunXDG::start (void) AGL_DEBUG("waiting for notification: surafce created"); m_pending_create = true; + ilm_commitChanges(); + // in case, target app has already run if (m_launcher->m_rid) { pid_t surf_pid = m_launcher->find_surfpid_by_rid(m_launcher->m_rid); @@ -599,10 +606,13 @@ void RunXDG::start (void) int id = itr->second; AGL_DEBUG("surface %d for <%s> already exists", id, m_role.c_str()); - setup_surface(id); + m_ivi_id = id; + setup_surface(); } } } + + ilm_commitChanges(); m_launcher->loop(e_flag); } diff --git a/src/runxdg.hpp b/src/runxdg.hpp index ce0c016..595babe 100644 --- a/src/runxdg.hpp +++ b/src/runxdg.hpp @@ -30,6 +30,7 @@ #include <gio/gio.h> #include <ilm/ilm_control.h> +#include <ilm/ilm_input.h> #include <libwindowmanager.h> #include <libhomescreen.hpp> @@ -149,6 +150,8 @@ class RunXDG LibHomeScreen *m_hs; ILMControl *m_ic; + t_ilm_surface m_ivi_id; + std::map<int, int> m_surfaces; // pair of <afm:rid, ivi:id> bool m_pending_create = false; @@ -158,7 +161,7 @@ class RunXDG int parse_config(const char *file); - void setup_surface(int id); + void setup_surface(void); }; #endif // RUNXDG_HPP |