mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
winsys: Expose environment variable to choose winsys
This makes it possible to override the winsys that cogl uses by setting the COGL_RENDERER environment variable e.g. to "GLX" or "EGL"
This commit is contained in:
parent
75e6d734c1
commit
fd42800d00
@ -28,6 +28,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "cogl.h"
|
#include "cogl.h"
|
||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-object.h"
|
#include "cogl-object.h"
|
||||||
@ -168,6 +171,7 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
|
|||||||
{
|
{
|
||||||
#ifdef COGL_HAS_FULL_WINSYS
|
#ifdef COGL_HAS_FULL_WINSYS
|
||||||
int i;
|
int i;
|
||||||
|
char *renderer_name = getenv ("COGL_RENDERER");
|
||||||
#endif
|
#endif
|
||||||
GString *error_message;
|
GString *error_message;
|
||||||
|
|
||||||
@ -180,6 +184,10 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
|
|||||||
{
|
{
|
||||||
const CoglWinsysVtable *winsys = _cogl_winsys_vtable_getters[i]();
|
const CoglWinsysVtable *winsys = _cogl_winsys_vtable_getters[i]();
|
||||||
GError *tmp_error = NULL;
|
GError *tmp_error = NULL;
|
||||||
|
|
||||||
|
if (renderer_name && strcmp (winsys->name, renderer_name) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!winsys->renderer_connect (renderer, &tmp_error))
|
if (!winsys->renderer_connect (renderer, &tmp_error))
|
||||||
{
|
{
|
||||||
g_string_append_c (error_message, '\n');
|
g_string_append_c (error_message, '\n');
|
||||||
|
@ -1082,6 +1082,7 @@ _cogl_winsys_context_egl_get_egl_display (CoglContext *context)
|
|||||||
|
|
||||||
static CoglWinsysVtable _cogl_winsys_vtable =
|
static CoglWinsysVtable _cogl_winsys_vtable =
|
||||||
{
|
{
|
||||||
|
.name = "EGL",
|
||||||
.get_proc_address = _cogl_winsys_get_proc_address,
|
.get_proc_address = _cogl_winsys_get_proc_address,
|
||||||
.renderer_connect = _cogl_winsys_renderer_connect,
|
.renderer_connect = _cogl_winsys_renderer_connect,
|
||||||
.renderer_disconnect = _cogl_winsys_renderer_disconnect,
|
.renderer_disconnect = _cogl_winsys_renderer_disconnect,
|
||||||
|
@ -1880,6 +1880,7 @@ _cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
|
|||||||
|
|
||||||
static CoglWinsysVtable _cogl_winsys_vtable =
|
static CoglWinsysVtable _cogl_winsys_vtable =
|
||||||
{
|
{
|
||||||
|
.name = "GLX",
|
||||||
.get_proc_address = _cogl_winsys_get_proc_address,
|
.get_proc_address = _cogl_winsys_get_proc_address,
|
||||||
.renderer_connect = _cogl_winsys_renderer_connect,
|
.renderer_connect = _cogl_winsys_renderer_connect,
|
||||||
.renderer_disconnect = _cogl_winsys_renderer_disconnect,
|
.renderer_disconnect = _cogl_winsys_renderer_disconnect,
|
||||||
|
@ -54,6 +54,8 @@ typedef enum
|
|||||||
|
|
||||||
typedef struct _CoglWinsysVtable
|
typedef struct _CoglWinsysVtable
|
||||||
{
|
{
|
||||||
|
const char *name;
|
||||||
|
|
||||||
CoglFuncPtr
|
CoglFuncPtr
|
||||||
(*get_proc_address) (const char *name);
|
(*get_proc_address) (const char *name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user