summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-12-06 22:23:06 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-12-06 22:23:06 +0000
commit6b9f08f720b23739e0ff7c9e3dbdf1f97e7867dd (patch)
treebf40d4cb0ede4c06bf4ece4a38c2f9bfa4b7b5db /libvo
parent33d32ef1933c5b71618db26a1e202a902d7f80e2 (diff)
downloadmpv-6b9f08f720b23739e0ff7c9e3dbdf1f97e7867dd.tar.bz2
mpv-6b9f08f720b23739e0ff7c9e3dbdf1f97e7867dd.tar.xz
Get rid of most #ifdefs
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17117 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/gl_common.c10
-rw-r--r--libvo/gl_common.h9
-rw-r--r--libvo/vo_gl.c36
-rw-r--r--libvo/vo_gl2.c42
4 files changed, 32 insertions, 65 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 0681a99a82..a885159abd 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -949,6 +949,7 @@ void glDrawTex(GLfloat x, GLfloat y, GLfloat w, GLfloat h,
}
#ifdef GL_WIN32
+#include "w32_common.h"
/**
* \brief little helper since wglGetProcAddress definition does not fit our
* getProcAddress
@@ -1023,10 +1024,15 @@ void releaseGlContext(int *vinfo, HGLRC *context) {
}
*context = 0;
}
+
+void swapGlBuffers() {
+ SwapBuffers(vo_hdc);
+}
#else
#ifdef HAVE_LIBDL
#include <dlfcn.h>
#endif
+#include "x11_common.h"
/**
* \brief find address of a linked function
* \param s name of function to find
@@ -1159,5 +1165,9 @@ void releaseGlContext(XVisualInfo **vinfo, GLXContext *context) {
}
*context = 0;
}
+
+void swapGlBuffers() {
+ glXSwapBuffers(mDisplay, vo_window);
+}
#endif
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index ca8399c5fa..29564f6a3d 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -231,12 +231,21 @@ void inline glDisableYUVConversion(GLenum target, int type);
/** \} */
#ifdef GL_WIN32
+#define vo_check_events() vo_w32_check_events()
+#define vo_fullscreen() vo_w32_fullscreen()
+#define vo_ontop() vo_w32_ontop()
+#define vo_uninit() vo_w32_uninit()
int setGlWindow(int *vinfo, HGLRC *context, HWND win);
void releaseGlContext(int *vinfo, HGLRC *context);
#else
+#define vo_check_events() vo_x11_check_events(mDisplay)
+#define vo_fullscreen() vo_x11_fullscreen()
+#define vo_ontop() vo_x11_ontop()
+#define vo_uninit() vo_x11_uninit()
int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win);
void releaseGlContext(XVisualInfo **vinfo, GLXContext *context);
#endif
+void swapGlBuffers();
extern void (APIENTRY *GenBuffers)(GLsizei, GLuint *);
extern void (APIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 40a03db53a..3264caa8cc 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -312,11 +312,6 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
vo_dy = (vo_screenheight - d_height) / 2;
geometry(&vo_dx, &vo_dy, &d_width, &d_height,
vo_screenwidth, vo_screenheight);
-#ifdef X11_FULLSCREEN
-// if( flags&VOFLAG_FULLSCREEN ){ // (-fs)
-// aspect(&d_width,&d_height,A_ZOOM);
-// }
-#endif
#ifdef HAVE_NEW_GUI
if (use_gui) {
// GUI creates and manages window for us
@@ -379,7 +374,6 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
vo_x11_classhint( mDisplay,vo_window,"gl" );
vo_hidecursor(mDisplay,vo_window);
-// if ( flags&VOFLAG_FULLSCREEN ) vo_x11_decoration( mDisplay,vo_window,0 );
XSelectInput(mDisplay, vo_window, StructureNotifyMask);
/* Tell other applications about this window */
XSetStandardProperties(mDisplay, vo_window, title, title, None, NULL, 0, &hint);
@@ -422,11 +416,7 @@ glconfig:
static void check_events(void)
{
-#ifdef GL_WIN32
- int e=vo_w32_check_events();
-#else
- int e=vo_x11_check_events(mDisplay);
-#endif
+ int e=vo_check_events();
if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight);
if(e&VO_EVENT_EXPOSE && int_pause) flip_page();
}
@@ -544,11 +534,7 @@ flip_page(void)
if (use_glFinish)
glFinish();
if (vo_doublebuffering)
-#ifdef GL_WIN32
- SwapBuffers(vo_hdc);
-#else
- glXSwapBuffers( mDisplay,vo_window );
-#endif
+ swapGlBuffers();
if (vo_fs && use_aspect && vo_doublebuffering)
glClear(GL_COLOR_BUFFER_BIT);
@@ -677,11 +663,7 @@ uninit(void)
custom_prog = NULL;
if (custom_tex) free(custom_tex);
custom_tex = NULL;
-#ifdef GL_WIN32
- vo_w32_uninit();
-#else
- vo_x11_uninit();
-#endif
+ vo_uninit();
}
static opt_t subopts[] = {
@@ -784,19 +766,11 @@ static int control(uint32_t request, void *data, ...)
case VOCTRL_GUISUPPORT:
return VO_TRUE;
case VOCTRL_ONTOP:
-#ifdef GL_WIN32
- vo_w32_ontop();
-#else
- vo_x11_ontop();
-#endif
+ vo_ontop();
return VO_TRUE;
case VOCTRL_FULLSCREEN:
-#ifdef GL_WIN32
- vo_w32_fullscreen();
+ vo_fullscreen();
resize(vo_dwidth, vo_dheight);
-#else
- vo_x11_fullscreen();
-#endif
return VO_TRUE;
#ifdef GL_WIN32
case VOCTRL_BORDER:
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index 4bac77ff76..102becc81f 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -905,24 +905,15 @@ static int gl_handlekey(int key)
return 1;
}
-#ifdef GL_WIN32
-
-static void check_events(void) {
- int e=vo_w32_check_events();
- if(e&VO_EVENT_RESIZE) resize(&vo_dwidth, &vo_dheight);
- if(e&VO_EVENT_EXPOSE && int_pause) flip_page();
-}
-
-#else
-
static void check_events(void)
{
+ int e;
+#ifndef GL_WIN32
XEvent Event;
char buf[100];
KeySym keySym;
int key;
static XComposeStatus stat;
- int e;
while ( XPending( mDisplay ) )
{
@@ -941,13 +932,12 @@ static void check_events(void)
break;
}
}
- e=vo_x11_check_events(mDisplay);
+#endif
+ e=vo_check_events();
if(e&VO_EVENT_RESIZE) resize(&vo_dwidth, &vo_dheight);
if(e&VO_EVENT_EXPOSE && int_pause) flip_page();
}
-#endif
-
static void draw_osd(void)
{
if (ImageData)
@@ -963,11 +953,7 @@ flip_page(void)
// glFlush();
if (use_glFinish)
glFinish();
-#ifdef GL_WIN32
- SwapBuffers(vo_hdc);
-#else
- glXSwapBuffers( mDisplay,vo_window );
-#endif
+ swapGlBuffers();
if (vo_fs) // Avoid flickering borders in fullscreen mode
glClear (GL_COLOR_BUFFER_BIT);
@@ -1070,11 +1056,7 @@ uninit(void)
free(texgrid);
texgrid = NULL;
}
-#ifdef GL_WIN32
- vo_w32_uninit();
-#else
- vo_x11_uninit();
-#endif
+ vo_uninit();
}
static opt_t subopts[] = {
@@ -1119,18 +1101,10 @@ static int control(uint32_t request, void *data, ...)
case VOCTRL_GUISUPPORT:
return VO_TRUE;
case VOCTRL_ONTOP:
-#ifdef GL_WIN32
- vo_w32_ontop();
-#else
- vo_x11_ontop();
-#endif
+ vo_ontop();
return VO_TRUE;
case VOCTRL_FULLSCREEN:
-#ifdef GL_WIN32
- vo_w32_fullscreen();
-#else
- vo_x11_fullscreen();
-#endif
+ vo_fullscreen();
if (setGlWindow(&gl_vinfo, &gl_context, vo_window) == SET_WINDOW_REINIT)
initGl(vo_dwidth, vo_dheight);
resize(&vo_dwidth, &vo_dheight);