gdk: Add a way to show included backends

Set GDK_BACKEND=help to see a list of all inluded GDK backends.
This commit is contained in:
Matthias Clasen 2016-02-18 22:03:12 -05:00
parent a3ba7f0a20
commit 9c2110122b
2 changed files with 12 additions and 2 deletions

View File

@ -477,7 +477,7 @@ nevertheless.
<para>
If set, selects the GDK backend to use. Selecting a backend requires that
GTK+ is compiled with support for that backend. The following backends can
be selected:
be selected, provided they are included in the GDK libraries you are using:
<variablelist>
<varlistentry>
@ -513,7 +513,8 @@ nevertheless.
</variablelist>
Since 3.10, this environment variable can contain a comma-separated list
of backend names, which are tried in order. The list may also contain
a *, which means: try all remaining backends.
a *, which means: try all remaining backends. The special value "help" can
be used to make GDK print out a list of all available backends.
For more information about selecting backends, see the gdk_display_manager_get() function.
</para>
</formalpara>

View File

@ -441,6 +441,15 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
backend_list = g_getenv ("GDK_BACKEND");
if (backend_list == NULL)
backend_list = allowed_backends;
else if (g_strcmp0 (backend_list, "help") == 0)
{
fprintf (stderr, "Supported GDK backends:");
for (i = 0; gdk_backends[i].name != NULL; i++)
fprintf (stderr, " %s", gdk_backends[i].name);
fprintf (stderr, "\n");
backend_list = allowed_backends;
}
backends = g_strsplit (backend_list, ",", 0);
display = NULL;