display: Make check-alive timeout configureable
The check-alive feature is there for the user to be able to terminate frozen applications more easily. However, sometimes applications are implemented in a way where they fail to be reply to ping requests in a timely manner, resulting in that, to the compositor, they are indistinguishable from clients that have frozen indefinitely. When using an application that has these issues, the GUI showed in response to the failure to respond to ping requests can become annoying, as it disrupts the visual presentation of the application. To allow users to work-around these issues, add a setting allowing them to configure the timeout waited until an application is considered frozen, or disabling the check completely. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1080
This commit is contained in:
parent
f9326cfa3d
commit
2da27720ca
@ -137,6 +137,16 @@
|
||||
</description>
|
||||
</key>
|
||||
|
||||
<key name="check-alive-timeout" type="u">
|
||||
<default>5000</default>
|
||||
<summary>Timeout for check-alive ping</summary>
|
||||
<description>
|
||||
Number of milliseconds a client has to respond to a ping request in
|
||||
order to not be detected as frozen. Using 0 will disable the alive check
|
||||
completely.
|
||||
</description>
|
||||
</key>
|
||||
|
||||
<child name="keybindings" schema="org.gnome.mutter.keybindings"/>
|
||||
|
||||
</schema>
|
||||
|
@ -2002,12 +2002,6 @@ meta_set_syncing (gboolean setting)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* How long, in milliseconds, we should wait after pinging a window
|
||||
* before deciding it's not going to get back to us.
|
||||
*/
|
||||
#define PING_TIMEOUT_DELAY 5000
|
||||
|
||||
/**
|
||||
* meta_display_ping_timeout:
|
||||
* @data: All the information about this ping. It is a #MetaPingData
|
||||
@ -2066,6 +2060,11 @@ meta_display_ping_window (MetaWindow *window,
|
||||
GSList *l;
|
||||
MetaDisplay *display = window->display;
|
||||
MetaPingData *ping_data;
|
||||
unsigned int check_alive_timeout;
|
||||
|
||||
check_alive_timeout = meta_prefs_get_check_alive_timeout ();
|
||||
if (check_alive_timeout == 0)
|
||||
return;
|
||||
|
||||
if (serial == 0)
|
||||
{
|
||||
@ -2101,9 +2100,10 @@ meta_display_ping_window (MetaWindow *window,
|
||||
ping_data = g_new (MetaPingData, 1);
|
||||
ping_data->window = window;
|
||||
ping_data->serial = serial;
|
||||
ping_data->ping_timeout_id = g_timeout_add (PING_TIMEOUT_DELAY,
|
||||
meta_display_ping_timeout,
|
||||
ping_data);
|
||||
ping_data->ping_timeout_id =
|
||||
g_timeout_add (check_alive_timeout,
|
||||
meta_display_ping_timeout,
|
||||
ping_data);
|
||||
g_source_set_name_by_id (ping_data->ping_timeout_id, "[mutter] meta_display_ping_timeout");
|
||||
|
||||
display->pending_pings = g_slist_prepend (display->pending_pings, ping_data);
|
||||
|
@ -102,6 +102,7 @@ static gboolean bell_is_audible = TRUE;
|
||||
static gboolean gnome_accessibility = FALSE;
|
||||
static gboolean gnome_animations = TRUE;
|
||||
static gboolean locate_pointer_is_enabled = FALSE;
|
||||
static unsigned int check_alive_timeout = 5000;
|
||||
static char *cursor_theme = NULL;
|
||||
/* cursor_size will, when running as an X11 compositing window manager, be the
|
||||
* actual cursor size, multiplied with the global window scaling factor. On
|
||||
@ -218,6 +219,12 @@ typedef struct
|
||||
gint *target;
|
||||
} MetaIntPreference;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MetaBasePreference base;
|
||||
unsigned int *target;
|
||||
} MetaUintPreference;
|
||||
|
||||
|
||||
/* All preferences that are not keybindings must be listed here,
|
||||
* plus in the GSettings schemas and the MetaPreference enum.
|
||||
@ -511,6 +518,18 @@ static MetaIntPreference preferences_int[] =
|
||||
{ { NULL, 0, 0 }, NULL },
|
||||
};
|
||||
|
||||
static MetaUintPreference preferences_uint[] =
|
||||
{
|
||||
{
|
||||
{ "check-alive-timeout",
|
||||
SCHEMA_MUTTER,
|
||||
META_PREF_CHECK_ALIVE_TIMEOUT,
|
||||
},
|
||||
&check_alive_timeout,
|
||||
},
|
||||
{ { NULL, 0, 0 }, NULL },
|
||||
};
|
||||
|
||||
static void
|
||||
handle_preference_init_enum (void)
|
||||
{
|
||||
@ -633,6 +652,21 @@ handle_preference_init_int (void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_preference_init_uint (void)
|
||||
{
|
||||
MetaUintPreference *cursor = preferences_uint;
|
||||
|
||||
while (cursor->base.key != NULL)
|
||||
{
|
||||
if (cursor->target)
|
||||
*cursor->target = g_settings_get_uint (SETTINGS (cursor->base.schema),
|
||||
cursor->base.key);
|
||||
|
||||
++cursor;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_preference_update_enum (GSettings *settings,
|
||||
gchar *key)
|
||||
@ -808,6 +842,28 @@ handle_preference_update_int (GSettings *settings,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_preference_update_uint (GSettings *settings,
|
||||
char *key)
|
||||
{
|
||||
MetaUintPreference *cursor = preferences_uint;
|
||||
unsigned int new_value;
|
||||
|
||||
while (cursor->base.key && strcmp (key, cursor->base.key) != 0)
|
||||
++cursor;
|
||||
|
||||
if (!cursor->base.key || !cursor->target)
|
||||
return;
|
||||
|
||||
new_value = g_settings_get_uint (SETTINGS (cursor->base.schema), key);
|
||||
|
||||
if (*cursor->target != new_value)
|
||||
{
|
||||
*cursor->target = new_value;
|
||||
queue_changed (cursor->base.pref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Listeners. */
|
||||
@ -986,6 +1042,7 @@ meta_prefs_init (void)
|
||||
handle_preference_init_string ();
|
||||
handle_preference_init_string_array ();
|
||||
handle_preference_init_int ();
|
||||
handle_preference_init_uint ();
|
||||
|
||||
init_bindings ();
|
||||
}
|
||||
@ -1039,6 +1096,8 @@ settings_changed (GSettings *settings,
|
||||
handle_preference_update_bool (settings, key);
|
||||
else if (g_variant_type_equal (type, G_VARIANT_TYPE_INT32))
|
||||
handle_preference_update_int (settings, key);
|
||||
else if (g_variant_type_equal (type, G_VARIANT_TYPE_UINT32))
|
||||
handle_preference_update_uint (settings, key);
|
||||
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING_ARRAY))
|
||||
handle_preference_update_string_array (settings, key);
|
||||
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING))
|
||||
@ -1695,6 +1754,9 @@ meta_preference_to_string (MetaPreference pref)
|
||||
|
||||
case META_PREF_LOCATE_POINTER:
|
||||
return "LOCATE_POINTER";
|
||||
|
||||
case META_PREF_CHECK_ALIVE_TIMEOUT:
|
||||
return "CHECK_ALIVE_TIMEOUT";
|
||||
}
|
||||
|
||||
return "(unknown)";
|
||||
@ -2041,6 +2103,12 @@ meta_prefs_is_locate_pointer_enabled (void)
|
||||
return locate_pointer_is_enabled;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
meta_prefs_get_check_alive_timeout (void)
|
||||
{
|
||||
return check_alive_timeout;
|
||||
}
|
||||
|
||||
const char *
|
||||
meta_prefs_get_iso_next_group_option (void)
|
||||
{
|
||||
|
@ -105,6 +105,7 @@ typedef enum
|
||||
META_PREF_CENTER_NEW_WINDOWS,
|
||||
META_PREF_DRAG_THRESHOLD,
|
||||
META_PREF_LOCATE_POINTER,
|
||||
META_PREF_CHECK_ALIVE_TIMEOUT,
|
||||
} MetaPreference;
|
||||
|
||||
typedef void (* MetaPrefsChangedFunc) (MetaPreference pref,
|
||||
@ -481,4 +482,7 @@ gboolean meta_prefs_bell_is_audible (void);
|
||||
META_EXPORT
|
||||
GDesktopVisualBellType meta_prefs_get_visual_bell_type (void);
|
||||
|
||||
META_EXPORT
|
||||
unsigned int meta_prefs_get_check_alive_timeout (void);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user