From: Dhiraj Kr Mishra Date: Fri, 23 Dec 2016 09:09:20 +0000 (+0530) Subject: Updating KeyRegister Delivery Status information X-Git-Tag: submit/tizen/20170201.085809~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F73%2F106873%2F6;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-keyrouter.git Updating KeyRegister Delivery Status information Change-Id: Ia2e68c38d75a1285e4aa1c47dd12ba3899c3420f Signed-off-by: Dhiraj Kr Mishra --- diff --git a/src/e_mod_keyrouter_events.c b/src/e_mod_keyrouter_events.c index ad68f87..ee9ca94 100644 --- a/src/e_mod_keyrouter_events.c +++ b/src/e_mod_keyrouter_events.c @@ -155,7 +155,6 @@ _e_keyrouter_send_key_events_release(int type, Ecore_Event_Key *ev) if (res == EINA_FALSE) ret = EINA_FALSE; } krt->HardKeys[ev->keycode].press_ptr = NULL; - krt->isRegisterDelivery = EINA_FALSE; return ret; } @@ -449,7 +448,6 @@ _e_keyrouter_send_key_events_focus(int type, struct wl_resource *surface_focus, KLINF("REGISTER : %s(%s:%d) => wl_surface (%p) (pid: %d) (pname: %s)", ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keyname, ev->keycode, surface, pid, pname ?: "Unknown"); *delivered_surface = surface; - krt->isRegisterDelivery = EINA_TRUE; if(pname) E_FREE(pname); if(cmd) E_FREE(cmd); return res; diff --git a/src/e_mod_main_wl.c b/src/e_mod_main_wl.c index 815f435..3594051 100644 --- a/src/e_mod_main_wl.c +++ b/src/e_mod_main_wl.c @@ -305,13 +305,137 @@ _e_keyrouter_cb_get_keyregister_status(struct wl_client *client, struct wl_resou (void) client; (void) key; - Eina_Bool res = EINA_FALSE; + Eina_Bool res = EINA_FALSE, below_focus = EINA_FALSE; + E_Client *ec_top = NULL, *ec_focus = NULL; + struct wl_resource *surface = NULL, *surface_focus = NULL; + Eina_List* key_list = NULL, *l = NULL, *l_next = NULL; + E_Keyrouter_Key_List_NodePtr key_node_data = NULL; - if (krt->isRegisterDelivery) + int *key_data = NULL; + int deliver_invisible = 0; + + // Check for exclusive & or_exclusive mode delivery + if (krt->HardKeys[key].excl_ptr || krt->HardKeys[key].or_excl_ptr) { - res = EINA_TRUE; + goto finish; } + ec_top = e_client_top_get(); + ec_focus = e_client_focused_get(); + surface_focus = e_keyrouter_util_get_surface_from_eclient(ec_focus); + + for (; ec_top != NULL; ec_top = e_client_below_get(ec_top)) + { + + surface = e_keyrouter_util_get_surface_from_eclient(ec_top); + + if (surface == NULL) + { + // Not a valid surface. + continue; + } + + if (ec_top->is_cursor) continue; + + // Check if window stack reaches to focus window + if (ec_top == ec_focus) + { + below_focus = EINA_TRUE; + } + + //Check Top-Most Delivery + if( below_focus == EINA_FALSE) + { + EINA_LIST_FOREACH_SAFE(krt->HardKeys[key].top_ptr, l, l_next, key_node_data) + { + if (key_node_data) + { + if (ec_top == wl_resource_get_user_data(key_node_data->surface)) + { + goto finish; + } + } + } + } + + // Check for FORCE DELIVER to INVISIBLE WINDOW + if (deliver_invisible && IsInvisibleGetWindow(surface)) + { + goto finish; + } + + // Check for visible window first + // return if not visible + if (ec_top->visibility.obscured == E_VISIBILITY_FULLY_OBSCURED || ec_top->visibility.obscured == E_VISIBILITY_UNKNOWN) + { + continue; + } + + // Set key Event Delivery for INVISIBLE WINDOW + if (IsInvisibleSetWindow(surface)) + { + deliver_invisible = 1; + } + + if (IsNoneKeyRegisterWindow(surface)) + { + continue; + } + + if (e_keyrouter_is_registered_window(surface)) + { + // get the key list and deliver events if it has registered for that key + key_list = _e_keyrouter_registered_window_key_list(surface); + if (key_list) + { + EINA_LIST_FOREACH(key_list, l, key_data) + { + if(!key_data) + { + continue; + } + + if(*key_data == key) + { + res = EINA_TRUE; + goto finish; + } + } + } + } + + if (surface != surface_focus) + { + if (below_focus == EINA_FALSE) + { + continue; + } + + // Deliver to below Non Registered window + else if (!e_keyrouter_is_registered_window(surface)) + { + goto finish; + } + else + { + continue; + } + } + else + { + // Deliver to Focus Surface window from FOCUS MODE + if (!e_keyrouter_is_registered_window(surface)) + { + goto finish; + } + else + { + continue; + } + } + } + + finish: tizen_keyrouter_send_keyregister_notify(resource, (int)res); } diff --git a/src/e_mod_main_wl.h b/src/e_mod_main_wl.h index 6ae72e8..f8bf540 100644 --- a/src/e_mod_main_wl.h +++ b/src/e_mod_main_wl.h @@ -152,7 +152,6 @@ struct _E_Keyrouter #endif int isPictureOffEnabled; Eina_Bool pictureoff_disabled; - Eina_Bool isRegisterDelivery; }; struct _E_Keyrouter_Grab_Request {