comparison src/video/x11/SDL_x11video.c @ 1658:e49147870aac SDL-1.3

glSDL support
author Sam Lantinga <slouken@libsdl.org>
date Mon, 01 May 2006 06:58:33 +0000
parents 0a53c90a37f9
children 14717b52abc0
comparison
equal deleted inserted replaced
1657:5b0805ceb50f 1658:e49147870aac
583 583
584 static void X11_DestroyWindow(_THIS, SDL_Surface *screen) 584 static void X11_DestroyWindow(_THIS, SDL_Surface *screen)
585 { 585 {
586 /* Clean up OpenGL */ 586 /* Clean up OpenGL */
587 if ( screen ) { 587 if ( screen ) {
588 screen->flags &= ~SDL_OPENGL; 588 screen->flags &= ~SDL_INTERNALOPENGL;
589 } 589 }
590 X11_GL_Shutdown(this); 590 X11_GL_Shutdown(this);
591 591
592 if ( ! SDL_windowid ) { 592 if ( ! SDL_windowid ) {
593 /* Hide the managed window */ 593 /* Hide the managed window */
789 } else { 789 } else {
790 SDL_Window = 0; 790 SDL_Window = 0;
791 } 791 }
792 792
793 /* find out which visual we are going to use */ 793 /* find out which visual we are going to use */
794 if ( flags & SDL_OPENGL ) { 794 if ( flags & SDL_INTERNALOPENGL ) {
795 XVisualInfo *vi; 795 XVisualInfo *vi;
796 796
797 vi = X11_GL_GetVisual(this); 797 vi = X11_GL_GetVisual(this);
798 if( !vi ) { 798 if( !vi ) {
799 return -1; 799 return -1;
902 XResizeWindow(SDL_Display, WMwindow, w, h); 902 XResizeWindow(SDL_Display, WMwindow, w, h);
903 } 903 }
904 904
905 /* Create (or use) the X11 display window */ 905 /* Create (or use) the X11 display window */
906 if ( !SDL_windowid ) { 906 if ( !SDL_windowid ) {
907 if ( flags & SDL_OPENGL ) { 907 if ( flags & SDL_INTERNALOPENGL ) {
908 if ( X11_GL_CreateWindow(this, w, h) < 0 ) { 908 if ( X11_GL_CreateWindow(this, w, h) < 0 ) {
909 return(-1); 909 return(-1);
910 } 910 }
911 } else { 911 } else {
912 XSetWindowAttributes swa; 912 XSetWindowAttributes swa;
925 ( EnterWindowMask | LeaveWindowMask 925 ( EnterWindowMask | LeaveWindowMask
926 | ButtonPressMask | ButtonReleaseMask 926 | ButtonPressMask | ButtonReleaseMask
927 | PointerMotionMask | ExposureMask )); 927 | PointerMotionMask | ExposureMask ));
928 } 928 }
929 /* Create the graphics context here, once we have a window */ 929 /* Create the graphics context here, once we have a window */
930 if ( flags & SDL_OPENGL ) { 930 if ( flags & SDL_INTERNALOPENGL ) {
931 if ( X11_GL_CreateContext(this) < 0 ) { 931 if ( X11_GL_CreateContext(this) < 0 ) {
932 return(-1); 932 return(-1);
933 } else { 933 } else {
934 screen->flags |= SDL_OPENGL; 934 screen->flags |= SDL_INTERNALOPENGL;
935 } 935 }
936 } else { 936 } else {
937 XGCValues gcv; 937 XGCValues gcv;
938 938
939 gcv.graphics_exposures = False; 939 gcv.graphics_exposures = False;
944 return(-1); 944 return(-1);
945 } 945 }
946 } 946 }
947 947
948 /* Set our colormaps when not setting a GL mode */ 948 /* Set our colormaps when not setting a GL mode */
949 if ( ! (flags & SDL_OPENGL) ) { 949 if ( ! (flags & SDL_INTERNALOPENGL) ) {
950 XSetWindowColormap(SDL_Display, SDL_Window, SDL_XColorMap); 950 XSetWindowColormap(SDL_Display, SDL_Window, SDL_XColorMap);
951 if( !SDL_windowid ) { 951 if( !SDL_windowid ) {
952 XSetWindowColormap(SDL_Display, FSwindow, SDL_XColorMap); 952 XSetWindowColormap(SDL_Display, FSwindow, SDL_XColorMap);
953 XSetWindowColormap(SDL_Display, WMwindow, SDL_XColorMap); 953 XSetWindowColormap(SDL_Display, WMwindow, SDL_XColorMap);
954 } 954 }
1061 /* Flush any delayed updates */ 1061 /* Flush any delayed updates */
1062 XSync(GFX_Display, False); 1062 XSync(GFX_Display, False);
1063 1063
1064 /* Set up the X11 window */ 1064 /* Set up the X11 window */
1065 saved_flags = current->flags; 1065 saved_flags = current->flags;
1066 if ( (SDL_Window) && ((saved_flags&SDL_OPENGL) == (flags&SDL_OPENGL)) 1066 if ( (SDL_Window) && ((saved_flags&SDL_INTERNALOPENGL) == (flags&SDL_INTERNALOPENGL))
1067 && (bpp == current->format->BitsPerPixel) 1067 && (bpp == current->format->BitsPerPixel)
1068 && ((saved_flags&SDL_NOFRAME) == (flags&SDL_NOFRAME)) ) { 1068 && ((saved_flags&SDL_NOFRAME) == (flags&SDL_NOFRAME)) ) {
1069 if (X11_ResizeWindow(this, current, width, height, flags) < 0) { 1069 if (X11_ResizeWindow(this, current, width, height, flags) < 0) {
1070 current = NULL; 1070 current = NULL;
1071 goto done; 1071 goto done;
1077 } 1077 }
1078 } 1078 }
1079 1079
1080 /* Set up the new mode framebuffer */ 1080 /* Set up the new mode framebuffer */
1081 if ( ((current->w != width) || (current->h != height)) || 1081 if ( ((current->w != width) || (current->h != height)) ||
1082 ((saved_flags&SDL_OPENGL) != (flags&SDL_OPENGL)) ) { 1082 ((saved_flags&SDL_INTERNALOPENGL) != (flags&SDL_INTERNALOPENGL)) ) {
1083 current->w = width; 1083 current->w = width;
1084 current->h = height; 1084 current->h = height;
1085 current->pitch = SDL_CalculatePitch(current); 1085 current->pitch = SDL_CalculatePitch(current);
1086 X11_ResizeImage(this, current, flags); 1086 X11_ResizeImage(this, current, flags);
1087 } 1087 }