cleanup: remove controversial naming

Replace "whitelist" and "blacklist" with "allow_list" and "deny_list"
which better represent the purpose of those variables.

There is no functional change.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1396
This commit is contained in:
Olivier Fourdan 2020-08-04 08:59:54 +02:00
parent 5ed97f3a02
commit 17417a82a5
5 changed files with 31 additions and 30 deletions

View File

@ -75,7 +75,7 @@
For a X11 grab to be taken into account under Wayland, the client must
also either send a specific X11 ClientMessage to the root window or be
among the applications white-listed in key “xwayland-grab-access-rules”.
among the applications allowed in key “xwayland-grab-access-rules”.
</description>
</key>
@ -91,8 +91,9 @@
Wildcards “*” and jokers “?” in the values are supported.
Values starting with “!” are blacklisted, which has precedence over
the whitelist, to revoke applications from the default system list.
Values starting with “!” are denied, which has precedence over
the list of values allowed, to revoke applications from the default
system list.
The default system list includes the following applications:

View File

@ -64,8 +64,8 @@ void meta_settings_enable_experimental_feature (MetaSettings *settings
MetaExperimentalFeature feature);
void meta_settings_get_xwayland_grab_patterns (MetaSettings *settings,
GPtrArray **whitelist_patterns,
GPtrArray **blacklist_patterns);
GPtrArray **allow_list_patterns,
GPtrArray **deny_list_patterns);
gboolean meta_settings_are_xwayland_grabs_allowed (MetaSettings *settings);

View File

@ -66,8 +66,8 @@ struct _MetaSettings
gboolean experimental_features_overridden;
gboolean xwayland_allow_grabs;
GPtrArray *xwayland_grab_whitelist_patterns;
GPtrArray *xwayland_grab_blacklist_patterns;
GPtrArray *xwayland_grab_allow_list_patterns;
GPtrArray *xwayland_grab_deny_list_patterns;
};
G_DEFINE_TYPE (MetaSettings, meta_settings, G_TYPE_OBJECT)
@ -321,12 +321,12 @@ static void
xwayland_grab_list_add_item (MetaSettings *settings,
char *item)
{
/* If first character is '!', it's a blacklisted item */
/* If first character is '!', it's a denied value */
if (item[0] != '!')
g_ptr_array_add (settings->xwayland_grab_whitelist_patterns,
g_ptr_array_add (settings->xwayland_grab_allow_list_patterns,
g_pattern_spec_new (item));
else if (item[1] != 0)
g_ptr_array_add (settings->xwayland_grab_blacklist_patterns,
g_ptr_array_add (settings->xwayland_grab_deny_list_patterns,
g_pattern_spec_new (&item[1]));
}
@ -356,14 +356,14 @@ update_xwayland_grab_access_rules (MetaSettings *settings)
int i;
/* Free previous patterns and create new arrays */
g_clear_pointer (&settings->xwayland_grab_whitelist_patterns,
g_clear_pointer (&settings->xwayland_grab_allow_list_patterns,
g_ptr_array_unref);
settings->xwayland_grab_whitelist_patterns =
settings->xwayland_grab_allow_list_patterns =
g_ptr_array_new_with_free_func ((GDestroyNotify) g_pattern_spec_free);
g_clear_pointer (&settings->xwayland_grab_blacklist_patterns,
g_clear_pointer (&settings->xwayland_grab_deny_list_patterns,
g_ptr_array_unref);
settings->xwayland_grab_blacklist_patterns =
settings->xwayland_grab_deny_list_patterns =
g_ptr_array_new_with_free_func ((GDestroyNotify) g_pattern_spec_free);
/* Add system defaults values */
@ -405,11 +405,11 @@ wayland_settings_changed (GSettings *wayland_settings,
void
meta_settings_get_xwayland_grab_patterns (MetaSettings *settings,
GPtrArray **whitelist_patterns,
GPtrArray **blacklist_patterns)
GPtrArray **allow_list_patterns,
GPtrArray **deny_list_patterns)
{
*whitelist_patterns = settings->xwayland_grab_whitelist_patterns;
*blacklist_patterns = settings->xwayland_grab_blacklist_patterns;
*allow_list_patterns = settings->xwayland_grab_allow_list_patterns;
*deny_list_patterns = settings->xwayland_grab_deny_list_patterns;
}
gboolean
@ -437,9 +437,9 @@ meta_settings_dispose (GObject *object)
g_clear_object (&settings->mutter_settings);
g_clear_object (&settings->interface_settings);
g_clear_object (&settings->wayland_settings);
g_clear_pointer (&settings->xwayland_grab_whitelist_patterns,
g_clear_pointer (&settings->xwayland_grab_allow_list_patterns,
g_ptr_array_unref);
g_clear_pointer (&settings->xwayland_grab_blacklist_patterns,
g_clear_pointer (&settings->xwayland_grab_deny_list_patterns,
g_ptr_array_unref);
G_OBJECT_CLASS (meta_settings_parent_class)->dispose (object);

View File

@ -48,7 +48,7 @@ struct _MetaPlayRequest
MetaSoundPlayer *player;
};
const char * const cache_whitelist[] = {
const char * const cache_allow_list[] = {
"bell-window-system",
"desktop-switch-left",
"desktop-switch-right",
@ -251,7 +251,7 @@ meta_sound_player_play_from_theme (MetaSoundPlayer *player,
ca_proplist_create (&props);
build_ca_proplist (props, CA_PROP_EVENT_ID, name, description);
if (g_strv_contains (cache_whitelist, name))
if (g_strv_contains (cache_allow_list, name))
ca_proplist_sets (props, CA_PROP_CANBERRA_CACHE_CONTROL, "permanent");
else
ca_proplist_sets (props, CA_PROP_CANBERRA_CACHE_CONTROL, "volatile");

View File

@ -183,26 +183,26 @@ meta_xwayland_grab_is_granted (MetaWindow *window)
{
MetaBackend *backend;
MetaSettings *settings;
GPtrArray *whitelist;
GPtrArray *blacklist;
GPtrArray *allow_list;
GPtrArray *deny_list;
gboolean may_grab;
backend = meta_get_backend ();
settings = meta_backend_get_settings (backend);
/* Check whether the window is blacklisted */
meta_settings_get_xwayland_grab_patterns (settings, &whitelist, &blacklist);
/* Check whether the window is in the deny list */
meta_settings_get_xwayland_grab_patterns (settings, &allow_list, &deny_list);
if (blacklist && application_is_in_pattern_array (window, blacklist))
if (deny_list && application_is_in_pattern_array (window, deny_list))
return FALSE;
/* Check if we are dealing with good citizen Xwayland client whitelisting itself. */
/* Check if we are dealing with good citizen Xwayland client allowing itself. */
g_object_get (G_OBJECT (window), "xwayland-may-grab-keyboard", &may_grab, NULL);
if (may_grab)
return TRUE;
/* Last resort, is it white listed. */
if (whitelist && application_is_in_pattern_array (window, whitelist))
/* Last resort, is it in the grant list. */
if (allow_list && application_is_in_pattern_array (window, allow_list))
return TRUE;
return FALSE;