From: Junseok, Kim Date: Mon, 16 Sep 2019 08:53:02 +0000 (+0900) Subject: e_info: Added method for set focus_policy_ext at runtime X-Git-Tag: accepted/tizen/unified/20190917.034050^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66e9a61c6c0c9ea8548b4322f3f191eea8b797a6;p=platform%2Fupstream%2Fenlightenment.git e_info: Added method for set focus_policy_ext at runtime Change-Id: I85f433715a7cfb752ef3f59004e52e33d6183574 --- diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 59e2bf7..87ac119 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -5224,6 +5224,14 @@ e_client_focus_defer_unset(E_Client *ec) defer_focus_stack = eina_list_remove(defer_focus_stack, ec); } +EINTERN void +e_client_focus_defer_clear(void) +{ + if (!defer_focus_stack) return; + + defer_focus_stack = eina_list_free(defer_focus_stack); +} + E_API Eina_Bool e_client_focus_track_enabled(void) { @@ -5516,6 +5524,14 @@ e_client_focus_stack_set(Eina_List *l) focus_stack = l; } +EINTERN void +e_client_focus_stack_clear(void) +{ + if (!focus_stack) return; + + focus_stack = eina_list_free(focus_stack); +} + E_API Eina_List * e_client_lost_windows_get(E_Zone *zone) { diff --git a/src/bin/e_client.h b/src/bin/e_client.h index 02af174..b4ae072 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -1078,6 +1078,7 @@ E_API void e_client_focus_latest_set(E_Client *ec); EINTERN void e_client_focus_stack_append_current_focused(E_Client *ec); E_API void e_client_focus_defer_set(E_Client *ec); E_API void e_client_focus_defer_unset(E_Client *ec); +EINTERN void e_client_focus_defer_clear(void); E_API Eina_Bool e_client_focus_track_enabled(void); E_API void e_client_focus_track_freeze(void); E_API void e_client_focus_track_thaw(void); @@ -1086,6 +1087,7 @@ E_API void e_client_focus_set_with_pointer(E_Client *ec); E_API void e_client_activate(E_Client *ec, Eina_Bool just_do_it); E_API E_Client *e_client_focused_get(void); E_API Eina_List *e_client_focus_stack_get(void); +EINTERN void e_client_focus_stack_clear(void); E_API Eina_List *e_client_lost_windows_get(E_Zone *zone); E_API void e_client_shade(E_Client *ec, E_Direction dir); E_API void e_client_unshade(E_Client *ec, E_Direction dir); diff --git a/src/bin/e_info_client.c b/src/bin/e_info_client.c index 473b017..6384e42 100644 --- a/src/bin/e_info_client.c +++ b/src/bin/e_info_client.c @@ -5135,6 +5135,55 @@ _e_info_client_proc_screen_info(int argc, char **argv) } static void +_e_info_client_cb_focus_policy_ext(const Eldbus_Message *msg) +{ + const char *errname = NULL, *errtext = NULL; + const int result = 0; + + EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err); + + EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "i", &result), err); + + if (result >= 0) + printf("Successfully changed, now focus_policy_ext=%d\n", result); + else + printf("value change failed\n"); + + return; + +err: + if(errname || errtext) + printf("errname : %s, errmsg : %s\n", errname, errtext); + else + printf("Error occurred in _e_info_client_cb_focus_policy_ext\n"); + + return; +} + +static void +_e_info_client_proc_focus_policy_ext(int argc, char **argv) +{ + int input = -1; + + EINA_SAFETY_ON_FALSE_GOTO(argc == 3, usage); + + input = atoi(argv[2]); + if ((input != 0) && (input != 1) && (input != -1)) goto usage; + + _e_info_client_eldbus_message_with_args("focus_policy_ext_set", _e_info_client_cb_focus_policy_ext, "i", atoi(argv[2])); + + return; + +usage : + printf("Usage : %s -focus_policy_ext [policy_enum]\n\n", argv[0]); + printf(" %s -focus_policy_ext 0 : set focus_policy_ext to E_FOCUS_EXT_TOP_STACK\n", argv[0]); + printf(" %s -focus_policy_ext 1 : set focus_policy_ext to E_FOCUS_EXT_HISTORY\n", argv[0]); + printf(" %s -focus_policy_ext : show now focus_policy_ext\n", argv[0]); + + return; +} + +static void _e_info_client_cb_focus_history(const Eldbus_Message *msg) { const char *errname = NULL, *errtext = NULL; @@ -5517,6 +5566,12 @@ static ProcInfo procs_to_execute[] = _e_info_client_magnifier }, { + "focus_policy_ext", + "[0], [1]", + "set focus_policy_ext, 0 is E_FOCUS_EXT_TOP_STACK, 1 is E_FOCUS_EXT_HISTORY", + _e_info_client_proc_focus_policy_ext + }, + { "focus_history", NULL, "get focus history", diff --git a/src/bin/e_info_server.c b/src/bin/e_info_server.c index 19892ad..a90e4d0 100644 --- a/src/bin/e_info_server.c +++ b/src/bin/e_info_server.c @@ -6158,6 +6158,51 @@ _e_info_server_cb_screen_info_get(const Eldbus_Service_Interface *iface EINA_UNU } static Eldbus_Message * +_e_info_server_cb_focus_policy_ext_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) +{ + Eldbus_Message *reply; + E_Client *ec = NULL; + int option = 0, res = -1; + + if (!eldbus_message_arguments_get(msg, "i", &option)) + { + return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR, + "focus_policy_ext_set: an attempt to get argument from method call message failed"); + } + + e_client_focus_defer_clear(); + e_client_focus_stack_clear(); + + switch (option) + { + case -1: + // get now focus policy ext + break; + case 0: + // use topmost focus + e_config->focus_policy_ext = E_FOCUS_EXT_TOP_STACK; + break; + case 1: + default: + // use focus history + e_config->focus_policy_ext = E_FOCUS_EXT_HISTORY; + + E_CLIENT_FOREACH(ec) + { + e_client_focus_latest_set(ec); + } + break; + } + + res = e_config->focus_policy_ext; + + reply = eldbus_message_method_return_new(msg); + eldbus_message_arguments_append(reply, "i", res); + + return reply; +} + +static Eldbus_Message * _e_info_server_cb_focus_history(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) { Eldbus_Message *reply; @@ -6260,6 +6305,7 @@ static const Eldbus_Method methods[] = { { "input_region", ELDBUS_ARGS({"siiii", "options"}), ELDBUS_ARGS({"a(iiii)", "path"}), _e_info_server_cb_input_region, 0}, { "hwc_wins", ELDBUS_ARGS({"i", "option"}), ELDBUS_ARGS({"as", "hwc wins info"}), _e_info_server_cb_hwc_wins_info_get, 0 }, { "screen_info", ELDBUS_ARGS({"i", "option"}), ELDBUS_ARGS({"as", "screen info"}), _e_info_server_cb_screen_info_get, 0 }, + { "focus_policy_ext_set", ELDBUS_ARGS({"i", "option"}), ELDBUS_ARGS({"i", "result"}), _e_info_server_cb_focus_policy_ext_set, 0 }, { "focus_history", NULL, ELDBUS_ARGS({"a(ubbbs)", "history array"}), _e_info_server_cb_focus_history, 0 }, { NULL, NULL, NULL, NULL, 0 } };