[Cogl] [PATCH] Add cogl_sdl_onscreen_get_window()
Robert Bragg
robert at sixbynine.org
Mon Nov 26 09:26:48 PST 2012
This looks good to land to me:
Reviewed-by: Robert Bragg <robert at linux.intel.com>
thanks,
- Robert
On Mon, Nov 26, 2012 at 3:15 PM, Neil Roberts <neil at linux.intel.com> wrote:
> This adds a function to get a pointer to the SDL_Window associated
> with a CoglOnscreen when using the SDL2 winsys.
> ---
> cogl/cogl-sdl.h | 17 +++++++++++++++++
> cogl/winsys/cogl-winsys-sdl2.c | 16 ++++++++++++++++
> doc/reference/cogl2/cogl2-sections.txt | 1 +
> 3 files changed, 34 insertions(+)
>
> diff --git a/cogl/cogl-sdl.h b/cogl/cogl-sdl.h
> index 05da036..0508649 100644
> --- a/cogl/cogl-sdl.h
> +++ b/cogl/cogl-sdl.h
> @@ -29,6 +29,7 @@
> #define __COGL_SDL_H__
>
> #include <cogl/cogl-context.h>
> +#include <cogl/cogl-onscreen.h>
> #include <SDL.h>
>
> #ifdef _MSC_VER
> @@ -202,6 +203,22 @@ cogl_sdl_handle_event (CoglContext *context,
> SDL_Event *event);
> void
> cogl_sdl_idle (CoglContext *context);
>
> +#if SDL_MAJOR_VERSION >= 2
> +
> +/**
> + * cogl_sdl_onscreen_get_window:
> + * @onscreen: A #CoglOnscreen
> + *
> + * Returns the underlying SDL_Window associated with an onscreen
> framebuffer.
> + *
> + * Since: 2.0
> + * Stability: unstable
> + */
> +SDL_Window *
> +cogl_sdl_onscreen_get_window (CoglOnscreen *onscreen);
> +
> +#endif /* SDL_MAJOR_VERSION */
> +
> G_END_DECLS
>
> #endif /* __COGL_SDL_H__ */
> diff --git a/cogl/winsys/cogl-winsys-sdl2.c
> b/cogl/winsys/cogl-winsys-sdl2.c
> index 1c0fc31..8c0c256 100644
> --- a/cogl/winsys/cogl-winsys-sdl2.c
> +++ b/cogl/winsys/cogl-winsys-sdl2.c
> @@ -38,6 +38,7 @@
> #include "cogl-onscreen-private.h"
> #include "cogl-winsys-sdl-private.h"
> #include "cogl-error-private.h"
> +#include "cogl-sdl.h"
>
> typedef struct _CoglContextSdl2
> {
> @@ -510,6 +511,21 @@ _cogl_winsys_poll_dispatch (CoglContext *context,
> }
> }
>
> +SDL_Window *
> +cogl_sdl_onscreen_get_window (CoglOnscreen *onscreen)
> +{
> + CoglOnscreenSdl2 *sdl_onscreen;
> +
> + _COGL_RETURN_VAL_IF_FAIL (cogl_is_onscreen (onscreen), NULL);
> +
> + if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), NULL))
> + return NULL;
> +
> + sdl_onscreen = onscreen->winsys;
> +
> + return sdl_onscreen->window;
> +}
> +
> const CoglWinsysVtable *
> _cogl_winsys_sdl_get_vtable (void)
> {
> diff --git a/doc/reference/cogl2/cogl2-sections.txt
> b/doc/reference/cogl2/cogl2-sections.txt
> index 004c0c0..5d58d10 100644
> --- a/doc/reference/cogl2/cogl2-sections.txt
> +++ b/doc/reference/cogl2/cogl2-sections.txt
> @@ -758,4 +758,5 @@ cogl_sdl_renderer_set_event_type
> cogl_sdl_renderer_get_event_type
> cogl_sdl_handle_event
> cogl_sdl_idle
> +cogl_sdl_onscreen_get_window
> </SECTION>
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/cogl/attachments/20121126/cc3b6a58/attachment.html>
More information about the Cogl
mailing list