x11: Replace all internal usage of cogl_xlib_get_display()

And use the renderer replacement, cogl_xlib_renderer_get_display()

(cherry picked from commit ea355792e88b09b0b0afa6fb5c5acc311d41688e)
This commit is contained in:
Damien Lespiau 2012-11-05 13:45:40 +00:00 committed by Robert Bragg
parent 6bcfc8342a
commit 5d796f0a4c
2 changed files with 19 additions and 9 deletions

View File

@ -86,13 +86,13 @@ void
_cogl_xlib_query_damage_extension (void) _cogl_xlib_query_damage_extension (void)
{ {
int damage_error; int damage_error;
Display *display;
_COGL_GET_CONTEXT (ctxt, NO_RETVAL); _COGL_GET_CONTEXT (ctxt, NO_RETVAL);
/* Check whether damage events are supported on this display */ /* Check whether damage events are supported on this display */
if (!XDamageQueryExtension (cogl_xlib_get_display (), display = cogl_xlib_renderer_get_display (ctxt->display->renderer);
&ctxt->damage_base, if (!XDamageQueryExtension (display, &ctxt->damage_base, &damage_error))
&damage_error))
ctxt->damage_base = -1; ctxt->damage_base = -1;
} }

View File

@ -132,7 +132,7 @@ process_damage_event (CoglTexturePixmapX11 *tex_pixmap,
_COGL_GET_CONTEXT (ctxt, NO_RETVAL); _COGL_GET_CONTEXT (ctxt, NO_RETVAL);
display = cogl_xlib_get_display (); display = cogl_xlib_renderer_get_display (ctxt->display->renderer);
COGL_NOTE (TEXTURE_PIXMAP, "Damage event received for %p", tex_pixmap); COGL_NOTE (TEXTURE_PIXMAP, "Damage event received for %p", tex_pixmap);
@ -250,6 +250,8 @@ set_damage_object_internal (CoglContext *ctx,
Damage damage, Damage damage,
CoglTexturePixmapX11ReportLevel report_level) CoglTexturePixmapX11ReportLevel report_level)
{ {
Display *display = cogl_xlib_renderer_get_display (ctx->display->renderer);
if (tex_pixmap->damage) if (tex_pixmap->damage)
{ {
cogl_xlib_renderer_remove_filter (ctx->display->renderer, cogl_xlib_renderer_remove_filter (ctx->display->renderer,
@ -258,7 +260,7 @@ set_damage_object_internal (CoglContext *ctx,
if (tex_pixmap->damage_owned) if (tex_pixmap->damage_owned)
{ {
XDamageDestroy (cogl_xlib_get_display (), tex_pixmap->damage); XDamageDestroy (display, tex_pixmap->damage);
tex_pixmap->damage_owned = FALSE; tex_pixmap->damage_owned = FALSE;
} }
} }
@ -279,7 +281,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctxt,
CoglError **error) CoglError **error)
{ {
CoglTexturePixmapX11 *tex_pixmap = g_new (CoglTexturePixmapX11, 1); CoglTexturePixmapX11 *tex_pixmap = g_new (CoglTexturePixmapX11, 1);
Display *display = cogl_xlib_get_display (); Display *display = cogl_xlib_renderer_get_display (ctxt->display->renderer);
Window pixmap_root_window; Window pixmap_root_window;
int pixmap_x, pixmap_y; int pixmap_x, pixmap_y;
unsigned int pixmap_border_width; unsigned int pixmap_border_width;
@ -368,7 +370,9 @@ try_alloc_shm (CoglTexturePixmapX11 *tex_pixmap)
XImage *dummy_image; XImage *dummy_image;
Display *display; Display *display;
display = cogl_xlib_get_display (); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
display = cogl_xlib_renderer_get_display (ctx->display->renderer);
if (!XShmQueryExtension (display)) if (!XShmQueryExtension (display))
return; return;
@ -486,7 +490,9 @@ _cogl_texture_pixmap_x11_update_image_texture (CoglTexturePixmapX11 *tex_pixmap)
int offset; int offset;
CoglError *ignore = NULL; CoglError *ignore = NULL;
display = cogl_xlib_get_display (); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
display = cogl_xlib_renderer_get_display (ctx->display->renderer);
visual = tex_pixmap->visual; visual = tex_pixmap->visual;
/* If the damage region is empty then there's nothing to do */ /* If the damage region is empty then there's nothing to do */
@ -971,8 +977,12 @@ _cogl_texture_pixmap_x11_get_type (CoglTexture *tex)
static void static void
_cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap) _cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap)
{ {
Display *display;
_COGL_GET_CONTEXT (ctxt, NO_RETVAL); _COGL_GET_CONTEXT (ctxt, NO_RETVAL);
display = cogl_xlib_renderer_get_display (ctxt->display->renderer);
set_damage_object_internal (ctxt, tex_pixmap, 0, 0); set_damage_object_internal (ctxt, tex_pixmap, 0, 0);
if (tex_pixmap->image) if (tex_pixmap->image)
@ -980,7 +990,7 @@ _cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap)
if (tex_pixmap->shm_info.shmid != -1) if (tex_pixmap->shm_info.shmid != -1)
{ {
XShmDetach (cogl_xlib_get_display (), &tex_pixmap->shm_info); XShmDetach (display, &tex_pixmap->shm_info);
shmdt (tex_pixmap->shm_info.shmaddr); shmdt (tex_pixmap->shm_info.shmaddr);
shmctl (tex_pixmap->shm_info.shmid, IPC_RMID, 0); shmctl (tex_pixmap->shm_info.shmid, IPC_RMID, 0);
} }