changeset 17116:724353364790

Get rid of most #ifdefs
author reimar
date Tue, 06 Dec 2005 22:23:06 +0000
parents dbe315450a32
children 6e3602d994a6
files libvo/gl_common.c libvo/gl_common.h libvo/vo_gl.c libvo/vo_gl2.c
diffstat 4 files changed, 32 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.c	Tue Dec 06 22:15:03 2005 +0000
+++ b/libvo/gl_common.c	Tue Dec 06 22:23:06 2005 +0000
@@ -949,6 +949,7 @@
 }
 
 #ifdef GL_WIN32
+#include "w32_common.h"
 /**
  * \brief little helper since wglGetProcAddress definition does not fit our 
  *        getProcAddress
@@ -1023,10 +1024,15 @@
   }
   *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 @@
   }
   *context = 0;
 }
+
+void swapGlBuffers() {
+  glXSwapBuffers(mDisplay, vo_window);
+}
 #endif
 
--- a/libvo/gl_common.h	Tue Dec 06 22:15:03 2005 +0000
+++ b/libvo/gl_common.h	Tue Dec 06 22:23:06 2005 +0000
@@ -231,12 +231,21 @@
 /** \} */
 
 #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 *);
--- a/libvo/vo_gl.c	Tue Dec 06 22:15:03 2005 +0000
+++ b/libvo/vo_gl.c	Tue Dec 06 22:23:06 2005 +0000
@@ -312,11 +312,6 @@
 	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 @@
       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 @@
 
 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 @@
   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 @@
   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 @@
   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:
--- a/libvo/vo_gl2.c	Tue Dec 06 22:15:03 2005 +0000
+++ b/libvo/vo_gl2.c	Tue Dec 06 22:23:06 2005 +0000
@@ -905,24 +905,15 @@
 	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 @@
 	               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 @@
 //  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 @@
     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 @@
   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);