In testdyngl.c the event type was being anded (&) with SDL_KEYDOWN and if the result was none zero the program was quiting. This is very weird because it was
authorBob Pendleton <bob@pendleton.com>
Fri, 07 Mar 2008 23:57:15 +0000
changeset 23277b53a8401195
parent 2326 133562468ff2
child 2328 91e601d9df8b
In testdyngl.c the event type was being anded (&) with SDL_KEYDOWN and if the result was none zero the program was quiting. This is very weird because it was
working earlier this week.

I added some more trace code to SDL_x11events.c

In SDL_X11opengl.c I modified SDL_GL_GetSwapInterval() so that it returns a pretty good value even if you have the SGI swap extension instead of the MESA swap
extension. I just saved the value you set and return it too you.
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11opengl.c
test/testdyngl.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Fri Mar 07 21:01:54 2008 +0000
     1.2 +++ b/src/video/x11/SDL_x11events.c	Fri Mar 07 23:57:15 2008 +0000
     1.3 @@ -43,8 +43,9 @@
     1.4      /* filter events catchs XIM events and sends them to the correct
     1.5         handler */
     1.6      if (XFilterEvent(&xevent, None) == True) {
     1.7 -#ifdef DEBUG_XEVENTS
     1.8 -        printf("Filtered event of type = 0x%X\n", xevent.type);
     1.9 +#if 0
    1.10 +      printf("Filtered event type = %d display = %d window = %d\n", 
    1.11 +             xevent.type, xevent.xany.display, xevent.xany.window);
    1.12  #endif
    1.13          return;
    1.14      }
    1.15 @@ -73,6 +74,10 @@
    1.16          return;
    1.17      }
    1.18  
    1.19 +#if 0
    1.20 +      printf("type = %d display = %d window = %d\n", 
    1.21 +             xevent.type, xevent.xany.display, xevent.xany.window);
    1.22 +#endif
    1.23      switch (xevent.type) {
    1.24  
    1.25          /* Gaining mouse coverage? */
     2.1 --- a/src/video/x11/SDL_x11opengl.c	Fri Mar 07 21:01:54 2008 +0000
     2.2 +++ b/src/video/x11/SDL_x11opengl.c	Fri Mar 07 23:57:15 2008 +0000
     2.3 @@ -472,6 +472,16 @@
     2.4      return (status);
     2.5  }
     2.6  
     2.7 +/* 
     2.8 +   0 is a valid argument to glxSwapIntervalMESA and setting it to 0
     2.9 +   with the MESA version of the extension will undo the effect of a
    2.10 +   previous call with a value that is greater than zero (or at least
    2.11 +   that is what the FM says. OTOH, 0 is an invalid argument to
    2.12 +   glxSwapIntervalSGI and it returns an error if you call it with 0 as
    2.13 +   an argument.
    2.14 +*/
    2.15 +
    2.16 +static int swapinterval = -1;
    2.17  int
    2.18  X11_GL_SetSwapInterval(_THIS, int interval)
    2.19  {
    2.20 @@ -482,12 +492,16 @@
    2.21          if (status != 0) {
    2.22              SDL_SetError("glxSwapIntervalMESA failed");
    2.23              status = -1;
    2.24 +        } else {
    2.25 +            swapinterval = interval;
    2.26          }
    2.27      } else if (_this->gl_data->glXSwapIntervalSGI) {
    2.28          status = _this->gl_data->glXSwapIntervalSGI(interval);
    2.29          if (status != 0) {
    2.30              SDL_SetError("glxSwapIntervalSGI failed");
    2.31              status = -1;
    2.32 +        } else {
    2.33 +            swapinterval = interval;
    2.34          }
    2.35      } else {
    2.36          SDL_Unsupported();
    2.37 @@ -502,8 +516,7 @@
    2.38      if (_this->gl_data->glXGetSwapIntervalMESA) {
    2.39          return _this->gl_data->glXGetSwapIntervalMESA();
    2.40      } else {
    2.41 -        SDL_Unsupported();
    2.42 -        return -1;
    2.43 +        return swapinterval;
    2.44      }
    2.45  }
    2.46  
     3.1 --- a/test/testdyngl.c	Fri Mar 07 21:01:54 2008 +0000
     3.2 +++ b/test/testdyngl.c	Fri Mar 07 23:57:15 2008 +0000
     3.3 @@ -180,7 +180,7 @@
     3.4          SDL_GL_SwapBuffers();
     3.5  
     3.6          while (SDL_PollEvent(&event)) {
     3.7 -            if (event.type & SDL_KEYDOWN)
     3.8 +            if (event.type == SDL_KEYDOWN)
     3.9                  done = 1;
    3.10          }
    3.11