[eglx] Update the EGLX backend

The EGLX backend needs to be updated to the new ClutterBackendX11
code.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
zhou jiangwei 2009-08-11 14:18:37 +01:00 committed by Emmanuele Bassi
parent 2ab9bef587
commit 13e055a351
3 changed files with 46 additions and 2 deletions

View File

@ -262,11 +262,53 @@ clutter_backend_egl_create_stage (ClutterBackend *backend,
return stage;
}
static XVisualInfo *
clutter_backend_egl_get_visual_info (ClutterBackendX11 *backend_x11,
gboolean for_offscreen)
{
EGLint visualId;
int i,nxvisuals;
XVisualInfo *visual_list, *visinfo = None;
XVisualInfo visual_template;
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend_x11);
/* Find all the visuals in the screen */
nxvisuals = 0;
visual_template.screen = backend_x11->xscreen_num;
visual_list = XGetVisualInfo (backend_x11->xdpy, VisualScreenMask,
&visual_template,
&nxvisuals);
if (!visual_list)
return None;
/*get xvisual id*/
eglGetConfigAttrib (backend_egl->edpy, backend_egl->egl_config,
EGL_NATIVE_VISUAL_ID, &visualId);
/* look up the xvisual matching with egl native visual id*/
for( i = 0; i < nxvisuals; i++)
{
if (visual_list[i].visualid == visualId)
break;
}
if (i < nxvisuals)
{
visinfo = (XVisualInfo*) Xalloc (sizeof (XVisualInfo));
*visinfo = visual_list[i];
}
XFree (visual_list);
return visinfo;
}
static void
clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass);
ClutterBackendX11Class *backendx11_class = CLUTTER_BACKEND_X11_CLASS (klass);
gobject_class->constructor = clutter_backend_egl_constructor;
gobject_class->dispose = clutter_backend_egl_dispose;
@ -277,6 +319,7 @@ clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
backend_class->get_features = clutter_backend_egl_get_features;
backend_class->create_stage = clutter_backend_egl_create_stage;
backend_class->ensure_context = clutter_backend_egl_ensure_context;
backendx11_class->get_visual_info = clutter_backend_egl_get_visual_info;
}
static void

View File

@ -53,6 +53,7 @@ struct _ClutterBackendEGL
EGLDisplay edpy;
EGLSurface egl_surface;
EGLContext egl_context;
EGLConfig egl_config;
gint egl_version_major;
gint egl_version_minor;

View File

@ -101,7 +101,7 @@ clutter_stage_egl_realize (ClutterActor *actor)
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_STENCIL_SIZE, 8,
#ifdef HAVE_COGL_GLES2
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
#else /* HAVE_COGL_GLES2 */
@ -248,7 +248,7 @@ clutter_stage_egl_realize (ClutterActor *actor)
g_critical ("Unable to create a suitable EGL context");
goto fail;
}
backend_egl->egl_config = configs[0];
CLUTTER_NOTE (GL, "Created EGL Context");
}
}