From 7f74712a79fba503e279b8c02e5efb5308ea6827 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 12 Dec 2011 13:46:45 +0000 Subject: [PATCH] Remove CoglXlibDisplay CoglXlibDisplay just contained one member called dummy_xwin. This was not shared outside of the respective winsys's so I don't think it really makes sense to have a separate shared struct for it. It seems more like an implementation detail that is specific to the winsys because for example it may be that the EGL winsys could use the surfaceless extension and not bother with a dummy window. This will also make it easier to factor out the Xlib-specific data in CoglDisplayEGL to the platform data. Reviewed-by: Robert Bragg --- cogl/Makefile.am | 1 - cogl/cogl-glx-display-private.h | 4 +-- cogl/cogl-xlib-display-private.h | 35 --------------------------- cogl/winsys/cogl-winsys-egl-private.h | 3 +-- cogl/winsys/cogl-winsys-egl.c | 13 ++++------ cogl/winsys/cogl-winsys-glx.c | 18 ++++++-------- 6 files changed, 14 insertions(+), 60 deletions(-) delete mode 100644 cogl/cogl-xlib-display-private.h diff --git a/cogl/Makefile.am b/cogl/Makefile.am index c0eac283f..7deea8252 100644 --- a/cogl/Makefile.am +++ b/cogl/Makefile.am @@ -351,7 +351,6 @@ cogl_sources_c += \ $(srcdir)/cogl-x11-renderer-private.h \ $(srcdir)/cogl-xlib-renderer-private.h \ $(srcdir)/cogl-xlib-renderer.c \ - $(srcdir)/cogl-xlib-display-private.h \ $(srcdir)/cogl-xlib.c \ $(srcdir)/cogl-xlib-private.h \ $(srcdir)/winsys/cogl-texture-pixmap-x11.c \ diff --git a/cogl/cogl-glx-display-private.h b/cogl/cogl-glx-display-private.h index f42284210..d30236997 100644 --- a/cogl/cogl-glx-display-private.h +++ b/cogl/cogl-glx-display-private.h @@ -26,7 +26,6 @@ #define __COGL_DISPLAY_GLX_PRIVATE_H #include "cogl-object-private.h" -#include "cogl-xlib-display-private.h" typedef struct _CoglGLXCachedConfig { @@ -41,8 +40,6 @@ typedef struct _CoglGLXCachedConfig typedef struct _CoglGLXDisplay { - CoglXlibDisplay _parent; - CoglGLXCachedConfig glx_cached_configs[COGL_GLX_N_CACHED_CONFIGS]; gboolean found_fbconfig; @@ -52,6 +49,7 @@ typedef struct _CoglGLXDisplay /* Single context for all wins */ GLXContext glx_context; GLXWindow dummy_glxwin; + Window dummy_xwin; } CoglGLXDisplay; #endif /* __COGL_DISPLAY_GLX_PRIVATE_H */ diff --git a/cogl/cogl-xlib-display-private.h b/cogl/cogl-xlib-display-private.h deleted file mode 100644 index 80c30f2fd..000000000 --- a/cogl/cogl-xlib-display-private.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Cogl - * - * An object oriented GL/GLES Abstraction/Utility Layer - * - * Copyright (C) 2011 Intel Corporation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * . - * - * - */ - -#ifndef __COGL_DISPLAY_XLIB_PRIVATE_H -#define __COGL_DISPLAY_XLIB_PRIVATE_H - -#include - -typedef struct _CoglXlibDisplay -{ - Window dummy_xwin; -} CoglXlibDisplay; - -#endif /* __COGL_DISPLAY_XLIB_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-egl-private.h b/cogl/winsys/cogl-winsys-egl-private.h index cd0896f2c..9d51d125a 100644 --- a/cogl/winsys/cogl-winsys-egl-private.h +++ b/cogl/winsys/cogl-winsys-egl-private.h @@ -30,7 +30,6 @@ #include "cogl-context-private.h" #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT #include "cogl-xlib-renderer-private.h" -#include "cogl-xlib-display-private.h" #endif #ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT #include @@ -106,7 +105,7 @@ typedef struct _CoglRendererEGL typedef struct _CoglDisplayEGL { #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT - CoglXlibDisplay _parent; + Window dummy_xwin; #endif EGLContext egl_context; diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c index f3141c94d..4ae45871b 100644 --- a/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/winsys/cogl-winsys-egl.c @@ -42,7 +42,6 @@ #include "cogl-onscreen-template-private.h" #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT #include "cogl-xlib-renderer-private.h" -#include "cogl-xlib-display-private.h" #include "cogl-xlib-renderer.h" #endif @@ -571,7 +570,6 @@ try_create_context (CoglDisplay *display, CoglRenderer *renderer = display->renderer; CoglDisplayEGL *egl_display = display->winsys; #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT - CoglXlibDisplay *xlib_display = display->winsys; CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer); #endif @@ -659,7 +657,7 @@ try_create_context (CoglDisplay *display, AllocNone); attrs.border_pixel = 0; - xlib_display->dummy_xwin = + egl_display->dummy_xwin = XCreateWindow (xlib_renderer->xdpy, DefaultRootWindow (xlib_renderer->xdpy), -100, -100, 1, 1, @@ -677,7 +675,7 @@ try_create_context (CoglDisplay *display, egl_display->dummy_surface = eglCreateWindowSurface (edpy, egl_display->egl_config, - (NativeWindowType) xlib_display->dummy_xwin, + (NativeWindowType) egl_display->dummy_xwin, NULL); if (egl_display->dummy_surface == EGL_NO_SURFACE) @@ -882,7 +880,6 @@ cleanup_context (CoglDisplay *display) CoglDisplayEGL *egl_display = display->winsys; CoglRendererEGL *egl_renderer = renderer->winsys; #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT - CoglXlibDisplay *xlib_display = display->winsys; CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer); #endif @@ -924,10 +921,10 @@ cleanup_context (CoglDisplay *display) egl_display->dummy_surface = EGL_NO_SURFACE; } - if (xlib_display->dummy_xwin) + if (egl_display->dummy_xwin) { - XDestroyWindow (xlib_renderer->xdpy, xlib_display->dummy_xwin); - xlib_display->dummy_xwin = None; + XDestroyWindow (xlib_renderer->xdpy, egl_display->dummy_xwin); + egl_display->dummy_xwin = None; } break; #endif diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c index e1dbdbe1f..107829f99 100644 --- a/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/winsys/cogl-winsys-glx.c @@ -39,7 +39,6 @@ #include "cogl-renderer-private.h" #include "cogl-glx-renderer-private.h" #include "cogl-onscreen-template-private.h" -#include "cogl-xlib-display-private.h" #include "cogl-glx-display-private.h" #include "cogl-private.h" #include "cogl-texture-2d-private.h" @@ -583,7 +582,6 @@ static gboolean create_context (CoglDisplay *display, GError **error) { CoglGLXDisplay *glx_display = display->winsys; - CoglXlibDisplay *xlib_display = display->winsys; CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (display->renderer); CoglGLXRenderer *glx_renderer = display->renderer->winsys; @@ -661,7 +659,7 @@ create_context (CoglDisplay *display, GError **error) AllocNone); attrs.border_pixel = 0; - xlib_display->dummy_xwin = + glx_display->dummy_xwin = XCreateWindow (xlib_renderer->xdpy, DefaultRootWindow (xlib_renderer->xdpy), -100, -100, 1, 1, @@ -680,14 +678,14 @@ create_context (CoglDisplay *display, GError **error) glx_display->dummy_glxwin = glx_renderer->glXCreateWindow (xlib_renderer->xdpy, config, - xlib_display->dummy_xwin, + glx_display->dummy_xwin, NULL); } if (glx_display->dummy_glxwin) dummy_drawable = glx_display->dummy_glxwin; else - dummy_drawable = xlib_display->dummy_xwin; + dummy_drawable = glx_display->dummy_xwin; COGL_NOTE (WINSYS, "Selecting dummy 0x%x for the GLX context", (unsigned int) dummy_drawable); @@ -714,7 +712,6 @@ static void _cogl_winsys_display_destroy (CoglDisplay *display) { CoglGLXDisplay *glx_display = display->winsys; - CoglXlibDisplay *xlib_display = display->winsys; CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (display->renderer); CoglGLXRenderer *glx_renderer = display->renderer->winsys; @@ -737,10 +734,10 @@ _cogl_winsys_display_destroy (CoglDisplay *display) glx_display->dummy_glxwin = None; } - if (xlib_display->dummy_xwin) + if (glx_display->dummy_xwin) { - XDestroyWindow (xlib_renderer->xdpy, xlib_display->dummy_xwin); - xlib_display->dummy_xwin = None; + XDestroyWindow (xlib_renderer->xdpy, glx_display->dummy_xwin); + glx_display->dummy_xwin = None; } g_slice_free (CoglGLXDisplay, display->winsys); @@ -1028,7 +1025,6 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) { CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; CoglContextGLX *glx_context = context->winsys; - CoglXlibDisplay *xlib_display = context->display->winsys; CoglGLXDisplay *glx_display = context->display->winsys; CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (context->display->renderer); @@ -1042,7 +1038,7 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) { drawable = glx_display->dummy_glxwin ? - glx_display->dummy_glxwin : xlib_display->dummy_xwin; + glx_display->dummy_glxwin : glx_display->dummy_xwin; if (glx_context->current_drawable == drawable) return;