summaryrefslogtreecommitdiff
path: root/gsk/gskrenderer.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-11-29 13:36:31 +0100
committerBenjamin Otte <otte@redhat.com>2016-12-05 15:02:47 +0100
commitda8d886b173df9a00e4ddb978abe2655cac85e76 (patch)
treea1d3994d48aa05f210d28286e9931ebf98814ec3 /gsk/gskrenderer.c
parent725a7236c039c7e26e349c7ee5025eec03fe3e12 (diff)
downloadgtk+-da8d886b173df9a00e4ddb978abe2655cac85e76.tar.gz
gsk: Change GSK_USE_SOFTWARE env var to GSK_RENDERER
This way, we can use the variable as more than a boolean flag. This will be useful for Vulkan or D3D renderers.
Diffstat (limited to 'gsk/gskrenderer.c')
-rw-r--r--gsk/gskrenderer.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c
index 173756ff6d..d6d8b2d9fd 100644
--- a/gsk/gskrenderer.c
+++ b/gsk/gskrenderer.c
@@ -698,19 +698,23 @@ gsk_renderer_get_profiler (GskRenderer *renderer)
static GType
get_renderer_for_env_var (GdkWindow *window)
{
- static const char *use_software;
+ static GType env_var_type = G_TYPE_NONE;
- if (use_software == NULL)
+ if (env_var_type == G_TYPE_NONE)
{
- use_software = g_getenv ("GSK_USE_SOFTWARE");
- if (use_software == NULL)
- use_software = "0";
+ const char *renderer_name = g_getenv ("GSK_RENDERER");
+
+ if (renderer_name == NULL)
+ env_var_type = G_TYPE_INVALID;
+ else if (g_ascii_strcasecmp (renderer_name, "cairo") == 0)
+ env_var_type = GSK_TYPE_CAIRO_RENDERER;
+ else if (g_ascii_strcasecmp (renderer_name, "opengl") == 0)
+ env_var_type = GSK_TYPE_GL_RENDERER;
+ else
+ env_var_type = G_TYPE_INVALID;
}
- if (use_software[0] != '0')
- return GSK_TYPE_CAIRO_RENDERER;
-
- return G_TYPE_INVALID;
+ return env_var_type;
}
static GType