0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

Get rid of most #ifdefs

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17117 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2005-12-06 22:23:06 +00:00
parent 33d32ef193
commit 6b9f08f720
4 changed files with 32 additions and 65 deletions

View File

@ -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

View File

@ -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 *);

View File

@ -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:

View File

@ -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);