From e2a5301768f61ff6a889e31eb255c6d743832ebc Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Fri, 10 Jun 2022 10:42:34 +0900 Subject: [PATCH] keyrouter: Rename grabbed for more suitable name The variable 'grabbed' was only used to check to see if the associated client has been privileged. So, it's better to rename 'grabbed' to 'privileged'. Plus, it should be determined when checking privilege. Change-Id: Ibc3956b6ab6e21bf8fd3d58d9a1c4fbcce1aec67 --- src/keyrouter/keyrouter.c | 13 ++++++------- src/keyrouter/keyrouter.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/keyrouter/keyrouter.c b/src/keyrouter/keyrouter.c index 62753dd..9d70fce 100644 --- a/src/keyrouter/keyrouter.c +++ b/src/keyrouter/keyrouter.c @@ -120,8 +120,6 @@ keyrouter_handle_keygrab_set(struct wl_client *client, res = keyrouter_grab_grab_key(keyrouter->keyrouter_grab, mode, key, (void *)client); - if (res == TIZEN_KEYROUTER_ERROR_NONE && keyrouter_client->grabbed != true) - keyrouter_client->grabbed = true; tizen_keyrouter_send_keygrab_notify(resource, surface, key, mode, res); } @@ -210,8 +208,6 @@ keyrouter_handle_keygrab_set_list(struct wl_client *client, } else { res = keyrouter_grab_grab_key(keyrouter->keyrouter_grab, grab_data->mode, grab_data->key, (void *)client); - if (res == TIZEN_KEYROUTER_ERROR_NONE && keyrouter_client->grabbed != true) - keyrouter_client->grabbed = true; grab_data->err = res; } @@ -381,13 +377,16 @@ keyrouter_check_privilege(struct ds_tizen_keyrouter_client *keyrouter_client, return true; } - // grabbed client is already checked the privilege before. - if (keyrouter_client->grabbed) + // already checked the privilege before. + if (keyrouter_client->privileged) return true; wl_client_get_credentials(client, &pid, &uid, &gid); - return tizen_security_check_privilege(pid, uid, "http://tizen.org/privilege/keygrab"); + keyrouter_client->privileged = tizen_security_check_privilege(pid, uid, + "http://tizen.org/privilege/keygrab"); + + return keyrouter_client->privileged; } static void diff --git a/src/keyrouter/keyrouter.h b/src/keyrouter/keyrouter.h index 3d88346..ab10f9b 100644 --- a/src/keyrouter/keyrouter.h +++ b/src/keyrouter/keyrouter.h @@ -66,7 +66,7 @@ struct ds_tizen_keyrouter_client struct wl_resource *resource; - bool grabbed; + bool privileged; struct wl_list link; // ds_tizen_keyrouter::clients }; -- 2.7.4