Added QNX cleanups by Mike Gorchak (thanks!)
authorSam Lantinga <slouken@libsdl.org>
Fri, 18 Jan 2002 18:14:03 +0000
changeset 266c6abdda2f666
parent 265 35d9c8a5aa10
child 267 b0a5d198755b
Added QNX cleanups by Mike Gorchak (thanks!)
README.QNX
src/video/SDL_video.c
src/video/photon/SDL_ph_events.c
src/video/photon/SDL_ph_image.c
src/video/photon/SDL_ph_modes.c
src/video/photon/SDL_ph_modes_c.h
src/video/photon/SDL_ph_mouse.c
src/video/photon/SDL_ph_video.c
src/video/photon/SDL_ph_video.h
src/video/photon/SDL_ph_wm.c
test/testvidinfo.c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/README.QNX	Fri Jan 18 18:14:03 2002 +0000
     1.3 @@ -0,0 +1,19 @@
     1.4 +README by Mike Gorchak <mike@malva.com.ua>
     1.5 +
     1.6 +    Experimentally added OpenGL support in window mode (in fullscreen
     1.7 +mode not yet). If you have QNX RtP v6.1.0 w/ or w/o Patch A you  need
     1.8 +to download new Photon3D runtime from http://developers.qnx.com.  The
     1.9 +versions of OS before 6.1.0 is not supported. OpenGL support is  very
    1.10 +raw. It is often fail.
    1.11 +
    1.12 +Some building issues:
    1.13 +
    1.14 +    Run configure script without x11 support, e.g.:
    1.15 +
    1.16 +    ./configure --prefix=/usr/local --disable-video-x11
    1.17 +
    1.18 +    In test directory also run ./configure script without x11 support, e.g.:
    1.19 +
    1.20 +    ./configure  --with-sdl-prefix=/usr/local      \
    1.21 +                 --with-sdl-exec-prefix=/usr/local \
    1.22 +                 --prefix=/usr/local --without-x
     2.1 --- a/src/video/SDL_video.c	Fri Jan 18 17:14:16 2002 +0000
     2.2 +++ b/src/video/SDL_video.c	Fri Jan 18 18:14:03 2002 +0000
     2.3 @@ -1391,7 +1391,9 @@
     2.4  	SDL_VideoDevice *this = current_video;
     2.5  
     2.6  	if ( video->screen->flags & SDL_OPENGL ) {
     2.7 -		video->GL_SwapBuffers( this );
     2.8 +		video->GL_SwapBuffers(this);
     2.9 +	} else {
    2.10 +		SDL_SetError("OpenGL video mode has not been set");
    2.11  	}
    2.12  }
    2.13  
     3.1 --- a/src/video/photon/SDL_ph_events.c	Fri Jan 18 17:14:16 2002 +0000
     3.2 +++ b/src/video/photon/SDL_ph_events.c	Fri Jan 18 18:14:03 2002 +0000
     3.3 @@ -55,9 +55,10 @@
     3.4     (idea shamelessly lifted from GII -- thanks guys! :)
     3.5   */
     3.6  
     3.7 +/*
     3.8  static int ph_KeyRepeat(_THIS, PhKeyEvent_t* keyevent)
     3.9  {
    3.10 -	PhEvent_t* peekevent;
    3.11 +//	PhEvent_t* peekevent;
    3.12  	PhKeyEvent_t* keyEvent;
    3.13  	int repeated;
    3.14  
    3.15 @@ -84,11 +85,13 @@
    3.16  		}
    3.17  		break;
    3.18  
    3.19 -		default: /* no events pending */
    3.20 +		default: // no events pending
    3.21  	}
    3.22  	return(repeated);
    3.23  }
    3.24  
    3.25 +*/
    3.26 +
    3.27  /* Note:  The X server buffers and accumulates mouse motion events, so
    3.28     the motion event generated by the warp may not appear exactly as we
    3.29     expect it to.  We work around this (and improve performance) by only
    3.30 @@ -118,7 +121,7 @@
    3.31  	     (xevent->xmotion.x > (w-MOUSE_FUDGE_FACTOR)) ||
    3.32  	     (xevent->xmotion.y < MOUSE_FUDGE_FACTOR) ||
    3.33  	     (xevent->xmotion.y > (h-MOUSE_FUDGE_FACTOR)) ) {
    3.34 -		/* Get the events that have accumulated */
    3.35 +		// Get the events that have accumulated
    3.36  /*		while ( XCheckTypedEvent(SDL_Display, MotionNotify, xevent) ) {
    3.37  			deltax = xevent->xmotion.x - mouse_last.x;
    3.38  			deltay = xevent->xmotion.y - mouse_last.y;
    3.39 @@ -161,6 +164,7 @@
    3.40  
    3.41  /* Control which motion flags the window has set, a flags value of -1 sets
    3.42   * MOTION_BUTTON and MOTION_NOBUTTON */
    3.43 +
    3.44  static void set_motion_sensitivity(_THIS, unsigned int flags)
    3.45  {
    3.46  	int rid, fields = Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON;
     4.1 --- a/src/video/photon/SDL_ph_image.c	Fri Jan 18 17:14:16 2002 +0000
     4.2 +++ b/src/video/photon/SDL_ph_image.c	Fri Jan 18 18:14:03 2002 +0000
     4.3 @@ -129,24 +129,24 @@
     4.4  		break;
     4.5  	}
     4.6  
     4.7 -		OCImage.FrameData0 = (FRAMEDATA *) malloc((size_t)(sizeof( FRAMEDATA)));
     4.8 -		OCImage.FrameData1 = (FRAMEDATA *) malloc((size_t)(sizeof( FRAMEDATA)));
     4.9 +	OCImage.FrameData0 = (FRAMEDATA *) malloc((size_t)(sizeof( FRAMEDATA)));
    4.10 +	OCImage.FrameData1 = (FRAMEDATA *) malloc((size_t)(sizeof( FRAMEDATA)));
    4.11  
    4.12  	if(OCImage.direct_context == NULL)
    4.13 -	  OCImage.direct_context = PdCreateDirectContext();
    4.14 +	   OCImage.direct_context = PdCreateDirectContext();
    4.15  
    4.16 -	  OCImage.offscreen_context = PdCreateOffscreenContext(0,screen->w,screen->h, Pg_OSC_MEM_PAGE_ALIGN);	
    4.17 +	OCImage.offscreen_context = PdCreateOffscreenContext(0,screen->w,screen->h, Pg_OSC_MEM_PAGE_ALIGN);
    4.18  				
    4.19 -		if (OCImage.offscreen_context == NULL)
    4.20 -		{
    4.21 -			printf("PdCreateOffscreenContext  failed\n");
    4.22 -			return -1;
    4.23 -		}
    4.24 +	if (OCImage.offscreen_context == NULL)
    4.25 +	{
    4.26 +	   printf("PdCreateOffscreenContext  failed\n");
    4.27 +	   return -1;
    4.28 +	}
    4.29  
    4.30 -		OCImage.Stride = OCImage.offscreen_context->pitch;	
    4.31 +	OCImage.Stride = OCImage.offscreen_context->pitch;	
    4.32  
    4.33 -      if (OCImage.flags & SDL_DOUBLEBUF)
    4.34 -      			printf("hardware flag for doublebuf offscreen context\n");
    4.35 +        if (OCImage.flags & SDL_DOUBLEBUF)
    4.36 +      	   printf("hardware flag for doublebuf offscreen context\n");
    4.37  
    4.38  			
    4.39  			OCImage.dc_ptr.ptr8 = (unsigned char *) PdGetOffscreenContextPtr(OCImage.offscreen_context);
    4.40 @@ -175,21 +175,18 @@
    4.41  
    4.42  void ph_DestroyImage(_THIS, SDL_Surface *screen)
    4.43  {
    4.44 -
    4.45 -
    4.46     if(SDL_Image == NULL)
    4.47       return;
    4.48  
    4.49 -	 if (OCImage.offscreen_context != NULL)
    4.50 -	{
    4.51 -			
    4.52 -			PhDCRelease(OCImage.offscreen_context);
    4.53 -			OCImage.offscreen_context = NULL;
    4.54 -			free(OCImage.FrameData0);
    4.55 -			OCImage.FrameData0 = NULL;
    4.56 -			free(OCImage.FrameData1);
    4.57 -			OCImage.FrameData1 = NULL;
    4.58 -	}
    4.59 +   if (OCImage.offscreen_context != NULL)
    4.60 +   {
    4.61 +      PhDCRelease(OCImage.offscreen_context);
    4.62 +      OCImage.offscreen_context = NULL;
    4.63 +      free(OCImage.FrameData0);
    4.64 +      OCImage.FrameData0 = NULL;
    4.65 +      free(OCImage.FrameData1);
    4.66 +      OCImage.FrameData1 = NULL;
    4.67 +   }
    4.68  
    4.69  	if (SDL_Image->image)
    4.70  	{
    4.71 @@ -210,7 +207,6 @@
    4.72  
    4.73  int ph_ResizeImage(_THIS, SDL_Surface *screen, Uint32 flags)
    4.74  {
    4.75 -  
    4.76      ph_DestroyImage(this, screen);
    4.77      
    4.78      if(  flags & SDL_HWSURFACE)
    4.79 @@ -226,30 +222,25 @@
    4.80      {
    4.81          return ph_SetupImage(this, screen);
    4.82      }      
    4.83 -
    4.84  }
    4.85  
    4.86  int ph_AllocHWSurface(_THIS, SDL_Surface *surface)
    4.87  {
    4.88 -
    4.89          return(-1);
    4.90  }
    4.91  
    4.92  void ph_FreeHWSurface(_THIS, SDL_Surface *surface)
    4.93  {
    4.94 -
    4.95          return;
    4.96  }
    4.97  
    4.98  int ph_FlipHWSurface(_THIS, SDL_Surface *surface)
    4.99  {
   4.100 -
   4.101          return(0);
   4.102  }
   4.103  
   4.104  int ph_LockHWSurface(_THIS, SDL_Surface *surface)
   4.105  {
   4.106 -
   4.107          if ( (surface == SDL_VideoSurface) && blit_queued ) {
   4.108  //                XSync(GFX_Display, False);
   4.109  				PgFlush();
   4.110 @@ -260,7 +251,6 @@
   4.111  
   4.112  void ph_UnlockHWSurface(_THIS, SDL_Surface *surface)
   4.113  {
   4.114 -
   4.115          return;
   4.116  }
   4.117  
   4.118 @@ -290,7 +280,7 @@
   4.119  		}
   4.120  	}
   4.121      if (PgFlush() < 0)
   4.122 -	{
   4.123 +    {
   4.124      	fprintf(stderr,"error: PgFlush failed.\n");
   4.125      }
   4.126  }
   4.127 @@ -326,13 +316,13 @@
   4.128  		
   4.129  			zero.x = zero.y = 0;
   4.130  	   		PgSetTranslation (&zero, 0);
   4.131 -	       PgSetRegion(PtWidgetRid(window));
   4.132 +	                PgSetRegion(PtWidgetRid(window));
   4.133  			PgSetClipping(0,NULL);
   4.134   			PgContextBlitArea(OCImage.offscreen_context, (PhArea_t *)(&src_rect), NULL, (PhArea_t *)(&dest_rect));
   4.135   			
   4.136  	}
   4.137      if (PgFlush() < 0)
   4.138 -	{
   4.139 +    {
   4.140      	fprintf(stderr,"error: PgFlush failed.\n");
   4.141      }
   4.142      
     5.1 --- a/src/video/photon/SDL_ph_modes.c	Fri Jan 18 17:14:16 2002 +0000
     5.2 +++ b/src/video/photon/SDL_ph_modes.c	Fri Jan 18 18:14:03 2002 +0000
     5.3 @@ -25,16 +25,15 @@
     5.4   "@(#) $Id$";
     5.5  #endif
     5.6  
     5.7 -
     5.8  #include "SDL_ph_modes_c.h"
     5.9  
    5.10  static unsigned long key1, key2;
    5.11  static PgVideoModeInfo_t mode_info;
    5.12  static PgVideoModes_t mode_list;
    5.13 +
    5.14    /* The current list of available video modes */
    5.15 - SDL_Rect SDL_modelist[127];
    5.16 - SDL_Rect *SDLmod_ptr;
    5.17 - SDL_Rect **SDLmod_ptrptr ;
    5.18 +SDL_Rect  SDL_modelist[PH_MAX_VIDEOMODES];
    5.19 +SDL_Rect* SDL_modearray[PH_MAX_VIDEOMODES];
    5.20  
    5.21  static int compare_modes_by_res(const void* mode1, const void* mode2)
    5.22  {
    5.23 @@ -43,17 +42,17 @@
    5.24  	{
    5.25  	    fprintf(stderr,"error: In compare_modes_by_res PgGetVideoModeInfo failed on mode: 0x%x\n",
    5.26          	    *(unsigned short*)mode1);
    5.27 -    	return 0;
    5.28 +    	    return 0;
    5.29  	}
    5.30  	key1 = mode_info.width * mode_info.height;
    5.31  
    5.32  	if (PgGetVideoModeInfo(*(unsigned short*)mode2, &mode_info) < 0)
    5.33  	{
    5.34 -    	fprintf(stderr,"error: In compare_modes_by_res PgGetVideoModeInfo failed on mode: 0x%x\n",
    5.35 +    	    fprintf(stderr,"error: In compare_modes_by_res PgGetVideoModeInfo failed on mode: 0x%x\n",
    5.36  	            *(unsigned short*)mode2);
    5.37  	    return 0;
    5.38  	}
    5.39 -    key2 = mode_info.width * mode_info.height;
    5.40 +        key2 = mode_info.width * mode_info.height;
    5.41  
    5.42  	if (key1 > key2)
    5.43  		return 1;
    5.44 @@ -63,6 +62,7 @@
    5.45  		return -1;
    5.46  }
    5.47  
    5.48 +/*
    5.49  static int compare_modes_by_bpp(const void* mode1, const void* mode2)
    5.50  {
    5.51  
    5.52 @@ -89,7 +89,9 @@
    5.53      else
    5.54          return -1;
    5.55  }
    5.56 +*/
    5.57  
    5.58 +/*
    5.59  int ph_GetVideoModes(_THIS)
    5.60  {
    5.61  	unsigned short *front;
    5.62 @@ -149,19 +151,24 @@
    5.63  	
    5.64  	return 0;
    5.65  }
    5.66 +*/
    5.67  
    5.68 -static SDL_Rect** ph_SupportedVisual( SDL_PixelFormat *format)
    5.69 +SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
    5.70  {
    5.71  	int i = 0;
    5.72  	int j = 0;
    5.73 -	SDL_Rect Amodelist[127];
    5.74 +	SDL_Rect Amodelist[PH_MAX_VIDEOMODES];
    5.75  
    5.76 +        for (i=0; i<PH_MAX_VIDEOMODES; i++)
    5.77 +        {
    5.78 +           SDL_modearray[i]=&SDL_modelist[i];
    5.79 +        }
    5.80  
    5.81  	if (PgGetVideoModeList( &mode_list ) < 0)
    5.82 -    {
    5.83 -        fprintf(stderr,"error: PgGetVideoModeList failed\n");
    5.84 -        return NULL;
    5.85 -    }
    5.86 +	{
    5.87 +	   fprintf(stderr,"error: PgGetVideoModeList failed\n");
    5.88 +	   return NULL;
    5.89 +	}
    5.90  
    5.91  	mode_info.bits_per_pixel = 0;
    5.92  
    5.93 @@ -173,47 +180,34 @@
    5.94                          mode_list.modes[i]);
    5.95                  return NULL;
    5.96              }
    5.97 -            
    5.98 +
    5.99              if(mode_info.bits_per_pixel == format->BitsPerPixel)
   5.100              {
   5.101 -				Amodelist[j].w = mode_info.width;
   5.102 -				Amodelist[j].h = mode_info.height;
   5.103 -				Amodelist[j].x = 0;
   5.104 -				Amodelist[j].y = 0;
   5.105 -				j++;	
   5.106 -			}
   5.107 +		Amodelist[j].w = mode_info.width;
   5.108 +		Amodelist[j].h = mode_info.height;
   5.109 +		Amodelist[j].x = 0;
   5.110 +		Amodelist[j].y = 0;
   5.111 +		j++;	
   5.112 +            }
   5.113  	}
   5.114  	
   5.115 -	//reorder biggest for smallest , assume width dominates
   5.116 -	   for(i=0; i< j ; i++)
   5.117 -	   {
   5.118 -	     SDL_modelist[i].w = Amodelist[j - i -1].w;
   5.119 -	     SDL_modelist[i].h = Amodelist[j - i -1].h;
   5.120 -	     SDL_modelist[i].x = Amodelist[j - i -1].x;
   5.121 -	     SDL_modelist[i].y = Amodelist[j - i -1].y;
   5.122 -	   }
   5.123 +	//reorder biggest for smallest, assume width dominates
   5.124 +
   5.125 +	for(i=0; i< j ; i++)
   5.126 +	{
   5.127 +	    SDL_modelist[i].w = Amodelist[j - i -1].w;
   5.128 +	    SDL_modelist[i].h = Amodelist[j - i -1].h;
   5.129 +	    SDL_modelist[i].x = Amodelist[j - i -1].x;
   5.130 +	    SDL_modelist[i].y = Amodelist[j - i -1].y;
   5.131 +	}
   5.132 +        SDL_modearray[j]=NULL;
   5.133  	
   5.134 -	SDLmod_ptr = SDL_modelist;
   5.135 -	SDLmod_ptrptr = &SDLmod_ptr;
   5.136 -	return SDLmod_ptrptr;
   5.137 -}
   5.138 -
   5.139 -SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
   5.140 -{
   5.141 -    return ph_SupportedVisual( format);
   5.142 +	return SDL_modearray;
   5.143  }
   5.144  
   5.145  void ph_FreeVideoModes(_THIS)
   5.146  {
   5.147 -//    int i;
   5.148 -
   5.149 - //   if ( SDL_modelist ) {
   5.150 - //       for ( i=0; SDL_modelist[i]; ++i ) {
   5.151 - //           free(SDL_modelist[i]);
   5.152 - //       }
   5.153 - //       free(SDL_modelist);
   5.154 - //       SDL_modelist = NULL;
   5.155 -//    }
   5.156 +   return;
   5.157  }
   5.158  
   5.159  static void set_best_resolution(_THIS, int width, int height)
   5.160 @@ -287,6 +281,7 @@
   5.161      }
   5.162  }
   5.163  
   5.164 +/*
   5.165  static void get_real_resolution(_THIS, int* w, int* h)
   5.166  {
   5.167  
   5.168 @@ -294,13 +289,13 @@
   5.169          //PgDisplaySettings_t settings;
   5.170  	    PgVideoModeInfo_t		current_mode_info;
   5.171  	    	PgHWCaps_t my_hwcaps;
   5.172 -        int unused;
   5.173 -		/*
   5.174 -        if (PgGetVideoMode( &settings ) >= 0) {
   5.175 -			*w = settings.xres;
   5.176 -			*h = settings.yres;
   5.177 -            return;
   5.178 -        }*/
   5.179 +//        int unused;
   5.180 +		
   5.181 +//        if (PgGetVideoMode( &settings ) >= 0) {
   5.182 +//			*w = settings.xres;
   5.183 +//			*h = settings.yres;
   5.184 +//            return;
   5.185 +//        }
   5.186              if (PgGetGraphicsHWCaps(&my_hwcaps) >= 0)
   5.187           	{
   5.188                   if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &current_mode_info) < 0)
   5.189 @@ -314,6 +309,7 @@
   5.190  //    *w = DisplayWidth(SDL_Display, SDL_Screen);
   5.191  //    *h = DisplayHeight(SDL_Display, SDL_Screen);
   5.192  }
   5.193 +*/
   5.194  
   5.195  int ph_ResizeFullScreen(_THIS)
   5.196  {
   5.197 @@ -496,9 +492,9 @@
   5.198  			mymode_settings.refresh= (unsigned short) old_refresh_rate;
   5.199  			mymode_settings.flags = 0;
   5.200  			if(PgSetVideoMode(&mymode_settings) < 0)
   5.201 -			{
   5.202 -            fprintf(stderr,"error: PgSetVideoMode failed\n");
   5.203 -        	}
   5.204 +                        {
   5.205 +                           fprintf(stderr,"error: PgSetVideoMode failed\n");
   5.206 +        	        }
   5.207  		}
   5.208  	
   5.209  		old_video_mode=-1;
     6.1 --- a/src/video/photon/SDL_ph_modes_c.h	Fri Jan 18 17:14:16 2002 +0000
     6.2 +++ b/src/video/photon/SDL_ph_modes_c.h	Fri Jan 18 18:14:03 2002 +0000
     6.3 @@ -31,7 +31,9 @@
     6.4  
     6.5  #include "SDL_ph_video.h"
     6.6  
     6.7 -extern int ph_GetVideoModes(_THIS);
     6.8 +#define PH_MAX_VIDEOMODES 127
     6.9 +
    6.10 +//extern int ph_GetVideoModes(_THIS);
    6.11  extern SDL_Rect **ph_ListModes(_THIS,SDL_PixelFormat *format, Uint32 flags);
    6.12  extern void ph_FreeVideoModes(_THIS);
    6.13  extern int ph_ResizeFullScreen(_THIS);
     7.1 --- a/src/video/photon/SDL_ph_mouse.c	Fri Jan 18 17:14:16 2002 +0000
     7.2 +++ b/src/video/photon/SDL_ph_mouse.c	Fri Jan 18 18:14:03 2002 +0000
     7.3 @@ -85,22 +85,23 @@
     7.4  	cursor->ph_cursor->bytesperline1 = (char)w/8;
     7.5  	cursor->ph_cursor->color1 = Pg_WHITE;
     7.6  	cursor->ph_cursor->size2.x = (short)w;
     7.7 -    cursor->ph_cursor->size2.y = (short)h;
     7.8 -    cursor->ph_cursor->offset2.x = (short)hot_x;
     7.9 -    cursor->ph_cursor->offset2.y = (short)hot_y;
    7.10 -    cursor->ph_cursor->bytesperline2 = (char)w/8;
    7.11 -    cursor->ph_cursor->color2 = Pg_BLACK;
    7.12 +        cursor->ph_cursor->size2.y = (short)h;
    7.13 +        cursor->ph_cursor->offset2.x = (short)hot_x;
    7.14 +        cursor->ph_cursor->offset2.y = (short)hot_y;
    7.15 +        cursor->ph_cursor->bytesperline2 = (char)w/8;
    7.16 +        cursor->ph_cursor->color2 = Pg_BLACK;
    7.17        
    7.18  	clen = (w/8)*h;
    7.19  
    7.20  	/* Copy the mask and the data to different 
    7.21  	   bitmap planes */
    7.22 -	for ( i=0; i<clen; ++i ) {
    7.23 -        cursor->ph_cursor->images[i] = data[i];
    7.24 -        cursor->ph_cursor->images[i+clen] = mask[i];
    7.25 -    }
    7.26 +	for ( i=0; i<clen; ++i )
    7.27 +        {
    7.28 +           cursor->ph_cursor->images[i] = data[i];
    7.29 +           cursor->ph_cursor->images[i+clen] = mask[i];
    7.30 +        }
    7.31      
    7.32 -    //#bytes following the hdr struct
    7.33 +        //#bytes following the hdr struct
    7.34  	cursor->ph_cursor->hdr.len =sizeof(PhCursorDef_t) + clen*2 - sizeof(PhRegionDataHdr_t); 
    7.35  
    7.36  	return (cursor);
    7.37 @@ -109,7 +110,6 @@
    7.38  
    7.39  PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor)
    7.40  {
    7.41 -
    7.42  	return(*cursor->ph_cursor);
    7.43  }
    7.44  
    7.45 @@ -120,8 +120,6 @@
    7.46  	int nargs = 0;
    7.47  	short cursor_is_defined = 0;
    7.48  
    7.49 -
    7.50 -
    7.51  	/* Don't do anything if the display is gone */
    7.52   	if ( window == NULL ) {
    7.53      	 return(0);
    7.54 @@ -145,8 +143,8 @@
    7.55  			cursor_is_defined = 1;
    7.56  		}
    7.57  		if (cursor_is_defined)
    7.58 -		 {
    7.59 -    	    SDL_Lock_EventThread();
    7.60 +		{
    7.61 +    	                SDL_Lock_EventThread();
    7.62  			
    7.63  			if (PtSetResources( window, nargs, args ) < 0 )
    7.64  			{
    7.65 @@ -163,15 +161,13 @@
    7.66  
    7.67  void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
    7.68  {
    7.69 -
    7.70 -	SDL_Lock_EventThread();
    7.71 -	PhMoveCursorRel( PhInputGroup(NULL), x, y );	
    7.72 -	SDL_Unlock_EventThread();
    7.73 +   SDL_Lock_EventThread();
    7.74 +   PhMoveCursorRel( PhInputGroup(NULL), x, y );	
    7.75 +   SDL_Unlock_EventThread();
    7.76  }
    7.77  
    7.78  
    7.79  void ph_CheckMouseMode(_THIS)
    7.80  {
    7.81 -
    7.82 -	mouse_relative = 1;
    7.83 +   mouse_relative = 1;
    7.84  }
     8.1 --- a/src/video/photon/SDL_ph_video.c	Fri Jan 18 17:14:16 2002 +0000
     8.2 +++ b/src/video/photon/SDL_ph_video.c	Fri Jan 18 18:14:03 2002 +0000
     8.3 @@ -56,10 +56,12 @@
     8.4  static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
     8.5  static void ph_VideoQuit(_THIS);
     8.6  static void ph_DeleteDevice(SDL_VideoDevice *device);
     8.7 +static void ph_GL_SwapBuffers(_THIS);
     8.8 +
     8.9 +PdOpenGLContext_t* OGLContext=NULL;
    8.10  
    8.11  static int ph_Available(void)
    8.12  {
    8.13 -
    8.14          return 1;
    8.15  }
    8.16  
    8.17 @@ -86,7 +88,7 @@
    8.18      device->handles_any_size = 1; //JB not true for fullscreen
    8.19  
    8.20      /* Set the function pointers */
    8.21 -	device->CreateYUVOverlay = ph_CreateYUVOverlay;
    8.22 +    device->CreateYUVOverlay = ph_CreateYUVOverlay;
    8.23      device->VideoInit = ph_VideoInit;
    8.24      device->ListModes = ph_ListModes;
    8.25      device->SetVideoMode = ph_SetVideoMode;
    8.26 @@ -117,6 +119,13 @@
    8.27      device->InitOSKeymap = ph_InitOSKeymap;
    8.28      device->PumpEvents = ph_PumpEvents;
    8.29  
    8.30 +    // OpenGL support.
    8.31 +    device->GL_LoadLibrary = NULL;
    8.32 +    device->GL_GetProcAddress = NULL;
    8.33 +    device->GL_GetAttribute = NULL;
    8.34 +    device->GL_MakeCurrent = NULL;
    8.35 +    device->GL_SwapBuffers = ph_GL_SwapBuffers;
    8.36 +
    8.37      device->free = ph_DeleteDevice;
    8.38  
    8.39      return device;
    8.40 @@ -147,17 +156,17 @@
    8.41  static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
    8.42  {
    8.43  	PtArg_t arg[1];
    8.44 -    PhDim_t dim;
    8.45 +	PhDim_t dim;
    8.46  	PgColor_t ph_palette[_Pg_MAX_PALETTE];
    8.47  	int i;
    8.48  	unsigned long *tempptr;
    8.49  	int rtnval;
    8.50 -	PgDisplaySettings_t mysettings;
    8.51 +//	PgDisplaySettings_t mysettings;
    8.52  	PgVideoModeInfo_t my_mode_info;
    8.53  	PgHWCaps_t my_hwcaps;
    8.54  	
    8.55 -     if( NULL == ( event = malloc( EVENT_SIZE ) ) )
    8.56 -          exit( EXIT_FAILURE );
    8.57 +	if( NULL == ( event = malloc( EVENT_SIZE ) ) )
    8.58 +	   exit( EXIT_FAILURE );
    8.59  
    8.60  	/* Create a widget 'window' to capture events */
    8.61      dim.w=0; //JB test320;
    8.62 @@ -190,10 +199,10 @@
    8.63  //        PtExit(EXIT_FAILURE);         // Got SEGFAULT.
    8.64    	}
    8.65  
    8.66 -    //PgSetDrawBufferSize(16 *1024);
    8.67 -   	PgSetRegion(PtWidgetRid(window));
    8.68 -    PgSetClipping(0,NULL);
    8.69 -    PtRealizeWidget(window);
    8.70 +	//PgSetDrawBufferSize(16 *1024);
    8.71 +	PgSetRegion(PtWidgetRid(window));
    8.72 +	PgSetClipping(0,NULL);
    8.73 +	PtRealizeWidget(window);
    8.74  
    8.75  
    8.76      /* Get the available video modes */
    8.77 @@ -216,14 +225,15 @@
    8.78              }
    8.79         */
    8.80           if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
    8.81 -         	{
    8.82 +         {
    8.83                  fprintf(stderr,"ph_VideoInit:  GetGraphicsHWCaps failed!! \n");
    8.84        			//that HAVE to work
    8.85 -            }
    8.86 +         }
    8.87           if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &my_mode_info) < 0)
    8.88 -            {
    8.89 +         {
    8.90                  fprintf(stderr,"ph_VideoInit:  PgGetVideoModeInfo failed\n");
    8.91 -            }
    8.92 +         }
    8.93 +
    8.94         //We need to return BytesPerPixel as it in used by CreateRGBsurface
    8.95         vformat->BitsPerPixel = my_mode_info.bits_per_pixel;
    8.96         vformat->BytesPerPixel = vformat->BitsPerPixel/8;
    8.97 @@ -263,32 +273,31 @@
    8.98  static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
    8.99                  int width, int height, int bpp, Uint32 flags)
   8.100  {
   8.101 -    PhRegion_t region_info;
   8.102 +//    PhRegion_t region_info;
   8.103      PgDisplaySettings_t settings;
   8.104      PgHWCaps_t my_hwcaps;
   8.105 -	PgVideoModeInfo_t mode_info;
   8.106 +    PgVideoModeInfo_t mode_info;
   8.107      int mode, actual_width, actual_height;
   8.108 -	PtArg_t arg[5];
   8.109 -	PhDim_t dim;	
   8.110 -		int rtnval;
   8.111 -	SDL_Rect ** mymodelist;
   8.112 -	SDL_PixelFormat myformat;
   8.113 -	PgColor_t ph_palette[_Pg_MAX_PALETTE];
   8.114 -	int i;
   8.115 -	unsigned long *tempptr;
   8.116 +    PtArg_t arg[5];
   8.117 +    PhDim_t dim;	
   8.118 +    int rtnval;
   8.119 +    PgColor_t ph_palette[_Pg_MAX_PALETTE];
   8.120 +    int i;
   8.121 +    unsigned long *tempptr;
   8.122 +    uint64_t OGLAttrib[PH_OGL_MAX_ATTRIBS];
   8.123  
   8.124 -	actual_width = width;
   8.125 -	actual_height = height;
   8.126 +    actual_width = width;
   8.127 +    actual_height = height;
   8.128  
   8.129 +    dim.w=width;
   8.130 +    dim.h=height;
   8.131  
   8.132      /* Lock the event thread, in multi-threading environments */
   8.133      SDL_Lock_EventThread();
   8.134  
   8.135 -
   8.136       /* Initialize the window */
   8.137      if (flags & SDL_FULLSCREEN) //Direct Context , assume SDL_HWSURFACE also set
   8.138      {
   8.139 -
   8.140  /*  
   8.141  	if (old_video_mode==-1)
   8.142  	{
   8.143 @@ -297,9 +306,7 @@
   8.144  		old_refresh_rate=graphics_card_caps.current_rrate;
   8.145  	}
   8.146  */    	
   8.147 -    	  	
   8.148 -    	  	  	
   8.149 -    	  	  	  	  	
   8.150 +
   8.151          /* Get the video mode and set it */
   8.152          if (bpp == 0)
   8.153          {
   8.154 @@ -309,15 +316,15 @@
   8.155                  fprintf(stderr,"error: PgGetVideoMode failed\n");
   8.156              }
   8.157              */
   8.158 -         if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
   8.159 -         	{
   8.160 -                fprintf(stderr,"ph_SetVideoMode:  GetGraphicsHWCaps failed!! \n");
   8.161 -      			//that HAVE to work
   8.162 -            }
   8.163 -         if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &mode_info) < 0)
   8.164 -            {
   8.165 -                fprintf(stderr,"ph_SetVideoMode:  PgGetVideoModeInfo failed\n");
   8.166 -            }
   8.167 +           if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
   8.168 +           {
   8.169 +                   fprintf(stderr,"ph_SetVideoMode:  GetGraphicsHWCaps failed!! \n");
   8.170 +      	           //that HAVE to work
   8.171 +           }
   8.172 +           if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &mode_info) < 0)
   8.173 +           {
   8.174 +               fprintf(stderr,"ph_SetVideoMode:  PgGetVideoModeInfo failed\n");
   8.175 +           }
   8.176             bpp = mode_info.bits_per_pixel;
   8.177          }
   8.178          if (flags & SDL_ANYFORMAT)
   8.179 @@ -341,8 +348,7 @@
   8.180          settings.mode = mode;
   8.181          settings.refresh = 0;
   8.182          settings.flags  = 0;       
   8.183 -             
   8.184 -        
   8.185 +
   8.186          if (PgSetVideoMode( &settings ) < 0)
   8.187          {
   8.188              fprintf(stderr,"error: PgSetVideoMode failed\n");
   8.189 @@ -358,16 +364,33 @@
   8.190         
   8.191  
   8.192      } //end fullscreen flag
   8.193 -    else if (flags & SDL_HWSURFACE)  /* Use offscreen memory iff SDL_HWSURFACE flag is set */
   8.194 +    else
   8.195      {
   8.196 -      // Hardware surface is Offsceen Context.  ph_ResizeImage handles the switch
   8.197 -      current->flags = (flags|(~SDL_RESIZABLE)); //no stretch blit in offscreen context
   8.198 +       if (flags & SDL_HWSURFACE)  /* Use offscreen memory iff SDL_HWSURFACE flag is set */
   8.199 +       {
   8.200 +         // Hardware surface is Offsceen Context.  ph_ResizeImage handles the switch
   8.201 +         current->flags = (flags|(~SDL_RESIZABLE)); //no stretch blit in offscreen context
   8.202 +       }
   8.203 +       else // must be SDL_SWSURFACE
   8.204 +       {
   8.205 +          current->flags = (flags|SDL_RESIZABLE); //yes we can resize as this is a software surface
   8.206 +       }
   8.207 +       
   8.208 +       if (flags & SDL_OPENGL) // for now support OpenGL in window mode only
   8.209 +       {
   8.210 +          OGLAttrib[0]=PHOGL_ATTRIB_DEPTH_BITS;
   8.211 +          OGLAttrib[1]=bpp;
   8.212 +          OGLAttrib[2]=PHOGL_ATTRIB_NONE;
   8.213 +          OGLContext=PdCreateOpenGLContext(2, &dim, 0, OGLAttrib);
   8.214 +          if (OGLContext==NULL)
   8.215 +          {
   8.216 +             fprintf(stderr,"error: cannot create OpenGL context\n");
   8.217 +             exit(1);
   8.218 +          }
   8.219 +          PhDCSetCurrent(OGLContext);
   8.220 +       }
   8.221 +       
   8.222      }
   8.223 -    else // must be SDL_SWSURFACE
   8.224 -    {
   8.225 -     current->flags = (flags|SDL_RESIZABLE); //yes we can resize as this is a software surface
   8.226 -     }
   8.227 -
   8.228  
   8.229  	//If we are setting video to use the palette make sure we have allocated memory for it
   8.230  	if(bpp == 8)
   8.231 @@ -379,7 +402,7 @@
   8.232  		//fill the palette
   8.233  		rtnval = PgGetPalette(ph_palette);
   8.234  
   8.235 -       tempptr = (unsigned long *)current->format->palette->colors;
   8.236 +                tempptr = (unsigned long *)current->format->palette->colors;
   8.237  
   8.238  		for(i=0;i<256; i++)
   8.239  		{
   8.240 @@ -397,17 +420,17 @@
   8.241  	if((dim.w != width)||(dim.h != height))
   8.242  	{
   8.243  	    dim.w=width;
   8.244 -    	dim.h=height; 
   8.245 -    	PtSetArg(&arg[0], Pt_ARG_DIM, &dim,0);
   8.246 -		PtSetResources( window, 1, arg ); 	
   8.247 -       current->w = width;
   8.248 -       current->h = height;
   8.249 -       current->format->BitsPerPixel = bpp;
   8.250 -		current->format->BytesPerPixel = bpp/8;
   8.251 -       current->pitch = SDL_CalculatePitch(current);
   8.252 -       //Must call at least once it setup image planes 
   8.253 -       ph_ResizeImage(this, current, flags);
   8.254 -    }
   8.255 +	    dim.h=height; 
   8.256 +	    PtSetArg(&arg[0], Pt_ARG_DIM, &dim,0);
   8.257 +	    PtSetResources( window, 1, arg ); 	
   8.258 +            current->w = width;
   8.259 +            current->h = height;
   8.260 +            current->format->BitsPerPixel = bpp;
   8.261 +            current->format->BytesPerPixel = bpp/8;
   8.262 +            current->pitch = SDL_CalculatePitch(current);
   8.263 +            //Must call at least once it setup image planes 
   8.264 +            ph_ResizeImage(this, current, flags);
   8.265 +        }
   8.266  
   8.267  
   8.268      SDL_Unlock_EventThread();
   8.269 @@ -421,8 +444,7 @@
   8.270  		
   8.271  	if(SDL_Image != NULL)
   8.272  	{
   8.273 -	  	    ph_DestroyImage(this, SDL_VideoSurface); 
   8.274 -	
   8.275 +  	    ph_DestroyImage(this, SDL_VideoSurface); 
   8.276  	}
   8.277  
   8.278  	if (currently_fullscreen)
   8.279 @@ -494,6 +516,13 @@
   8.280  	return alloct_all;
   8.281  }
   8.282  
   8.283 +void ph_GL_SwapBuffers(_THIS)
   8.284 +{
   8.285 +   PgSetRegion(PtWidgetRid(window));
   8.286 +   PdOpenGLContextSwapBuffers(OGLContext);
   8.287 +}
   8.288 +
   8.289 +/*
   8.290  static int ph_ResizeWindow(_THIS,
   8.291              SDL_Surface *screen, int w, int h, Uint32 flags)
   8.292  {
   8.293 @@ -512,5 +541,4 @@
   8.294  	current_h = h;
   8.295      return(0);
   8.296  }
   8.297 -
   8.298 -
   8.299 +*/
     9.1 --- a/src/video/photon/SDL_ph_video.h	Fri Jan 18 17:14:16 2002 +0000
     9.2 +++ b/src/video/photon/SDL_ph_video.h	Fri Jan 18 18:14:03 2002 +0000
     9.3 @@ -50,10 +50,13 @@
     9.4  #include "Pt.h"
     9.5  #include <photon/Pg.h>
     9.6  #include <photon/PdDirect.h>
     9.7 +#include <photon/PdGL.h>
     9.8  
     9.9  /* Hidden "this" pointer for the video functions */
    9.10  #define _THIS	SDL_VideoDevice *this
    9.11  
    9.12 +#define PH_OGL_MAX_ATTRIBS 32
    9.13 +
    9.14  typedef union vidptr{
    9.15    uint8_t  *volatile ptr8;
    9.16    uint16_t *volatile ptr16;
    10.1 --- a/src/video/photon/SDL_ph_wm.c	Fri Jan 18 17:14:16 2002 +0000
    10.2 +++ b/src/video/photon/SDL_ph_wm.c	Fri Jan 18 18:14:03 2002 +0000
    10.3 @@ -230,168 +230,44 @@
    10.4  	SDL_Unlock_EventThread();
    10.5  }
    10.6  
    10.7 -/* Iconify the window (stolen from PhHotKey sources by phearbear ;-) */
    10.8 +/* Iconify current window */
    10.9  int ph_IconifyWindow(_THIS)
   10.10  {
   10.11 -#if 1 /* Code submitted by Luca <barbato_luca@yahoo.com> */
   10.12 -	WmApiContext_t context=WmCreateContext();
   10.13 -	WmWindowDefinition_t
   10.14 -**wininfo=malloc(sizeof(WmWindowDefinition_t)*2);
   10.15 -	int num;									
   10.16 -	SDL_Lock_EventThread();
   10.17 -	WmGetFocusList(context,2,&num,wininfo);
   10.18 -	WmPerformFrameAction(context, wininfo[0]->rid,Pt_ACTION_MIN);
   10.19 +   WmApiContext_t context=WmCreateContext();
   10.20 +   WmWindowDefinition_t **wininfo=malloc(sizeof(WmWindowDefinition_t)*2);
   10.21 +   int num;
   10.22  
   10.23 -	WmDestroyContext (context);   
   10.24 -	SDL_Unlock_EventThread();	 
   10.25 -	free(wininfo);		   
   10.26 -	return (0);   
   10.27 -#else
   10.28 -	int result=0;
   10.29 -        int myerr;
   10.30 -        int num;
   10.31 -        PtConnectionClient_t *Client=0;
   10.32 -        WmMsg_t* Message=malloc(sizeof(WmMsg_t));
   10.33 -        WmReply_t *Reply=malloc(sizeof(WmReply_t));
   10.34 -        WmApiContext_t MsgStruct=malloc(sizeof(WmApiContext_t));
   10.35 -        WmWindowDefinition_t **WNDDEF=malloc(sizeof(WmWindowDefinition_t)*2);
   10.36 -	
   10.37 -	SDL_Lock_EventThread();
   10.38 +   SDL_Lock_EventThread();
   10.39 +   WmGetFocusList(context,2,&num,wininfo);
   10.40 +   WmPerformFrameAction(context, wininfo[0]->rid,Pt_ACTION_MIN);
   10.41  
   10.42 -        PtInit("/dev/photon");
   10.43 +   WmDestroyContext (context);   
   10.44 +   SDL_Unlock_EventThread();	 
   10.45 +   free(wininfo);		   
   10.46  
   10.47 -        Client=PtConnectionFindName("pwm",0,0);
   10.48 -
   10.49 -        if(!Client)
   10.50 -        {
   10.51 -           return result;
   10.52 -        }
   10.53 -
   10.54 -        MsgStruct->input_group=PhInputGroup(0);
   10.55 -        MsgStruct->connection=PtConnectionFindName("pwm",0,0);
   10.56 -        myerr=WmGetFocusList(MsgStruct,2,&num,WNDDEF);
   10.57 -
   10.58 -        Message->hdr.type=WM_REQUEST_WIN_ACTION;
   10.59 -        Message->hdr.subtype=Pt_ACTION_MIN;	   
   10.60 -        Message->hdr.rid=WNDDEF[0]->rid;
   10.61 -        myerr=WmSendMessage(Client,Message,Reply,0);
   10.62 -
   10.63 -        free(Message);
   10.64 -        free(Reply);
   10.65 -
   10.66 -	SDL_Unlock_EventThread();
   10.67 -
   10.68 -	return(result);
   10.69 -#endif /* 1 */
   10.70 +   return (0);   
   10.71  }
   10.72  
   10.73  SDL_GrabMode ph_GrabInputNoLock(_THIS, SDL_GrabMode mode)
   10.74  {
   10.75 -#if 0 /*big*/
   10.76 -	int numtries, result;
   10.77 -
   10.78 -	if ( this->screen == NULL ) {
   10.79 -		return(SDL_GRAB_OFF);
   10.80 -	}
   10.81 -	if ( ! SDL_Window ) {
   10.82 -		return(mode);	/* Will be set later on mode switch */
   10.83 -	}
   10.84 -	if ( mode == SDL_GRAB_OFF ) {
   10.85 -		XUngrabPointer(SDL_Display, CurrentTime);
   10.86 -		if ( this->screen->flags & SDL_FULLSCREEN ) {
   10.87 -			/* Rebind the mouse to the fullscreen window */
   10.88 -			for ( numtries = 0; numtries < 10; ++numtries ) {
   10.89 -				result = XGrabPointer(SDL_Display, FSwindow,
   10.90 -						True, 0,
   10.91 -						GrabModeAsync, GrabModeAsync,
   10.92 -						FSwindow, None, CurrentTime);
   10.93 -				if ( result == AlreadyGrabbed ) {
   10.94 -					break;
   10.95 -				}
   10.96 -				SDL_Delay(100);
   10.97 -			}
   10.98 -		}
   10.99 -#ifdef GRAB_FULLSCREEN
  10.100 -		if ( !(this->screen->flags & SDL_FULLSCREEN) )
  10.101 -#endif
  10.102 -		XUngrabKeyboard(SDL_Display, CurrentTime);
  10.103 -	} else {
  10.104 -		if ( this->screen->flags & SDL_FULLSCREEN ) {
  10.105 -			/* Unbind the mouse from the fullscreen window */
  10.106 -			XUngrabPointer(SDL_Display, CurrentTime);
  10.107 -		}
  10.108 -		/* Try to grab the mouse */
  10.109 -		for ( numtries = 0; numtries < 10; ++numtries ) {
  10.110 -			result = XGrabPointer(SDL_Display, SDL_Window, True, 0,
  10.111 -						GrabModeAsync, GrabModeAsync,
  10.112 -						SDL_Window, None, CurrentTime);
  10.113 -			if ( result != AlreadyGrabbed ) {
  10.114 -				break;
  10.115 -			}
  10.116 -			SDL_Delay(100);
  10.117 -		}
  10.118 -#ifdef GRAB_FULLSCREEN
  10.119 -		if ( !(this->screen->flags & SDL_FULLSCREEN) )
  10.120 -#endif
  10.121 -		XGrabKeyboard(SDL_Display, WMwindow, True,
  10.122 -			GrabModeAsync, GrabModeAsync, CurrentTime);
  10.123 -	}
  10.124 -	XSync(SDL_Display, False);
  10.125 -
  10.126 -
  10.127 -#endif /*big*/
  10.128 -	return(mode);
  10.129 +   return(mode);
  10.130  }
  10.131  
  10.132  SDL_GrabMode ph_GrabInput(_THIS, SDL_GrabMode mode)
  10.133  {
  10.134 -#if 0
  10.135 -	SDL_Lock_EventThread();
  10.136 -	mode = X11_GrabInputNoLock(this, mode);
  10.137 -	SDL_Unlock_EventThread();
  10.138 -#endif
  10.139 -	return(mode);
  10.140 +   return(mode);
  10.141  }
  10.142  
  10.143 -/* If 'info' is the right version, this function fills it and returns 1.
  10.144 -   Otherwise, in case of a version mismatch, it returns -1.
  10.145 -*/
  10.146 -static void lock_display(void)
  10.147 -{
  10.148 -	SDL_Lock_EventThread();
  10.149 -}
  10.150 -static void unlock_display(void)
  10.151 -{
  10.152 -#if 0
  10.153 -	/* Make sure any X11 transactions are completed */
  10.154 -	SDL_VideoDevice *this = current_video;
  10.155 -	XSync(SDL_Display, False);
  10.156 -#endif
  10.157 -	SDL_Unlock_EventThread();
  10.158 -}
  10.159  int ph_GetWMInfo(_THIS, SDL_SysWMinfo *info)
  10.160  {
  10.161 -#if 0
  10.162 -	if ( info->version.major <= SDL_MAJOR_VERSION ) {
  10.163 -		info->subsystem = SDL_SYSWM_X11;
  10.164 -		info->info.x11.display = SDL_Display;
  10.165 -		info->info.x11.window = SDL_Window;
  10.166 -		if ( SDL_VERSIONNUM(info->version.major,
  10.167 -		                    info->version.minor,
  10.168 -		                    info->version.patch) >= 1002 ) {
  10.169 -			info->info.x11.fswindow = FSwindow;
  10.170 -			info->info.x11.wmwindow = WMwindow;
  10.171 -		}
  10.172 -		info->info.x11.lock_func = lock_display;
  10.173 -		info->info.x11.unlock_func = unlock_display;
  10.174 -		return(1);
  10.175 -	} else {
  10.176 -		SDL_SetError("Application not compiled with SDL %d.%d\n",
  10.177 -					SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
  10.178 -		return(-1);
  10.179 -	}
  10.180 -#endif
  10.181 -   return -1; // for now ...
  10.182 +   if (info->version.major <= SDL_MAJOR_VERSION)
  10.183 +   {
  10.184 +      return 1;
  10.185 +   }
  10.186 +   else
  10.187 +   {
  10.188 +      SDL_SetError("Application not compiled with SDL %d.%d\n",
  10.189 +                    SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
  10.190 +      return -1;
  10.191 +   }
  10.192  }
  10.193 -
  10.194 -	   
    11.1 --- a/test/testvidinfo.c	Fri Jan 18 17:14:16 2002 +0000
    11.2 +++ b/test/testvidinfo.c	Fri Jan 18 18:14:03 2002 +0000
    11.3 @@ -35,7 +35,7 @@
    11.4  	} else {
    11.5  		printf("Fullscreen video modes:\n");
    11.6  		for ( i=0; modes[i]; ++i ) {
    11.7 -			printf("\t%dx%d\n", modes[i]->w, modes[i]->h);
    11.8 +			printf("\t%dx%dx%d\n", modes[i]->w, modes[i]->h, info->vfmt->BitsPerPixel);
    11.9  		}
   11.10  	}
   11.11  	if ( info->wm_available ) {