comparison libvo/gl_common.c @ 31032:362425fe3de8

Add sdl_common file and use it to share the input handling between -vo gl with SDL backend and -vo sdl.
author reimar
date Sun, 25 Apr 2010 08:17:23 +0000
parents d94eeec25c47
children 8d1080e9c92d
comparison
equal deleted inserted replaced
31031:d94eeec25c47 31032:362425fe3de8
1842 return vo_x11_check_events(mDisplay); 1842 return vo_x11_check_events(mDisplay);
1843 } 1843 }
1844 #endif 1844 #endif
1845 1845
1846 #ifdef CONFIG_GL_SDL 1846 #ifdef CONFIG_GL_SDL
1847 #ifdef CONFIG_SDL_SDL_H 1847 #include "sdl_common.h"
1848 #include <SDL/SDL.h>
1849 #else
1850 #include <SDL.h>
1851 #endif
1852 1848
1853 static void swapGlBuffers_sdl(MPGLContext *ctx) { 1849 static void swapGlBuffers_sdl(MPGLContext *ctx) {
1854 SDL_GL_SwapBuffers(); 1850 SDL_GL_SwapBuffers();
1855 } 1851 }
1856 1852
1861 static int setGlWindow_sdl(MPGLContext *ctx) { 1857 static int setGlWindow_sdl(MPGLContext *ctx) {
1862 SDL_GL_LoadLibrary(NULL); 1858 SDL_GL_LoadLibrary(NULL);
1863 getFunctions(sdlgpa, NULL); 1859 getFunctions(sdlgpa, NULL);
1864 return SET_WINDOW_OK; 1860 return SET_WINDOW_OK;
1865 } 1861 }
1862
1863 static int sdl_check_events(void) {
1864 int res = 0;
1865 SDL_Event event;
1866 while (SDL_PollEvent(&event)) {
1867 res |= sdl_default_handle_event(&event);
1868 }
1869 return res;
1870 }
1871
1866 #endif 1872 #endif
1867 1873
1868 static int setGlWindow_dummy(MPGLContext *ctx) { 1874 static int setGlWindow_dummy(MPGLContext *ctx) {
1869 getFunctions(NULL, NULL); 1875 getFunctions(NULL, NULL);
1870 return SET_WINDOW_OK; 1876 return SET_WINDOW_OK;
1911 #ifdef CONFIG_GL_SDL 1917 #ifdef CONFIG_GL_SDL
1912 case GLTYPE_SDL: 1918 case GLTYPE_SDL:
1913 SDL_Init(SDL_INIT_VIDEO); 1919 SDL_Init(SDL_INIT_VIDEO);
1914 ctx->setGlWindow = setGlWindow_sdl; 1920 ctx->setGlWindow = setGlWindow_sdl;
1915 ctx->swapGlBuffers = swapGlBuffers_sdl; 1921 ctx->swapGlBuffers = swapGlBuffers_sdl;
1922 ctx->check_events = sdl_check_events;
1916 return 1; 1923 return 1;
1917 #endif 1924 #endif
1918 default: 1925 default:
1919 return 0; 1926 return 0;
1920 } 1927 }