Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
authorSam Lantinga <slouken@libsdl.org>
Thu, 21 Jan 2010 06:21:52 +0000
changeset 368564ce267332c6
parent 3684 cc564f08884f
child 3686 d87db9cf6a31
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
README.iphoneos
Xcode-iPhoneOS/Demos/src/accelerometer.c
Xcode-iPhoneOS/Demos/src/fireworks.c
Xcode-iPhoneOS/Demos/src/happy.c
Xcode-iPhoneOS/Demos/src/keyboard.c
Xcode-iPhoneOS/Demos/src/mixer.c
Xcode-iPhoneOS/Demos/src/rectangles.c
Xcode-iPhoneOS/Demos/src/touch.c
include/SDL_compat.h
include/SDL_events.h
include/SDL_mouse.h
include/SDL_syswm.h
include/SDL_video.h
src/SDL_assert.c
src/SDL_compat.c
src/events/SDL_keyboard.c
src/events/SDL_keyboard_c.h
src/events/SDL_mouse.c
src/events/SDL_mouse_c.h
src/events/SDL_windowevents.c
src/events/SDL_windowevents_c.h
src/video/SDL_gamma.c
src/video/SDL_renderer_gl.c
src/video/SDL_renderer_gles.c
src/video/SDL_renderer_sw.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/cocoa/SDL_cocoamouse.m
src/video/cocoa/SDL_cocoaopengl.m
src/video/cocoa/SDL_cocoawindow.h
src/video/cocoa/SDL_cocoawindow.m
src/video/directfb/SDL_DirectFB_WM.c
src/video/directfb/SDL_DirectFB_events.c
src/video/directfb/SDL_DirectFB_mouse.c
src/video/directfb/SDL_DirectFB_render.c
src/video/directfb/SDL_DirectFB_window.c
src/video/directfb/SDL_DirectFB_window.h
src/video/dummy/SDL_nullrender.c
src/video/nds/SDL_ndsrender.c
src/video/pandora/SDL_pandora.c
src/video/photon/SDL_photon.c
src/video/photon/SDL_photon_input.c
src/video/photon/SDL_photon_render.c
src/video/ps3/SDL_ps3render.c
src/video/qnxgf/SDL_gf_input.c
src/video/qnxgf/SDL_gf_render.c
src/video/qnxgf/SDL_qnxgf.c
src/video/uikit/SDL_uikitappdelegate.h
src/video/uikit/SDL_uikitappdelegate.m
src/video/uikit/SDL_uikitkeyboard.h
src/video/uikit/SDL_uikitview.m
src/video/uikit/SDL_uikitwindow.h
src/video/uikit/SDL_uikitwindow.m
src/video/win32/SDL_ceddrawrender.c
src/video/win32/SDL_d3drender.c
src/video/win32/SDL_gapirender.c
src/video/win32/SDL_gdirender.c
src/video/win32/SDL_win32events.c
src/video/win32/SDL_win32window.c
src/video/win32/SDL_win32window.h
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11opengl.c
src/video/x11/SDL_x11render.c
src/video/x11/SDL_x11window.c
src/video/x11/SDL_x11window.h
test/automated/render/render.c
test/common.c
test/common.h
test/testdraw2.c
test/testintersections.c
test/testnative.c
test/testsprite2.c
test/testspriteminimal.c
     1.1 --- a/README.iphoneos	Thu Jan 21 05:49:41 2010 +0000
     1.2 +++ b/README.iphoneos	Thu Jan 21 06:21:52 2010 +0000
     1.3 @@ -67,13 +67,13 @@
     1.4  
     1.5  SDL for iPhone contains several additional functions related to keyboard visibility.  These functions are not part of the SDL standard API, but are necessary for revealing and hiding the iPhone's virtual onscreen keyboard.  You can use them in your own applications by including a copy of the SDL_uikitkeyboard.h header (located in src/video/uikit) in your project.
     1.6  
     1.7 -int SDL_iPhoneKeyboardShow(SDL_WindowID windowID) 
     1.8 +int SDL_iPhoneKeyboardShow(SDL_Window * window) 
     1.9  	-- reveals the onscreen keyboard.  Returns 0 on success and -1 on error.
    1.10 -int SDL_iPhoneKeyboardHide(SDL_WindowID windowID) 
    1.11 +int SDL_iPhoneKeyboardHide(SDL_Window * window) 
    1.12  	-- hides the onscreen keyboard.  Returns 0 on success and -1 on error.
    1.13 -SDL_bool SDL_iPhoneKeyboardIsShown(SDL_WindowID windowID) 
    1.14 +SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) 
    1.15  	-- returns whether or not the onscreen keyboard is currently visible.
    1.16 -int SDL_iPhoneKeyboardToggle(SDL_WindowID windowID) 	
    1.17 +int SDL_iPhoneKeyboardToggle(SDL_Window * window) 	
    1.18  	-- toggles the visibility of the onscreen keyboard.  Returns 0 on success and -1 on error.
    1.19  
    1.20  ==============================================================================
     2.1 --- a/Xcode-iPhoneOS/Demos/src/accelerometer.c	Thu Jan 21 05:49:41 2010 +0000
     2.2 +++ b/Xcode-iPhoneOS/Demos/src/accelerometer.c	Thu Jan 21 06:21:52 2010 +0000
     2.3 @@ -27,8 +27,8 @@
     2.4      SDL_Rect rect;              /* (drawn) position and size of ship */
     2.5  } ship;
     2.6  
     2.7 -static SDL_TextureID shipID = 0;        /* texture for spaceship */
     2.8 -static SDL_TextureID spaceID = 0;       /* texture for space (background */
     2.9 +static SDL_Texture *ship = 0;        /* texture for spaceship */
    2.10 +static SDL_Texture *space = 0;       /* texture for space (background */
    2.11  
    2.12  void
    2.13  render(void)
    2.14 @@ -97,13 +97,13 @@
    2.15      }
    2.16  
    2.17      /* draw the background */
    2.18 -    SDL_RenderCopy(spaceID, NULL, NULL);
    2.19 +    SDL_RenderCopy(space, NULL, NULL);
    2.20  
    2.21      /* draw the ship */
    2.22      ship.rect.x = ship.x;
    2.23      ship.rect.y = ship.y;
    2.24  
    2.25 -    SDL_RenderCopy(shipID, NULL, &ship.rect);
    2.26 +    SDL_RenderCopy(ship, NULL, &ship.rect);
    2.27  
    2.28      /* update screen */
    2.29      SDL_RenderPresent();
    2.30 @@ -141,11 +141,11 @@
    2.31      SDL_BlitSurface(bmp_surface, NULL, bmp_surface_rgba, NULL);
    2.32  
    2.33      /* create ship texture from surface */
    2.34 -    shipID = SDL_CreateTextureFromSurface(format, bmp_surface_rgba);
    2.35 -    if (shipID == 0) {
    2.36 +    ship = SDL_CreateTextureFromSurface(format, bmp_surface_rgba);
    2.37 +    if (ship == 0) {
    2.38          fatalError("could not create ship texture");
    2.39      }
    2.40 -    SDL_SetTextureBlendMode(shipID, SDL_BLENDMODE_BLEND);
    2.41 +    SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND);
    2.42  
    2.43      /* set the width and height of the ship from the surface dimensions */
    2.44      ship.rect.w = bmp_surface->w;
    2.45 @@ -160,8 +160,8 @@
    2.46          fatalError("could not load space.bmp");
    2.47      }
    2.48      /* create space texture from surface */
    2.49 -    spaceID = SDL_CreateTextureFromSurface(format, bmp_surface);
    2.50 -    if (spaceID == 0) {
    2.51 +    space = SDL_CreateTextureFromSurface(format, bmp_surface);
    2.52 +    if (space == 0) {
    2.53          fatalError("could not create space texture");
    2.54      }
    2.55      SDL_FreeSurface(bmp_surface);
    2.56 @@ -174,7 +174,7 @@
    2.57  main(int argc, char *argv[])
    2.58  {
    2.59  
    2.60 -    SDL_WindowID windowID;      /* ID of main window */
    2.61 +    SDL_Window *window;         /* main window */
    2.62      Uint32 startFrame;          /* time frame began to process */
    2.63      Uint32 endFrame;            /* time frame ended processing */
    2.64      Uint32 delay;               /* time to pause waiting to draw next frame */
    2.65 @@ -186,10 +186,10 @@
    2.66      }
    2.67  
    2.68      /* create main window and renderer */
    2.69 -    windowID = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    2.70 +    window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    2.71                                  SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN |
    2.72                                  SDL_WINDOW_BORDERLESS);
    2.73 -    SDL_CreateRenderer(windowID, 0, 0);
    2.74 +    SDL_CreateRenderer(window, 0, 0);
    2.75  
    2.76      /* print out some info about joysticks and try to open accelerometer for use */
    2.77      printf("There are %d joysticks available\n", SDL_NumJoysticks());
    2.78 @@ -240,8 +240,8 @@
    2.79      }
    2.80  
    2.81      /* delete textures */
    2.82 -    SDL_DestroyTexture(shipID);
    2.83 -    SDL_DestroyTexture(spaceID);
    2.84 +    SDL_DestroyTexture(ship);
    2.85 +    SDL_DestroyTexture(space);
    2.86  
    2.87      /* shutdown SDL */
    2.88      SDL_Quit();
     3.1 --- a/Xcode-iPhoneOS/Demos/src/fireworks.c	Thu Jan 21 05:49:41 2010 +0000
     3.2 +++ b/Xcode-iPhoneOS/Demos/src/fireworks.c	Thu Jan 21 06:21:52 2010 +0000
     3.3 @@ -363,8 +363,7 @@
     3.4  int
     3.5  main(int argc, char *argv[])
     3.6  {
     3.7 -
     3.8 -    SDL_WindowID windowID;      /* ID of main window */
     3.9 +    SDL_Window *window;         /* main window */
    3.10      Uint32 startFrame;          /* time frame began to process */
    3.11      Uint32 endFrame;            /* time frame ended processing */
    3.12      Uint32 delay;               /* time to pause waiting to draw next frame */
    3.13 @@ -389,10 +388,10 @@
    3.14      SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
    3.15  
    3.16      /* create main window and renderer */
    3.17 -    windowID = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    3.18 +    window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    3.19                                  SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN |
    3.20                                  SDL_WINDOW_BORDERLESS);
    3.21 -    SDL_CreateRenderer(windowID, 0, 0);
    3.22 +    SDL_CreateRenderer(window, 0, 0);
    3.23  
    3.24      /* load the particle texture */
    3.25      initializeTexture();
     4.1 --- a/Xcode-iPhoneOS/Demos/src/happy.c	Thu Jan 21 05:49:41 2010 +0000
     4.2 +++ b/Xcode-iPhoneOS/Demos/src/happy.c	Thu Jan 21 06:21:52 2010 +0000
     4.3 @@ -11,7 +11,7 @@
     4.4  #define MILLESECONDS_PER_FRAME 16       /* about 60 frames per second */
     4.5  #define HAPPY_FACE_SIZE 32      /* width and height of happyface (pixels) */
     4.6  
     4.7 -static SDL_TextureID texture_id = 0;    /* reference to texture holding happyface */
     4.8 +static SDL_Texture *texture = 0;    /* reference to texture holding happyface */
     4.9  
    4.10  static struct
    4.11  {
    4.12 @@ -86,7 +86,7 @@
    4.13          }
    4.14          dstRect.x = faces[i].x;
    4.15          dstRect.y = faces[i].y;
    4.16 -        SDL_RenderCopy(texture_id, &srcRect, &dstRect);
    4.17 +        SDL_RenderCopy(texture, &srcRect, &dstRect);
    4.18      }
    4.19      /* update screen */
    4.20      SDL_RenderPresent();
    4.21 @@ -124,11 +124,11 @@
    4.22      SDL_BlitSurface(bmp_surface, NULL, bmp_surface_rgba, NULL);
    4.23  
    4.24      /* convert RGBA surface to texture */
    4.25 -    texture_id = SDL_CreateTextureFromSurface(format, bmp_surface_rgba);
    4.26 -    if (texture_id == 0) {
    4.27 +    texture = SDL_CreateTextureFromSurface(format, bmp_surface_rgba);
    4.28 +    if (texture == 0) {
    4.29          fatalError("could not create texture");
    4.30      }
    4.31 -    SDL_SetTextureBlendMode(texture_id, SDL_BLENDMODE_BLEND);
    4.32 +    SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
    4.33  
    4.34      /* free up allocated memory */
    4.35      SDL_FreeSurface(bmp_surface_rgba);
    4.36 @@ -139,7 +139,7 @@
    4.37  main(int argc, char *argv[])
    4.38  {
    4.39  
    4.40 -    SDL_WindowID windowID;
    4.41 +    SDL_Window *window;
    4.42      Uint32 startFrame;
    4.43      Uint32 endFrame;
    4.44      Uint32 delay;
    4.45 @@ -149,11 +149,11 @@
    4.46      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    4.47          fatalError("Could not initialize SDL");
    4.48      }
    4.49 -    windowID = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    4.50 +    window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    4.51                                  SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN |
    4.52                                  SDL_WINDOW_BORDERLESS);
    4.53  
    4.54 -    SDL_CreateRenderer(windowID, -1, 0);
    4.55 +    SDL_CreateRenderer(window, -1, 0);
    4.56  
    4.57      initializeTexture();
    4.58      initializeHappyFaces();
    4.59 @@ -182,7 +182,7 @@
    4.60      }
    4.61  
    4.62      /* cleanup */
    4.63 -    SDL_DestroyTexture(texture_id);
    4.64 +    SDL_DestroyTexture(texture);
    4.65      /* shutdown SDL */
    4.66      SDL_Quit();
    4.67  
     5.1 --- a/Xcode-iPhoneOS/Demos/src/keyboard.c	Thu Jan 21 05:49:41 2010 +0000
     5.2 +++ b/Xcode-iPhoneOS/Demos/src/keyboard.c	Thu Jan 21 06:21:52 2010 +0000
     5.3 @@ -10,14 +10,14 @@
     5.4  #define GLYPH_SIZE_IMAGE 16     /* size of glyphs (characters) in the bitmap font file */
     5.5  #define GLYPH_SIZE_SCREEN 32    /* size of glyphs (characters) as shown on the screen */
     5.6  
     5.7 -static SDL_TextureID textureID; /* texture where we'll hold our font */
     5.8 +static SDL_Texture *texture; /* texture where we'll hold our font */
     5.9  
    5.10  /* iPhone SDL addition keyboard related function definitions */
    5.11 -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_WindowID windowID);
    5.12 -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardHide(SDL_WindowID windowID);
    5.13 -extern DECLSPEC SDL_bool SDLCALL SDL_iPhoneKeyboardIsShown(SDL_WindowID
    5.14 -                                                           windowID);
    5.15 -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_WindowID windowID);
    5.16 +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_Window * window);
    5.17 +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardHide(SDL_Window * window);
    5.18 +extern DECLSPEC SDL_bool SDLCALL SDL_iPhoneKeyboardIsShown(SDL_Window *
    5.19 +                                                           window);
    5.20 +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_Window * window);
    5.21  
    5.22  /* function declarations */
    5.23  void cleanup(void);
    5.24 @@ -157,7 +157,7 @@
    5.25          { GLYPH_SIZE_IMAGE * index, 0, GLYPH_SIZE_IMAGE, GLYPH_SIZE_IMAGE };
    5.26      SDL_Rect dstRect = { x, y, GLYPH_SIZE_SCREEN, GLYPH_SIZE_SCREEN };
    5.27      drawBlank(x, y);
    5.28 -    SDL_RenderCopy(textureID, &srcRect, &dstRect);
    5.29 +    SDL_RenderCopy(texture, &srcRect, &dstRect);
    5.30  }
    5.31  
    5.32  /*  draws the cursor icon at the current end position of the text */
    5.33 @@ -194,8 +194,8 @@
    5.34      }
    5.35  }
    5.36  
    5.37 -/* this function loads our font into an SDL_Texture and returns the SDL_TextureID */
    5.38 -SDL_TextureID
    5.39 +/* this function loads our font into an SDL_Texture and returns the SDL_Texture  */
    5.40 +SDL_Texture*
    5.41  loadFont(void)
    5.42  {
    5.43  
    5.44 @@ -218,17 +218,17 @@
    5.45                                   Bmask, Amask);
    5.46          SDL_BlitSurface(surface, NULL, converted, NULL);
    5.47          /* create our texture */
    5.48 -        textureID =
    5.49 +        texture =
    5.50              SDL_CreateTextureFromSurface(SDL_PIXELFORMAT_ABGR8888, converted);
    5.51 -        if (textureID == 0) {
    5.52 +        if (texture == 0) {
    5.53              printf("texture creation failed: %s\n", SDL_GetError());
    5.54          } else {
    5.55              /* set blend mode for our texture */
    5.56 -            SDL_SetTextureBlendMode(textureID, SDL_BLENDMODE_BLEND);
    5.57 +            SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
    5.58          }
    5.59          SDL_FreeSurface(surface);
    5.60          SDL_FreeSurface(converted);
    5.61 -        return textureID;
    5.62 +        return texture;
    5.63      }
    5.64  }
    5.65  
    5.66 @@ -237,6 +237,7 @@
    5.67  {
    5.68  
    5.69      int index;                  /* index of last key we pushed in the bitmap font */
    5.70 +    SDL_Window *window;
    5.71      SDL_Event event;            /* last event received */
    5.72      SDLMod mod;                 /* key modifiers of last key we pushed */
    5.73      SDL_scancode scancode;      /* scancode of last key we pushed */
    5.74 @@ -245,11 +246,9 @@
    5.75          printf("Error initializing SDL: %s", SDL_GetError());
    5.76      }
    5.77      /* create window */
    5.78 -    SDL_WindowID windowID =
    5.79 -        SDL_CreateWindow("iPhone keyboard test", 0, 0, SCREEN_WIDTH,
    5.80 -                         SCREEN_HEIGHT, 0);
    5.81 +    window = SDL_CreateWindow("iPhone keyboard test", 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);
    5.82      /* create renderer */
    5.83 -    SDL_CreateRenderer(windowID, 0, 0);
    5.84 +    SDL_CreateRenderer(window, 0, 0);
    5.85  
    5.86      /* load up our font */
    5.87      loadFont();
    5.88 @@ -301,7 +300,7 @@
    5.89              /*      mouse up toggles onscreen keyboard visibility
    5.90                 this function is available ONLY on iPhone OS
    5.91               */
    5.92 -            SDL_iPhoneKeyboardToggle(windowID);
    5.93 +            SDL_iPhoneKeyboardToggle(window);
    5.94              break;
    5.95  #endif
    5.96          }
    5.97 @@ -314,6 +313,6 @@
    5.98  void
    5.99  cleanup(void)
   5.100  {
   5.101 -    SDL_DestroyTexture(textureID);
   5.102 +    SDL_DestroyTexture(texture);
   5.103      SDL_Quit();
   5.104  }
     6.1 --- a/Xcode-iPhoneOS/Demos/src/mixer.c	Thu Jan 21 05:49:41 2010 +0000
     6.2 +++ b/Xcode-iPhoneOS/Demos/src/mixer.c	Thu Jan 21 06:21:52 2010 +0000
     6.3 @@ -274,7 +274,7 @@
     6.4  {
     6.5  
     6.6      int done;                   /* has user tried to quit ? */
     6.7 -    SDL_WindowID windowID;      /* our main window */
     6.8 +    SDL_Window *window;         /* main window */
     6.9      SDL_Event event;
    6.10      Uint32 startFrame;          /* holds when frame started processing */
    6.11      Uint32 endFrame;            /* holds when frame ended processing */
    6.12 @@ -283,10 +283,10 @@
    6.13      if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
    6.14          fatalError("could not initialize SDL");
    6.15      }
    6.16 -    windowID =
    6.17 +    window =
    6.18          SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    6.19                           SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS);
    6.20 -    SDL_CreateRenderer(windowID, 0, 0);
    6.21 +    SDL_CreateRenderer(window, 0, 0);
    6.22  
    6.23      /* initialize the mixer */
    6.24      SDL_memset(&mixer, 0, sizeof(mixer));
     7.1 --- a/Xcode-iPhoneOS/Demos/src/rectangles.c	Thu Jan 21 05:49:41 2010 +0000
     7.2 +++ b/Xcode-iPhoneOS/Demos/src/rectangles.c	Thu Jan 21 06:21:52 2010 +0000
     7.3 @@ -38,7 +38,7 @@
     7.4  main(int argc, char *argv[])
     7.5  {
     7.6  
     7.7 -    SDL_WindowID windowID;
     7.8 +    SDL_Window *window;
     7.9      int done;
    7.10      SDL_Event event;
    7.11  
    7.12 @@ -51,13 +51,13 @@
    7.13      srand(time(NULL));
    7.14  
    7.15      /* create window and renderer */
    7.16 -    windowID =
    7.17 +    window =
    7.18          SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    7.19                           SDL_WINDOW_SHOWN);
    7.20 -    if (windowID == 0) {
    7.21 +    if (window == 0) {
    7.22          fatalError("Could not initialize Window");
    7.23      }
    7.24 -    if (SDL_CreateRenderer(windowID, -1, 0) != 0) {
    7.25 +    if (SDL_CreateRenderer(window, -1, 0) != 0) {
    7.26          fatalError("Could not create renderer");
    7.27      }
    7.28  
     8.1 --- a/Xcode-iPhoneOS/Demos/src/touch.c	Thu Jan 21 05:49:41 2010 +0000
     8.2 +++ b/Xcode-iPhoneOS/Demos/src/touch.c	Thu Jan 21 06:21:52 2010 +0000
     8.3 @@ -11,7 +11,7 @@
     8.4  #define BRUSH_SIZE 32           /* width and height of the brush */
     8.5  #define PIXELS_PER_ITERATION 5  /* number of pixels between brush blots when forming a line */
     8.6  
     8.7 -static SDL_TextureID brushID = 0;       /* texture for the brush */
     8.8 +static SDL_Texture *brush = 0;       /* texture for the brush */
     8.9  
    8.10  /*
    8.11  	draws a line from (startx, starty) to (startx + dx, starty + dy)
    8.12 @@ -43,7 +43,7 @@
    8.13          x += dx_prime;
    8.14          y += dy_prime;
    8.15          /* draw brush blot */
    8.16 -        SDL_RenderCopy(brushID, NULL, &dstRect);
    8.17 +        SDL_RenderCopy(brush, NULL, &dstRect);
    8.18      }
    8.19  }
    8.20  
    8.21 @@ -58,16 +58,16 @@
    8.22      if (bmp_surface == NULL) {
    8.23          fatalError("could not load stroke.bmp");
    8.24      }
    8.25 -    brushID =
    8.26 +    brush =
    8.27          SDL_CreateTextureFromSurface(SDL_PIXELFORMAT_ABGR8888, bmp_surface);
    8.28      SDL_FreeSurface(bmp_surface);
    8.29 -    if (brushID == 0) {
    8.30 +    if (brush == 0) {
    8.31          fatalError("could not create brush texture");
    8.32      }
    8.33      /* additive blending -- laying strokes on top of eachother makes them brighter */
    8.34 -    SDL_SetTextureBlendMode(brushID, SDL_BLENDMODE_ADD);
    8.35 +    SDL_SetTextureBlendMode(brush, SDL_BLENDMODE_ADD);
    8.36      /* set brush color (red) */
    8.37 -    SDL_SetTextureColorMod(brushID, 255, 100, 100);
    8.38 +    SDL_SetTextureColorMod(brush, 255, 100, 100);
    8.39  }
    8.40  
    8.41  int
    8.42 @@ -77,7 +77,7 @@
    8.43      int x, y, dx, dy;           /* mouse location          */
    8.44      Uint8 state;                /* mouse (touch) state */
    8.45      SDL_Event event;
    8.46 -    SDL_WindowID windowID;      /* main window */
    8.47 +    SDL_Window *window;         /* main window */
    8.48      int done;                   /* does user want to quit? */
    8.49  
    8.50      /* initialize SDL */
    8.51 @@ -86,10 +86,10 @@
    8.52      }
    8.53  
    8.54      /* create main window and renderer */
    8.55 -    windowID = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    8.56 +    window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    8.57                                  SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN |
    8.58                                  SDL_WINDOW_BORDERLESS);
    8.59 -    SDL_CreateRenderer(windowID, 0, 0);
    8.60 +    SDL_CreateRenderer(window, 0, 0);
    8.61  
    8.62      /*load brush texture */
    8.63      initializeTexture();
    8.64 @@ -118,7 +118,7 @@
    8.65      }
    8.66  
    8.67      /* cleanup */
    8.68 -    SDL_DestroyTexture(brushID);
    8.69 +    SDL_DestroyTexture(brush);
    8.70      SDL_Quit();
    8.71  
    8.72      return 0;
     9.1 --- a/include/SDL_compat.h	Thu Jan 21 05:49:41 2010 +0000
     9.2 +++ b/include/SDL_compat.h	Thu Jan 21 06:21:52 2010 +0000
     9.3 @@ -295,6 +295,8 @@
     9.4  extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
     9.5  extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
     9.6  
     9.7 +#define SDL_TextureID SDL_Texture*
     9.8 +#define SDL_WindowID SDL_Window*
     9.9  #define SDL_RenderPoint SDL_RenderDrawPoint
    9.10  #define SDL_RenderLine SDL_RenderDrawLine
    9.11  #define SDL_RenderFill(X)  (X) ? SDL_RenderFillRect(X) : SDL_RenderClear()
    10.1 --- a/include/SDL_events.h	Thu Jan 21 05:49:41 2010 +0000
    10.2 +++ b/include/SDL_events.h	Thu Jan 21 06:21:52 2010 +0000
    10.3 @@ -127,7 +127,7 @@
    10.4  typedef struct SDL_WindowEvent
    10.5  {
    10.6      Uint8 type;             /**< ::SDL_WINDOWEVENT */
    10.7 -    SDL_WindowID windowID;  /**< The associated window */
    10.8 +    Uint32 windowID;        /**< The associated window */
    10.9      Uint8 event;            /**< ::SDL_WindowEventID */
   10.10      int data1;              /**< event dependent data */
   10.11      int data2;              /**< event dependent data */
   10.12 @@ -139,7 +139,7 @@
   10.13  typedef struct SDL_KeyboardEvent
   10.14  {
   10.15      Uint8 type;             /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
   10.16 -    SDL_WindowID windowID;  /**< The window with keyboard focus, if any */
   10.17 +    Uint32 windowID;        /**< The window with keyboard focus, if any */
   10.18      Uint8 which;            /**< The keyboard device index */
   10.19      Uint8 state;            /**< ::SDL_PRESSED or ::SDL_RELEASED */
   10.20      SDL_keysym keysym;      /**< The key that was pressed or released */
   10.21 @@ -165,7 +165,7 @@
   10.22  typedef struct SDL_TextInputEvent
   10.23  {
   10.24      Uint8 type;                               /**< ::SDL_TEXTINPUT */
   10.25 -    SDL_WindowID windowID;                    /**< The window with keyboard focus, if any */
   10.26 +    Uint32 windowID;                          /**< The window with keyboard focus, if any */
   10.27      Uint8 which;                              /**< The keyboard device index */
   10.28      char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];  /**< The input text */
   10.29  } SDL_TextInputEvent;
   10.30 @@ -176,7 +176,7 @@
   10.31  typedef struct SDL_MouseMotionEvent
   10.32  {
   10.33      Uint8 type;             /**< ::SDL_MOUSEMOTION */
   10.34 -    SDL_WindowID windowID;  /**< The window with mouse focus, if any */
   10.35 +    Uint32 windowID;        /**< The window with mouse focus, if any */
   10.36      Uint8 which;            /**< The mouse device index */
   10.37      Uint8 state;            /**< The current button state */
   10.38      int x;                  /**< X coordinate, relative to window */
   10.39 @@ -199,7 +199,7 @@
   10.40  typedef struct SDL_MouseButtonEvent
   10.41  {
   10.42      Uint8 type;             /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
   10.43 -    SDL_WindowID windowID;  /**< The window with mouse focus, if any */
   10.44 +    Uint32 windowID;        /**< The window with mouse focus, if any */
   10.45      Uint8 which;            /**< The mouse device index */
   10.46      Uint8 button;           /**< The mouse button index */
   10.47      Uint8 state;            /**< ::SDL_PRESSED or ::SDL_RELEASED */
   10.48 @@ -213,7 +213,7 @@
   10.49  typedef struct SDL_MouseWheelEvent
   10.50  {
   10.51      Uint8 type;             /**< ::SDL_MOUSEWHEEL */
   10.52 -    SDL_WindowID windowID;  /**< The window with mouse focus, if any */
   10.53 +    Uint32 windowID;        /**< The window with mouse focus, if any */
   10.54      Uint8 which;            /**< The mouse device index */
   10.55      int x;                  /**< The amount scrolled horizontally */
   10.56      int y;                  /**< The amount scrolled vertically */
   10.57 @@ -284,7 +284,7 @@
   10.58  typedef struct SDL_UserEvent
   10.59  {
   10.60      Uint8 type;             /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
   10.61 -    SDL_WindowID windowID;  /**< The associated window if any*/
   10.62 +    Uint32 windowID;        /**< The associated window if any*/
   10.63      int code;               /**< User defined event code */
   10.64      void *data1;            /**< User defined data pointer */
   10.65      void *data2;            /**< User defined data pointer */
   10.66 @@ -307,7 +307,7 @@
   10.67  typedef struct SDL_ProximityEvent
   10.68  {
   10.69      Uint8 type;
   10.70 -    SDL_WindowID windowID;  /**< The associated window */
   10.71 +    Uint32 windowID;    /**< The associated window */
   10.72      Uint8 which;
   10.73      int cursor;
   10.74      int x;
    11.1 --- a/include/SDL_mouse.h	Thu Jan 21 05:49:41 2010 +0000
    11.2 +++ b/include/SDL_mouse.h	Thu Jan 21 06:21:52 2010 +0000
    11.3 @@ -75,7 +75,7 @@
    11.4  /**
    11.5   *  \brief Get the window which currently has focus for the specified mouse.
    11.6   */
    11.7 -extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(int index);
    11.8 +extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocusWindow(int index);
    11.9  
   11.10  /**
   11.11   *  \brief Set relative mouse mode for the specified mouse.
   11.12 @@ -126,13 +126,13 @@
   11.13  /**
   11.14   *  \brief Moves the currently selected mouse to the given position within the window.
   11.15   *  
   11.16 - *  \param windowID The window to move the mouse into, or 0 for the current mouse focus
   11.17 + *  \param window The window to move the mouse into, or NULL for the current mouse focus
   11.18   *  \param x The x coordinate within the window
   11.19   *  \param y The y coordinate within the window
   11.20   *  
   11.21   *  \note This function generates a mouse motion event
   11.22   */
   11.23 -extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_WindowID windowID,
   11.24 +extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
   11.25                                                     int x, int y);
   11.26  
   11.27  /**
    12.1 --- a/include/SDL_syswm.h	Thu Jan 21 05:49:41 2010 +0000
    12.2 +++ b/include/SDL_syswm.h	Thu Jan 21 06:21:52 2010 +0000
    12.3 @@ -245,7 +245,7 @@
    12.4   *  if ( SDL_GetWindowWMInfo(&info) ) { ... }
    12.5   *  \endcode
    12.6   */
    12.7 -extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
    12.8 +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
    12.9                                                       SDL_SysWMinfo * info);
   12.10  
   12.11  
    13.1 --- a/include/SDL_video.h	Thu Jan 21 05:49:41 2010 +0000
    13.2 +++ b/include/SDL_video.h	Thu Jan 21 06:21:52 2010 +0000
    13.3 @@ -88,7 +88,8 @@
    13.4   *  \sa SDL_SetWindowTitle()
    13.5   *  \sa SDL_ShowWindow()
    13.6   */
    13.7 -typedef Uint32 SDL_WindowID;
    13.8 +struct SDL_Window;
    13.9 +typedef struct SDL_Window SDL_Window;
   13.10  
   13.11  /**
   13.12   *  \brief The flags on a window
   13.13 @@ -248,7 +249,8 @@
   13.14  /**
   13.15   *  \brief An efficient driver-specific representation of pixel data
   13.16   */
   13.17 -typedef Uint32 SDL_TextureID;
   13.18 +struct SDL_Texture;
   13.19 +typedef struct SDL_Texture SDL_Texture;
   13.20  
   13.21  /**
   13.22   *  \brief An opaque handle to an OpenGL context.
   13.23 @@ -449,7 +451,7 @@
   13.24   *  \sa SDL_GetWindowDisplayMode()
   13.25   *  \sa SDL_SetWindowFullscreen()
   13.26   */
   13.27 -extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_WindowID windowID,
   13.28 +extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
   13.29                                                       const SDL_DisplayMode
   13.30                                                           * mode);
   13.31  
   13.32 @@ -460,7 +462,7 @@
   13.33   *  \sa SDL_SetWindowDisplayMode()
   13.34   *  \sa SDL_SetWindowFullscreen()
   13.35   */
   13.36 -extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_WindowID windowID,
   13.37 +extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
   13.38                                                       SDL_DisplayMode * mode);
   13.39  
   13.40  /**
   13.41 @@ -551,7 +553,7 @@
   13.42   *  
   13.43   *  \sa SDL_DestroyWindow()
   13.44   */
   13.45 -extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title,
   13.46 +extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
   13.47                                                        int x, int y, int w,
   13.48                                                        int h, Uint32 flags);
   13.49  
   13.50 @@ -564,19 +566,29 @@
   13.51   *  
   13.52   *  \sa SDL_DestroyWindow()
   13.53   */
   13.54 -extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data);
   13.55 +extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
   13.56 +
   13.57 +/**
   13.58 + *  \brief Get the numeric ID of the window, for logging purposes.
   13.59 + */
   13.60 +extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
   13.61 +
   13.62 +/**
   13.63 + *  \brief Get a window from a stored ID, or NULL if it doesn't exist.
   13.64 + */
   13.65 +extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
   13.66  
   13.67  /**
   13.68   *  \brief Get the window flags.
   13.69   */
   13.70 -extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID);
   13.71 +extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
   13.72  
   13.73  /**
   13.74   *  \brief Set the title of the window, in UTF-8 format.
   13.75   *  
   13.76   *  \sa SDL_GetWindowTitle()
   13.77   */
   13.78 -extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID,
   13.79 +extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
   13.80                                                  const char *title);
   13.81  
   13.82  /**
   13.83 @@ -584,14 +596,14 @@
   13.84   *  
   13.85   *  \sa SDL_SetWindowTitle()
   13.86   */
   13.87 -extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID);
   13.88 +extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
   13.89  
   13.90  /**
   13.91   *  \brief Set the icon of the window.
   13.92   *  
   13.93   *  \param icon The icon for the window.
   13.94   */
   13.95 -extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_WindowID windowID,
   13.96 +extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
   13.97                                                 SDL_Surface * icon);
   13.98  
   13.99  /**
  13.100 @@ -599,7 +611,7 @@
  13.101   *  
  13.102   *  \sa SDL_GetWindowData()
  13.103   */
  13.104 -extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID,
  13.105 +extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_Window * window,
  13.106                                                 void *userdata);
  13.107  
  13.108  /**
  13.109 @@ -607,12 +619,12 @@
  13.110   *  
  13.111   *  \sa SDL_SetWindowData()
  13.112   */
  13.113 -extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID);
  13.114 +extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window);
  13.115  
  13.116  /**
  13.117   *  \brief Set the position of the window.
  13.118   *  
  13.119 - *  \param windowID The window to reposition.
  13.120 + *  \param window The window to reposition.
  13.121   *  \param x        The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
  13.122                      ::SDL_WINDOWPOS_UNDEFINED.
  13.123   *  \param y        The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
  13.124 @@ -622,7 +634,7 @@
  13.125   *  
  13.126   *  \sa SDL_GetWindowPosition()
  13.127   */
  13.128 -extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID,
  13.129 +extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
  13.130                                                     int x, int y);
  13.131  
  13.132  /**
  13.133 @@ -630,7 +642,7 @@
  13.134   *  
  13.135   *  \sa SDL_SetWindowPosition()
  13.136   */
  13.137 -extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID,
  13.138 +extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
  13.139                                                     int *x, int *y);
  13.140  
  13.141  /**
  13.142 @@ -641,7 +653,7 @@
  13.143   *  
  13.144   *  \sa SDL_GetWindowSize()
  13.145   */
  13.146 -extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w,
  13.147 +extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
  13.148                                                 int h);
  13.149  
  13.150  /**
  13.151 @@ -649,7 +661,7 @@
  13.152   *  
  13.153   *  \sa SDL_SetWindowSize()
  13.154   */
  13.155 -extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w,
  13.156 +extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
  13.157                                                 int *h);
  13.158  
  13.159  /**
  13.160 @@ -657,33 +669,33 @@
  13.161   *  
  13.162   *  \sa SDL_HideWindow()
  13.163   */
  13.164 -extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID);
  13.165 +extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
  13.166  
  13.167  /**
  13.168   *  \brief Hide the window.
  13.169   *  
  13.170   *  \sa SDL_ShowWindow()
  13.171   */
  13.172 -extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID);
  13.173 +extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
  13.174  
  13.175  /**
  13.176   *  \brief Raise the window above other windows and set the input focus.
  13.177   */
  13.178 -extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID);
  13.179 +extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
  13.180  
  13.181  /**
  13.182   *  \brief Make the window as large as possible.
  13.183   *  
  13.184   *  \sa SDL_RestoreWindow()
  13.185   */
  13.186 -extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID);
  13.187 +extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
  13.188  
  13.189  /**
  13.190   *  \brief Minimize the window to an iconic representation.
  13.191   *  
  13.192   *  \sa SDL_RestoreWindow()
  13.193   */
  13.194 -extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID);
  13.195 +extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
  13.196  
  13.197  /**
  13.198   *  \brief Restore the size and position of a minimized or maximized window.
  13.199 @@ -691,7 +703,7 @@
  13.200   *  \sa SDL_MaximizeWindow()
  13.201   *  \sa SDL_MinimizeWindow()
  13.202   */
  13.203 -extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID);
  13.204 +extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
  13.205  
  13.206  /**
  13.207   *  \brief Set the window's fullscreen state.
  13.208 @@ -701,7 +713,7 @@
  13.209   *  \sa SDL_SetWindowDisplayMode()
  13.210   *  \sa SDL_GetWindowDisplayMode()
  13.211   */
  13.212 -extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID,
  13.213 +extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
  13.214                                                      int fullscreen);
  13.215  
  13.216  /**
  13.217 @@ -711,7 +723,7 @@
  13.218   *  
  13.219   *  \sa SDL_GetWindowGrab()
  13.220   */
  13.221 -extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID,
  13.222 +extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
  13.223                                                 int mode);
  13.224  
  13.225  /**
  13.226 @@ -721,7 +733,7 @@
  13.227   *  
  13.228   *  \sa SDL_SetWindowGrab()
  13.229   */
  13.230 -extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID);
  13.231 +extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_Window * window);
  13.232  
  13.233  /**
  13.234   *  \brief Get driver specific information about a window.
  13.235 @@ -729,14 +741,14 @@
  13.236   *  \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
  13.237   */
  13.238  struct SDL_SysWMinfo;
  13.239 -extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
  13.240 +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
  13.241                                                       struct SDL_SysWMinfo
  13.242                                                       *info);
  13.243  
  13.244  /**
  13.245   *  \brief Destroy a window.
  13.246   */
  13.247 -extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID);
  13.248 +extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
  13.249  
  13.250  /**
  13.251   *  \brief Get the number of 2D rendering drivers available for the current 
  13.252 @@ -769,7 +781,7 @@
  13.253  /**
  13.254   *  \brief Create and make active a 2D rendering context for a window.
  13.255   *  
  13.256 - *  \param windowID The window where rendering is displayed.
  13.257 + *  \param window The window where rendering is displayed.
  13.258   *  \param index    The index of the rendering driver to initialize, or -1 to 
  13.259   *                  initialize the first one supporting the requested flags.
  13.260   *  \param flags    ::SDL_RendererFlags.
  13.261 @@ -780,7 +792,7 @@
  13.262   *  \sa SDL_GetRendererInfo()
  13.263   *  \sa SDL_DestroyRenderer()
  13.264   */
  13.265 -extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID,
  13.266 +extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_Window * window,
  13.267                                                 int index, Uint32 flags);
  13.268  
  13.269  /**
  13.270 @@ -789,7 +801,7 @@
  13.271   *  \return 0 on success, -1 if the selected window doesn't have a
  13.272   *          rendering context.
  13.273   */
  13.274 -extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID);
  13.275 +extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_Window * window);
  13.276  
  13.277  /**
  13.278   *  \brief Get information about the current rendering context.
  13.279 @@ -811,7 +823,7 @@
  13.280   *  \sa SDL_QueryTexture()
  13.281   *  \sa SDL_DestroyTexture()
  13.282   */
  13.283 -extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format,
  13.284 +extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(Uint32 format,
  13.285                                                          int access, int w,
  13.286                                                          int h);
  13.287  
  13.288 @@ -830,7 +842,7 @@
  13.289   *  \sa SDL_QueryTexture()
  13.290   *  \sa SDL_DestroyTexture()
  13.291   */
  13.292 -extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32
  13.293 +extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(Uint32
  13.294                                                                     format,
  13.295                                                                     SDL_Surface
  13.296                                                                     * surface);
  13.297 @@ -838,7 +850,7 @@
  13.298  /**
  13.299   *  \brief Query the attributes of a texture
  13.300   *  
  13.301 - *  \param textureID A texture to be queried.
  13.302 + *  \param texture A texture to be queried.
  13.303   *  \param format  A pointer filled in with the raw format of the texture.  The 
  13.304   *                 actual format may differ, but pixel transfers will use this 
  13.305   *                 format.
  13.306 @@ -848,7 +860,7 @@
  13.307   *  
  13.308   *  \return 0 on success, or -1 if the texture is not valid.
  13.309   */
  13.310 -extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID,
  13.311 +extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
  13.312                                               Uint32 * format, int *access,
  13.313                                               int *w, int *h);
  13.314  
  13.315 @@ -856,7 +868,7 @@
  13.316   *  \brief Query the pixels of a texture, if the texture does not need to be 
  13.317   *         locked for pixel access.
  13.318   *  
  13.319 - *  \param textureID A texture to be queried, which was created with 
  13.320 + *  \param texture A texture to be queried, which was created with 
  13.321   *                   ::SDL_TEXTUREACCESS_STREAMING.
  13.322   *  \param pixels    A pointer filled with a pointer to the pixels for the 
  13.323   *                   texture.
  13.324 @@ -865,13 +877,13 @@
  13.325   *  \return 0 on success, or -1 if the texture is not valid, or must be locked 
  13.326   *          for pixel access.
  13.327   */
  13.328 -extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID,
  13.329 +extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_Texture * texture,
  13.330                                                     void **pixels, int *pitch);
  13.331  
  13.332  /**
  13.333   *  \brief Set the color palette of an indexed texture.
  13.334   *  
  13.335 - *  \param textureID  The texture to update.
  13.336 + *  \param texture  The texture to update.
  13.337   *  \param colors     The array of RGB color data.
  13.338   *  \param firstcolor The first index to update.
  13.339   *  \param ncolors    The number of palette entries to fill with the color data.
  13.340 @@ -879,7 +891,7 @@
  13.341   *  \return 0 on success, or -1 if the texture is not valid or not an indexed 
  13.342   *          texture.
  13.343   */
  13.344 -extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID,
  13.345 +extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_Texture * texture,
  13.346                                                    const SDL_Color * colors,
  13.347                                                    int firstcolor,
  13.348                                                    int ncolors);
  13.349 @@ -887,7 +899,7 @@
  13.350  /**
  13.351   *  \brief Get the color palette from an indexed texture if it has one.
  13.352   *  
  13.353 - *  \param textureID  The texture to update.
  13.354 + *  \param texture  The texture to update.
  13.355   *  \param colors     The array to fill with RGB color data.
  13.356   *  \param firstcolor The first index to retrieve.
  13.357   *  \param ncolors    The number of palette entries to retrieve.
  13.358 @@ -895,7 +907,7 @@
  13.359   *  \return 0 on success, or -1 if the texture is not valid or not an indexed 
  13.360   *          texture.
  13.361   */
  13.362 -extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID,
  13.363 +extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_Texture * texture,
  13.364                                                    SDL_Color * colors,
  13.365                                                    int firstcolor,
  13.366                                                    int ncolors);
  13.367 @@ -903,7 +915,7 @@
  13.368  /**
  13.369   *  \brief Set an additional color value used in render copy operations.
  13.370   *  
  13.371 - *  \param textureID The texture to update.
  13.372 + *  \param texture The texture to update.
  13.373   *  \param r       The red source color value multiplied into copy operations.
  13.374   *  \param g       The green source color value multiplied into copy operations.
  13.375   *  \param b       The blue source color value multiplied into copy operations.
  13.376 @@ -913,14 +925,14 @@
  13.377   *  
  13.378   *  \sa SDL_GetTextureColorMod()
  13.379   */
  13.380 -extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_TextureID textureID,
  13.381 +extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
  13.382                                                     Uint8 r, Uint8 g, Uint8 b);
  13.383  
  13.384  
  13.385  /**
  13.386   *  \brief Get the additional color value used in render copy operations.
  13.387   *  
  13.388 - *  \param textureID The texture to query.
  13.389 + *  \param texture The texture to query.
  13.390   *  \param r         A pointer filled in with the source red color value.
  13.391   *  \param g         A pointer filled in with the source green color value.
  13.392   *  \param b         A pointer filled in with the source blue color value.
  13.393 @@ -929,14 +941,14 @@
  13.394   *  
  13.395   *  \sa SDL_SetTextureColorMod()
  13.396   */
  13.397 -extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_TextureID textureID,
  13.398 +extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
  13.399                                                     Uint8 * r, Uint8 * g,
  13.400                                                     Uint8 * b);
  13.401  
  13.402  /**
  13.403   *  \brief Set an additional alpha value used in render copy operations.
  13.404   *  
  13.405 - *  \param textureID The texture to update.
  13.406 + *  \param texture The texture to update.
  13.407   *  \param alpha     The source alpha value multiplied into copy operations.
  13.408   *  
  13.409   *  \return 0 on success, or -1 if the texture is not valid or alpha modulation 
  13.410 @@ -944,26 +956,26 @@
  13.411   *  
  13.412   *  \sa SDL_GetTextureAlphaMod()
  13.413   */
  13.414 -extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_TextureID textureID,
  13.415 +extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
  13.416                                                     Uint8 alpha);
  13.417  
  13.418  /**
  13.419   *  \brief Get the additional alpha value used in render copy operations.
  13.420   *  
  13.421 - *  \param textureID The texture to query.
  13.422 + *  \param texture The texture to query.
  13.423   *  \param alpha     A pointer filled in with the source alpha value.
  13.424   *  
  13.425   *  \return 0 on success, or -1 if the texture is not valid.
  13.426   *  
  13.427   *  \sa SDL_SetTextureAlphaMod()
  13.428   */
  13.429 -extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_TextureID textureID,
  13.430 +extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
  13.431                                                     Uint8 * alpha);
  13.432  
  13.433  /**
  13.434   *  \brief Set the blend mode used for texture copy operations.
  13.435   *  
  13.436 - *  \param textureID The texture to update.
  13.437 + *  \param texture The texture to update.
  13.438   *  \param blendMode ::SDL_BlendMode to use for texture blending.
  13.439   *  
  13.440   *  \return 0 on success, or -1 if the texture is not valid or the blend mode is
  13.441 @@ -974,26 +986,26 @@
  13.442   *  
  13.443   *  \sa SDL_GetTextureBlendMode()
  13.444   */
  13.445 -extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_TextureID textureID,
  13.446 +extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
  13.447                                                      int blendMode);
  13.448  
  13.449  /**
  13.450   *  \brief Get the blend mode used for texture copy operations.
  13.451   *  
  13.452 - *  \param textureID The texture to query.
  13.453 + *  \param texture The texture to query.
  13.454   *  \param blendMode A pointer filled in with the current blend mode.
  13.455   *  
  13.456   *  \return 0 on success, or -1 if the texture is not valid.
  13.457   *  
  13.458   *  \sa SDL_SetTextureBlendMode()
  13.459   */
  13.460 -extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_TextureID textureID,
  13.461 +extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
  13.462                                                      int *blendMode);
  13.463  
  13.464  /**
  13.465   *  \brief Set the scale mode used for texture copy operations.
  13.466   *  
  13.467 - *  \param textureID The texture to update.
  13.468 + *  \param texture The texture to update.
  13.469   *  \param scaleMode ::SDL_TextureScaleMode to use for texture scaling.
  13.470   *  
  13.471   *  \return 0 on success, or -1 if the texture is not valid or the scale mode is
  13.472 @@ -1004,26 +1016,26 @@
  13.473   *  
  13.474   *  \sa SDL_GetTextureScaleMode()
  13.475   */
  13.476 -extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_TextureID textureID,
  13.477 +extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
  13.478                                                      int scaleMode);
  13.479  
  13.480  /**
  13.481   *  \brief Get the scale mode used for texture copy operations.
  13.482   *  
  13.483 - *  \param textureID The texture to query.
  13.484 + *  \param texture The texture to query.
  13.485   *  \param scaleMode A pointer filled in with the current scale mode.
  13.486   *  
  13.487   *  \return 0 on success, or -1 if the texture is not valid.
  13.488   *  
  13.489   *  \sa SDL_SetTextureScaleMode()
  13.490   */
  13.491 -extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_TextureID textureID,
  13.492 +extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
  13.493                                                      int *scaleMode);
  13.494  
  13.495  /**
  13.496   *  \brief Update the given texture rectangle with new pixel data.
  13.497   *  
  13.498 - *  \param textureID The texture to update
  13.499 + *  \param texture The texture to update
  13.500   *  \param rect      A pointer to the rectangle of pixels to update, or NULL to 
  13.501   *                   update the entire texture.
  13.502   *  \param pixels    The raw pixel data.
  13.503 @@ -1033,14 +1045,14 @@
  13.504   *  
  13.505   *  \note This is a fairly slow function.
  13.506   */
  13.507 -extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID,
  13.508 +extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
  13.509                                                const SDL_Rect * rect,
  13.510                                                const void *pixels, int pitch);
  13.511  
  13.512  /**
  13.513   *  \brief Lock a portion of the texture for pixel access.
  13.514   *  
  13.515 - *  \param textureID The texture to lock for access, which was created with 
  13.516 + *  \param texture The texture to lock for access, which was created with 
  13.517   *                   ::SDL_TEXTUREACCESS_STREAMING.
  13.518   *  \param rect      A pointer to the rectangle to lock for access. If the rect 
  13.519   *                   is NULL, the entire texture will be locked.
  13.520 @@ -1056,7 +1068,7 @@
  13.521   *  \sa SDL_DirtyTexture()
  13.522   *  \sa SDL_UnlockTexture()
  13.523   */
  13.524 -extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID,
  13.525 +extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
  13.526                                              const SDL_Rect * rect,
  13.527                                              int markDirty, void **pixels,
  13.528                                              int *pitch);
  13.529 @@ -1067,12 +1079,12 @@
  13.530   *  \sa SDL_LockTexture()
  13.531   *  \sa SDL_DirtyTexture()
  13.532   */
  13.533 -extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID);
  13.534 +extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
  13.535  
  13.536  /**
  13.537   *  \brief Mark the specified rectangles of the texture as dirty.
  13.538   *  
  13.539 - *  \param textureID The texture to mark dirty, which was created with 
  13.540 + *  \param texture The texture to mark dirty, which was created with 
  13.541   *                   ::SDL_TEXTUREACCESS_STREAMING.
  13.542   *  \param numrects  The number of rectangles pointed to by rects.
  13.543   *  \param rects     The pointer to an array of dirty rectangles.
  13.544 @@ -1080,7 +1092,7 @@
  13.545   *  \sa SDL_LockTexture()
  13.546   *  \sa SDL_UnlockTexture()
  13.547   */
  13.548 -extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID,
  13.549 +extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_Texture * texture,
  13.550                                                int numrects,
  13.551                                                const SDL_Rect * rects);
  13.552  
  13.553 @@ -1228,7 +1240,7 @@
  13.554  /**
  13.555   *  \brief Copy a portion of the texture to the current rendering target.
  13.556   *  
  13.557 - *  \param textureID The source texture.
  13.558 + *  \param texture The source texture.
  13.559   *  \param srcrect   A pointer to the source rectangle, or NULL for the entire 
  13.560   *                   texture.
  13.561   *  \param dstrect   A pointer to the destination rectangle, or NULL for the 
  13.562 @@ -1237,7 +1249,7 @@
  13.563   *  \return 0 on success, or -1 if there is no rendering context current, or the
  13.564   *          driver doesn't support the requested operation.
  13.565   */
  13.566 -extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID,
  13.567 +extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Texture * texture,
  13.568                                             const SDL_Rect * srcrect,
  13.569                                             const SDL_Rect * dstrect);
  13.570  
  13.571 @@ -1289,7 +1301,7 @@
  13.572   *  \sa SDL_CreateTexture()
  13.573   *  \sa SDL_CreateTextureFromSurface()
  13.574   */
  13.575 -extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID);
  13.576 +extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
  13.577  
  13.578  /**
  13.579   *  \brief Destroy the rendering context for a window and free associated
  13.580 @@ -1297,7 +1309,7 @@
  13.581   *  
  13.582   *  \sa SDL_CreateRenderer()
  13.583   */
  13.584 -extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID);
  13.585 +extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Window * window);
  13.586  
  13.587  /**
  13.588   *  \brief Returns whether the screensaver is currently enabled (default off).
  13.589 @@ -1384,15 +1396,15 @@
  13.590   *  
  13.591   *  \sa SDL_GL_DeleteContext()
  13.592   */
  13.593 -extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID
  13.594 -                                                           windowID);
  13.595 +extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
  13.596 +                                                           window);
  13.597  
  13.598  /**
  13.599   *  \brief Set up an OpenGL context for rendering into an OpenGL window.
  13.600   *  
  13.601   *  \note The context must have been created with a compatible window.
  13.602   */
  13.603 -extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID,
  13.604 +extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
  13.605                                                 SDL_GLContext context);
  13.606  
  13.607  /**
  13.608 @@ -1422,7 +1434,7 @@
  13.609   * \brief Swap the OpenGL buffers for the window, if double-buffering is 
  13.610   *        supported.
  13.611   */
  13.612 -extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_WindowID windowID);
  13.613 +extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
  13.614  
  13.615  /**
  13.616   *  \brief Delete an OpenGL context.
    14.1 --- a/src/SDL_assert.c	Thu Jan 21 05:49:41 2010 +0000
    14.2 +++ b/src/SDL_assert.c	Thu Jan 21 06:21:52 2010 +0000
    14.3 @@ -265,7 +265,7 @@
    14.4  {
    14.5      const char *envr;
    14.6      SDL_assert_state state = SDL_ASSERTION_ABORT;
    14.7 -    SDL_WindowID window;
    14.8 +    SDL_Window *window;
    14.9  
   14.10      (void) userdata;  /* unused in default handler. */
   14.11  
    15.1 --- a/src/SDL_compat.c	Thu Jan 21 05:49:41 2010 +0000
    15.2 +++ b/src/SDL_compat.c	Thu Jan 21 06:21:52 2010 +0000
    15.3 @@ -30,9 +30,9 @@
    15.4  #include "video/SDL_pixels_c.h"
    15.5  #include "video/SDL_yuv_sw_c.h"
    15.6  
    15.7 -static SDL_WindowID SDL_VideoWindow = 0;
    15.8 +static SDL_Window *SDL_VideoWindow = NULL;
    15.9  static SDL_RendererInfo SDL_VideoRendererInfo;
   15.10 -static SDL_TextureID SDL_VideoTexture = 0;
   15.11 +static SDL_Texture *SDL_VideoTexture = NULL;
   15.12  static SDL_Surface *SDL_VideoSurface = NULL;
   15.13  static SDL_Surface *SDL_ShadowSurface = NULL;
   15.14  static SDL_Surface *SDL_PublicSurface = NULL;
   15.15 @@ -294,7 +294,7 @@
   15.16                  button = SDL_BUTTON_WHEELDOWN;
   15.17              }
   15.18  
   15.19 -            fake.button.which = event->wheel.windowID;
   15.20 +            fake.button.which = event->wheel.which;
   15.21              fake.button.button = button;
   15.22              fake.button.x = x;
   15.23              fake.button.y = y;
   15.24 @@ -357,7 +357,7 @@
   15.25  }
   15.26  
   15.27  static SDL_Surface *
   15.28 -CreateVideoSurface(SDL_TextureID textureID)
   15.29 +CreateVideoSurface(SDL_Texture * texture)
   15.30  {
   15.31      SDL_Surface *surface;
   15.32      Uint32 format;
   15.33 @@ -367,7 +367,7 @@
   15.34      void *pixels;
   15.35      int pitch;
   15.36  
   15.37 -    if (SDL_QueryTexture(textureID, &format, NULL, &w, &h) < 0) {
   15.38 +    if (SDL_QueryTexture(texture, &format, NULL, &w, &h) < 0) {
   15.39          return NULL;
   15.40      }
   15.41  
   15.42 @@ -377,7 +377,7 @@
   15.43          return NULL;
   15.44      }
   15.45  
   15.46 -    if (SDL_QueryTexturePixels(textureID, &pixels, &pitch) == 0) {
   15.47 +    if (SDL_QueryTexturePixels(texture, &pixels, &pitch) == 0) {
   15.48          surface =
   15.49              SDL_CreateRGBSurfaceFrom(pixels, w, h, bpp, pitch, Rmask, Gmask,
   15.50                                       Bmask, Amask);
   15.51 @@ -1504,7 +1504,7 @@
   15.52  
   15.53      SDL_SW_YUVTexture *sw;
   15.54  
   15.55 -    SDL_TextureID textureID;
   15.56 +    SDL_Texture *texture;
   15.57      Uint32 texture_format;
   15.58  };
   15.59  
   15.60 @@ -1585,9 +1585,9 @@
   15.61          break;
   15.62      }
   15.63  
   15.64 -    overlay->hwdata->textureID =
   15.65 +    overlay->hwdata->texture =
   15.66          SDL_CreateTexture(texture_format, SDL_TEXTUREACCESS_STREAMING, w, h);
   15.67 -    if (overlay->hwdata->textureID) {
   15.68 +    if (overlay->hwdata->texture) {
   15.69          overlay->hwdata->sw = NULL;
   15.70      } else {
   15.71          SDL_DisplayMode current_mode;
   15.72 @@ -1601,11 +1601,11 @@
   15.73          /* Create a supported RGB format texture for display */
   15.74          SDL_GetCurrentDisplayMode(&current_mode);
   15.75          texture_format = current_mode.format;
   15.76 -        overlay->hwdata->textureID =
   15.77 +        overlay->hwdata->texture =
   15.78              SDL_CreateTexture(texture_format,
   15.79                                SDL_TEXTUREACCESS_STREAMING, w, h);
   15.80      }
   15.81 -    if (!overlay->hwdata->textureID) {
   15.82 +    if (!overlay->hwdata->texture) {
   15.83          SDL_FreeYUVOverlay(overlay);
   15.84          return NULL;
   15.85      }
   15.86 @@ -1631,7 +1631,7 @@
   15.87          }
   15.88      } else {
   15.89          if (SDL_LockTexture
   15.90 -            (overlay->hwdata->textureID, NULL, 1, &pixels, &pitch)
   15.91 +            (overlay->hwdata->texture, NULL, 1, &pixels, &pitch)
   15.92              < 0) {
   15.93              return -1;
   15.94          }
   15.95 @@ -1666,7 +1666,7 @@
   15.96          void *pixels;
   15.97          int pitch;
   15.98          if (SDL_LockTexture
   15.99 -            (overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) == 0) {
  15.100 +            (overlay->hwdata->texture, NULL, 1, &pixels, &pitch) == 0) {
  15.101              SDL_Rect srcrect;
  15.102  
  15.103              srcrect.x = 0;
  15.104 @@ -1676,10 +1676,10 @@
  15.105              SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect,
  15.106                                  overlay->hwdata->texture_format,
  15.107                                  overlay->w, overlay->h, pixels, pitch);
  15.108 -            SDL_UnlockTexture(overlay->hwdata->textureID);
  15.109 +            SDL_UnlockTexture(overlay->hwdata->texture);
  15.110          }
  15.111      } else {
  15.112 -        SDL_UnlockTexture(overlay->hwdata->textureID);
  15.113 +        SDL_UnlockTexture(overlay->hwdata->texture);
  15.114      }
  15.115  }
  15.116  
  15.117 @@ -1690,7 +1690,7 @@
  15.118          SDL_SetError("Passed a NULL overlay or dstrect");
  15.119          return -1;
  15.120      }
  15.121 -    if (SDL_RenderCopy(overlay->hwdata->textureID, NULL, dstrect) < 0) {
  15.122 +    if (SDL_RenderCopy(overlay->hwdata->texture, NULL, dstrect) < 0) {
  15.123          return -1;
  15.124      }
  15.125      SDL_RenderPresent();
  15.126 @@ -1704,8 +1704,8 @@
  15.127          return;
  15.128      }
  15.129      if (overlay->hwdata) {
  15.130 -        if (overlay->hwdata->textureID) {
  15.131 -            SDL_DestroyTexture(overlay->hwdata->textureID);
  15.132 +        if (overlay->hwdata->texture) {
  15.133 +            SDL_DestroyTexture(overlay->hwdata->texture);
  15.134          }
  15.135          SDL_free(overlay->hwdata);
  15.136      }
    16.1 --- a/src/events/SDL_keyboard.c	Thu Jan 21 05:49:41 2010 +0000
    16.2 +++ b/src/events/SDL_keyboard.c	Thu Jan 21 06:21:52 2010 +0000
    16.3 @@ -646,7 +646,7 @@
    16.4  }
    16.5  
    16.6  void
    16.7 -SDL_SetKeyboardFocus(int index, SDL_WindowID windowID)
    16.8 +SDL_SetKeyboardFocus(int index, SDL_Window * window)
    16.9  {
   16.10      SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
   16.11      int i;
   16.12 @@ -657,7 +657,7 @@
   16.13      }
   16.14  
   16.15      /* See if the current window has lost focus */
   16.16 -    if (keyboard->focus && keyboard->focus != windowID) {
   16.17 +    if (keyboard->focus && keyboard->focus != window) {
   16.18          focus = SDL_FALSE;
   16.19          for (i = 0; i < SDL_num_keyboards; ++i) {
   16.20              if (i != index) {
   16.21 @@ -674,7 +674,7 @@
   16.22          }
   16.23      }
   16.24  
   16.25 -    keyboard->focus = windowID;
   16.26 +    keyboard->focus = window;
   16.27  
   16.28      if (keyboard->focus) {
   16.29          SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
   16.30 @@ -809,7 +809,7 @@
   16.31          event.key.keysym.sym = keyboard->keymap[scancode];
   16.32          event.key.keysym.mod = modstate;
   16.33          event.key.keysym.unicode = 0;
   16.34 -        event.key.windowID = keyboard->focus;
   16.35 +        event.key.windowID = keyboard->focus->id;
   16.36          posted = (SDL_PushEvent(&event) > 0);
   16.37      }
   16.38      return (posted);
   16.39 @@ -832,7 +832,7 @@
   16.40          event.text.type = SDL_TEXTINPUT;
   16.41          event.text.which = (Uint8) index;
   16.42          SDL_strlcpy(event.text.text, text, SDL_arraysize(event.text.text));
   16.43 -        event.text.windowID = keyboard->focus;
   16.44 +        event.text.windowID = keyboard->focus->id;
   16.45          posted = (SDL_PushEvent(&event) > 0);
   16.46      }
   16.47      return (posted);
    17.1 --- a/src/events/SDL_keyboard_c.h	Thu Jan 21 05:49:41 2010 +0000
    17.2 +++ b/src/events/SDL_keyboard_c.h	Thu Jan 21 06:21:52 2010 +0000
    17.3 @@ -35,7 +35,7 @@
    17.4      void (*FreeKeyboard) (SDL_Keyboard * keyboard);
    17.5  
    17.6      /* Data common to all keyboards */
    17.7 -    SDL_WindowID focus;
    17.8 +    SDL_Window *focus;
    17.9      Uint16 modstate;
   17.10      Uint8 keystate[SDL_NUM_SCANCODES];
   17.11      SDLKey keymap[SDL_NUM_SCANCODES];
   17.12 @@ -73,7 +73,7 @@
   17.13  extern void SDL_SetScancodeName(SDL_scancode scancode, const char *name);
   17.14  
   17.15  /* Set the keyboard focus window */
   17.16 -extern void SDL_SetKeyboardFocus(int index, SDL_WindowID windowID);
   17.17 +extern void SDL_SetKeyboardFocus(int index, SDL_Window * window);
   17.18  
   17.19  /* Send a keyboard event for a keyboard at an index */
   17.20  extern int SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode);
    18.1 --- a/src/events/SDL_mouse.c	Thu Jan 21 05:49:41 2010 +0000
    18.2 +++ b/src/events/SDL_mouse.c	Thu Jan 21 06:21:52 2010 +0000
    18.3 @@ -26,6 +26,7 @@
    18.4  #include "SDL_events.h"
    18.5  #include "SDL_events_c.h"
    18.6  #include "default_cursor.h"
    18.7 +#include "../video/SDL_sysvideo.h"
    18.8  
    18.9  
   18.10  static int SDL_num_mice = 0;
   18.11 @@ -190,7 +191,7 @@
   18.12      return SDL_current_mouse;
   18.13  }
   18.14  
   18.15 -SDL_WindowID
   18.16 +SDL_Window *
   18.17  SDL_GetMouseFocusWindow(int index)
   18.18  {
   18.19      SDL_Mouse *mouse = SDL_GetMouse(index);
   18.20 @@ -302,14 +303,14 @@
   18.21  }
   18.22  
   18.23  void
   18.24 -SDL_SetMouseFocus(int id, SDL_WindowID windowID)
   18.25 +SDL_SetMouseFocus(int id, SDL_Window * window)
   18.26  {
   18.27      int index = SDL_GetMouseIndexId(id);
   18.28      SDL_Mouse *mouse = SDL_GetMouse(index);
   18.29      int i;
   18.30      SDL_bool focus;
   18.31  
   18.32 -    if (!mouse || (mouse->focus == windowID)) {
   18.33 +    if (!mouse || (mouse->focus == window)) {
   18.34          return;
   18.35      }
   18.36  
   18.37 @@ -331,7 +332,7 @@
   18.38          }
   18.39      }
   18.40  
   18.41 -    mouse->focus = windowID;
   18.42 +    mouse->focus = window;
   18.43  
   18.44      if (mouse->focus) {
   18.45          focus = SDL_FALSE;
   18.46 @@ -372,7 +373,7 @@
   18.47          event.proximity.cursor = mouse->current_end;
   18.48          event.proximity.type = type;
   18.49          /* FIXME: is this right? */
   18.50 -        event.proximity.windowID = mouse->focus;
   18.51 +        event.proximity.windowID = mouse->focus->id;
   18.52          posted = (SDL_PushEvent(&event) > 0);
   18.53          if (type == SDL_PROXIMITYIN) {
   18.54              mouse->proximity = SDL_TRUE;
   18.55 @@ -478,7 +479,7 @@
   18.56          event.motion.cursor = mouse->current_end;
   18.57          event.motion.xrel = xrel;
   18.58          event.motion.yrel = yrel;
   18.59 -        event.motion.windowID = mouse->focus;
   18.60 +        event.motion.windowID = mouse->focus->id;
   18.61          posted = (SDL_PushEvent(&event) > 0);
   18.62      }
   18.63      mouse->last_x = mouse->x;
   18.64 @@ -531,7 +532,7 @@
   18.65          event.button.button = button;
   18.66          event.button.x = mouse->x;
   18.67          event.button.y = mouse->y;
   18.68 -        event.button.windowID = mouse->focus;
   18.69 +        event.button.windowID = mouse->focus->id;
   18.70          posted = (SDL_PushEvent(&event) > 0);
   18.71      }
   18.72      return posted;
   18.73 @@ -555,14 +556,14 @@
   18.74          event.wheel.which = (Uint8) index;
   18.75          event.wheel.x = x;
   18.76          event.wheel.y = y;
   18.77 -        event.wheel.windowID = mouse->focus;
   18.78 +        event.wheel.windowID = mouse->focus->id;
   18.79          posted = (SDL_PushEvent(&event) > 0);
   18.80      }
   18.81      return posted;
   18.82  }
   18.83  
   18.84  void
   18.85 -SDL_WarpMouseInWindow(SDL_WindowID windowID, int x, int y)
   18.86 +SDL_WarpMouseInWindow(SDL_Window * window, int x, int y)
   18.87  {
   18.88      SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
   18.89  
   18.90 @@ -571,9 +572,9 @@
   18.91      }
   18.92  
   18.93      if (mouse->WarpMouse) {
   18.94 -        mouse->WarpMouse(mouse, windowID, x, y);
   18.95 +        mouse->WarpMouse(mouse, window, x, y);
   18.96      } else {
   18.97 -        SDL_SetMouseFocus(SDL_current_mouse, windowID);
   18.98 +        SDL_SetMouseFocus(SDL_current_mouse, window);
   18.99          SDL_SendMouseMotion(SDL_current_mouse, 0, x, y, 0);
  18.100      }
  18.101  }
    19.1 --- a/src/events/SDL_mouse_c.h	Thu Jan 21 05:49:41 2010 +0000
    19.2 +++ b/src/events/SDL_mouse_c.h	Thu Jan 21 06:21:52 2010 +0000
    19.3 @@ -48,7 +48,7 @@
    19.4      void (*FreeCursor) (SDL_Cursor * cursor);
    19.5  
    19.6      /* Warp the mouse to (x,y) */
    19.7 -    void (*WarpMouse) (SDL_Mouse * mouse, SDL_WindowID windowID, int x,
    19.8 +    void (*WarpMouse) (SDL_Mouse * mouse, SDL_Window * window, int x,
    19.9                         int y);
   19.10  
   19.11      /* Free the mouse when it's time */
   19.12 @@ -65,7 +65,7 @@
   19.13  
   19.14      /* Data common to all mice */
   19.15      int id;
   19.16 -    SDL_WindowID focus;
   19.17 +    SDL_Window *focus;
   19.18      int which;
   19.19      int x;
   19.20      int y;
   19.21 @@ -106,7 +106,7 @@
   19.22  extern void SDL_ResetMouse(int index);
   19.23  
   19.24  /* Set the mouse focus window */
   19.25 -extern void SDL_SetMouseFocus(int id, SDL_WindowID windowID);
   19.26 +extern void SDL_SetMouseFocus(int id, SDL_Window * window);
   19.27  
   19.28  /* Send a mouse motion event for a mouse */
   19.29  extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z);
    20.1 --- a/src/events/SDL_windowevents.c	Thu Jan 21 05:49:41 2010 +0000
    20.2 +++ b/src/events/SDL_windowevents.c	Thu Jan 21 06:21:52 2010 +0000
    20.3 @@ -44,13 +44,11 @@
    20.4  }
    20.5  
    20.6  int
    20.7 -SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent, int data1,
    20.8 +SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
    20.9                      int data2)
   20.10  {
   20.11      int posted;
   20.12 -    SDL_Window *window;
   20.13  
   20.14 -    window = SDL_GetWindowFromID(windowID);
   20.15      if (!window) {
   20.16          return 0;
   20.17      }
   20.18 @@ -152,7 +150,7 @@
   20.19          event.window.event = windowevent;
   20.20          event.window.data1 = data1;
   20.21          event.window.data2 = data2;
   20.22 -        event.window.windowID = windowID;
   20.23 +        event.window.windowID = window->id;
   20.24  
   20.25          /* Fixes queue overflow with resize events that aren't processed */
   20.26          if (windowevent == SDL_WINDOWEVENT_RESIZED) {
    21.1 --- a/src/events/SDL_windowevents_c.h	Thu Jan 21 05:49:41 2010 +0000
    21.2 +++ b/src/events/SDL_windowevents_c.h	Thu Jan 21 06:21:52 2010 +0000
    21.3 @@ -24,7 +24,7 @@
    21.4  #ifndef _SDL_windowevents_c_h
    21.5  #define _SDL_windowevents_c_h
    21.6  
    21.7 -extern int SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent,
    21.8 +extern int SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent,
    21.9                                 int data1, int data2);
   21.10  
   21.11  #endif /* _SDL_windowevents_c_h */
    22.1 --- a/src/video/SDL_gamma.c	Thu Jan 21 05:49:41 2010 +0000
    22.2 +++ b/src/video/SDL_gamma.c	Thu Jan 21 06:21:52 2010 +0000
    22.3 @@ -171,7 +171,7 @@
    22.4          SDL_UninitializedVideo();
    22.5          return -1;
    22.6      }
    22.7 -    return SDL_SetGammaRampForDisplay(&SDL_CurrentDisplay, red, green, blue);
    22.8 +    return SDL_SetGammaRampForDisplay(SDL_CurrentDisplay, red, green, blue);
    22.9  }
   22.10  
   22.11  int
   22.12 @@ -230,7 +230,7 @@
   22.13          SDL_UninitializedVideo();
   22.14          return -1;
   22.15      }
   22.16 -    return SDL_GetGammaRampForDisplay(&SDL_CurrentDisplay, red, green, blue);
   22.17 +    return SDL_GetGammaRampForDisplay(SDL_CurrentDisplay, red, green, blue);
   22.18  }
   22.19  
   22.20  /* vi: set ts=4 sw=4 expandtab: */
    23.1 --- a/src/video/SDL_renderer_gl.c	Thu Jan 21 05:49:41 2010 +0000
    23.2 +++ b/src/video/SDL_renderer_gl.c	Thu Jan 21 06:21:52 2010 +0000
    23.3 @@ -321,7 +321,7 @@
    23.4      renderer->DestroyTexture = GL_DestroyTexture;
    23.5      renderer->DestroyRenderer = GL_DestroyRenderer;
    23.6      renderer->info = GL_RenderDriver.info;
    23.7 -    renderer->window = window->id;
    23.8 +    renderer->window = window;
    23.9      renderer->driverdata = data;
   23.10  
   23.11      renderer->info.flags =
   23.12 @@ -332,12 +332,12 @@
   23.13          return NULL;
   23.14      }
   23.15  
   23.16 -    data->context = SDL_GL_CreateContext(window->id);
   23.17 +    data->context = SDL_GL_CreateContext(window);
   23.18      if (!data->context) {
   23.19          GL_DestroyRenderer(renderer);
   23.20          return NULL;
   23.21      }
   23.22 -    if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
   23.23 +    if (SDL_GL_MakeCurrent(window, data->context) < 0) {
   23.24          GL_DestroyRenderer(renderer);
   23.25          return NULL;
   23.26      }
   23.27 @@ -442,9 +442,9 @@
   23.28  GL_ActivateRenderer(SDL_Renderer * renderer)
   23.29  {
   23.30      GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
   23.31 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   23.32 +    SDL_Window *window = renderer->window;
   23.33  
   23.34 -    if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
   23.35 +    if (SDL_GL_MakeCurrent(window, data->context) < 0) {
   23.36          return -1;
   23.37      }
   23.38      if (data->updateSize) {
   23.39 @@ -752,7 +752,7 @@
   23.40  GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   23.41  {
   23.42      GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
   23.43 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   23.44 +    SDL_Window *window = renderer->window;
   23.45      GL_TextureData *data;
   23.46      GLint internalFormat;
   23.47      GLenum format, type;
   23.48 @@ -1407,7 +1407,7 @@
   23.49                      Uint32 pixel_format, void * pixels, int pitch)
   23.50  {
   23.51      GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
   23.52 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   23.53 +    SDL_Window *window = renderer->window;
   23.54      GLint internalFormat;
   23.55      GLenum format, type;
   23.56      Uint8 *src, *dst, *tmp;
   23.57 @@ -1454,7 +1454,7 @@
   23.58                       Uint32 pixel_format, const void * pixels, int pitch)
   23.59  {
   23.60      GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
   23.61 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   23.62 +    SDL_Window *window = renderer->window;
   23.63      GLint internalFormat;
   23.64      GLenum format, type;
   23.65      Uint8 *src, *dst, *tmp;
    24.1 --- a/src/video/SDL_renderer_gles.c	Thu Jan 21 05:49:41 2010 +0000
    24.2 +++ b/src/video/SDL_renderer_gles.c	Thu Jan 21 06:21:52 2010 +0000
    24.3 @@ -332,7 +332,7 @@
    24.4  {
    24.5  
    24.6      GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
    24.7 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
    24.8 +    SDL_Window *window = renderer->window;
    24.9  
   24.10      if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
   24.11          return -1;
   24.12 @@ -872,7 +872,7 @@
   24.13  
   24.14      if (data->GL_OES_draw_texture_supported && data->useDrawTexture) {
   24.15          /* this code is a little funny because the viewport is upside down vs SDL's coordinate system */
   24.16 -        SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   24.17 +        SDL_Window *window = renderer->window;
   24.18          GLint cropRect[4];
   24.19          cropRect[0] = srcrect->x;
   24.20          cropRect[1] = srcrect->y + srcrect->h;
    25.1 --- a/src/video/SDL_renderer_sw.c	Thu Jan 21 05:49:41 2010 +0000
    25.2 +++ b/src/video/SDL_renderer_sw.c	Thu Jan 21 06:21:52 2010 +0000
    25.3 @@ -201,7 +201,7 @@
    25.4  SDL_Renderer *
    25.5  SW_CreateRenderer(SDL_Window * window, Uint32 flags)
    25.6  {
    25.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    25.8 +    SDL_VideoDisplay *display = window->display;
    25.9      SDL_DisplayMode *displayMode = &display->current_mode;
   25.10      SDL_Renderer *renderer;
   25.11      SW_RenderData *data;
   25.12 @@ -243,7 +243,7 @@
   25.13      renderer->DestroyRenderer = SW_DestroyRenderer;
   25.14      renderer->info.name = SW_RenderDriver.info.name;
   25.15      renderer->info.flags = 0;
   25.16 -    renderer->window = window->id;
   25.17 +    renderer->window = window;
   25.18      renderer->driverdata = data;
   25.19      Setup_SoftwareRenderer(renderer);
   25.20  
   25.21 @@ -321,7 +321,7 @@
   25.22  SW_ActivateRenderer(SDL_Renderer * renderer)
   25.23  {
   25.24      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   25.25 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   25.26 +    SDL_Window *window = renderer->window;
   25.27      int i, n;
   25.28  
   25.29      if (data->renderer && data->renderer->ActivateRenderer) {
   25.30 @@ -794,7 +794,7 @@
   25.31                const SDL_Rect * srcrect, const SDL_Rect * dstrect)
   25.32  {
   25.33      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   25.34 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   25.35 +    SDL_Window *window = renderer->window;
   25.36      int status;
   25.37  
   25.38      if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
   25.39 @@ -928,8 +928,8 @@
   25.40  SW_DestroyRenderer(SDL_Renderer * renderer)
   25.41  {
   25.42      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
   25.43 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   25.44 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   25.45 +    SDL_Window *window = renderer->window;
   25.46 +    SDL_VideoDisplay *display = window->display;
   25.47      int i;
   25.48  
   25.49      if (data) {
    26.1 --- a/src/video/SDL_sysvideo.h	Thu Jan 21 05:49:41 2010 +0000
    26.2 +++ b/src/video/SDL_sysvideo.h	Thu Jan 21 06:21:52 2010 +0000
    26.3 @@ -29,8 +29,6 @@
    26.4  
    26.5  /* The SDL video driver */
    26.6  
    26.7 -typedef struct SDL_Window SDL_Window;
    26.8 -typedef struct SDL_Texture SDL_Texture;
    26.9  typedef struct SDL_Renderer SDL_Renderer;
   26.10  typedef struct SDL_RenderDriver SDL_RenderDriver;
   26.11  typedef struct SDL_VideoDisplay SDL_VideoDisplay;
   26.12 @@ -39,21 +37,20 @@
   26.13  /* Define the SDL texture structure */
   26.14  struct SDL_Texture
   26.15  {
   26.16 -    Uint32 id;
   26.17 -
   26.18      Uint32 format;              /**< The pixel format of the texture */
   26.19      int access;                 /**< SDL_TextureAccess */
   26.20      int w;                      /**< The width of the texture */
   26.21      int h;                      /**< The height of the texture */
   26.22      int modMode;                /**< The texture modulation mode */
   26.23 -    int blendMode;                      /**< The texture blend mode */
   26.24 -    int scaleMode;                      /**< The texture scale mode */
   26.25 -    Uint8 r, g, b, a;                   /**< Texture modulation values */
   26.26 +    int blendMode;              /**< The texture blend mode */
   26.27 +    int scaleMode;              /**< The texture scale mode */
   26.28 +    Uint8 r, g, b, a;           /**< Texture modulation values */
   26.29  
   26.30      SDL_Renderer *renderer;
   26.31  
   26.32 -    void *driverdata;                   /**< Driver specific texture representation */
   26.33 +    void *driverdata;           /**< Driver specific texture representation */
   26.34  
   26.35 +    SDL_Texture *prev;
   26.36      SDL_Texture *next;
   26.37  };
   26.38  
   26.39 @@ -118,7 +115,10 @@
   26.40      SDL_RendererInfo info;
   26.41  
   26.42      /* The window associated with the renderer */
   26.43 -    SDL_WindowID window;
   26.44 +    SDL_Window *window;
   26.45 +
   26.46 +    /* The list of textures */
   26.47 +    SDL_Texture *textures;
   26.48  
   26.49      Uint8 r, g, b, a;                   /**< Color for drawing operations values */
   26.50      int blendMode;                      /**< The drawing blend mode */
   26.51 @@ -139,19 +139,21 @@
   26.52  struct SDL_Window
   26.53  {
   26.54      Uint32 id;
   26.55 -
   26.56      char *title;
   26.57      int x, y;
   26.58      int w, h;
   26.59      Uint32 flags;
   26.60  
   26.61 -    int display;
   26.62 +    SDL_VideoDisplay *display;
   26.63      SDL_Renderer *renderer;
   26.64  
   26.65      SDL_DisplayMode fullscreen_mode;
   26.66  
   26.67      void *userdata;
   26.68      void *driverdata;
   26.69 +
   26.70 +    SDL_Window *prev;
   26.71 +    SDL_Window *next;
   26.72  };
   26.73  #define FULLSCREEN_VISIBLE(W) \
   26.74      (((W)->flags & SDL_WINDOW_FULLSCREEN) && \
   26.75 @@ -184,9 +186,6 @@
   26.76  
   26.77      SDL_Renderer *current_renderer;
   26.78  
   26.79 -    /* The hash list of textures */
   26.80 -    SDL_Texture *textures[64];
   26.81 -
   26.82      SDL_VideoDevice *device;
   26.83  
   26.84      void *driverdata;
   26.85 @@ -413,8 +412,8 @@
   26.86  extern VideoBootStrap PND_bootstrap;
   26.87  #endif
   26.88  
   26.89 -#define SDL_CurrentDisplay	(_this->displays[_this->current_display])
   26.90 -#define SDL_CurrentRenderer	(SDL_CurrentDisplay.current_renderer)
   26.91 +#define SDL_CurrentDisplay	(&_this->displays[_this->current_display])
   26.92 +#define SDL_CurrentRenderer	(SDL_CurrentDisplay->current_renderer)
   26.93  
   26.94  extern SDL_VideoDevice *SDL_GetVideoDevice();
   26.95  extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
   26.96 @@ -433,8 +432,6 @@
   26.97  extern void SDL_AddRenderDriver(SDL_VideoDisplay *display, const SDL_RenderDriver * driver);
   26.98  
   26.99  extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
  26.100 -extern SDL_Window *SDL_GetWindowFromID(SDL_WindowID windowID);
  26.101 -extern SDL_VideoDisplay *SDL_GetDisplayFromWindow(SDL_Window * window);
  26.102  
  26.103  extern void SDL_OnWindowShown(SDL_Window * window);
  26.104  extern void SDL_OnWindowHidden(SDL_Window * window);
  26.105 @@ -443,7 +440,7 @@
  26.106  extern void SDL_OnWindowRestored(SDL_Window * window);
  26.107  extern void SDL_OnWindowFocusGained(SDL_Window * window);
  26.108  extern void SDL_OnWindowFocusLost(SDL_Window * window);
  26.109 -extern SDL_WindowID SDL_GetFocusWindow(void);
  26.110 +extern SDL_Window * SDL_GetFocusWindow(void);
  26.111  
  26.112  #endif /* _SDL_sysvideo_h */
  26.113  
    27.1 --- a/src/video/SDL_video.c	Thu Jan 21 05:49:41 2010 +0000
    27.2 +++ b/src/video/SDL_video.c	Thu Jan 21 06:21:52 2010 +0000
    27.3 @@ -443,7 +443,7 @@
    27.4  SDL_GetNumDisplayModes()
    27.5  {
    27.6      if (_this) {
    27.7 -        return SDL_GetNumDisplayModesForDisplay(&SDL_CurrentDisplay);
    27.8 +        return SDL_GetNumDisplayModesForDisplay(SDL_CurrentDisplay);
    27.9      }
   27.10      return 0;
   27.11  }
   27.12 @@ -465,7 +465,7 @@
   27.13  int
   27.14  SDL_GetDisplayMode(int index, SDL_DisplayMode * mode)
   27.15  {
   27.16 -    return SDL_GetDisplayModeForDisplay(&SDL_CurrentDisplay, index, mode);
   27.17 +    return SDL_GetDisplayModeForDisplay(SDL_CurrentDisplay, index, mode);
   27.18  }
   27.19  
   27.20  int
   27.21 @@ -484,7 +484,7 @@
   27.22          SDL_UninitializedVideo();
   27.23          return -1;
   27.24      }
   27.25 -    return SDL_GetDesktopDisplayModeForDisplay(&SDL_CurrentDisplay, mode);
   27.26 +    return SDL_GetDesktopDisplayModeForDisplay(SDL_CurrentDisplay, mode);
   27.27  }
   27.28  
   27.29  int
   27.30 @@ -503,7 +503,7 @@
   27.31          SDL_UninitializedVideo();
   27.32          return -1;
   27.33      }
   27.34 -    return SDL_GetCurrentDisplayModeForDisplay(&SDL_CurrentDisplay, mode);
   27.35 +    return SDL_GetCurrentDisplayModeForDisplay(SDL_CurrentDisplay, mode);
   27.36  }
   27.37  
   27.38  SDL_DisplayMode *
   27.39 @@ -621,7 +621,7 @@
   27.40          SDL_UninitializedVideo();
   27.41          return NULL;
   27.42      }
   27.43 -    return SDL_GetClosestDisplayModeForDisplay(&SDL_CurrentDisplay, mode, closest);
   27.44 +    return SDL_GetClosestDisplayModeForDisplay(SDL_CurrentDisplay, mode, closest);
   27.45  }
   27.46  
   27.47  int
   27.48 @@ -702,14 +702,12 @@
   27.49          SDL_UninitializedVideo();
   27.50          return -1;
   27.51      }
   27.52 -    return SDL_SetDisplayModeForDisplay(&SDL_CurrentDisplay, mode);
   27.53 +    return SDL_SetDisplayModeForDisplay(SDL_CurrentDisplay, mode);
   27.54  }
   27.55  
   27.56  int
   27.57 -SDL_SetWindowDisplayMode(SDL_WindowID windowID, const SDL_DisplayMode * mode)
   27.58 +SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode)
   27.59  {
   27.60 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
   27.61 -
   27.62      if (!window) {
   27.63          return -1;
   27.64      }
   27.65 @@ -723,9 +721,8 @@
   27.66  }
   27.67  
   27.68  int
   27.69 -SDL_GetWindowDisplayMode(SDL_WindowID windowID, SDL_DisplayMode * mode)
   27.70 +SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
   27.71  {
   27.72 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
   27.73      SDL_DisplayMode fullscreen_mode;
   27.74  
   27.75      if (!window) {
   27.76 @@ -740,7 +737,7 @@
   27.77          fullscreen_mode.h = window->h;
   27.78      }
   27.79  
   27.80 -    if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayFromWindow(window),
   27.81 +    if (!SDL_GetClosestDisplayModeForDisplay(window->display,
   27.82                                               &fullscreen_mode,
   27.83                                               &fullscreen_mode)) {
   27.84          SDL_SetError("Couldn't find display mode match");
   27.85 @@ -756,7 +753,7 @@
   27.86  static void
   27.87  SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool attempt)
   27.88  {
   27.89 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   27.90 +    SDL_VideoDisplay *display = window->display;
   27.91      int i;
   27.92  
   27.93      /* See if we're already processing a window */
   27.94 @@ -772,13 +769,13 @@
   27.95          if (attempt) {
   27.96              /* We just gained some state, try to gain all states */
   27.97              if (window->flags & SDL_WINDOW_MINIMIZED) {
   27.98 -                SDL_RestoreWindow(window->id);
   27.99 +                SDL_RestoreWindow(window);
  27.100              } else {
  27.101 -                SDL_RaiseWindow(window->id);
  27.102 +                SDL_RaiseWindow(window);
  27.103              }
  27.104          } else {
  27.105              /* We just lost some state, try to release all states */
  27.106 -            SDL_MinimizeWindow(window->id);
  27.107 +            SDL_MinimizeWindow(window);
  27.108          }
  27.109      }
  27.110  
  27.111 @@ -787,7 +784,7 @@
  27.112          for (i = 0; i < display->num_windows; ++i) {
  27.113              SDL_Window *other = &display->windows[i];
  27.114              if (other != window && FULLSCREEN_VISIBLE(other)) {
  27.115 -                SDL_MinimizeWindow(other->id);
  27.116 +                SDL_MinimizeWindow(other);
  27.117              }
  27.118          }
  27.119      }
  27.120 @@ -799,7 +796,7 @@
  27.121          window = &display->windows[i];
  27.122          if (FULLSCREEN_VISIBLE(window)) {
  27.123              SDL_DisplayMode fullscreen_mode;
  27.124 -            if (SDL_GetWindowDisplayMode(window->id, &fullscreen_mode) == 0) {
  27.125 +            if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
  27.126                  SDL_SetDisplayModeForDisplay(display, &fullscreen_mode);
  27.127                  display->fullscreen_window = window;
  27.128                  return;
  27.129 @@ -840,7 +837,7 @@
  27.130          SDL_UninitializedVideo();
  27.131          return -1;
  27.132      }
  27.133 -    return SDL_SetPaletteForDisplay(&SDL_CurrentDisplay, colors, firstcolor, ncolors);
  27.134 +    return SDL_SetPaletteForDisplay(SDL_CurrentDisplay, colors, firstcolor, ncolors);
  27.135  }
  27.136  
  27.137  int
  27.138 @@ -869,10 +866,10 @@
  27.139          SDL_UninitializedVideo();
  27.140          return -1;
  27.141      }
  27.142 -    return SDL_GetPaletteForDisplay(&SDL_CurrentDisplay, colors, firstcolor, ncolors);
  27.143 +    return SDL_GetPaletteForDisplay(SDL_CurrentDisplay, colors, firstcolor, ncolors);
  27.144  }
  27.145  
  27.146 -SDL_WindowID
  27.147 +SDL_Window *
  27.148  SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
  27.149  {
  27.150      const Uint32 allowed_flags = (SDL_WINDOW_FULLSCREEN |
  27.151 @@ -881,112 +878,79 @@
  27.152                                    SDL_WINDOW_RESIZABLE |
  27.153                                    SDL_WINDOW_INPUT_GRABBED);
  27.154      SDL_VideoDisplay *display;
  27.155 -    SDL_Window window;
  27.156 -    int num_windows;
  27.157 -    SDL_Window *windows;
  27.158 +    SDL_Window *window;
  27.159  
  27.160      if (!_this) {
  27.161          /* Initialize the video system if needed */
  27.162          if (SDL_VideoInit(NULL, 0) < 0) {
  27.163 -            return 0;
  27.164 +            return NULL;
  27.165          }
  27.166      }
  27.167      if (flags & SDL_WINDOW_OPENGL) {
  27.168          if (!_this->GL_CreateContext) {
  27.169              SDL_SetError("No OpenGL support in video driver");
  27.170 -            return 0;
  27.171 +            return NULL;
  27.172          }
  27.173          SDL_GL_LoadLibrary(NULL);
  27.174      }
  27.175 -    SDL_zero(window);
  27.176 -    window.id = _this->next_object_id++;
  27.177 -    window.x = x;
  27.178 -    window.y = y;
  27.179 -    window.w = w;
  27.180 -    window.h = h;
  27.181 -    window.flags = (flags & allowed_flags);
  27.182 -    window.display = _this->current_display;
  27.183 -
  27.184 -    if (_this->CreateWindow && _this->CreateWindow(_this, &window) < 0) {
  27.185 -        if (flags & SDL_WINDOW_OPENGL) {
  27.186 -            SDL_GL_UnloadLibrary();
  27.187 -        }
  27.188 -        return 0;
  27.189 -    }
  27.190 -    display = &SDL_CurrentDisplay;
  27.191 -    num_windows = display->num_windows;
  27.192 -    windows =
  27.193 -        SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows));
  27.194 -    if (!windows) {
  27.195 -        if (_this->DestroyWindow) {
  27.196 -            _this->DestroyWindow(_this, &window);
  27.197 -        }
  27.198 -        if (flags & SDL_WINDOW_OPENGL) {
  27.199 -            SDL_GL_UnloadLibrary();
  27.200 -        }
  27.201 -        return 0;
  27.202 -    }
  27.203 -    windows[num_windows] = window;
  27.204 -    display->windows = windows;
  27.205 -    display->num_windows++;
  27.206 +    display = SDL_CurrentDisplay;
  27.207 +    window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
  27.208 +    window->id = _this->next_object_id++;
  27.209 +    window->x = x;
  27.210 +    window->y = y;
  27.211 +    window->w = w;
  27.212 +    window->h = h;
  27.213 +    window->flags = (flags & allowed_flags);
  27.214 +    window->display = display;
  27.215 +    window->next = display->windows;
  27.216 +    display->windows = window;
  27.217 +
  27.218 +    if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) {
  27.219 +        SDL_DestroyWindow(window);
  27.220 +        return NULL;
  27.221 +    }
  27.222  
  27.223      if (title) {
  27.224 -        SDL_SetWindowTitle(window.id, title);
  27.225 +        SDL_SetWindowTitle(window, title);
  27.226      }
  27.227      if (flags & SDL_WINDOW_MAXIMIZED) {
  27.228 -        SDL_MaximizeWindow(window.id);
  27.229 +        SDL_MaximizeWindow(window);
  27.230      }
  27.231      if (flags & SDL_WINDOW_MINIMIZED) {
  27.232 -        SDL_MinimizeWindow(window.id);
  27.233 +        SDL_MinimizeWindow(window);
  27.234      }
  27.235      if (flags & SDL_WINDOW_SHOWN) {
  27.236 -        SDL_ShowWindow(window.id);
  27.237 -    }
  27.238 -    SDL_UpdateWindowGrab(&window);
  27.239 -
  27.240 -    return window.id;
  27.241 +        SDL_ShowWindow(window);
  27.242 +    }
  27.243 +    SDL_UpdateWindowGrab(window);
  27.244 +
  27.245 +    return window;
  27.246  }
  27.247  
  27.248 -SDL_WindowID
  27.249 +SDL_Window *
  27.250  SDL_CreateWindowFrom(const void *data)
  27.251  {
  27.252      SDL_VideoDisplay *display;
  27.253 -    SDL_Window window;
  27.254 -    int num_windows;
  27.255 -    SDL_Window *windows;
  27.256 +    SDL_Window *window;
  27.257  
  27.258      if (!_this) {
  27.259          SDL_UninitializedVideo();
  27.260 -        return (0);
  27.261 -    }
  27.262 -    SDL_zero(window);
  27.263 -    window.id = _this->next_object_id++;
  27.264 -    window.display = _this->current_display;
  27.265 -    window.flags = SDL_WINDOW_FOREIGN;
  27.266 +        return NULL;
  27.267 +    }
  27.268 +    display = SDL_CurrentDisplay;
  27.269 +    window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
  27.270 +    window->id = _this->next_object_id++;
  27.271 +    window->flags = SDL_WINDOW_FOREIGN;
  27.272 +    window->display = display;
  27.273 +    window->next = display->windows;
  27.274 +    display->windows = window;
  27.275  
  27.276      if (!_this->CreateWindowFrom ||
  27.277 -        _this->CreateWindowFrom(_this, &window, data) < 0) {
  27.278 -        return 0;
  27.279 -    }
  27.280 -    /* FIXME: Find out what display this window is actually on... */
  27.281 -    display = &SDL_CurrentDisplay;
  27.282 -    num_windows = display->num_windows;
  27.283 -    windows =
  27.284 -        SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows));
  27.285 -    if (!windows) {
  27.286 -        if (_this->DestroyWindow) {
  27.287 -            _this->DestroyWindow(_this, &window);
  27.288 -        }
  27.289 -        if (window.title) {
  27.290 -            SDL_free(window.title);
  27.291 -        }
  27.292 -        return 0;
  27.293 -    }
  27.294 -    windows[num_windows] = window;
  27.295 -    display->windows = windows;
  27.296 -    display->num_windows++;
  27.297 -
  27.298 -    return window.id;
  27.299 +        _this->CreateWindowFrom(_this, window, data) < 0) {
  27.300 +        SDL_DestroyWindow(window);
  27.301 +        return NULL;
  27.302 +    }
  27.303 +    return window;
  27.304  }
  27.305  
  27.306  int
  27.307 @@ -1036,70 +1000,23 @@
  27.308      }
  27.309  
  27.310      if (title) {
  27.311 -        SDL_SetWindowTitle(window->id, title);
  27.312 +        SDL_SetWindowTitle(window, title);
  27.313          SDL_free(title);
  27.314      }
  27.315      if (flags & SDL_WINDOW_MAXIMIZED) {
  27.316 -        SDL_MaximizeWindow(window->id);
  27.317 +        SDL_MaximizeWindow(window);
  27.318      }
  27.319      if (flags & SDL_WINDOW_MINIMIZED) {
  27.320 -        SDL_MinimizeWindow(window->id);
  27.321 +        SDL_MinimizeWindow(window);
  27.322      }
  27.323      if (flags & SDL_WINDOW_SHOWN) {
  27.324 -        SDL_ShowWindow(window->id);
  27.325 +        SDL_ShowWindow(window);
  27.326      }
  27.327      SDL_UpdateWindowGrab(window);
  27.328  
  27.329      return 0;
  27.330  }
  27.331  
  27.332 -SDL_Window *
  27.333 -SDL_GetWindowFromID(SDL_WindowID windowID)
  27.334 -{
  27.335 -    int i, j;
  27.336 -
  27.337 -    if (!_this) {
  27.338 -        SDL_UninitializedVideo();
  27.339 -        return NULL;
  27.340 -    }
  27.341 -    if (windowID) {
  27.342 -        for (i = 0; i < _this->num_displays; ++i) {
  27.343 -            SDL_VideoDisplay *display = &_this->displays[i];
  27.344 -            for (j = 0; j < display->num_windows; ++j) {
  27.345 -                SDL_Window *window = &display->windows[j];
  27.346 -                if (window->id == windowID) {
  27.347 -                    return window;
  27.348 -                }
  27.349 -            }
  27.350 -        }
  27.351 -    } else {
  27.352 -        /* Just return the first active window */
  27.353 -        for (i = 0; i < _this->num_displays; ++i) {
  27.354 -            SDL_VideoDisplay *display = &_this->displays[i];
  27.355 -            for (j = 0; j < display->num_windows; ++j) {
  27.356 -                SDL_Window *window = &display->windows[j];
  27.357 -                return window;
  27.358 -            }
  27.359 -        }
  27.360 -    }
  27.361 -    /* Couldn't find the window with the requested ID */
  27.362 -    SDL_SetError("Invalid window ID");
  27.363 -    return NULL;
  27.364 -}
  27.365 -
  27.366 -SDL_VideoDisplay *
  27.367 -SDL_GetDisplayFromWindow(SDL_Window * window)
  27.368 -{
  27.369 -    if (!_this) {
  27.370 -        SDL_UninitializedVideo();
  27.371 -        return NULL;
  27.372 -    }
  27.373 -    if (!window) {
  27.374 -        return NULL;
  27.375 -    }
  27.376 -    return &_this->displays[window->display];
  27.377 -}
  27.378 -
  27.379  static __inline__ SDL_Renderer *
  27.380  SDL_GetCurrentRenderer(SDL_bool create)
  27.381  {
  27.382 @@ -1120,21 +1037,47 @@
  27.383  }
  27.384  
  27.385  Uint32
  27.386 -SDL_GetWindowFlags(SDL_WindowID windowID)
  27.387 +SDL_GetWindowID(SDL_Window * window)
  27.388  {
  27.389 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.390 -
  27.391      if (!window) {
  27.392          return 0;
  27.393      }
  27.394 +    return window->id;
  27.395 +}
  27.396 +
  27.397 +SDL_Window *
  27.398 +SDL_GetWindowFromID(Uint32 id)
  27.399 +{
  27.400 +    SDL_Window *window;
  27.401 +    int i;
  27.402 +
  27.403 +    if (!_this) {
  27.404 +        return NULL;
  27.405 +    }
  27.406 +    /* FIXME: Should we keep a separate hash table for these? */
  27.407 +    for (i = _this->num_displays; i--;) {
  27.408 +        SDL_VideoDisplay *display = &_this->displays[i];
  27.409 +        for (window = display->windows; window; window = window->next) {
  27.410 +            if (window->id == id) {
  27.411 +                return window;
  27.412 +            }
  27.413 +        }
  27.414 +    }
  27.415 +    return NULL;
  27.416 +}
  27.417 +
  27.418 +Uint32
  27.419 +SDL_GetWindowFlags(SDL_Window * window)
  27.420 +{
  27.421 +    if (!window) {
  27.422 +        return 0;
  27.423 +    }
  27.424      return window->flags;
  27.425  }
  27.426  
  27.427  void
  27.428 -SDL_SetWindowTitle(SDL_WindowID windowID, const char *title)
  27.429 +SDL_SetWindowTitle(SDL_Window * window, const char *title)
  27.430  {
  27.431 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.432 -
  27.433      if (!window || title == window->title) {
  27.434          return;
  27.435      }
  27.436 @@ -1153,10 +1096,8 @@
  27.437  }
  27.438  
  27.439  const char *
  27.440 -SDL_GetWindowTitle(SDL_WindowID windowID)
  27.441 +SDL_GetWindowTitle(SDL_Window * window)
  27.442  {
  27.443 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.444 -
  27.445      if (!window) {
  27.446          return NULL;
  27.447      }
  27.448 @@ -1164,10 +1105,8 @@
  27.449  }
  27.450  
  27.451  void
  27.452 -SDL_SetWindowIcon(SDL_WindowID windowID, SDL_Surface * icon)
  27.453 +SDL_SetWindowIcon(SDL_Window * window, SDL_Surface * icon)
  27.454  {
  27.455 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.456 -
  27.457      if (!window) {
  27.458          return;
  27.459      }
  27.460 @@ -1177,10 +1116,8 @@
  27.461  }
  27.462  
  27.463  void
  27.464 -SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
  27.465 +SDL_SetWindowData(SDL_Window * window, void *userdata)
  27.466  {
  27.467 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.468 -
  27.469      if (!window) {
  27.470          return;
  27.471      }
  27.472 @@ -1188,10 +1125,8 @@
  27.473  }
  27.474  
  27.475  void *
  27.476 -SDL_GetWindowData(SDL_WindowID windowID)
  27.477 +SDL_GetWindowData(SDL_Window * window)
  27.478  {
  27.479 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.480 -
  27.481      if (!window) {
  27.482          return NULL;
  27.483      }
  27.484 @@ -1199,11 +1134,8 @@
  27.485  }
  27.486  
  27.487  void
  27.488 -SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
  27.489 +SDL_SetWindowPosition(SDL_Window * window, int x, int y)
  27.490  {
  27.491 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.492 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  27.493 -
  27.494      if (!window) {
  27.495          return;
  27.496      }
  27.497 @@ -1216,14 +1148,12 @@
  27.498      if (_this->SetWindowPosition) {
  27.499          _this->SetWindowPosition(_this, window);
  27.500      }
  27.501 -    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MOVED, x, y);
  27.502 +    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
  27.503  }
  27.504  
  27.505  void
  27.506 -SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y)
  27.507 +SDL_GetWindowPosition(SDL_Window * window, int *x, int *y)
  27.508  {
  27.509 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.510 -
  27.511      if (!window) {
  27.512          return;
  27.513      }
  27.514 @@ -1236,10 +1166,8 @@
  27.515  }
  27.516  
  27.517  void
  27.518 -SDL_SetWindowSize(SDL_WindowID windowID, int w, int h)
  27.519 +SDL_SetWindowSize(SDL_Window * window, int w, int h)
  27.520  {
  27.521 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.522 -
  27.523      if (!window) {
  27.524          return;
  27.525      }
  27.526 @@ -1253,10 +1181,8 @@
  27.527  }
  27.528  
  27.529  void
  27.530 -SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *h)
  27.531 +SDL_GetWindowSize(SDL_Window * window, int *w, int *h)
  27.532  {
  27.533 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.534 -
  27.535      if (window) {
  27.536          if (w) {
  27.537              *w = window->w;
  27.538 @@ -1275,10 +1201,8 @@
  27.539  }
  27.540  
  27.541  void
  27.542 -SDL_ShowWindow(SDL_WindowID windowID)
  27.543 +SDL_ShowWindow(SDL_Window * window)
  27.544  {
  27.545 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.546 -
  27.547      if (!window || (window->flags & SDL_WINDOW_SHOWN)) {
  27.548          return;
  27.549      }
  27.550 @@ -1286,14 +1210,12 @@
  27.551      if (_this->ShowWindow) {
  27.552          _this->ShowWindow(_this, window);
  27.553      }
  27.554 -    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_SHOWN, 0, 0);
  27.555 +    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
  27.556  }
  27.557  
  27.558  void
  27.559 -SDL_HideWindow(SDL_WindowID windowID)
  27.560 +SDL_HideWindow(SDL_Window * window)
  27.561  {
  27.562 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.563 -
  27.564      if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
  27.565          return;
  27.566      }
  27.567 @@ -1301,14 +1223,12 @@
  27.568      if (_this->HideWindow) {
  27.569          _this->HideWindow(_this, window);
  27.570      }
  27.571 -    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_HIDDEN, 0, 0);
  27.572 +    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
  27.573  }
  27.574  
  27.575  void
  27.576 -SDL_RaiseWindow(SDL_WindowID windowID)
  27.577 +SDL_RaiseWindow(SDL_Window * window)
  27.578  {
  27.579 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.580 -
  27.581      if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
  27.582          return;
  27.583      }
  27.584 @@ -1316,15 +1236,13 @@
  27.585          _this->RaiseWindow(_this, window);
  27.586      } else {
  27.587          /* FIXME: What we really want is a way to request focus */
  27.588 -        SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
  27.589 +        SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
  27.590      }
  27.591  }
  27.592  
  27.593  void
  27.594 -SDL_MaximizeWindow(SDL_WindowID windowID)
  27.595 +SDL_MaximizeWindow(SDL_Window * window)
  27.596  {
  27.597 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.598 -
  27.599      if (!window || (window->flags & SDL_WINDOW_MAXIMIZED)) {
  27.600          return;
  27.601      }
  27.602 @@ -1332,14 +1250,12 @@
  27.603      if (_this->MaximizeWindow) {
  27.604          _this->MaximizeWindow(_this, window);
  27.605      }
  27.606 -    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
  27.607 +    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
  27.608  }
  27.609  
  27.610  void
  27.611 -SDL_MinimizeWindow(SDL_WindowID windowID)
  27.612 +SDL_MinimizeWindow(SDL_Window * window)
  27.613  {
  27.614 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.615 -
  27.616      if (!window || (window->flags & SDL_WINDOW_MINIMIZED)) {
  27.617          return;
  27.618      }
  27.619 @@ -1347,14 +1263,12 @@
  27.620      if (_this->MinimizeWindow) {
  27.621          _this->MinimizeWindow(_this, window);
  27.622      }
  27.623 -    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
  27.624 +    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
  27.625  }
  27.626  
  27.627  void
  27.628 -SDL_RestoreWindow(SDL_WindowID windowID)
  27.629 +SDL_RestoreWindow(SDL_Window * window)
  27.630  {
  27.631 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.632 -
  27.633      if (!window
  27.634          || !(window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
  27.635          return;
  27.636 @@ -1363,14 +1277,12 @@
  27.637      if (_this->RestoreWindow) {
  27.638          _this->RestoreWindow(_this, window);
  27.639      }
  27.640 -    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_RESTORED, 0, 0);
  27.641 +    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
  27.642  }
  27.643  
  27.644  int
  27.645 -SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen)
  27.646 +SDL_SetWindowFullscreen(SDL_Window * window, int fullscreen)
  27.647  {
  27.648 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.649 -
  27.650      if (!window) {
  27.651          return -1;
  27.652      }
  27.653 @@ -1393,10 +1305,8 @@
  27.654  }
  27.655  
  27.656  void
  27.657 -SDL_SetWindowGrab(SDL_WindowID windowID, int mode)
  27.658 +SDL_SetWindowGrab(SDL_Window * window, int mode)
  27.659  {
  27.660 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.661 -
  27.662      if (!window || (!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
  27.663          return;
  27.664      }
  27.665 @@ -1417,10 +1327,8 @@
  27.666  }
  27.667  
  27.668  int
  27.669 -SDL_GetWindowGrab(SDL_WindowID windowID)
  27.670 +SDL_GetWindowGrab(SDL_Window * window)
  27.671  {
  27.672 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.673 -
  27.674      if (!window) {
  27.675          return 0;
  27.676      }
  27.677 @@ -1430,7 +1338,7 @@
  27.678  void
  27.679  SDL_OnWindowShown(SDL_Window * window)
  27.680  {
  27.681 -    SDL_RaiseWindow(window->id);
  27.682 +    SDL_RaiseWindow(window);
  27.683      SDL_UpdateFullscreenMode(window, SDL_TRUE);
  27.684  }
  27.685  
  27.686 @@ -1459,14 +1367,14 @@
  27.687  void
  27.688  SDL_OnWindowRestored(SDL_Window * window)
  27.689  {
  27.690 -    SDL_RaiseWindow(window->id);
  27.691 +    SDL_RaiseWindow(window);
  27.692      SDL_UpdateFullscreenMode(window, SDL_TRUE);
  27.693  }
  27.694  
  27.695  void
  27.696  SDL_OnWindowFocusGained(SDL_Window * window)
  27.697  {
  27.698 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  27.699 +    SDL_VideoDisplay *display = window->display;
  27.700  
  27.701      if (display->gamma && _this->SetDisplayGammaRamp) {
  27.702          _this->SetDisplayGammaRamp(_this, display, display->gamma);
  27.703 @@ -1480,12 +1388,12 @@
  27.704  void
  27.705  SDL_OnWindowFocusLost(SDL_Window * window)
  27.706  {
  27.707 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  27.708 +    SDL_VideoDisplay *display = window->display;
  27.709  
  27.710      /* If we're fullscreen on a single-head system and lose focus, minimize */
  27.711      if ((window->flags & SDL_WINDOW_FULLSCREEN) &&
  27.712          _this->num_displays == 1) {
  27.713 -        SDL_MinimizeWindow(window->id);
  27.714 +        SDL_MinimizeWindow(window);
  27.715      }
  27.716  
  27.717      if (display->gamma && _this->SetDisplayGammaRamp) {
  27.718 @@ -1497,69 +1405,63 @@
  27.719      }
  27.720  }
  27.721  
  27.722 -SDL_WindowID
  27.723 +SDL_Window *
  27.724  SDL_GetFocusWindow(void)
  27.725  {
  27.726      SDL_VideoDisplay *display;
  27.727 -    int i;
  27.728 +    SDL_Window *window;
  27.729  
  27.730      if (!_this) {
  27.731 -        return 0;
  27.732 -    }
  27.733 -    display = &SDL_CurrentDisplay;
  27.734 -    for (i = 0; i < display->num_windows; ++i) {
  27.735 -        SDL_Window *window = &display->windows[i];
  27.736 -
  27.737 +        return NULL;
  27.738 +    }
  27.739 +    display = SDL_CurrentDisplay;
  27.740 +    for (window = display->windows; window; window = window->next) {
  27.741          if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
  27.742 -            return window->id;
  27.743 +            return window;
  27.744          }
  27.745      }
  27.746 -    return 0;
  27.747 +    return NULL;
  27.748  }
  27.749  
  27.750  void
  27.751 -SDL_DestroyWindow(SDL_WindowID windowID)
  27.752 +SDL_DestroyWindow(SDL_Window * window)
  27.753  {
  27.754 -    int i, j;
  27.755 -
  27.756 -    if (!_this) {
  27.757 +    SDL_VideoDisplay *display;
  27.758 +
  27.759 +    if (!_this || !window || !window->id) {
  27.760 +        SDL_SetError("Invalid window");
  27.761          return;
  27.762      }
  27.763  
  27.764 -    for (i = 0; i < _this->num_displays; ++i) {
  27.765 -        SDL_VideoDisplay *display = &_this->displays[i];
  27.766 -        for (j = 0; j < display->num_windows; ++j) {
  27.767 -            SDL_Window *window = &display->windows[j];
  27.768 -            if (window->id != windowID) {
  27.769 -                continue;
  27.770 -            }
  27.771 -            if (window->title) {
  27.772 -                SDL_free(window->title);
  27.773 -                window->title = NULL;
  27.774 -            }
  27.775 -            if (window->renderer) {
  27.776 -                SDL_DestroyRenderer(window->id);
  27.777 -                window->renderer = NULL;
  27.778 -            }
  27.779 -
  27.780 -            /* Restore video mode, etc. */
  27.781 -            SDL_UpdateFullscreenMode(window, SDL_FALSE);
  27.782 -
  27.783 -            if (_this->DestroyWindow) {
  27.784 -                _this->DestroyWindow(_this, window);
  27.785 -            }
  27.786 -            if (window->flags & SDL_WINDOW_OPENGL) {
  27.787 -                SDL_GL_UnloadLibrary();
  27.788 -            }
  27.789 -            if (j != display->num_windows - 1) {
  27.790 -                SDL_memcpy(&display->windows[i],
  27.791 -                           &display->windows[i + 1],
  27.792 -                           (display->num_windows - i - 1) * sizeof(*window));
  27.793 -            }
  27.794 -            --display->num_windows;
  27.795 -            return;
  27.796 -        }
  27.797 -    }
  27.798 +    if (window->title) {
  27.799 +        SDL_free(window->title);
  27.800 +    }
  27.801 +    if (window->renderer) {
  27.802 +        SDL_DestroyRenderer(window);
  27.803 +    }
  27.804 +
  27.805 +    /* Restore video mode, etc. */
  27.806 +    SDL_UpdateFullscreenMode(window, SDL_FALSE);
  27.807 +
  27.808 +    if (_this->DestroyWindow) {
  27.809 +        _this->DestroyWindow(_this, window);
  27.810 +    }
  27.811 +    if (window->flags & SDL_WINDOW_OPENGL) {
  27.812 +        SDL_GL_UnloadLibrary();
  27.813 +    }
  27.814 +
  27.815 +    /* Unlink the window from the list */
  27.816 +    display = window->display;
  27.817 +    if (window->prev) {
  27.818 +        window->prev->next = window->next;
  27.819 +    } else {
  27.820 +        display->windows = window->next;
  27.821 +    }
  27.822 +
  27.823 +    /* Clear the ID so we know it was destroyed */
  27.824 +    window->id = 0;
  27.825 +
  27.826 +    SDL_free(window);
  27.827  }
  27.828  
  27.829  void
  27.830 @@ -1582,7 +1484,7 @@
  27.831  SDL_GetNumRenderDrivers(void)
  27.832  {
  27.833      if (_this) {
  27.834 -        return SDL_CurrentDisplay.num_render_drivers;
  27.835 +        return SDL_CurrentDisplay->num_render_drivers;
  27.836      }
  27.837      return 0;
  27.838  }
  27.839 @@ -1599,22 +1501,20 @@
  27.840                       SDL_GetNumRenderDrivers() - 1);
  27.841          return -1;
  27.842      }
  27.843 -    *info = SDL_CurrentDisplay.render_drivers[index].info;
  27.844 +    *info = SDL_CurrentDisplay->render_drivers[index].info;
  27.845      return 0;
  27.846  }
  27.847  
  27.848  int
  27.849 -SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags)
  27.850 +SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
  27.851  {
  27.852 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.853 -
  27.854      if (!window) {
  27.855 -        SDL_SetError("Invalid window ID");
  27.856 +        SDL_SetError("Invalid window");
  27.857          return -1;
  27.858      }
  27.859  
  27.860      /* Free any existing renderer */
  27.861 -    SDL_DestroyRenderer(windowID);
  27.862 +    SDL_DestroyRenderer(window);
  27.863  
  27.864      if (index < 0) {
  27.865          char *override = SDL_getenv("SDL_VIDEO_RENDERER");
  27.866 @@ -1633,7 +1533,7 @@
  27.867          if (override) {
  27.868              for (index = 0; index < n; ++index) {
  27.869                  SDL_RenderDriver *driver =
  27.870 -                    &SDL_CurrentDisplay.render_drivers[index];
  27.871 +                    &SDL_CurrentDisplay->render_drivers[index];
  27.872  
  27.873                  if (SDL_strcasecmp(override, driver->info.name) == 0) {
  27.874                      /* Create a new renderer instance */
  27.875 @@ -1644,7 +1544,7 @@
  27.876          } else {
  27.877              for (index = 0; index < n; ++index) {
  27.878                  SDL_RenderDriver *driver =
  27.879 -                    &SDL_CurrentDisplay.render_drivers[index];
  27.880 +                    &SDL_CurrentDisplay->render_drivers[index];
  27.881  
  27.882                  if ((driver->info.flags & flags) == flags) {
  27.883                      /* Create a new renderer instance */
  27.884 @@ -1667,7 +1567,7 @@
  27.885              return -1;
  27.886          }
  27.887          /* Create a new renderer instance */
  27.888 -        window->renderer = SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window, flags);
  27.889 +        window->renderer = SDL_CurrentDisplay->render_drivers[index].CreateRenderer(window, flags);
  27.890      }
  27.891  
  27.892      if (window->renderer == NULL) {
  27.893 @@ -1675,19 +1575,18 @@
  27.894          return -1;
  27.895      }
  27.896  
  27.897 -    SDL_SelectRenderer(window->id);
  27.898 +    SDL_SelectRenderer(window);
  27.899  
  27.900      return 0;
  27.901  }
  27.902  
  27.903  int
  27.904 -SDL_SelectRenderer(SDL_WindowID windowID)
  27.905 +SDL_SelectRenderer(SDL_Window * window)
  27.906  {
  27.907 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
  27.908      SDL_Renderer *renderer;
  27.909  
  27.910      if (!window) {
  27.911 -        SDL_SetError("Invalid window ID");
  27.912 +        SDL_SetError("Invalid window");
  27.913          return -1;
  27.914      }
  27.915      renderer = window->renderer;
  27.916 @@ -1700,7 +1599,7 @@
  27.917              return -1;
  27.918          }
  27.919      }
  27.920 -    SDL_CurrentDisplay.current_renderer = renderer;
  27.921 +    SDL_CurrentDisplay->current_renderer = renderer;
  27.922      return 0;
  27.923  }
  27.924  
  27.925 @@ -1715,10 +1614,9 @@
  27.926      return 0;
  27.927  }
  27.928  
  27.929 -SDL_TextureID
  27.930 +SDL_Texture *
  27.931  SDL_CreateTexture(Uint32 format, int access, int w, int h)
  27.932  {
  27.933 -    int hash;
  27.934      SDL_Renderer *renderer;
  27.935      SDL_Texture *texture;
  27.936  
  27.937 @@ -1735,7 +1633,6 @@
  27.938          SDL_OutOfMemory();
  27.939          return 0;
  27.940      }
  27.941 -    texture->id = _this->next_object_id++;
  27.942      texture->format = format;
  27.943      texture->access = access;
  27.944      texture->w = w;
  27.945 @@ -1745,25 +1642,20 @@
  27.946      texture->b = 255;
  27.947      texture->a = 255;
  27.948      texture->renderer = renderer;
  27.949 +    texture->next = renderer->textures;
  27.950 +    renderer->textures = texture;
  27.951  
  27.952      if (renderer->CreateTexture(renderer, texture) < 0) {
  27.953 -        if (renderer->DestroyTexture) {
  27.954 -            renderer->DestroyTexture(renderer, texture);
  27.955 -        }
  27.956 -        SDL_free(texture);
  27.957 +        SDL_DestroyTexture(texture);
  27.958          return 0;
  27.959      }
  27.960 -    hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures));
  27.961 -    texture->next = SDL_CurrentDisplay.textures[hash];
  27.962 -    SDL_CurrentDisplay.textures[hash] = texture;
  27.963 -
  27.964 -    return texture->id;
  27.965 +    return texture;
  27.966  }
  27.967  
  27.968 -SDL_TextureID
  27.969 +SDL_Texture *
  27.970  SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface)
  27.971  {
  27.972 -    SDL_TextureID textureID;
  27.973 +    SDL_Texture *texture;
  27.974      Uint32 requested_format = format;
  27.975      SDL_PixelFormat *fmt;
  27.976      SDL_Renderer *renderer;
  27.977 @@ -1980,29 +1872,29 @@
  27.978          }
  27.979      }
  27.980  
  27.981 -    textureID =
  27.982 +    texture =
  27.983          SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, surface->w,
  27.984                            surface->h);
  27.985 -    if (!textureID && !requested_format) {
  27.986 +    if (!texture && !requested_format) {
  27.987          SDL_DisplayMode desktop_mode;
  27.988          SDL_GetDesktopDisplayMode(&desktop_mode);
  27.989          format = desktop_mode.format;
  27.990 -        textureID =
  27.991 +        texture =
  27.992              SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, surface->w,
  27.993                                surface->h);
  27.994      }
  27.995 -    if (!textureID) {
  27.996 +    if (!texture) {
  27.997          return 0;
  27.998      }
  27.999      if (bpp == fmt->BitsPerPixel && Rmask == fmt->Rmask && Gmask == fmt->Gmask
 27.1000          && Bmask == fmt->Bmask && Amask == fmt->Amask) {
 27.1001          if (SDL_MUSTLOCK(surface)) {
 27.1002              SDL_LockSurface(surface);
 27.1003 -            SDL_UpdateTexture(textureID, NULL, surface->pixels,
 27.1004 +            SDL_UpdateTexture(texture, NULL, surface->pixels,
 27.1005                                surface->pitch);
 27.1006              SDL_UnlockSurface(surface);
 27.1007          } else {
 27.1008 -            SDL_UpdateTexture(textureID, NULL, surface->pixels,
 27.1009 +            SDL_UpdateTexture(texture, NULL, surface->pixels,
 27.1010                                surface->pitch);
 27.1011          }
 27.1012      } else {
 27.1013 @@ -2025,14 +1917,14 @@
 27.1014          }
 27.1015          dst = SDL_ConvertSurface(surface, &dst_fmt, 0);
 27.1016          if (dst) {
 27.1017 -            SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
 27.1018 +            SDL_UpdateTexture(texture, NULL, dst->pixels, dst->pitch);
 27.1019              SDL_FreeSurface(dst);
 27.1020          }
 27.1021          if (dst_fmt.palette) {
 27.1022              SDL_FreePalette(dst_fmt.palette);
 27.1023          }
 27.1024          if (!dst) {
 27.1025 -            SDL_DestroyTexture(textureID);
 27.1026 +            SDL_DestroyTexture(texture);
 27.1027              return 0;
 27.1028          }
 27.1029      }
 27.1030 @@ -2043,50 +1935,29 @@
 27.1031          int scaleMode;
 27.1032  
 27.1033          SDL_GetSurfaceColorMod(surface, &r, &g, &b);
 27.1034 -        SDL_SetTextureColorMod(textureID, r, g, b);
 27.1035 +        SDL_SetTextureColorMod(texture, r, g, b);
 27.1036  
 27.1037          SDL_GetSurfaceAlphaMod(surface, &a);
 27.1038 -        SDL_SetTextureAlphaMod(textureID, a);
 27.1039 +        SDL_SetTextureAlphaMod(texture, a);
 27.1040  
 27.1041          SDL_GetSurfaceBlendMode(surface, &blendMode);
 27.1042 -        SDL_SetTextureBlendMode(textureID, blendMode);
 27.1043 +        SDL_SetTextureBlendMode(texture, blendMode);
 27.1044  
 27.1045          SDL_GetSurfaceScaleMode(surface, &scaleMode);
 27.1046 -        SDL_SetTextureScaleMode(textureID, scaleMode);
 27.1047 +        SDL_SetTextureScaleMode(texture, scaleMode);
 27.1048      }
 27.1049  
 27.1050      if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
 27.1051 -        SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
 27.1052 +        SDL_SetTexturePalette(texture, fmt->palette->colors, 0,
 27.1053                                fmt->palette->ncolors);
 27.1054      }
 27.1055 -    return textureID;
 27.1056 +    return texture;
 27.1057  }
 27.1058  
 27.1059 -static __inline__ SDL_Texture *
 27.1060 -SDL_GetTextureFromID(SDL_TextureID textureID)
 27.1061 -{
 27.1062 -    int hash;
 27.1063 -    SDL_Texture *texture;
 27.1064 -
 27.1065 -    if (!_this) {
 27.1066 -        return NULL;
 27.1067 -    }
 27.1068 -    hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
 27.1069 -    for (texture = SDL_CurrentDisplay.textures[hash]; texture;
 27.1070 -         texture = texture->next) {
 27.1071 -        if (texture->id == textureID) {
 27.1072 -            return texture;
 27.1073 -        }
 27.1074 -    }
 27.1075 -    return NULL;
 27.1076 -}
 27.1077 -
 27.1078  int
 27.1079 -SDL_QueryTexture(SDL_TextureID textureID, Uint32 * format, int *access,
 27.1080 +SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access,
 27.1081                   int *w, int *h)
 27.1082  {
 27.1083 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1084 -
 27.1085      if (!texture) {
 27.1086          return -1;
 27.1087      }
 27.1088 @@ -2106,9 +1977,8 @@
 27.1089  }
 27.1090  
 27.1091  int
 27.1092 -SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int *pitch)
 27.1093 +SDL_QueryTexturePixels(SDL_Texture * texture, void **pixels, int *pitch)
 27.1094  {
 27.1095 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1096      SDL_Renderer *renderer;
 27.1097  
 27.1098      if (!texture) {
 27.1099 @@ -2123,10 +1993,9 @@
 27.1100  }
 27.1101  
 27.1102  int
 27.1103 -SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors,
 27.1104 +SDL_SetTexturePalette(SDL_Texture * texture, const SDL_Color * colors,
 27.1105                        int firstcolor, int ncolors)
 27.1106  {
 27.1107 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1108      SDL_Renderer *renderer;
 27.1109  
 27.1110      if (!texture) {
 27.1111 @@ -2142,10 +2011,9 @@
 27.1112  }
 27.1113  
 27.1114  int
 27.1115 -SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors,
 27.1116 +SDL_GetTexturePalette(SDL_Texture * texture, SDL_Color * colors,
 27.1117                        int firstcolor, int ncolors)
 27.1118  {
 27.1119 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1120      SDL_Renderer *renderer;
 27.1121  
 27.1122      if (!texture) {
 27.1123 @@ -2161,9 +2029,8 @@
 27.1124  }
 27.1125  
 27.1126  int
 27.1127 -SDL_SetTextureColorMod(SDL_TextureID textureID, Uint8 r, Uint8 g, Uint8 b)
 27.1128 +SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
 27.1129  {
 27.1130 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1131      SDL_Renderer *renderer;
 27.1132  
 27.1133      if (!texture) {
 27.1134 @@ -2186,10 +2053,9 @@
 27.1135  }
 27.1136  
 27.1137  int
 27.1138 -SDL_GetTextureColorMod(SDL_TextureID textureID, Uint8 * r, Uint8 * g,
 27.1139 +SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g,
 27.1140                         Uint8 * b)
 27.1141  {
 27.1142 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1143      SDL_Renderer *renderer;
 27.1144  
 27.1145      if (!texture) {
 27.1146 @@ -2209,9 +2075,8 @@
 27.1147  }
 27.1148  
 27.1149  int
 27.1150 -SDL_SetTextureAlphaMod(SDL_TextureID textureID, Uint8 alpha)
 27.1151 +SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha)
 27.1152  {
 27.1153 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1154      SDL_Renderer *renderer;
 27.1155  
 27.1156      if (!texture) {
 27.1157 @@ -2232,10 +2097,8 @@
 27.1158  }
 27.1159  
 27.1160  int
 27.1161 -SDL_GetTextureAlphaMod(SDL_TextureID textureID, Uint8 * alpha)
 27.1162 +SDL_GetTextureAlphaMod(SDL_Texture * texture, Uint8 * alpha)
 27.1163  {
 27.1164 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1165 -
 27.1166      if (!texture) {
 27.1167          return -1;
 27.1168      }
 27.1169 @@ -2246,9 +2109,8 @@
 27.1170  }
 27.1171  
 27.1172  int
 27.1173 -SDL_SetTextureBlendMode(SDL_TextureID textureID, int blendMode)
 27.1174 +SDL_SetTextureBlendMode(SDL_Texture * texture, int blendMode)
 27.1175  {
 27.1176 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1177      SDL_Renderer *renderer;
 27.1178  
 27.1179      if (!texture) {
 27.1180 @@ -2264,10 +2126,8 @@
 27.1181  }
 27.1182  
 27.1183  int
 27.1184 -SDL_GetTextureBlendMode(SDL_TextureID textureID, int *blendMode)
 27.1185 +SDL_GetTextureBlendMode(SDL_Texture * texture, int *blendMode)
 27.1186  {
 27.1187 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1188 -
 27.1189      if (!texture) {
 27.1190          return -1;
 27.1191      }
 27.1192 @@ -2278,9 +2138,8 @@
 27.1193  }
 27.1194  
 27.1195  int
 27.1196 -SDL_SetTextureScaleMode(SDL_TextureID textureID, int scaleMode)
 27.1197 +SDL_SetTextureScaleMode(SDL_Texture * texture, int scaleMode)
 27.1198  {
 27.1199 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1200      SDL_Renderer *renderer;
 27.1201  
 27.1202      if (!texture) {
 27.1203 @@ -2296,10 +2155,8 @@
 27.1204  }
 27.1205  
 27.1206  int
 27.1207 -SDL_GetTextureScaleMode(SDL_TextureID textureID, int *scaleMode)
 27.1208 +SDL_GetTextureScaleMode(SDL_Texture * texture, int *scaleMode)
 27.1209  {
 27.1210 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1211 -
 27.1212      if (!texture) {
 27.1213          return -1;
 27.1214      }
 27.1215 @@ -2310,10 +2167,9 @@
 27.1216  }
 27.1217  
 27.1218  int
 27.1219 -SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect * rect,
 27.1220 +SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect,
 27.1221                    const void *pixels, int pitch)
 27.1222  {
 27.1223 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1224      SDL_Renderer *renderer;
 27.1225      SDL_Rect full_rect;
 27.1226  
 27.1227 @@ -2336,10 +2192,9 @@
 27.1228  }
 27.1229  
 27.1230  int
 27.1231 -SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect * rect, int markDirty,
 27.1232 +SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty,
 27.1233                  void **pixels, int *pitch)
 27.1234  {
 27.1235 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1236      SDL_Renderer *renderer;
 27.1237      SDL_Rect full_rect;
 27.1238  
 27.1239 @@ -2367,9 +2222,8 @@
 27.1240  }
 27.1241  
 27.1242  void
 27.1243 -SDL_UnlockTexture(SDL_TextureID textureID)
 27.1244 +SDL_UnlockTexture(SDL_Texture * texture)
 27.1245  {
 27.1246 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1247      SDL_Renderer *renderer;
 27.1248  
 27.1249      if (!texture) {
 27.1250 @@ -2386,10 +2240,9 @@
 27.1251  }
 27.1252  
 27.1253  void
 27.1254 -SDL_DirtyTexture(SDL_TextureID textureID, int numrects,
 27.1255 +SDL_DirtyTexture(SDL_Texture * texture, int numrects,
 27.1256                   const SDL_Rect * rects)
 27.1257  {
 27.1258 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1259      SDL_Renderer *renderer;
 27.1260  
 27.1261      if (!texture) {
 27.1262 @@ -2607,11 +2460,10 @@
 27.1263      /* Check for NULL rect, which means fill entire window */
 27.1264      for (i = 0; i < count; ++i) {
 27.1265          if (rects[i] == NULL) {
 27.1266 -            SDL_Window *window;
 27.1267 +            SDL_Window *window = renderer->window;
 27.1268              SDL_Rect full_rect;
 27.1269              const SDL_Rect *rect;
 27.1270  
 27.1271 -            window = SDL_GetWindowFromID(renderer->window);
 27.1272              full_rect.x = 0;
 27.1273              full_rect.y = 0;
 27.1274              full_rect.w = window->w;
 27.1275 @@ -2654,11 +2506,10 @@
 27.1276      /* Check for NULL rect, which means fill entire window */
 27.1277      for (i = 0; i < count; ++i) {
 27.1278          if (rects[i] == NULL) {
 27.1279 -            SDL_Window *window;
 27.1280 +            SDL_Window *window = renderer->window;
 27.1281              SDL_Rect full_rect;
 27.1282              const SDL_Rect *rect;
 27.1283  
 27.1284 -            window = SDL_GetWindowFromID(renderer->window);
 27.1285              full_rect.x = 0;
 27.1286              full_rect.y = 0;
 27.1287              full_rect.w = window->w;
 27.1288 @@ -2671,10 +2522,9 @@
 27.1289  }
 27.1290  
 27.1291  int
 27.1292 -SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect,
 27.1293 +SDL_RenderCopy(SDL_Texture * texture, const SDL_Rect * srcrect,
 27.1294                 const SDL_Rect * dstrect)
 27.1295  {
 27.1296 -    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
 27.1297      SDL_Renderer *renderer;
 27.1298      SDL_Window *window;
 27.1299      SDL_Rect real_srcrect;
 27.1300 @@ -2696,7 +2546,7 @@
 27.1301          SDL_Unsupported();
 27.1302          return -1;
 27.1303      }
 27.1304 -    window = SDL_GetWindowFromID(renderer->window);
 27.1305 +    window = renderer->window;
 27.1306  
 27.1307      real_srcrect.x = 0;
 27.1308      real_srcrect.y = 0;
 27.1309 @@ -2751,10 +2601,10 @@
 27.1310          SDL_Unsupported();
 27.1311          return -1;
 27.1312      }
 27.1313 -    window = SDL_GetWindowFromID(renderer->window);
 27.1314 +    window = renderer->window;
 27.1315  
 27.1316      if (!format) {
 27.1317 -        format = SDL_GetDisplayFromWindow(window)->current_mode.format;
 27.1318 +        format = window->display->current_mode.format;
 27.1319      }
 27.1320  
 27.1321      real_rect.x = 0;
 27.1322 @@ -2769,7 +2619,7 @@
 27.1323              pixels = (Uint8 *)pixels + pitch * (real_rect.y - rect->y);
 27.1324          }
 27.1325          if (real_rect.x > rect->x) {
 27.1326 -            Uint32 format = SDL_CurrentDisplay.current_mode.format;
 27.1327 +            Uint32 format = SDL_CurrentDisplay->current_mode.format;
 27.1328              int bpp = SDL_BYTESPERPIXEL(format);
 27.1329              pixels = (Uint8 *)pixels + bpp * (real_rect.x - rect->x);
 27.1330          }
 27.1331 @@ -2795,10 +2645,10 @@
 27.1332          SDL_Unsupported();
 27.1333          return -1;
 27.1334      }
 27.1335 -    window = SDL_GetWindowFromID(renderer->window);
 27.1336 +    window = renderer->window;
 27.1337  
 27.1338      if (!format) {
 27.1339 -        format = SDL_GetDisplayFromWindow(window)->current_mode.format;
 27.1340 +        format = window->display->current_mode.format;
 27.1341      }
 27.1342  
 27.1343      real_rect.x = 0;
 27.1344 @@ -2813,7 +2663,7 @@
 27.1345              pixels = (const Uint8 *)pixels + pitch * (real_rect.y - rect->y);
 27.1346          }
 27.1347          if (real_rect.x > rect->x) {
 27.1348 -            Uint32 format = SDL_CurrentDisplay.current_mode.format;
 27.1349 +            Uint32 format = SDL_CurrentDisplay->current_mode.format;
 27.1350              int bpp = SDL_BYTESPERPIXEL(format);
 27.1351              pixels = (const Uint8 *)pixels + bpp * (real_rect.x - rect->x);
 27.1352          }
 27.1353 @@ -2836,45 +2686,30 @@
 27.1354  }
 27.1355  
 27.1356  void
 27.1357 -SDL_DestroyTexture(SDL_TextureID textureID)
 27.1358 +SDL_DestroyTexture(SDL_Texture * texture)
 27.1359  {
 27.1360 -    int hash;
 27.1361 -    SDL_Texture *prev, *texture;
 27.1362      SDL_Renderer *renderer;
 27.1363  
 27.1364 -    if (!_this) {
 27.1365 -        SDL_UninitializedVideo();
 27.1366 +    if (!texture || !texture->renderer) {
 27.1367 +        SDL_SetError("Invalid texture");
 27.1368          return;
 27.1369      }
 27.1370 -    /* Look up the texture in the hash table */
 27.1371 -    hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
 27.1372 -    prev = NULL;
 27.1373 -    for (texture = SDL_CurrentDisplay.textures[hash]; texture;
 27.1374 -         prev = texture, texture = texture->next) {
 27.1375 -        if (texture->id == textureID) {
 27.1376 -            break;
 27.1377 -        }
 27.1378 -    }
 27.1379 -    if (!texture) {
 27.1380 -        return;
 27.1381 -    }
 27.1382 -    /* Unlink the texture from the list */
 27.1383 -    if (prev) {
 27.1384 -        prev->next = texture->next;
 27.1385 +
 27.1386 +    renderer = texture->renderer;
 27.1387 +    if (texture->prev) {
 27.1388 +        texture->prev->next = texture->next;
 27.1389      } else {
 27.1390 -        SDL_CurrentDisplay.textures[hash] = texture->next;
 27.1391 -    }
 27.1392 -
 27.1393 -    /* Free the texture */
 27.1394 -    renderer = texture->renderer;
 27.1395 +        renderer->textures = texture->next;
 27.1396 +    }
 27.1397 +    texture->renderer = NULL;
 27.1398 +
 27.1399      renderer->DestroyTexture(renderer, texture);
 27.1400      SDL_free(texture);
 27.1401  }
 27.1402  
 27.1403  void
 27.1404 -SDL_DestroyRenderer(SDL_WindowID windowID)
 27.1405 +SDL_DestroyRenderer(SDL_Window * window)
 27.1406  {
 27.1407 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
 27.1408      SDL_Renderer *renderer;
 27.1409      int i;
 27.1410  
 27.1411 @@ -2885,26 +2720,10 @@
 27.1412      if (!renderer) {
 27.1413          return;
 27.1414      }
 27.1415 +
 27.1416      /* Free existing textures for this renderer */
 27.1417 -    for (i = 0; i < SDL_arraysize(SDL_CurrentDisplay.textures); ++i) {
 27.1418 -        SDL_Texture *texture;
 27.1419 -        SDL_Texture *prev = NULL;
 27.1420 -        SDL_Texture *next;
 27.1421 -        for (texture = SDL_CurrentDisplay.textures[i]; texture;
 27.1422 -             texture = next) {
 27.1423 -            next = texture->next;
 27.1424 -            if (texture->renderer == renderer) {
 27.1425 -                if (prev) {
 27.1426 -                    prev->next = next;
 27.1427 -                } else {
 27.1428 -                    SDL_CurrentDisplay.textures[i] = next;
 27.1429 -                }
 27.1430 -                renderer->DestroyTexture(renderer, texture);
 27.1431 -                SDL_free(texture);
 27.1432 -            } else {
 27.1433 -                prev = texture;
 27.1434 -            }
 27.1435 -        }
 27.1436 +    while (renderer->textures) {
 27.1437 +        SDL_DestroyTexture(renderer->textures);
 27.1438      }
 27.1439  
 27.1440      /* Free the renderer instance */
 27.1441 @@ -2912,8 +2731,8 @@
 27.1442  
 27.1443      /* Clear references */
 27.1444      window->renderer = NULL;
 27.1445 -    if (SDL_CurrentDisplay.current_renderer == renderer) {
 27.1446 -        SDL_CurrentDisplay.current_renderer = NULL;
 27.1447 +    if (SDL_CurrentDisplay->current_renderer == renderer) {
 27.1448 +        SDL_CurrentDisplay->current_renderer = NULL;
 27.1449      }
 27.1450  }
 27.1451  
 27.1452 @@ -2971,14 +2790,9 @@
 27.1453      /* Clean up the system video */
 27.1454      for (i = _this->num_displays; i--;) {
 27.1455          SDL_VideoDisplay *display = &_this->displays[i];
 27.1456 -        for (j = display->num_windows; j--;) {
 27.1457 -            SDL_DestroyWindow(display->windows[i].id);
 27.1458 +        while (display->windows) {
 27.1459 +            SDL_DestroyWindow(display->windows);
 27.1460          }
 27.1461 -        if (display->windows) {
 27.1462 -            SDL_free(display->windows);
 27.1463 -            display->windows = NULL;
 27.1464 -        }
 27.1465 -        display->num_windows = 0;
 27.1466          if (display->render_drivers) {
 27.1467              SDL_free(display->render_drivers);
 27.1468              display->render_drivers = NULL;
 27.1469 @@ -3383,10 +3197,8 @@
 27.1470  }
 27.1471  
 27.1472  SDL_GLContext
 27.1473 -SDL_GL_CreateContext(SDL_WindowID windowID)
 27.1474 +SDL_GL_CreateContext(SDL_Window * window)
 27.1475  {
 27.1476 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
 27.1477 -
 27.1478      if (!window) {
 27.1479          return NULL;
 27.1480      }
 27.1481 @@ -3398,10 +3210,8 @@
 27.1482  }
 27.1483  
 27.1484  int
 27.1485 -SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
 27.1486 +SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext context)
 27.1487  {
 27.1488 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
 27.1489 -
 27.1490      if (window && !(window->flags & SDL_WINDOW_OPENGL)) {
 27.1491          SDL_SetError("The specified window isn't an OpenGL window");
 27.1492          return -1;
 27.1493 @@ -3443,10 +3253,8 @@
 27.1494  }
 27.1495  
 27.1496  void
 27.1497 -SDL_GL_SwapWindow(SDL_WindowID windowID)
 27.1498 +SDL_GL_SwapWindow(SDL_Window * window)
 27.1499  {
 27.1500 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
 27.1501 -
 27.1502      if (!window) {
 27.1503          return;
 27.1504      }
 27.1505 @@ -3567,10 +3375,8 @@
 27.1506  #endif
 27.1507  
 27.1508  SDL_bool
 27.1509 -SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo *info)
 27.1510 +SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
 27.1511  {
 27.1512 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
 27.1513 -
 27.1514      if (!window || !_this->GetWindowWMInfo) {
 27.1515          return SDL_FALSE;
 27.1516      }
    28.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Thu Jan 21 05:49:41 2010 +0000
    28.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Thu Jan 21 06:21:52 2010 +0000
    28.3 @@ -76,7 +76,7 @@
    28.4              if (point.x < 0 || point.x >= candidate->w ||
    28.5                  point.y < 0 || point.y >= candidate->h) {
    28.6                  /* The mouse is out of this fullscreen display */
    28.7 -                if (mouse->focus == candidate->id) {
    28.8 +                if (mouse->focus == candidate) {
    28.9                      SDL_SetMouseFocus(data->mouse, 0);
   28.10                  }
   28.11              } else {
   28.12 @@ -91,8 +91,8 @@
   28.13      }
   28.14  
   28.15      /* Set the focus appropriately */
   28.16 -    if (mouse->focus != window->id) {
   28.17 -        SDL_SetMouseFocus(data->mouse, window->id);
   28.18 +    if (mouse->focus != window) {
   28.19 +        SDL_SetMouseFocus(data->mouse, window);
   28.20      }
   28.21  
   28.22      switch ([event type]) {
    29.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Thu Jan 21 05:49:41 2010 +0000
    29.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Thu Jan 21 06:21:52 2010 +0000
    29.3 @@ -82,7 +82,7 @@
    29.4  Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
    29.5  {
    29.6      NSAutoreleasePool *pool;
    29.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    29.8 +    SDL_VideoDisplay *display = window->display;
    29.9      SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
   29.10      NSOpenGLPixelFormatAttribute attr[32];
   29.11      NSOpenGLPixelFormat *fmt;
    30.1 --- a/src/video/cocoa/SDL_cocoawindow.h	Thu Jan 21 05:49:41 2010 +0000
    30.2 +++ b/src/video/cocoa/SDL_cocoawindow.h	Thu Jan 21 06:21:52 2010 +0000
    30.3 @@ -69,8 +69,8 @@
    30.4  
    30.5  struct SDL_WindowData
    30.6  {
    30.7 -    SDL_WindowID windowID;
    30.8 -    NSWindow *window;
    30.9 +    SDL_Window *window;
   30.10 +    NSWindow *nswindow;
   30.11      SDL_bool created;
   30.12      CGDirectDisplayID display;
   30.13      Cocoa_WindowListener *listener;
    31.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Thu Jan 21 05:49:41 2010 +0000
    31.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Thu Jan 21 06:21:52 2010 +0000
    31.3 @@ -86,13 +86,13 @@
    31.4  
    31.5  - (BOOL)windowShouldClose:(id)sender
    31.6  {
    31.7 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_CLOSE, 0, 0);
    31.8 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
    31.9      return NO;
   31.10  }
   31.11  
   31.12  - (void)windowDidExpose:(NSNotification *)aNotification
   31.13  {
   31.14 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_EXPOSED, 0, 0);
   31.15 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
   31.16  }
   31.17  
   31.18  - (void)windowDidMove:(NSNotification *)aNotification
   31.19 @@ -102,7 +102,7 @@
   31.20      ConvertNSRect(&rect);
   31.21      x = (int)rect.origin.x;
   31.22      y = (int)rect.origin.y;
   31.23 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_MOVED, x, y);
   31.24 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MOVED, x, y);
   31.25  }
   31.26  
   31.27  - (void)windowDidResize:(NSNotification *)aNotification
   31.28 @@ -111,17 +111,17 @@
   31.29      NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
   31.30      w = (int)rect.size.width;
   31.31      h = (int)rect.size.height;
   31.32 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_RESIZED, w, h);
   31.33 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
   31.34  }
   31.35  
   31.36  - (void)windowDidMiniaturize:(NSNotification *)aNotification
   31.37  {
   31.38 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
   31.39 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
   31.40  }
   31.41  
   31.42  - (void)windowDidDeminiaturize:(NSNotification *)aNotification
   31.43  {
   31.44 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_RESTORED, 0, 0);
   31.45 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
   31.46  }
   31.47  
   31.48  - (void)windowDidBecomeKey:(NSNotification *)aNotification
   31.49 @@ -130,7 +130,7 @@
   31.50  
   31.51      /* We're going to get keyboard events, since we're key. */
   31.52      index = _data->videodata->keyboard;
   31.53 -    SDL_SetKeyboardFocus(index, _data->windowID);
   31.54 +    SDL_SetKeyboardFocus(index, _data->window);
   31.55  }
   31.56  
   31.57  - (void)windowDidResignKey:(NSNotification *)aNotification
   31.58 @@ -141,7 +141,7 @@
   31.59      /* Some other window will get mouse events, since we're not key. */
   31.60      index = _data->videodata->mouse;
   31.61      mouse = SDL_GetMouse(index);
   31.62 -    if (mouse->focus == _data->windowID) {
   31.63 +    if (mouse->focus == _data->window) {
   31.64          SDL_SetMouseFocus(index, 0);
   31.65      }
   31.66  
   31.67 @@ -152,12 +152,12 @@
   31.68  
   31.69  - (void)windowDidHide:(NSNotification *)aNotification
   31.70  {
   31.71 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_HIDDEN, 0, 0);
   31.72 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
   31.73  }
   31.74  
   31.75  - (void)windowDidUnhide:(NSNotification *)aNotification
   31.76  {
   31.77 -    SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_SHOWN, 0, 0);
   31.78 +    SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
   31.79  }
   31.80  
   31.81  - (void)mouseDown:(NSEvent *)theEvent
   31.82 @@ -228,7 +228,7 @@
   31.83  
   31.84  - (void)mouseMoved:(NSEvent *)theEvent
   31.85  {
   31.86 -    SDL_Window *window = SDL_GetWindowFromID(_data->windowID);
   31.87 +    SDL_Window *window = _data->window;
   31.88      int index;
   31.89      SDL_Mouse *mouse;
   31.90      NSPoint point;
   31.91 @@ -243,8 +243,8 @@
   31.92              SDL_SetMouseFocus(index, 0);
   31.93          }
   31.94      } else {
   31.95 -        if (mouse->focus != _data->windowID) {
   31.96 -            SDL_SetMouseFocus(index, _data->windowID);
   31.97 +        if (mouse->focus != _data->window) {
   31.98 +            SDL_SetMouseFocus(index, _data->window);
   31.99          }
  31.100          SDL_SendMouseMotion(index, 0, (int)point.x, (int)point.y, 0);
  31.101      }
  31.102 @@ -298,7 +298,7 @@
  31.103  {
  31.104      NSAutoreleasePool *pool;
  31.105      SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
  31.106 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  31.107 +    SDL_VideoDisplay *display = window->display;
  31.108      SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
  31.109      SDL_WindowData *data;
  31.110  
  31.111 @@ -308,7 +308,7 @@
  31.112          SDL_OutOfMemory();
  31.113          return -1;
  31.114      }
  31.115 -    data->windowID = window->id;
  31.116 +    data->window = window;
  31.117      data->window = nswindow;
  31.118      data->created = created;
  31.119      data->display = displaydata->display;
  31.120 @@ -363,7 +363,7 @@
  31.121      if ([nswindow isKeyWindow]) {
  31.122          int index = data->videodata->keyboard;
  31.123          window->flags |= SDL_WINDOW_INPUT_FOCUS;
  31.124 -        SDL_SetKeyboardFocus(index, data->windowID);
  31.125 +        SDL_SetKeyboardFocus(index, data->window);
  31.126  
  31.127          if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
  31.128              /* FIXME */
  31.129 @@ -381,7 +381,7 @@
  31.130  {
  31.131      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  31.132      NSWindow *nswindow;
  31.133 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  31.134 +    SDL_VideoDisplay *display = window->display;
  31.135      NSRect rect;
  31.136      SDL_Rect bounds;
  31.137      unsigned int style;
  31.138 @@ -490,7 +490,7 @@
  31.139  {
  31.140      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  31.141      NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
  31.142 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  31.143 +    SDL_VideoDisplay *display = window->display;
  31.144      NSRect rect;
  31.145      SDL_Rect bounds;
  31.146  
    32.1 --- a/src/video/directfb/SDL_DirectFB_WM.c	Thu Jan 21 05:49:41 2010 +0000
    32.2 +++ b/src/video/directfb/SDL_DirectFB_WM.c	Thu Jan 21 06:21:52 2010 +0000
    32.3 @@ -196,7 +196,7 @@
    32.4  DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window)
    32.5  {
    32.6      SDL_DFB_WINDOWDATA(window);
    32.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    32.8 +    SDL_VideoDisplay *display = window->display;
    32.9  
   32.10      windata->window->GetPosition(windata->window,
   32.11                                   &windata->restore.x, &windata->restore.y);
    33.1 --- a/src/video/directfb/SDL_DirectFB_events.c	Thu Jan 21 05:49:41 2010 +0000
    33.2 +++ b/src/video/directfb/SDL_DirectFB_events.c	Thu Jan 21 06:21:52 2010 +0000
    33.3 @@ -46,7 +46,7 @@
    33.4  static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button);
    33.5  
    33.6  static void
    33.7 -DirectFB_SetContext(_THIS, SDL_WindowID id)
    33.8 +DirectFB_SetContext(_THIS, SDL_Window *window)
    33.9  {
   33.10  #if (DFB_VERSION_ATLEAST(1,0,0))
   33.11      /* FIXME: does not work on 1.0/1.2 with radeon driver
   33.12 @@ -55,7 +55,7 @@
   33.13       */
   33.14  
   33.15      SDL_Window *window = SDL_GetWindowFromID(id);
   33.16 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   33.17 +    SDL_VideoDisplay *display = window->display;
   33.18      DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
   33.19      int ret;
   33.20  
   33.21 @@ -70,7 +70,7 @@
   33.22  }
   33.23  
   33.24  static void
   33.25 -FocusAllMice(_THIS, SDL_WindowID id)
   33.26 +FocusAllMice(_THIS, SDL_Window *window)
   33.27  {
   33.28      SDL_DFB_DEVICEDATA(_this);
   33.29      int index;
   33.30 @@ -81,7 +81,7 @@
   33.31  
   33.32  
   33.33  static void
   33.34 -FocusAllKeyboards(_THIS, SDL_WindowID id)
   33.35 +FocusAllKeyboards(_THIS, SDL_Window *window)
   33.36  {
   33.37      SDL_DFB_DEVICEDATA(_this);
   33.38      int index;
   33.39 @@ -177,7 +177,7 @@
   33.40              break;
   33.41          case DWET_MOTION:
   33.42              if (ClientXY(p, &evt->x, &evt->y)) {
   33.43 -                SDL_Window *window = SDL_GetWindowFromID(p->sdl_id);
   33.44 +                SDL_Window *window = p->window;
   33.45                  if (!devdata->use_linux_input) {
   33.46                      if (!(flags & SDL_WINDOW_INPUT_GRABBED))
   33.47                          SDL_SendMouseMotion(devdata->mouse_id[0], 0,
   33.48 @@ -193,7 +193,7 @@
   33.49                      }
   33.50                  }
   33.51                  if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS))
   33.52 -                    SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_ENTER, 0,
   33.53 +                    SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_ENTER, 0,
   33.54                                          0);
   33.55              }
   33.56              break;
   33.57 @@ -218,13 +218,13 @@
   33.58              break;
   33.59          case DWET_POSITION:
   33.60              if (ClientXY(p, &evt->x, &evt->y)) {
   33.61 -                SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_MOVED,
   33.62 +                SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_MOVED,
   33.63                                      evt->x, evt->y);
   33.64              }
   33.65              break;
   33.66          case DWET_POSITION_SIZE:
   33.67              if (ClientXY(p, &evt->x, &evt->y)) {
   33.68 -                SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_MOVED,
   33.69 +                SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_MOVED,
   33.70                                      evt->x, evt->y);
   33.71              }
   33.72              /* fall throught */
   33.73 @@ -234,32 +234,32 @@
   33.74              evt->h -=
   33.75                  (p->theme.top_size + p->theme.bottom_size +
   33.76                   p->theme.caption_size);
   33.77 -            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_RESIZED,
   33.78 +            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_RESIZED,
   33.79                                  evt->w, evt->h);
   33.80              break;
   33.81          case DWET_CLOSE:
   33.82 -            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_CLOSE, 0, 0);
   33.83 +            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
   33.84              break;
   33.85          case DWET_GOTFOCUS:
   33.86 -            DirectFB_SetContext(_this, p->sdl_id);
   33.87 -            FocusAllKeyboards(_this, p->sdl_id);
   33.88 -            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_FOCUS_GAINED,
   33.89 +            DirectFB_SetContext(_this, p->window);
   33.90 +            FocusAllKeyboards(_this, p->window);
   33.91 +            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_FOCUS_GAINED,
   33.92                                  0, 0);
   33.93              break;
   33.94          case DWET_LOSTFOCUS:
   33.95 -            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
   33.96 +            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
   33.97              FocusAllKeyboards(_this, 0);
   33.98              break;
   33.99          case DWET_ENTER:
  33.100              /* SDL_DirectFB_ReshowCursor(_this, 0); */
  33.101 -            FocusAllMice(_this, p->sdl_id);
  33.102 +            FocusAllMice(_this, p->window);
  33.103              // FIXME: when do we really enter ?
  33.104              if (ClientXY(p, &evt->x, &evt->y))
  33.105                  MotionAllMice(_this, evt->x, evt->y);
  33.106 -            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_ENTER, 0, 0);
  33.107 +            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_ENTER, 0, 0);
  33.108              break;
  33.109          case DWET_LEAVE:
  33.110 -            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_LEAVE, 0, 0);
  33.111 +            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_LEAVE, 0, 0);
  33.112              FocusAllMice(_this, 0);
  33.113              /* SDL_DirectFB_ReshowCursor(_this, 1); */
  33.114              break;
  33.115 @@ -372,16 +372,16 @@
  33.116      SDL_DFB_DEVICEDATA(_this);
  33.117      DFB_WindowData *p;
  33.118      DFBInputEvent ievt;
  33.119 -    Sint32 /* SDL_WindowID */ grabbed_window;
  33.120 +    SDL_Window *grabbed_window;
  33.121  
  33.122 -    grabbed_window = -1;
  33.123 +    grabbed_window = NULL;
  33.124  
  33.125      for (p = devdata->firstwin; p != NULL; p = p->next) {
  33.126          DFBWindowEvent evt;
  33.127 -        SDL_Window *w = SDL_GetWindowFromID(p->sdl_id);
  33.128 +        SDL_Window *w = SDL_GetWindowFromID(p->window);
  33.129  
  33.130          if (w->flags & SDL_WINDOW_INPUT_GRABBED) {
  33.131 -            grabbed_window = p->sdl_id;
  33.132 +            grabbed_window = w;
  33.133          }
  33.134  
  33.135          while (p->eventbuffer->GetEvent(p->eventbuffer,
    34.1 --- a/src/video/directfb/SDL_DirectFB_mouse.c	Thu Jan 21 05:49:41 2010 +0000
    34.2 +++ b/src/video/directfb/SDL_DirectFB_mouse.c	Thu Jan 21 06:21:52 2010 +0000
    34.3 @@ -31,7 +31,7 @@
    34.4  static int DirectFB_ShowCursor(SDL_Cursor * cursor);
    34.5  static void DirectFB_MoveCursor(SDL_Cursor * cursor);
    34.6  static void DirectFB_FreeCursor(SDL_Cursor * cursor);
    34.7 -static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_WindowID windowID,
    34.8 +static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window,
    34.9                                 int x, int y);
   34.10  static void DirectFB_FreeMouse(SDL_Mouse * mouse);
   34.11  
   34.12 @@ -159,14 +159,13 @@
   34.13  {
   34.14      SDL_DFB_CURSORDATA(cursor);
   34.15      DFBResult ret;
   34.16 -    SDL_WindowID wid;
   34.17 +    SDL_Window *window;
   34.18  
   34.19 -    wid = SDL_GetFocusWindow();
   34.20 -    if (wid <= 0)
   34.21 +    window = SDL_GetFocusWindow();
   34.22 +    if (!window)
   34.23          return -1;
   34.24      else {
   34.25 -        SDL_Window *window = SDL_GetWindowFromID(wid);
   34.26 -        SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   34.27 +        SDL_VideoDisplay *display = window->display;
   34.28  
   34.29          if (display) {
   34.30              DFB_DisplayData *dispdata =
   34.31 @@ -216,10 +215,9 @@
   34.32  
   34.33  /* Warp the mouse to (x,y) */
   34.34  static void
   34.35 -DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y)
   34.36 +DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y)
   34.37  {
   34.38 -    SDL_Window *window = SDL_GetWindowFromID(windowID);
   34.39 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   34.40 +    SDL_VideoDisplay *display = window->display;
   34.41      DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
   34.42      DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   34.43      DFBResult ret;
    35.1 --- a/src/video/directfb/SDL_DirectFB_render.c	Thu Jan 21 05:49:41 2010 +0000
    35.2 +++ b/src/video/directfb/SDL_DirectFB_render.c	Thu Jan 21 06:21:52 2010 +0000
    35.3 @@ -280,7 +280,7 @@
    35.4  DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags)
    35.5  {
    35.6      SDL_DFB_WINDOWDATA(window);
    35.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    35.8 +    SDL_VideoDisplay *display = window->display;
    35.9      SDL_Renderer *renderer = NULL;
   35.10      DirectFB_RenderData *data = NULL;
   35.11      DFBResult ret;
   35.12 @@ -313,7 +313,7 @@
   35.13      renderer->DestroyTexture = DirectFB_DestroyTexture;
   35.14      renderer->DestroyRenderer = DirectFB_DestroyRenderer;
   35.15      renderer->info = DirectFB_RenderDriver.info;
   35.16 -    renderer->window = window->id;      /* SDL window id */
   35.17 +    renderer->window = window;      /* SDL window */
   35.18      renderer->driverdata = data;
   35.19  
   35.20      renderer->info.flags =
   35.21 @@ -446,7 +446,7 @@
   35.22  {
   35.23      SDL_DFB_RENDERERDATA(renderer);
   35.24      SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   35.25 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   35.26 +    SDL_VideoDisplay *display = window->display;
   35.27      SDL_DFB_DEVICEDATA(display->device);
   35.28      DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
   35.29      DirectFB_TextureData *data = texture->driverdata;
   35.30 @@ -502,7 +502,7 @@
   35.31  DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   35.32  {
   35.33      SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   35.34 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   35.35 +    SDL_VideoDisplay *display = window->display;
   35.36      SDL_DFB_DEVICEDATA(display->device);
   35.37      DirectFB_TextureData *data;
   35.38      DFBResult ret;
    36.1 --- a/src/video/directfb/SDL_DirectFB_window.c	Thu Jan 21 05:49:41 2010 +0000
    36.2 +++ b/src/video/directfb/SDL_DirectFB_window.c	Thu Jan 21 06:21:52 2010 +0000
    36.3 @@ -140,7 +140,7 @@
    36.4      windata->window->RaiseToTop(windata->window);
    36.5  
    36.6      /* remember parent */
    36.7 -    windata->sdl_id = window->id;
    36.8 +    windata->window = window;
    36.9  
   36.10      /* Add to list ... */
   36.11  
    37.1 --- a/src/video/directfb/SDL_DirectFB_window.h	Thu Jan 21 05:49:41 2010 +0000
    37.2 +++ b/src/video/directfb/SDL_DirectFB_window.h	Thu Jan 21 06:21:52 2010 +0000
    37.3 @@ -36,7 +36,7 @@
    37.4      IDirectFBWindow *window;
    37.5      DirectFB_GLContext *gl_context;
    37.6      IDirectFBEventBuffer *eventbuffer;
    37.7 -    SDL_WindowID sdl_id;
    37.8 +    SDL_Window *window;
    37.9      DFB_WindowData *next;
   37.10      Uint8 opacity;
   37.11      DFBRectangle client;
    38.1 --- a/src/video/dummy/SDL_nullrender.c	Thu Jan 21 05:49:41 2010 +0000
    38.2 +++ b/src/video/dummy/SDL_nullrender.c	Thu Jan 21 06:21:52 2010 +0000
    38.3 @@ -74,7 +74,7 @@
    38.4  SDL_Renderer *
    38.5  SDL_DUMMY_CreateRenderer(SDL_Window * window, Uint32 flags)
    38.6  {
    38.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    38.8 +    SDL_VideoDisplay *display = window->display;
    38.9      SDL_DisplayMode *displayMode = &display->current_mode;
   38.10      SDL_Renderer *renderer;
   38.11      SDL_DUMMY_RenderData *data;
   38.12 @@ -113,7 +113,7 @@
   38.13      renderer->DestroyRenderer = SDL_DUMMY_DestroyRenderer;
   38.14      renderer->info.name = SDL_DUMMY_RenderDriver.info.name;
   38.15      renderer->info.flags = 0;
   38.16 -    renderer->window = window->id;
   38.17 +    renderer->window = window;
   38.18      renderer->driverdata = data;
   38.19      Setup_SoftwareRenderer(renderer);
   38.20  
   38.21 @@ -238,8 +238,8 @@
   38.22  {
   38.23      SDL_DUMMY_RenderData *data =
   38.24          (SDL_DUMMY_RenderData *) renderer->driverdata;
   38.25 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   38.26 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   38.27 +    SDL_Window *window = renderer->window;
   38.28 +    SDL_VideoDisplay *display = window->display;
   38.29  
   38.30      if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
   38.31          SDL_Surface *target = data->screens[data->current_screen];
   38.32 @@ -266,8 +266,8 @@
   38.33  {
   38.34      SDL_DUMMY_RenderData *data =
   38.35          (SDL_DUMMY_RenderData *) renderer->driverdata;
   38.36 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   38.37 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   38.38 +    SDL_Window *window = renderer->window;
   38.39 +    SDL_VideoDisplay *display = window->display;
   38.40      SDL_Surface *screen = data->screens[data->current_screen];
   38.41      Uint32 screen_format = display->current_mode.format;
   38.42      Uint8 *screen_pixels = (Uint8 *) screen->pixels +
   38.43 @@ -286,8 +286,8 @@
   38.44  {
   38.45      SDL_DUMMY_RenderData *data =
   38.46          (SDL_DUMMY_RenderData *) renderer->driverdata;
   38.47 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   38.48 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   38.49 +    SDL_Window *window = renderer->window;
   38.50 +    SDL_VideoDisplay *display = window->display;
   38.51      SDL_Surface *screen = data->screens[data->current_screen];
   38.52      Uint32 screen_format = display->current_mode.format;
   38.53      Uint8 *screen_pixels = (Uint8 *) screen->pixels +
   38.54 @@ -311,7 +311,7 @@
   38.55      if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) {
   38.56          char file[128];
   38.57          SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp",
   38.58 -                     renderer->window, ++frame_number);
   38.59 +                     renderer->window->id, ++frame_number);
   38.60          SDL_SaveBMP(data->screens[data->current_screen], file);
   38.61      }
   38.62  
    39.1 --- a/src/video/nds/SDL_ndsrender.c	Thu Jan 21 05:49:41 2010 +0000
    39.2 +++ b/src/video/nds/SDL_ndsrender.c	Thu Jan 21 06:21:52 2010 +0000
    39.3 @@ -126,7 +126,7 @@
    39.4  SDL_Renderer *
    39.5  NDS_CreateRenderer(SDL_Window * window, Uint32 flags)
    39.6  {
    39.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    39.8 +    SDL_VideoDisplay *display = window->display;
    39.9      SDL_DisplayMode *displayMode = &display->current_mode;
   39.10      SDL_Renderer *renderer;
   39.11      NDS_RenderData *data;
   39.12 @@ -175,7 +175,7 @@
   39.13      renderer->DestroyRenderer = NDS_DestroyRenderer;
   39.14      renderer->info.name = NDS_RenderDriver.info.name;
   39.15      renderer->info.flags = 0;
   39.16 -    renderer->window = window->id;
   39.17 +    renderer->window = window;
   39.18      renderer->driverdata = data;
   39.19      renderer->CreateTexture = NDS_CreateTexture;
   39.20      renderer->QueryTexturePixels = NDS_QueryTexturePixels;
   39.21 @@ -490,8 +490,8 @@
   39.22  {
   39.23      NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
   39.24      NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata;
   39.25 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   39.26 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   39.27 +    SDL_Window *window = renderer->window;
   39.28 +    SDL_VideoDisplay *display = window->display;
   39.29      int Bpp = SDL_BYTESPERPIXEL(texture->format);
   39.30  
   39.31      if (txdat->type == NDSTX_BG) {
   39.32 @@ -515,8 +515,8 @@
   39.33  NDS_RenderPresent(SDL_Renderer * renderer)
   39.34  {
   39.35      NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
   39.36 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   39.37 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   39.38 +    SDL_Window *window = renderer->window;
   39.39 +    SDL_VideoDisplay *display = window->display;
   39.40  
   39.41      /* update sprites */
   39.42  //    NDS_OAM_Update(&(data->oam_copy), data->sub);
   39.43 @@ -538,8 +538,6 @@
   39.44  NDS_DestroyRenderer(SDL_Renderer * renderer)
   39.45  {
   39.46      NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
   39.47 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   39.48 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   39.49      int i;
   39.50  
   39.51      if (data) {
    40.1 --- a/src/video/pandora/SDL_pandora.c	Thu Jan 21 05:49:41 2010 +0000
    40.2 +++ b/src/video/pandora/SDL_pandora.c	Thu Jan 21 06:21:52 2010 +0000
    40.3 @@ -417,7 +417,7 @@
    40.4      SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
    40.5      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
    40.6      SDL_DisplayData *didata =
    40.7 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
    40.8 +        (SDL_DisplayData *) window->display->driverdata;
    40.9      EGLBoolean status;
   40.10      int32_t gfstatus;
   40.11      EGLint configs;
   40.12 @@ -816,7 +816,7 @@
   40.13      SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   40.14      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   40.15      SDL_DisplayData *didata =
   40.16 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   40.17 +        (SDL_DisplayData *) window->display->driverdata;
   40.18  
   40.19  
   40.20      if (phdata->egl_initialized != SDL_TRUE) {
    41.1 --- a/src/video/photon/SDL_photon.c	Thu Jan 21 05:49:41 2010 +0000
    41.2 +++ b/src/video/photon/SDL_photon.c	Thu Jan 21 06:21:52 2010 +0000
    41.3 @@ -777,7 +777,7 @@
    41.4  {
    41.5      SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
    41.6      SDL_DisplayData *didata =
    41.7 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
    41.8 +        (SDL_DisplayData *) window->display->driverdata;
    41.9      SDL_WindowData *wdata;
   41.10      PhDim_t winsize;
   41.11      PhPoint_t winpos;
   41.12 @@ -997,7 +997,7 @@
   41.13      PtFlush();
   41.14  
   41.15      /* By default last created window got a input focus */
   41.16 -    SDL_SetKeyboardFocus(0, window->id);
   41.17 +    SDL_SetKeyboardFocus(0, window);
   41.18  
   41.19      /* Emit focus gained event, because photon is not sending it */
   41.20      SDL_OnWindowFocusGained(window);
   41.21 @@ -1055,7 +1055,7 @@
   41.22  {
   41.23      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   41.24      SDL_DisplayData *didata =
   41.25 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   41.26 +        (SDL_DisplayData *) window->display->driverdata;
   41.27      PhPoint_t winpos;
   41.28      int32_t status;
   41.29  
   41.30 @@ -1223,7 +1223,7 @@
   41.31  {
   41.32      SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   41.33      SDL_DisplayData *didata =
   41.34 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   41.35 +        (SDL_DisplayData *) window->display->driverdata;
   41.36      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   41.37      int32_t status;
   41.38  
   41.39 @@ -1414,7 +1414,7 @@
   41.40      SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   41.41      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   41.42      SDL_DisplayData *didata =
   41.43 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   41.44 +        (SDL_DisplayData *) window->display->driverdata;
   41.45      EGLBoolean status;
   41.46      int32_t gfstatus;
   41.47      EGLint configs;
   41.48 @@ -1941,7 +1941,7 @@
   41.49      SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   41.50      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   41.51      SDL_DisplayData *didata =
   41.52 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   41.53 +        (SDL_DisplayData *) window->display->driverdata;
   41.54      PhRect_t dst_rect;
   41.55      PhRect_t src_rect;
   41.56      int32_t status;
   41.57 @@ -2050,7 +2050,7 @@
   41.58      SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   41.59      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   41.60      SDL_DisplayData *didata =
   41.61 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   41.62 +        (SDL_DisplayData *) window->display->driverdata;
   41.63      SDL_bool makecurrent=SDL_FALSE;
   41.64      int32_t gfstatus;
   41.65  
   41.66 @@ -2199,10 +2199,10 @@
   41.67                              {
   41.68                                  /* Mouse cursor over handled window */
   41.69                                  if (window != NULL) {
   41.70 -                                    SDL_SendWindowEvent(window->id,
   41.71 +                                    SDL_SendWindowEvent(window,
   41.72                                                          SDL_WINDOWEVENT_ENTER,
   41.73                                                          0, 0);
   41.74 -                                    SDL_SetMouseFocus(0, window->id);
   41.75 +                                    SDL_SetMouseFocus(0, window);
   41.76                                  }
   41.77                              }
   41.78                              break;
   41.79 @@ -2210,7 +2210,7 @@
   41.80                              {
   41.81                                  /* Mouse cursor out of handled window */
   41.82                                  if (window != NULL) {
   41.83 -                                    SDL_SendWindowEvent(window->id,
   41.84 +                                    SDL_SendWindowEvent(window,
   41.85                                                          SDL_WINDOWEVENT_LEAVE,
   41.86                                                          0, 0);
   41.87                                  }
   41.88 @@ -2682,7 +2682,7 @@
   41.89                          case Ph_WM_CLOSE:
   41.90                              {
   41.91                                  if (window != NULL) {
   41.92 -                                    SDL_SendWindowEvent(window->id,
   41.93 +                                    SDL_SendWindowEvent(window,
   41.94                                                          SDL_WINDOWEVENT_CLOSE,
   41.95                                                          0, 0);
   41.96                                  }
   41.97 @@ -2695,10 +2695,10 @@
   41.98                                      if (window != NULL) {
   41.99                                          PhRegion_t wregion;
  41.100  
  41.101 -                                        SDL_SendWindowEvent(window->id,
  41.102 +                                        SDL_SendWindowEvent(window,
  41.103                                                              SDL_WINDOWEVENT_FOCUS_GAINED,
  41.104                                                              0, 0);
  41.105 -                                        SDL_SetKeyboardFocus(0, window->id);
  41.106 +                                        SDL_SetKeyboardFocus(0, window);
  41.107  
  41.108                                          /* Set window region sensible to mouse motion events */
  41.109                                          PhRegionQuery(PtWidgetRid
  41.110 @@ -2712,7 +2712,7 @@
  41.111                                                         &wregion, NULL, NULL);
  41.112  
  41.113                                          /* If window got a focus, then it is visible */
  41.114 -                                        SDL_SendWindowEvent(window->id,
  41.115 +                                        SDL_SendWindowEvent(window,
  41.116                                                              SDL_WINDOWEVENT_SHOWN,
  41.117                                                              0, 0);
  41.118                                      }
  41.119 @@ -2722,7 +2722,7 @@
  41.120                                      if (window != NULL) {
  41.121                                          PhRegion_t wregion;
  41.122  
  41.123 -                                        SDL_SendWindowEvent(window->id,
  41.124 +                                        SDL_SendWindowEvent(window,
  41.125                                                              SDL_WINDOWEVENT_FOCUS_LOST,
  41.126                                                              0, 0);
  41.127  
  41.128 @@ -2743,7 +2743,7 @@
  41.129                          case Ph_WM_MOVE:
  41.130                              {
  41.131                                  if (window != NULL) {
  41.132 -                                    SDL_SendWindowEvent(window->id,
  41.133 +                                    SDL_SendWindowEvent(window,
  41.134                                                          SDL_WINDOWEVENT_MOVED,
  41.135                                                          wmevent->pos.x,
  41.136                                                          wmevent->pos.y);
  41.137 @@ -2754,7 +2754,7 @@
  41.138                              {
  41.139                                  if (window != NULL) {
  41.140                                      /* Set new window position after resize */
  41.141 -                                    SDL_SendWindowEvent(window->id,
  41.142 +                                    SDL_SendWindowEvent(window,
  41.143                                                          SDL_WINDOWEVENT_MOVED,
  41.144                                                          wmevent->pos.x,
  41.145                                                          wmevent->pos.y);
  41.146 @@ -2766,7 +2766,7 @@
  41.147                                      }
  41.148  
  41.149                                      /* Set new window size after resize */
  41.150 -                                    SDL_SendWindowEvent(window->id,
  41.151 +                                    SDL_SendWindowEvent(window,
  41.152                                                          SDL_WINDOWEVENT_RESIZED,
  41.153                                                          wmevent->size.w,
  41.154                                                          wmevent->size.h);
  41.155 @@ -2777,11 +2777,11 @@
  41.156                              {
  41.157                                  if (window != NULL) {
  41.158                                      /* Send new window state: minimized */
  41.159 -                                    SDL_SendWindowEvent(window->id,
  41.160 +                                    SDL_SendWindowEvent(window,
  41.161                                                          SDL_WINDOWEVENT_MINIMIZED,
  41.162                                                          0, 0);
  41.163                                      /* In case window is minimized, then it is hidden */
  41.164 -                                    SDL_SendWindowEvent(window->id,
  41.165 +                                    SDL_SendWindowEvent(window,
  41.166                                                          SDL_WINDOWEVENT_HIDDEN,
  41.167                                                          0, 0);
  41.168                                  }
  41.169 @@ -2792,7 +2792,7 @@
  41.170                                  if (window != NULL) {
  41.171                                      if ((window->flags & SDL_WINDOW_RESIZABLE)==SDL_WINDOW_RESIZABLE)
  41.172                                      {
  41.173 -                                       SDL_SendWindowEvent(window->id,
  41.174 +                                       SDL_SendWindowEvent(window,
  41.175                                                             SDL_WINDOWEVENT_MAXIMIZED,
  41.176                                                             0, 0);
  41.177                                      }
  41.178 @@ -2806,7 +2806,7 @@
  41.179                          case Ph_WM_RESTORE:
  41.180                              {
  41.181                                  if (window != NULL) {
  41.182 -                                    SDL_SendWindowEvent(window->id,
  41.183 +                                    SDL_SendWindowEvent(window,
  41.184                                                          SDL_WINDOWEVENT_RESTORED,
  41.185                                                          0, 0);
  41.186                                  }
    42.1 --- a/src/video/photon/SDL_photon_input.c	Thu Jan 21 05:49:41 2010 +0000
    42.2 +++ b/src/video/photon/SDL_photon_input.c	Thu Jan 21 06:21:52 2010 +0000
    42.3 @@ -38,7 +38,7 @@
    42.4  int photon_showcursor(SDL_Cursor * cursor);
    42.5  void photon_movecursor(SDL_Cursor * cursor);
    42.6  void photon_freecursor(SDL_Cursor * cursor);
    42.7 -void photon_warpmouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y);
    42.8 +void photon_warpmouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y);
    42.9  void photon_freemouse(SDL_Mouse * mouse);
   42.10  
   42.11  int32_t
   42.12 @@ -228,13 +228,12 @@
   42.13      SDL_DisplayData *didata;
   42.14      SDL_Window *window;
   42.15      SDL_WindowData *wdata;
   42.16 -    SDL_WindowID window_id;
   42.17      PhCursorDef_t *internal_cursor;
   42.18      int32_t status;
   42.19  
   42.20      /* Get current window id */
   42.21 -    window_id = SDL_GetFocusWindow();
   42.22 -    if (window_id <= 0) {
   42.23 +    window = SDL_GetFocusWindow();
   42.24 +    if (!window) {
   42.25          SDL_MouseData *mdata = NULL;
   42.26  
   42.27          /* If there is no current window, then someone calls this function */
   42.28 @@ -264,17 +263,12 @@
   42.29          }
   42.30      } else {
   42.31          /* Sanity checks */
   42.32 -        window = SDL_GetWindowFromID(window_id);
   42.33 -        if (window != NULL) {
   42.34 -            display = SDL_GetDisplayFromWindow(window);
   42.35 -            if (display != NULL) {
   42.36 -                didata = (SDL_DisplayData *) display->driverdata;
   42.37 -                if (didata != NULL) {
   42.38 -                    wdata = (SDL_WindowData *) window->driverdata;
   42.39 -                    if (wdata == NULL) {
   42.40 -                        return -1;
   42.41 -                    }
   42.42 -                } else {
   42.43 +        display = window->display;
   42.44 +        if (display != NULL) {
   42.45 +            didata = (SDL_DisplayData *) display->driverdata;
   42.46 +            if (didata != NULL) {
   42.47 +                wdata = (SDL_WindowData *) window->driverdata;
   42.48 +                if (wdata == NULL) {
   42.49                      return -1;
   42.50                  }
   42.51              } else {
   42.52 @@ -379,7 +373,7 @@
   42.53          /* Sanity checks */
   42.54          window = SDL_GetWindowFromID(window_id);
   42.55          if (window != NULL) {
   42.56 -            display = SDL_GetDisplayFromWindow(window);
   42.57 +            display = window->display;
   42.58              if (display != NULL) {
   42.59                  didata = (SDL_DisplayData *) display->driverdata;
   42.60                  if (didata != NULL) {
   42.61 @@ -418,19 +412,17 @@
   42.62  }
   42.63  
   42.64  void
   42.65 -photon_warpmouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y)
   42.66 +photon_warpmouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y)
   42.67  {
   42.68      SDL_VideoDisplay *display;
   42.69      SDL_DisplayData *didata;
   42.70 -    SDL_Window *window;
   42.71      SDL_WindowData *wdata;
   42.72      int16_t wx;
   42.73      int16_t wy;
   42.74  
   42.75      /* Sanity checks */
   42.76 -    window = SDL_GetWindowFromID(windowID);
   42.77      if (window != NULL) {
   42.78 -        display = SDL_GetDisplayFromWindow(window);
   42.79 +        display = window->display;
   42.80          if (display != NULL) {
   42.81              didata = (SDL_DisplayData *) display->driverdata;
   42.82              if (didata != NULL) {
    43.1 --- a/src/video/photon/SDL_photon_render.c	Thu Jan 21 05:49:41 2010 +0000
    43.2 +++ b/src/video/photon/SDL_photon_render.c	Thu Jan 21 06:21:52 2010 +0000
    43.3 @@ -124,7 +124,7 @@
    43.4  static SDL_Renderer *
    43.5  photon_createrenderer(SDL_Window * window, Uint32 flags)
    43.6  {
    43.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    43.8 +    SDL_VideoDisplay *display = window->display;
    43.9      SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
   43.10      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   43.11      SDL_Renderer *renderer = NULL;
   43.12 @@ -171,7 +171,7 @@
   43.13      renderer->DestroyTexture = photon_destroytexture;
   43.14      renderer->DestroyRenderer = photon_destroyrenderer;
   43.15      renderer->info = photon_renderdriver.info;
   43.16 -    renderer->window = window->id;
   43.17 +    renderer->window = window;
   43.18      renderer->driverdata = rdata;
   43.19  
   43.20      /* Copy direct_mode status */
   43.21 @@ -298,7 +298,7 @@
   43.22      /* Obtain window and display structures */
   43.23      window=SDL_GetWindowFromID(renderer->window);
   43.24      wdata=(SDL_WindowData*)window->driverdata;
   43.25 -    display=SDL_GetDisplayFromWindow(window);
   43.26 +    display=window->display;
   43.27      didata=(SDL_DisplayData *) display->driverdata;
   43.28      phdata=(SDL_VideoData *) display->device->driverdata;
   43.29  
   43.30 @@ -723,7 +723,7 @@
   43.31  {
   43.32      SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
   43.33      SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   43.34 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   43.35 +    SDL_VideoDisplay *display = window->display;
   43.36      SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
   43.37  
   43.38      /* Copy direct_mode status */
   43.39 @@ -738,7 +738,7 @@
   43.40  {
   43.41      SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
   43.42      SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   43.43 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   43.44 +    SDL_VideoDisplay *display = window->display;
   43.45      SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
   43.46      SDL_TextureData *tdata = NULL;
   43.47      uint32_t it;
    44.1 --- a/src/video/ps3/SDL_ps3render.c	Thu Jan 21 05:49:41 2010 +0000
    44.2 +++ b/src/video/ps3/SDL_ps3render.c	Thu Jan 21 06:21:52 2010 +0000
    44.3 @@ -133,7 +133,7 @@
    44.4  SDL_PS3_CreateRenderer(SDL_Window * window, Uint32 flags)
    44.5  {
    44.6      deprintf(1, "+SDL_PS3_CreateRenderer()\n");
    44.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    44.8 +    SDL_VideoDisplay *display = window->display;
    44.9      SDL_DisplayMode *displayMode = &display->current_mode;
   44.10      SDL_VideoData *devdata = display->device->driverdata;
   44.11      SDL_Renderer *renderer;
   44.12 @@ -179,7 +179,7 @@
   44.13      renderer->DestroyRenderer = SDL_PS3_DestroyRenderer;
   44.14      renderer->info.name = SDL_PS3_RenderDriver.info.name;
   44.15      renderer->info.flags = 0;
   44.16 -    renderer->window = window->id;
   44.17 +    renderer->window = window;
   44.18      renderer->driverdata = data;
   44.19  
   44.20      deprintf(1, "window->w = %u\n", window->w);
   44.21 @@ -518,7 +518,7 @@
   44.22      SDL_PS3_RenderData *data =
   44.23          (SDL_PS3_RenderData *) renderer->driverdata;
   44.24      SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   44.25 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   44.26 +    SDL_VideoDisplay *display = window->display;
   44.27      PS3_TextureData *txdata = (PS3_TextureData *) texture->driverdata;
   44.28      SDL_VideoData *devdata = display->device->driverdata;
   44.29  
   44.30 @@ -640,7 +640,7 @@
   44.31      SDL_PS3_RenderData *data =
   44.32          (SDL_PS3_RenderData *) renderer->driverdata;
   44.33      SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   44.34 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   44.35 +    SDL_VideoDisplay *display = window->display;
   44.36      SDL_VideoData *devdata = display->device->driverdata;
   44.37  
   44.38      /* Send the data to the screen */
    45.1 --- a/src/video/qnxgf/SDL_gf_input.c	Thu Jan 21 05:49:41 2010 +0000
    45.2 +++ b/src/video/qnxgf/SDL_gf_input.c	Thu Jan 21 06:21:52 2010 +0000
    45.3 @@ -41,7 +41,7 @@
    45.4  int gf_showcursor(SDL_Cursor * cursor);
    45.5  void gf_movecursor(SDL_Cursor * cursor);
    45.6  void gf_freecursor(SDL_Cursor * cursor);
    45.7 -void gf_warpmouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y);
    45.8 +void gf_warpmouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y);
    45.9  void gf_freemouse(SDL_Mouse * mouse);
   45.10  
   45.11  /* HIDDI interacting functions */
   45.12 @@ -278,7 +278,7 @@
   45.13          /* Sanity checks */
   45.14          window = SDL_GetWindowFromID(window_id);
   45.15          if (window != NULL) {
   45.16 -            display = SDL_GetDisplayFromWindow(window);
   45.17 +            display = window->display;
   45.18              if (display != NULL) {
   45.19                  didata = (SDL_DisplayData *) display->driverdata;
   45.20                  if (didata == NULL) {
   45.21 @@ -399,7 +399,7 @@
   45.22          /* Sanity checks */
   45.23          window = SDL_GetWindowFromID(window_id);
   45.24          if (window != NULL) {
   45.25 -            display = SDL_GetDisplayFromWindow(window);
   45.26 +            display = window->display;
   45.27              if (display != NULL) {
   45.28                  didata = (SDL_DisplayData *) display->driverdata;
   45.29                  if (didata == NULL) {
   45.30 @@ -461,19 +461,17 @@
   45.31  }
   45.32  
   45.33  void
   45.34 -gf_warpmouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y)
   45.35 +gf_warpmouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y)
   45.36  {
   45.37      SDL_VideoDisplay *display;
   45.38      SDL_DisplayData *didata;
   45.39 -    SDL_Window *window;
   45.40      uint32_t xmax;
   45.41      uint32_t ymax;
   45.42      int32_t status;
   45.43  
   45.44      /* Sanity checks */
   45.45 -    window = SDL_GetWindowFromID(windowID);
   45.46      if (window != NULL) {
   45.47 -        display = SDL_GetDisplayFromWindow(window);
   45.48 +        display = window->display;
   45.49          if (display != NULL) {
   45.50              didata = (SDL_DisplayData *) display->driverdata;
   45.51              if (didata == NULL) {
   45.52 @@ -495,7 +493,7 @@
   45.53      }
   45.54  
   45.55      /* Get window size to clamp maximum coordinates */
   45.56 -    SDL_GetWindowSize(windowID, &xmax, &ymax);
   45.57 +    SDL_GetWindowSize(window, &xmax, &ymax);
   45.58      if (x >= xmax) {
   45.59          x = xmax - 1;
   45.60      }
    46.1 --- a/src/video/qnxgf/SDL_gf_render.c	Thu Jan 21 05:49:41 2010 +0000
    46.2 +++ b/src/video/qnxgf/SDL_gf_render.c	Thu Jan 21 06:21:52 2010 +0000
    46.3 @@ -110,7 +110,7 @@
    46.4  static SDL_Renderer *
    46.5  gf_createrenderer(SDL_Window * window, Uint32 flags)
    46.6  {
    46.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    46.8 +    SDL_VideoDisplay *display = window->display;
    46.9      SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
   46.10      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   46.11      SDL_Renderer *renderer = NULL;
   46.12 @@ -162,7 +162,7 @@
   46.13      renderer->DestroyTexture = gf_destroytexture;
   46.14      renderer->DestroyRenderer = gf_destroyrenderer;
   46.15      renderer->info = gf_renderdriver.info;
   46.16 -    renderer->window = window->id;
   46.17 +    renderer->window = window;
   46.18      renderer->driverdata = rdata;
   46.19  
   46.20      /* Set render acceleration flag in case it is accelerated */
   46.21 @@ -284,7 +284,7 @@
   46.22  gf_activaterenderer(SDL_Renderer * renderer)
   46.23  {
   46.24      SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
   46.25 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(rdata->window);
   46.26 +    SDL_VideoDisplay *display = rdata->window->display;
   46.27      SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
   46.28  
   46.29      /* Setup current surface as visible */
   46.30 @@ -301,7 +301,7 @@
   46.31  {
   46.32      SDL_RenderData *renderdata = (SDL_RenderData *) renderer->driverdata;
   46.33      SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   46.34 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   46.35 +    SDL_VideoDisplay *display = window->display;
   46.36      SDL_TextureData *tdata = NULL;
   46.37  
   46.38      /* Allocate texture driver data */
    47.1 --- a/src/video/qnxgf/SDL_qnxgf.c	Thu Jan 21 05:49:41 2010 +0000
    47.2 +++ b/src/video/qnxgf/SDL_qnxgf.c	Thu Jan 21 06:21:52 2010 +0000
    47.3 @@ -978,7 +978,7 @@
    47.4  qnxgf_createwindow(_THIS, SDL_Window * window)
    47.5  {
    47.6      SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
    47.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    47.8 +    SDL_VideoDisplay *display = window->display;
    47.9      SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
   47.10      SDL_WindowData *wdata;
   47.11      int32_t status;
   47.12 @@ -1081,8 +1081,8 @@
   47.13      hiddi_enable_mouse();
   47.14  
   47.15      /* By default last created window got a input focus */
   47.16 -    SDL_SetKeyboardFocus(0, window->id);
   47.17 -    SDL_SetMouseFocus(0, window->id);
   47.18 +    SDL_SetKeyboardFocus(0, window);
   47.19 +    SDL_SetMouseFocus(0, window);
   47.20  
   47.21      /* Window has been successfully created */
   47.22      return 0;
   47.23 @@ -1155,7 +1155,7 @@
   47.24  {
   47.25      SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
   47.26      SDL_DisplayData *didata =
   47.27 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   47.28 +        (SDL_DisplayData *) window->display->driverdata;
   47.29      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   47.30  
   47.31      if (wdata != NULL) {
   47.32 @@ -1309,7 +1309,7 @@
   47.33      SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
   47.34      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   47.35      SDL_DisplayData *didata =
   47.36 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   47.37 +        (SDL_DisplayData *) window->display->driverdata;
   47.38      EGLBoolean status;
   47.39      int32_t gfstatus;
   47.40      EGLint configs;
    48.1 --- a/src/video/uikit/SDL_uikitappdelegate.h	Thu Jan 21 05:49:41 2010 +0000
    48.2 +++ b/src/video/uikit/SDL_uikitappdelegate.h	Thu Jan 21 06:21:52 2010 +0000
    48.3 @@ -25,12 +25,12 @@
    48.4  
    48.5  /* *INDENT-OFF* */
    48.6  @interface SDLUIKitDelegate:NSObject<UIApplicationDelegate> {
    48.7 -    UIWindow *window;
    48.8 -	SDL_WindowID windowID;
    48.9 +    SDL_Window *window;
   48.10 +    UIWindow *uiwindow;
   48.11  }
   48.12  
   48.13 -@property (readwrite, retain) UIWindow *window;
   48.14 -@property (readwrite, assign) SDL_WindowID windowID;
   48.15 +@property (readwrite, assign) SDL_Window *window;
   48.16 +@property (readwrite, retain) UIWindow *uiwindow;
   48.17  
   48.18  +(SDLUIKitDelegate *)sharedAppDelegate;
   48.19  
    49.1 --- a/src/video/uikit/SDL_uikitappdelegate.m	Thu Jan 21 05:49:41 2010 +0000
    49.2 +++ b/src/video/uikit/SDL_uikitappdelegate.m	Thu Jan 21 06:21:52 2010 +0000
    49.3 @@ -56,7 +56,7 @@
    49.4  @implementation SDLUIKitDelegate
    49.5  
    49.6  @synthesize window;
    49.7 -@synthesize windowID;
    49.8 +@synthesize uiwindow;
    49.9  
   49.10  /* convenience method */
   49.11  +(SDLUIKitDelegate *)sharedAppDelegate {
   49.12 @@ -66,8 +66,8 @@
   49.13  
   49.14  - (id)init {
   49.15  	self = [super init];
   49.16 -	window = nil;
   49.17 -	windowID = 0;
   49.18 +	window = NULL;
   49.19 +	uiwindow = nil;
   49.20  	return self;
   49.21  }
   49.22  
   49.23 @@ -107,19 +107,19 @@
   49.24  - (void) applicationWillResignActive:(UIApplication*)application
   49.25  {
   49.26  //	NSLog(@"%@", NSStringFromSelector(_cmd));
   49.27 -	SDL_SendWindowEvent(self.windowID, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
   49.28 +	SDL_SendWindowEvent(self.window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
   49.29  }
   49.30  
   49.31  - (void) applicationDidBecomeActive:(UIApplication*)application
   49.32  {
   49.33  //	NSLog(@"%@", NSStringFromSelector(_cmd));
   49.34 -	SDL_SendWindowEvent(self.windowID, SDL_WINDOWEVENT_RESTORED, 0, 0);
   49.35 +	SDL_SendWindowEvent(self.window, SDL_WINDOWEVENT_RESTORED, 0, 0);
   49.36  }
   49.37  
   49.38  
   49.39  
   49.40  -(void)dealloc {
   49.41 -	[window release];
   49.42 +	[uiwindow release];
   49.43  	[super dealloc];
   49.44  }
   49.45  
    50.1 --- a/src/video/uikit/SDL_uikitkeyboard.h	Thu Jan 21 05:49:41 2010 +0000
    50.2 +++ b/src/video/uikit/SDL_uikitkeyboard.h	Thu Jan 21 06:21:52 2010 +0000
    50.3 @@ -23,10 +23,9 @@
    50.4  #ifndef sdl_uikitkeyboard_h
    50.5  #define sdl_uikitkeyboard_h
    50.6  
    50.7 -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_WindowID windowID);
    50.8 -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardHide(SDL_WindowID windowID);
    50.9 -extern DECLSPEC SDL_bool SDLCALL SDL_iPhoneKeyboardIsShown(SDL_WindowID
   50.10 -                                                           windowID);
   50.11 -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_WindowID windowID);
   50.12 +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_Window * window);
   50.13 +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardHide(SDL_Window * window);
   50.14 +extern DECLSPEC SDL_bool SDLCALL SDL_iPhoneKeyboardIsShown(SDL_Window * window);
   50.15 +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_Window * window);
   50.16  
   50.17  #endif
    51.1 --- a/src/video/uikit/SDL_uikitview.m	Thu Jan 21 05:49:41 2010 +0000
    51.2 +++ b/src/video/uikit/SDL_uikitview.m	Thu Jan 21 06:21:52 2010 +0000
    51.3 @@ -272,9 +272,8 @@
    51.4  /* iPhone keyboard addition functions */
    51.5  #if SDL_IPHONE_KEYBOARD
    51.6  
    51.7 -int SDL_iPhoneKeyboardShow(SDL_WindowID windowID) {
    51.8 +int SDL_iPhoneKeyboardShow(SDL_Window * window) {
    51.9  	
   51.10 -	SDL_Window *window = SDL_GetWindowFromID(windowID);
   51.11  	SDL_WindowData *data;
   51.12  	SDL_uikitview *view;
   51.13  	
   51.14 @@ -296,9 +295,8 @@
   51.15  	}
   51.16  }
   51.17  
   51.18 -int SDL_iPhoneKeyboardHide(SDL_WindowID windowID) {
   51.19 +int SDL_iPhoneKeyboardHide(SDL_Window * window) {
   51.20  	
   51.21 -	SDL_Window *window = SDL_GetWindowFromID(windowID);
   51.22  	SDL_WindowData *data;
   51.23  	SDL_uikitview *view;
   51.24  	
   51.25 @@ -320,9 +318,8 @@
   51.26  	}
   51.27  }
   51.28  
   51.29 -SDL_bool SDL_iPhoneKeyboardIsShown(SDL_WindowID windowID) {
   51.30 +SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) {
   51.31  	
   51.32 -	SDL_Window *window = SDL_GetWindowFromID(windowID);
   51.33  	SDL_WindowData *data;
   51.34  	SDL_uikitview *view;
   51.35  	
   51.36 @@ -343,9 +340,8 @@
   51.37  	}
   51.38  }
   51.39  
   51.40 -int SDL_iPhoneKeyboardToggle(SDL_WindowID windowID) {
   51.41 +int SDL_iPhoneKeyboardToggle(SDL_Window * window) {
   51.42  	
   51.43 -	SDL_Window *window = SDL_GetWindowFromID(windowID);
   51.44  	SDL_WindowData *data;
   51.45  	SDL_uikitview *view;
   51.46  	
   51.47 @@ -362,11 +358,11 @@
   51.48  		return -1;
   51.49  	}
   51.50  	else {
   51.51 -		if (SDL_iPhoneKeyboardIsShown(windowID)) {
   51.52 -			SDL_iPhoneKeyboardHide(windowID);
   51.53 +		if (SDL_iPhoneKeyboardIsShown(window)) {
   51.54 +			SDL_iPhoneKeyboardHide(window);
   51.55  		}
   51.56  		else {
   51.57 -			SDL_iPhoneKeyboardShow(windowID);
   51.58 +			SDL_iPhoneKeyboardShow(window);
   51.59  		}
   51.60  		return 0;
   51.61  	}
   51.62 @@ -376,21 +372,21 @@
   51.63  
   51.64  /* stubs, used if compiled without keyboard support */
   51.65  
   51.66 -int SDL_iPhoneKeyboardShow(SDL_WindowID windowID) {
   51.67 +int SDL_iPhoneKeyboardShow(SDL_Window * window) {
   51.68  	SDL_SetError("Not compiled with keyboard support");
   51.69  	return -1;
   51.70  }
   51.71  
   51.72 -int SDL_iPhoneKeyboardHide(SDL_WindowID windowID) {
   51.73 +int SDL_iPhoneKeyboardHide(SDL_Window * window) {
   51.74  	SDL_SetError("Not compiled with keyboard support");
   51.75  	return -1;
   51.76  }
   51.77  
   51.78 -SDL_bool SDL_iPhoneKeyboardIsShown(SDL_WindowID windowID) {
   51.79 +SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) {
   51.80  	return 0;
   51.81  }
   51.82  
   51.83 -int SDL_iPhoneKeyboardToggle(SDL_WindowID windowID) {
   51.84 +int SDL_iPhoneKeyboardToggle(SDL_Window * window) {
   51.85  	SDL_SetError("Not compiled with keyboard support");
   51.86  	return -1;
   51.87  }
    52.1 --- a/src/video/uikit/SDL_uikitwindow.h	Thu Jan 21 05:49:41 2010 +0000
    52.2 +++ b/src/video/uikit/SDL_uikitwindow.h	Thu Jan 21 06:21:52 2010 +0000
    52.3 @@ -36,7 +36,7 @@
    52.4  
    52.5  struct SDL_WindowData
    52.6  {
    52.7 -    SDL_WindowID windowID;
    52.8 +    SDL_Window *window;
    52.9      UIWindow *uiwindow;
   52.10      SDL_uikitopenglview *view;
   52.11  };
    53.1 --- a/src/video/uikit/SDL_uikitwindow.m	Thu Jan 21 05:49:41 2010 +0000
    53.2 +++ b/src/video/uikit/SDL_uikitwindow.m	Thu Jan 21 06:21:52 2010 +0000
    53.3 @@ -41,83 +41,82 @@
    53.4  static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created) {
    53.5  
    53.6      SDL_WindowData *data;
    53.7 -		
    53.8 +        
    53.9      /* Allocate the window data */
   53.10      data = (SDL_WindowData *)SDL_malloc(sizeof(*data));
   53.11      if (!data) {
   53.12          SDL_OutOfMemory();
   53.13          return -1;
   53.14      }
   53.15 -    data->windowID = window->id;
   53.16 +    data->window = window;
   53.17      data->uiwindow = uiwindow;
   53.18 -	data->view = nil;
   53.19 -		
   53.20 +    data->view = nil;
   53.21 +
   53.22      /* Fill in the SDL window with the window data */
   53.23 -	{
   53.24 +    {
   53.25          window->x = 0;
   53.26          window->y = 0;
   53.27          window->w = (int)uiwindow.frame.size.width;
   53.28          window->h = (int)uiwindow.frame.size.height;
   53.29      }
   53.30 -	
   53.31 -	window->driverdata = data;
   53.32 -	
   53.33 -	window->flags &= ~SDL_WINDOW_RESIZABLE;		/* window is NEVER resizeable */
   53.34 -	window->flags |= SDL_WINDOW_OPENGL;			/* window is always OpenGL */
   53.35 -	window->flags |= SDL_WINDOW_FULLSCREEN;		/* window is always fullscreen */
   53.36 -	window->flags |= SDL_WINDOW_SHOWN;			/* only one window on iPod touch, always shown */
   53.37 -	window->flags |= SDL_WINDOW_INPUT_FOCUS;	/* always has input focus */	
   53.38 +    
   53.39 +    window->driverdata = data;
   53.40 +    
   53.41 +    window->flags &= ~SDL_WINDOW_RESIZABLE;        /* window is NEVER resizeable */
   53.42 +    window->flags |= SDL_WINDOW_OPENGL;            /* window is always OpenGL */
   53.43 +    window->flags |= SDL_WINDOW_FULLSCREEN;        /* window is always fullscreen */
   53.44 +    window->flags |= SDL_WINDOW_SHOWN;            /* only one window on iPod touch, always shown */
   53.45 +    window->flags |= SDL_WINDOW_INPUT_FOCUS;    /* always has input focus */    
   53.46  
   53.47 -	/* SDL_WINDOW_BORDERLESS controls whether status bar is hidden */
   53.48 -	if (window->flags & SDL_WINDOW_BORDERLESS) {
   53.49 -		[UIApplication sharedApplication].statusBarHidden = YES;
   53.50 -	}
   53.51 -	else {
   53.52 -		[UIApplication sharedApplication].statusBarHidden = NO;
   53.53 -	}
   53.54 -	
   53.55 +    /* SDL_WINDOW_BORDERLESS controls whether status bar is hidden */
   53.56 +    if (window->flags & SDL_WINDOW_BORDERLESS) {
   53.57 +        [UIApplication sharedApplication].statusBarHidden = YES;
   53.58 +    }
   53.59 +    else {
   53.60 +        [UIApplication sharedApplication].statusBarHidden = NO;
   53.61 +    }
   53.62 +    
   53.63      return 0;
   53.64 -	
   53.65 +    
   53.66  }
   53.67  
   53.68  int UIKit_CreateWindow(_THIS, SDL_Window *window) {
   53.69 -		
   53.70 -	/* We currently only handle single window applications on iPhone */
   53.71 -	if (nil != [SDLUIKitDelegate sharedAppDelegate].window) {
   53.72 -		SDL_SetError("Window already exists, no multi-window support.");
   53.73 -		return -1;
   53.74 -	}
   53.75 -	
   53.76 -	/* ignore the size user requested, and make a fullscreen window */
   53.77 -	UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
   53.78 -	
   53.79 -	if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) {
   53.80 +        
   53.81 +    /* We currently only handle single window applications on iPhone */
   53.82 +    if (nil != [SDLUIKitDelegate sharedAppDelegate].window) {
   53.83 +        SDL_SetError("Window already exists, no multi-window support.");
   53.84 +        return -1;
   53.85 +    }
   53.86 +    
   53.87 +    /* ignore the size user requested, and make a fullscreen window */
   53.88 +    UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
   53.89 +    
   53.90 +    if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) {
   53.91          [uiwindow release];
   53.92          return -1;
   53.93 -    }	
   53.94 -	
   53.95 -	// This saves the main window in the app delegate so event callbacks can do stuff on the window.
   53.96 -	// This assumes a single window application design and needs to be fixed for multiple windows.
   53.97 -	[SDLUIKitDelegate sharedAppDelegate].window = uiwindow;
   53.98 -	[SDLUIKitDelegate sharedAppDelegate].windowID = window->id;
   53.99 -	[uiwindow release]; /* release the window (the app delegate has retained it) */
  53.100 -	
  53.101 -	return 1;
  53.102 -	
  53.103 +    }    
  53.104 +    
  53.105 +    // This saves the main window in the app delegate so event callbacks can do stuff on the window.
  53.106 +    // This assumes a single window application design and needs to be fixed for multiple windows.
  53.107 +    [SDLUIKitDelegate sharedAppDelegate].window = window;
  53.108 +    [SDLUIKitDelegate sharedAppDelegate].uiwindow = uiwindow;
  53.109 +    [uiwindow release]; /* release the window (the app delegate has retained it) */
  53.110 +    
  53.111 +    return 1;
  53.112 +    
  53.113  }
  53.114  
  53.115  void UIKit_DestroyWindow(_THIS, SDL_Window * window) {
  53.116 -	/* don't worry, the delegate will automatically release the window */
  53.117 -	
  53.118 -	SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
  53.119 -	if (data) {
  53.120 -		SDL_free( window->driverdata );
  53.121 -	}
  53.122 +    /* don't worry, the delegate will automatically release the window */
  53.123 +    
  53.124 +    SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
  53.125 +    if (data) {
  53.126 +        SDL_free( window->driverdata );
  53.127 +    }
  53.128  
  53.129 -	/* this will also destroy the window */
  53.130 -	[SDLUIKitDelegate sharedAppDelegate].window = nil;
  53.131 -	[SDLUIKitDelegate sharedAppDelegate].windowID = 0;
  53.132 -
  53.133 +    /* this will also destroy the window */
  53.134 +    [SDLUIKitDelegate sharedAppDelegate].window = NULL;
  53.135 +    [SDLUIKitDelegate sharedAppDelegate].uiwindow = nil;
  53.136  }
  53.137  
  53.138  /* vi: set ts=4 sw=4 expandtab: */
    54.1 --- a/src/video/win32/SDL_ceddrawrender.c	Thu Jan 21 05:49:41 2010 +0000
    54.2 +++ b/src/video/win32/SDL_ceddrawrender.c	Thu Jan 21 06:21:52 2010 +0000
    54.3 @@ -391,7 +391,7 @@
    54.4  {
    54.5      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    54.6      SDL_RendererInfo *info = &DDRAW_RenderDriver.info;
    54.7 -    SDL_DisplayMode *mode = &SDL_CurrentDisplay.desktop_mode;
    54.8 +    SDL_DisplayMode *mode = &SDL_CurrentDisplay->desktop_mode;
    54.9  
   54.10      if (data->ddraw) {
   54.11          int i;
   54.12 @@ -437,7 +437,7 @@
   54.13  SDL_Renderer *
   54.14  DDRAW_CreateRenderer(SDL_Window * window, Uint32 flags)
   54.15  {
   54.16 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   54.17 +    SDL_VideoDisplay *display = window->display;
   54.18      SDL_VideoData *videodata = (SDL_VideoData *) display->device->driverdata;
   54.19      SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
   54.20      SDL_Renderer *renderer;
   54.21 @@ -479,7 +479,7 @@
   54.22      renderer->DestroyTexture = DDRAW_DestroyTexture;
   54.23      renderer->DestroyRenderer = DDRAW_DestroyRenderer;
   54.24      renderer->info = DDRAW_RenderDriver.info;
   54.25 -    renderer->window = window->id;
   54.26 +    renderer->window = window;
   54.27      renderer->driverdata = data;
   54.28  
   54.29      renderer->info.flags = SDL_RENDERER_ACCELERATED;
   54.30 @@ -568,8 +568,8 @@
   54.31  {
   54.32      //TODO implement
   54.33      /*D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
   54.34 -       SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   54.35 -       SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   54.36 +       SDL_Window *window = renderer->window;
   54.37 +       SDL_VideoDisplay *display = window->display;
   54.38  
   54.39         data->pparams.BackBufferWidth = window->w;
   54.40         data->pparams.BackBufferHeight = window->h;
   54.41 @@ -587,8 +587,8 @@
   54.42  DDRAW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   54.43  {
   54.44      DDRAW_RenderData *renderdata = (DDRAW_RenderData *) renderer->driverdata;
   54.45 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   54.46 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   54.47 +    SDL_Window *window = renderer->window;
   54.48 +    SDL_VideoDisplay *display = window->display;
   54.49      Uint32 display_format = display->current_mode.format;
   54.50      DDRAW_TextureData *data;
   54.51      DDSURFACEDESC ddsd;
    55.1 --- a/src/video/win32/SDL_d3drender.c	Thu Jan 21 05:49:41 2010 +0000
    55.2 +++ b/src/video/win32/SDL_d3drender.c	Thu Jan 21 06:21:52 2010 +0000
    55.3 @@ -427,7 +427,7 @@
    55.4  SDL_Renderer *
    55.5  D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
    55.6  {
    55.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    55.8 +    SDL_VideoDisplay *display = window->display;
    55.9      SDL_VideoData *videodata = (SDL_VideoData *) display->device->driverdata;
   55.10      SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
   55.11      SDL_Renderer *renderer;
   55.12 @@ -475,7 +475,7 @@
   55.13      renderer->DestroyTexture = D3D_DestroyTexture;
   55.14      renderer->DestroyRenderer = D3D_DestroyRenderer;
   55.15      renderer->info = D3D_RenderDriver.info;
   55.16 -    renderer->window = window->id;
   55.17 +    renderer->window = window;
   55.18      renderer->driverdata = data;
   55.19  
   55.20      renderer->info.flags = SDL_RENDERER_ACCELERATED;
   55.21 @@ -677,8 +677,8 @@
   55.22  D3D_DisplayModeChanged(SDL_Renderer * renderer)
   55.23  {
   55.24      D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
   55.25 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   55.26 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   55.27 +    SDL_Window *window = renderer->window;
   55.28 +    SDL_VideoDisplay *display = window->display;
   55.29  
   55.30      data->pparams.BackBufferWidth = window->w;
   55.31      data->pparams.BackBufferHeight = window->h;
   55.32 @@ -695,8 +695,8 @@
   55.33  D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   55.34  {
   55.35      D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
   55.36 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   55.37 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   55.38 +    SDL_Window *window = renderer->window;
   55.39 +    SDL_VideoDisplay *display = window->display;
   55.40      Uint32 display_format = display->current_mode.format;
   55.41      D3D_TextureData *data;
   55.42      HRESULT result;
   55.43 @@ -1398,8 +1398,8 @@
   55.44                       Uint32 format, void * pixels, int pitch)
   55.45  {
   55.46      D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
   55.47 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   55.48 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   55.49 +    SDL_Window *window = renderer->window;
   55.50 +    SDL_VideoDisplay *display = window->display;
   55.51      D3DSURFACE_DESC desc;
   55.52      LPDIRECT3DSURFACE9 backBuffer;
   55.53      LPDIRECT3DSURFACE9 surface;
    56.1 --- a/src/video/win32/SDL_gapirender.c	Thu Jan 21 05:49:41 2010 +0000
    56.2 +++ b/src/video/win32/SDL_gapirender.c	Thu Jan 21 06:21:52 2010 +0000
    56.3 @@ -430,7 +430,7 @@
    56.4  SDL_Renderer *
    56.5  GAPI_CreateRenderer(SDL_Window * window, Uint32 flags)
    56.6  {
    56.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    56.8 +    SDL_VideoDisplay *display = window->display;
    56.9      SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
   56.10      SDL_DisplayMode *displayMode = &display->current_mode;
   56.11      SDL_Renderer *renderer;
   56.12 @@ -472,7 +472,7 @@
   56.13      renderer->DestroyRenderer = GAPI_DestroyRenderer;
   56.14      renderer->info.name = GAPI_RenderDriver.info.name;
   56.15      renderer->info.flags = 0;
   56.16 -    renderer->window = window->id;
   56.17 +    renderer->window = window;
   56.18      renderer->driverdata = data;
   56.19  
   56.20      /* Gapi provides only a framebuffer so lets use software implementation */
    57.1 --- a/src/video/win32/SDL_gdirender.c	Thu Jan 21 05:49:41 2010 +0000
    57.2 +++ b/src/video/win32/SDL_gdirender.c	Thu Jan 21 06:21:52 2010 +0000
    57.3 @@ -207,7 +207,7 @@
    57.4      renderer->DestroyTexture = GDI_DestroyTexture;
    57.5      renderer->DestroyRenderer = GDI_DestroyRenderer;
    57.6      renderer->info = GDI_RenderDriver.info;
    57.7 -    renderer->window = window->id;
    57.8 +    renderer->window = window;
    57.9      renderer->driverdata = data;
   57.10  
   57.11      renderer->info.flags = SDL_RENDERER_ACCELERATED;
   57.12 @@ -274,7 +274,7 @@
   57.13  GDI_DisplayModeChanged(SDL_Renderer * renderer)
   57.14  {
   57.15      GDI_RenderData *data = (GDI_RenderData *) renderer->driverdata;
   57.16 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   57.17 +    SDL_Window *window = renderer->window;
   57.18      int i, n;
   57.19  
   57.20      if (renderer->info.flags & SDL_RENDERER_SINGLEBUFFER) {
   57.21 @@ -378,8 +378,8 @@
   57.22  GDI_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   57.23  {
   57.24      GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata;
   57.25 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   57.26 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   57.27 +    SDL_Window *window = renderer->window;
   57.28 +    SDL_VideoDisplay *display = window->display;
   57.29      GDI_TextureData *data;
   57.30  
   57.31      data = (GDI_TextureData *) SDL_calloc(1, sizeof(*data));
   57.32 @@ -699,7 +699,7 @@
   57.33  
   57.34      if (data->makedirty) {
   57.35          /* Get the smallest rectangle that contains everything */
   57.36 -        SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   57.37 +        SDL_Window *window = renderer->window;
   57.38          SDL_Rect rect;
   57.39  
   57.40          rect.x = 0;
   57.41 @@ -732,7 +732,7 @@
   57.42  
   57.43      if (data->makedirty) {
   57.44          /* Get the smallest rectangle that contains everything */
   57.45 -        SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   57.46 +        SDL_Window *window = renderer->window;
   57.47          SDL_Rect clip, rect;
   57.48  
   57.49          clip.x = 0;
   57.50 @@ -787,7 +787,7 @@
   57.51      int i, status = 1;
   57.52  
   57.53      if (data->makedirty) {
   57.54 -        SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   57.55 +        SDL_Window *window = renderer->window;
   57.56          SDL_Rect clip, rect;
   57.57  
   57.58          clip.x = 0;
   57.59 @@ -844,7 +844,7 @@
   57.60      int i, status = 1;
   57.61  
   57.62      if (data->makedirty) {
   57.63 -        SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   57.64 +        SDL_Window *window = renderer->window;
   57.65          SDL_Rect clip, rect;
   57.66  
   57.67          clip.x = 0;
   57.68 @@ -943,8 +943,8 @@
   57.69                       Uint32 format, void * pixels, int pitch)
   57.70  {
   57.71      GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata;
   57.72 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   57.73 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   57.74 +    SDL_Window *window = renderer->window;
   57.75 +    SDL_VideoDisplay *display = window->display;
   57.76      struct {
   57.77          HBITMAP hbm;
   57.78          void *pixels;
   57.79 @@ -984,8 +984,8 @@
   57.80                        Uint32 format, const void * pixels, int pitch)
   57.81  {
   57.82      GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata;
   57.83 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   57.84 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   57.85 +    SDL_Window *window = renderer->window;
   57.86 +    SDL_VideoDisplay *display = window->display;
   57.87      struct {
   57.88          HBITMAP hbm;
   57.89          void *pixels;
    58.1 --- a/src/video/win32/SDL_win32events.c	Thu Jan 21 05:49:41 2010 +0000
    58.2 +++ b/src/video/win32/SDL_win32events.c	Thu Jan 21 06:21:52 2010 +0000
    58.3 @@ -169,11 +169,9 @@
    58.4      case WM_SHOWWINDOW:
    58.5          {
    58.6              if (wParam) {
    58.7 -                SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN, 0,
    58.8 -                                    0);
    58.9 +                SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
   58.10              } else {
   58.11 -                SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_HIDDEN, 0,
   58.12 -                                    0);
   58.13 +                SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
   58.14              }
   58.15          }
   58.16          break;
   58.17 @@ -188,26 +186,25 @@
   58.18              index = data->videodata->keyboard;
   58.19              keyboard = SDL_GetKeyboard(index);
   58.20              if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
   58.21 -                SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN,
   58.22 -                                    0, 0);
   58.23 -                SDL_SendWindowEvent(data->windowID,
   58.24 +                SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
   58.25 +                SDL_SendWindowEvent(data->window,
   58.26                                      SDL_WINDOWEVENT_RESTORED, 0, 0);
   58.27  #ifndef _WIN32_WCE              /* WinCE misses IsZoomed() */
   58.28                  if (IsZoomed(hwnd)) {
   58.29 -                    SDL_SendWindowEvent(data->windowID,
   58.30 +                    SDL_SendWindowEvent(data->window,
   58.31                                          SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
   58.32                  }
   58.33  #endif
   58.34 -                if (keyboard && keyboard->focus != data->windowID) {
   58.35 -                    SDL_SetKeyboardFocus(index, data->windowID);
   58.36 +                if (keyboard && keyboard->focus != data->window) {
   58.37 +                    SDL_SetKeyboardFocus(index, data->window);
   58.38                  }
   58.39                  /* FIXME: Update keyboard state */
   58.40              } else {
   58.41 -                if (keyboard && keyboard->focus == data->windowID) {
   58.42 +                if (keyboard && keyboard->focus == data->window) {
   58.43                      SDL_SetKeyboardFocus(index, 0);
   58.44                  }
   58.45                  if (minimized) {
   58.46 -                    SDL_SendWindowEvent(data->windowID,
   58.47 +                    SDL_SendWindowEvent(data->window,
   58.48                                          SDL_WINDOWEVENT_MINIMIZED, 0, 0);
   58.49                  }
   58.50              }
   58.51 @@ -272,9 +269,9 @@
   58.52              GetCursorPos(&point);
   58.53              ScreenToClient(hwnd, &point);
   58.54  
   58.55 -            SDL_GetWindowSize(data->windowID, &w, &h);
   58.56 +            SDL_GetWindowSize(data->window, &w, &h);
   58.57              if (point.x >= 0 && point.y >= 0 && point.x < w && point.y < h) {
   58.58 -                SDL_SetMouseFocus(index, data->windowID);
   58.59 +                SDL_SetMouseFocus(index, data->window);
   58.60              } else {
   58.61                  SDL_SetMouseFocus(index, 0);
   58.62                  /* FIXME: Should we be doing anything else here? */
   58.63 @@ -330,7 +327,7 @@
   58.64              for (i = 0; i < SDL_GetNumMice(); ++i) {
   58.65                  SDL_Mouse *mouse = SDL_GetMouse(i);
   58.66  
   58.67 -                if (mouse->focus == data->windowID) {
   58.68 +                if (mouse->focus == data->window) {
   58.69                      SDL_SetMouseFocus(i, 0);
   58.70                  }
   58.71              }
   58.72 @@ -490,7 +487,7 @@
   58.73              BOOL menu;
   58.74  
   58.75              /* If we allow resizing, let the resize happen naturally */
   58.76 -            if (SDL_GetWindowFlags(data->windowID) & SDL_WINDOW_RESIZABLE) {
   58.77 +            if (SDL_GetWindowFlags(data->window) & SDL_WINDOW_RESIZABLE) {
   58.78                  returnCode = 0;
   58.79                  break;
   58.80              }
   58.81 @@ -501,7 +498,7 @@
   58.82              y = size.top;
   58.83  
   58.84              /* Calculate current size of our window */
   58.85 -            SDL_GetWindowSize(data->windowID, &w, &h);
   58.86 +            SDL_GetWindowSize(data->window, &w, &h);
   58.87              size.top = 0;
   58.88              size.left = 0;
   58.89              size.bottom = h;
   58.90 @@ -551,7 +548,7 @@
   58.91              ClientToScreen(hwnd, (LPPOINT) & rect);
   58.92              ClientToScreen(hwnd, (LPPOINT) & rect + 1);
   58.93  
   58.94 -            window_flags = SDL_GetWindowFlags(data->windowID);
   58.95 +            window_flags = SDL_GetWindowFlags(data->window);
   58.96              if ((window_flags & SDL_WINDOW_INPUT_GRABBED) &&
   58.97                  (window_flags & SDL_WINDOW_INPUT_FOCUS)) {
   58.98                  ClipCursor(&rect);
   58.99 @@ -559,11 +556,11 @@
  58.100  
  58.101              x = rect.left;
  58.102              y = rect.top;
  58.103 -            SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MOVED, x, y);
  58.104 +            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y);
  58.105  
  58.106              w = rect.right - rect.left;
  58.107              h = rect.bottom - rect.top;
  58.108 -            SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESIZED, w,
  58.109 +            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w,
  58.110                                  h);
  58.111          }
  58.112          break;
  58.113 @@ -610,7 +607,7 @@
  58.114              RECT rect;
  58.115              if (GetUpdateRect(hwnd, &rect, FALSE)) {
  58.116                  ValidateRect(hwnd, &rect);
  58.117 -                SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_EXPOSED,
  58.118 +                SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED,
  58.119                                      0, 0);
  58.120              }
  58.121          }
  58.122 @@ -637,7 +634,7 @@
  58.123  
  58.124      case WM_CLOSE:
  58.125          {
  58.126 -            SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_CLOSE, 0, 0);
  58.127 +            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
  58.128          }
  58.129          returnCode = 0;
  58.130          break;
    59.1 --- a/src/video/win32/SDL_win32window.c	Thu Jan 21 05:49:41 2010 +0000
    59.2 +++ b/src/video/win32/SDL_win32window.c	Thu Jan 21 06:21:52 2010 +0000
    59.3 @@ -86,7 +86,7 @@
    59.4  SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
    59.5  {
    59.6      SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
    59.7 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    59.8 +    SDL_VideoDisplay *display = window->display;
    59.9      SDL_WindowData *data;
   59.10  
   59.11      /* Allocate the window data */
   59.12 @@ -95,7 +95,7 @@
   59.13          SDL_OutOfMemory();
   59.14          return -1;
   59.15      }
   59.16 -    data->windowID = window->id;
   59.17 +    data->window = window;
   59.18      data->hwnd = hwnd;
   59.19      data->hdc = GetDC(hwnd);
   59.20      data->created = created;
   59.21 @@ -167,7 +167,7 @@
   59.22      if (GetFocus() == hwnd) {
   59.23          int index = data->videodata->keyboard;
   59.24          window->flags |= SDL_WINDOW_INPUT_FOCUS;
   59.25 -        SDL_SetKeyboardFocus(index, data->windowID);
   59.26 +        SDL_SetKeyboardFocus(index, data->window);
   59.27  
   59.28          if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
   59.29              RECT rect;
   59.30 @@ -187,7 +187,7 @@
   59.31  WIN_CreateWindow(_THIS, SDL_Window * window)
   59.32  {
   59.33      SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
   59.34 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   59.35 +    SDL_VideoDisplay *display = window->display;
   59.36      RAWINPUTDEVICE Rid;
   59.37      AXIS TabX, TabY;
   59.38      LOGCONTEXTA lc;
   59.39 @@ -429,7 +429,7 @@
   59.40  void
   59.41  WIN_SetWindowPosition(_THIS, SDL_Window * window)
   59.42  {
   59.43 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   59.44 +    SDL_VideoDisplay *display = window->display;
   59.45      HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
   59.46      RECT rect;
   59.47      SDL_Rect bounds;
    60.1 --- a/src/video/win32/SDL_win32window.h	Thu Jan 21 05:49:41 2010 +0000
    60.2 +++ b/src/video/win32/SDL_win32window.h	Thu Jan 21 06:21:52 2010 +0000
    60.3 @@ -26,7 +26,7 @@
    60.4  
    60.5  typedef struct
    60.6  {
    60.7 -    SDL_WindowID windowID;
    60.8 +    SDL_Window *window;
    60.9      HWND hwnd;
   60.10      HDC hdc;
   60.11      WNDPROC wndproc;
    61.1 --- a/src/video/x11/SDL_x11events.c	Thu Jan 21 05:49:41 2010 +0000
    61.2 +++ b/src/video/x11/SDL_x11events.c	Thu Jan 21 06:21:52 2010 +0000
    61.3 @@ -66,7 +66,7 @@
    61.4      if (videodata && videodata->windowlist) {
    61.5          for (i = 0; i < videodata->numwindows; ++i) {
    61.6              if ((videodata->windowlist[i] != NULL) &&
    61.7 -                (videodata->windowlist[i]->window == xevent.xany.window)) {
    61.8 +                (videodata->windowlist[i]->xwindow == xevent.xany.window)) {
    61.9                  data = videodata->windowlist[i];
   61.10                  break;
   61.11              }
   61.12 @@ -97,7 +97,7 @@
   61.13              /* FIXME: Should we reset data for all mice? */
   61.14              for (i = 0; i < SDL_GetNumMice(); ++i) {
   61.15                  SDL_Mouse *mouse = SDL_GetMouse(i);
   61.16 -                SDL_SetMouseFocus(mouse->id, data->windowID);
   61.17 +                SDL_SetMouseFocus(mouse->id, data->window);
   61.18              }
   61.19  #endif
   61.20          }
   61.21 @@ -132,7 +132,7 @@
   61.22  #ifdef DEBUG_XEVENTS
   61.23              printf("FocusIn!\n");
   61.24  #endif
   61.25 -            SDL_SetKeyboardFocus(videodata->keyboard, data->windowID);
   61.26 +            SDL_SetKeyboardFocus(videodata->keyboard, data->window);
   61.27  #ifdef X_HAVE_UTF8_STRING
   61.28              if (data->ic) {
   61.29                  XSetICFocus(data->ic);
   61.30 @@ -232,9 +232,8 @@
   61.31  #ifdef DEBUG_XEVENTS
   61.32              printf("UnmapNotify!\n");
   61.33  #endif
   61.34 -            SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_HIDDEN, 0, 0);
   61.35 -            SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MINIMIZED, 0,
   61.36 -                                0);
   61.37 +            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
   61.38 +            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
   61.39          }
   61.40          break;
   61.41  
   61.42 @@ -243,9 +242,8 @@
   61.43  #ifdef DEBUG_XEVENTS
   61.44              printf("MapNotify!\n");
   61.45  #endif
   61.46 -            SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN, 0, 0);
   61.47 -            SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESTORED, 0,
   61.48 -                                0);
   61.49 +            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
   61.50 +            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
   61.51          }
   61.52          break;
   61.53  
   61.54 @@ -255,9 +253,9 @@
   61.55              printf("ConfigureNotify! (resize: %dx%d)\n",
   61.56                     xevent.xconfigure.width, xevent.xconfigure.height);
   61.57  #endif
   61.58 -            SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MOVED,
   61.59 +            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
   61.60                                  xevent.xconfigure.x, xevent.xconfigure.y);
   61.61 -            SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESIZED,
   61.62 +            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED,
   61.63                                  xevent.xconfigure.width,
   61.64                                  xevent.xconfigure.height);
   61.65          }
   61.66 @@ -268,8 +266,7 @@
   61.67              if ((xevent.xclient.format == 32) &&
   61.68                  (xevent.xclient.data.l[0] == videodata->WM_DELETE_WINDOW)) {
   61.69  
   61.70 -                SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_CLOSE, 0,
   61.71 -                                    0);
   61.72 +                SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
   61.73              }
   61.74          }
   61.75          break;
   61.76 @@ -279,8 +276,7 @@
   61.77  #ifdef DEBUG_XEVENTS
   61.78              printf("Expose (count = %d)\n", xevent.xexpose.count);
   61.79  #endif
   61.80 -            SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_EXPOSED, 0,
   61.81 -                                0);
   61.82 +            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
   61.83          }
   61.84          break;
   61.85  
    62.1 --- a/src/video/x11/SDL_x11opengl.c	Thu Jan 21 05:49:41 2010 +0000
    62.2 +++ b/src/video/x11/SDL_x11opengl.c	Thu Jan 21 06:21:52 2010 +0000
    62.3 @@ -221,7 +221,7 @@
    62.4  X11_GL_InitExtensions(_THIS)
    62.5  {
    62.6      Display *display = ((SDL_VideoData *) _this->driverdata)->display;
    62.7 -    int screen = ((SDL_DisplayData *) SDL_CurrentDisplay.driverdata)->screen;
    62.8 +    int screen = ((SDL_DisplayData *) SDL_CurrentDisplay->driverdata)->screen;
    62.9      XVisualInfo *vinfo;
   62.10      XSetWindowAttributes xattr;
   62.11      Window w;
   62.12 @@ -394,8 +394,7 @@
   62.13      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   62.14      Display *display = data->videodata->display;
   62.15      int screen =
   62.16 -        ((SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->
   62.17 -         driverdata)->screen;
   62.18 +        ((SDL_DisplayData *) window->display->driverdata)->screen;
   62.19      XWindowAttributes xattr;
   62.20      XVisualInfo v, *vinfo;
   62.21      int n;
   62.22 @@ -403,7 +402,7 @@
   62.23  
   62.24      /* We do this to create a clean separation between X and GLX errors. */
   62.25      XSync(display, False);
   62.26 -    XGetWindowAttributes(display, data->window, &xattr);
   62.27 +    XGetWindowAttributes(display, data->xwindow, &xattr);
   62.28      v.screen = screen;
   62.29      v.visualid = XVisualIDFromVisual(xattr.visual);
   62.30      vinfo = XGetVisualInfo(display, VisualScreenMask | VisualIDMask, &v, &n);
   62.31 @@ -492,7 +491,7 @@
   62.32  {
   62.33      Display *display = ((SDL_VideoData *) _this->driverdata)->display;
   62.34      Window drawable =
   62.35 -        (window ? ((SDL_WindowData *) window->driverdata)->window : None);
   62.36 +        (window ? ((SDL_WindowData *) window->driverdata)->xwindow : None);
   62.37      GLXContext glx_context = (GLXContext) context;
   62.38      int status;
   62.39  
   62.40 @@ -560,7 +559,7 @@
   62.41      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   62.42      Display *display = data->videodata->display;
   62.43  
   62.44 -    _this->gl_data->glXSwapBuffers(display, data->window);
   62.45 +    _this->gl_data->glXSwapBuffers(display, data->xwindow);
   62.46  }
   62.47  
   62.48  void
    63.1 --- a/src/video/x11/SDL_x11render.c	Thu Jan 21 05:49:41 2010 +0000
    63.2 +++ b/src/video/x11/SDL_x11render.c	Thu Jan 21 06:21:52 2010 +0000
    63.3 @@ -93,7 +93,7 @@
    63.4      Visual *visual;
    63.5      int depth;
    63.6      int scanline_pad;
    63.7 -    Window window;
    63.8 +    Window xwindow;
    63.9      Pixmap pixmaps[3];
   63.10      int current_pixmap;
   63.11      Drawable drawable;
   63.12 @@ -153,7 +153,7 @@
   63.13  {
   63.14      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   63.15      SDL_RendererInfo *info = &X11_RenderDriver.info;
   63.16 -    SDL_DisplayMode *mode = &SDL_CurrentDisplay.desktop_mode;
   63.17 +    SDL_DisplayMode *mode = &SDL_CurrentDisplay->desktop_mode;
   63.18      int i;
   63.19  
   63.20      info->texture_formats[info->num_texture_formats++] = mode->format;
   63.21 @@ -171,7 +171,7 @@
   63.22  SDL_Renderer *
   63.23  X11_CreateRenderer(SDL_Window * window, Uint32 flags)
   63.24  {
   63.25 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   63.26 +    SDL_VideoDisplay *display = window->display;
   63.27      SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
   63.28      SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
   63.29      SDL_Renderer *renderer;
   63.30 @@ -199,7 +199,7 @@
   63.31      data->visual = displaydata->visual;
   63.32      data->depth = displaydata->depth;
   63.33      data->scanline_pad = displaydata->scanline_pad;
   63.34 -    data->window = windowdata->window;
   63.35 +    data->xwindow = windowdata->xwindow;
   63.36  
   63.37      renderer->DisplayModeChanged = X11_DisplayModeChanged;
   63.38      renderer->CreateTexture = X11_CreateTexture;
   63.39 @@ -221,7 +221,7 @@
   63.40      renderer->DestroyTexture = X11_DestroyTexture;
   63.41      renderer->DestroyRenderer = X11_DestroyRenderer;
   63.42      renderer->info = X11_RenderDriver.info;
   63.43 -    renderer->window = window->id;
   63.44 +    renderer->window = window;
   63.45      renderer->driverdata = data;
   63.46  
   63.47      renderer->info.flags = SDL_RENDERER_ACCELERATED;
   63.48 @@ -242,7 +242,7 @@
   63.49      }
   63.50      for (i = 0; i < n; ++i) {
   63.51          data->pixmaps[i] =
   63.52 -            XCreatePixmap(data->display, data->window, window->w, window->h,
   63.53 +            XCreatePixmap(data->display, data->xwindow, window->w, window->h,
   63.54                            displaydata->depth);
   63.55          if (data->pixmaps[i] == None) {
   63.56              X11_DestroyRenderer(renderer);
   63.57 @@ -254,7 +254,7 @@
   63.58          data->drawable = data->pixmaps[0];
   63.59          data->makedirty = SDL_TRUE;
   63.60      } else {
   63.61 -        data->drawable = data->window;
   63.62 +        data->drawable = data->xwindow;
   63.63          data->makedirty = SDL_FALSE;
   63.64      }
   63.65      data->current_pixmap = 0;
   63.66 @@ -272,7 +272,7 @@
   63.67      /* Create the drawing context */
   63.68      gcv.graphics_exposures = False;
   63.69      data->gc =
   63.70 -        XCreateGC(data->display, data->window, GCGraphicsExposures, &gcv);
   63.71 +        XCreateGC(data->display, data->xwindow, GCGraphicsExposures, &gcv);
   63.72      if (!data->gc) {
   63.73          X11_DestroyRenderer(renderer);
   63.74          SDL_SetError("XCreateGC() failed");
   63.75 @@ -286,7 +286,7 @@
   63.76  X11_DisplayModeChanged(SDL_Renderer * renderer)
   63.77  {
   63.78      X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
   63.79 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   63.80 +    SDL_Window *window = renderer->window;
   63.81      int i, n;
   63.82  
   63.83      if (renderer->info.flags & SDL_RENDERER_SINGLEBUFFER) {
   63.84 @@ -306,7 +306,7 @@
   63.85      }
   63.86      for (i = 0; i < n; ++i) {
   63.87          data->pixmaps[i] =
   63.88 -            XCreatePixmap(data->display, data->window, window->w, window->h,
   63.89 +            XCreatePixmap(data->display, data->xwindow, window->w, window->h,
   63.90                            data->depth);
   63.91          if (data->pixmaps[i] == None) {
   63.92              SDL_SetError("XCreatePixmap() failed");
   63.93 @@ -325,8 +325,8 @@
   63.94  X11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   63.95  {
   63.96      X11_RenderData *renderdata = (X11_RenderData *) renderer->driverdata;
   63.97 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   63.98 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   63.99 +    SDL_Window *window = renderer->window;
  63.100 +    SDL_VideoDisplay *display = window->display;
  63.101      X11_TextureData *data;
  63.102      int pitch_alignmask = ((renderdata->scanline_pad / 8) - 1);
  63.103  
  63.104 @@ -425,7 +425,7 @@
  63.105          }
  63.106      } else {
  63.107          data->pixmap =
  63.108 -            XCreatePixmap(renderdata->display, renderdata->window, texture->w,
  63.109 +            XCreatePixmap(renderdata->display, renderdata->xwindow, texture->w,
  63.110                            texture->h, renderdata->depth);
  63.111          if (data->pixmap == None) {
  63.112              X11_DestroyTexture(renderer, texture);
  63.113 @@ -607,7 +607,7 @@
  63.114                       int count)
  63.115  {
  63.116      X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
  63.117 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
  63.118 +    SDL_Window *window = renderer->window;
  63.119      unsigned long foreground;
  63.120      XPoint *xpoints, *xpoint;
  63.121      int i, xcount;
  63.122 @@ -657,7 +657,7 @@
  63.123                      int count)
  63.124  {
  63.125      X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
  63.126 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
  63.127 +    SDL_Window *window = renderer->window;
  63.128      SDL_Rect clip, rect;
  63.129      unsigned long foreground;
  63.130      XPoint *xpoints, *xpoint;
  63.131 @@ -795,7 +795,7 @@
  63.132  X11_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
  63.133  {
  63.134      X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
  63.135 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
  63.136 +    SDL_Window *window = renderer->window;
  63.137      SDL_Rect clip, rect;
  63.138      unsigned long foreground;
  63.139      XRectangle *xrects, *xrect;
  63.140 @@ -840,7 +840,7 @@
  63.141  X11_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
  63.142  {
  63.143      X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
  63.144 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
  63.145 +    SDL_Window *window = renderer->window;
  63.146      SDL_Rect clip, rect;
  63.147      unsigned long foreground;
  63.148      XRectangle *xrects, *xrect;
  63.149 @@ -998,8 +998,8 @@
  63.150                       Uint32 format, void * pixels, int pitch)
  63.151  {
  63.152      X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
  63.153 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
  63.154 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  63.155 +    SDL_Window *window = renderer->window;
  63.156 +    SDL_VideoDisplay *display = window->display;
  63.157      Uint32 screen_format = display->current_mode.format;
  63.158      XImage *image;
  63.159  
  63.160 @@ -1019,8 +1019,8 @@
  63.161                        Uint32 format, const void * pixels, int pitch)
  63.162  {
  63.163      X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
  63.164 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
  63.165 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  63.166 +    SDL_Window *window = renderer->window;
  63.167 +    SDL_VideoDisplay *display = window->display;
  63.168      Uint32 screen_format = display->current_mode.format;
  63.169      XImage *image;
  63.170      void *image_pixels;
  63.171 @@ -1067,7 +1067,7 @@
  63.172      if (!(renderer->info.flags & SDL_RENDERER_SINGLEBUFFER)) {
  63.173          for (dirty = data->dirty.list; dirty; dirty = dirty->next) {
  63.174              const SDL_Rect *rect = &dirty->rect;
  63.175 -            XCopyArea(data->display, data->drawable, data->window,
  63.176 +            XCopyArea(data->display, data->drawable, data->xwindow,
  63.177                        data->gc, rect->x, rect->y, rect->w, rect->h,
  63.178                        rect->x, rect->y);
  63.179          }
    64.1 --- a/src/video/x11/SDL_x11window.c	Thu Jan 21 05:49:41 2010 +0000
    64.2 +++ b/src/video/x11/SDL_x11window.c	Thu Jan 21 06:21:52 2010 +0000
    64.3 @@ -45,7 +45,7 @@
    64.4  {
    64.5      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    64.6      SDL_DisplayData *displaydata =
    64.7 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
    64.8 +        (SDL_DisplayData *) window->display->driverdata;
    64.9      XWindowAttributes attr;
   64.10  
   64.11      XGetWindowAttributes(data->display, RootWindow(data->display,
   64.12 @@ -75,8 +75,8 @@
   64.13          SDL_OutOfMemory();
   64.14          return -1;
   64.15      }
   64.16 -    data->windowID = window->id;
   64.17 -    data->window = w;
   64.18 +    data->window = window;
   64.19 +    data->xwindow = w;
   64.20  #ifdef X_HAVE_UTF8_STRING
   64.21      if (SDL_X11_HAVE_UTF8) {
   64.22          data->ic =
   64.23 @@ -193,7 +193,7 @@
   64.24         if (GetFocus() == hwnd) {
   64.25         int index = data->videodata->keyboard;
   64.26         window->flags |= SDL_WINDOW_INPUT_FOCUS;
   64.27 -       SDL_SetKeyboardFocus(index, data->windowID);
   64.28 +       SDL_SetKeyboardFocus(index, data->window);
   64.29  
   64.30         if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
   64.31         RECT rect;
   64.32 @@ -215,7 +215,7 @@
   64.33  {
   64.34      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   64.35      SDL_DisplayData *displaydata =
   64.36 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   64.37 +        (SDL_DisplayData *) window->display->driverdata;
   64.38      Visual *visual;
   64.39      int depth;
   64.40      XSetWindowAttributes xattr;
   64.41 @@ -782,7 +782,7 @@
   64.42          status = XStringListToTextProperty(&title_locale, 1, &titleprop);
   64.43          SDL_free(title_locale);
   64.44          if (status) {
   64.45 -            XSetTextProperty(display, data->window, &titleprop, XA_WM_NAME);
   64.46 +            XSetTextProperty(display, data->xwindow, &titleprop, XA_WM_NAME);
   64.47              XFree(titleprop.value);
   64.48          }
   64.49  #ifdef X_HAVE_UTF8_STRING
   64.50 @@ -791,7 +791,7 @@
   64.51                  Xutf8TextListToTextProperty(display, (char **) &title, 1,
   64.52                                              XUTF8StringStyle, &titleprop);
   64.53              if (status == Success) {
   64.54 -                XSetTextProperty(display, data->window, &titleprop,
   64.55 +                XSetTextProperty(display, data->xwindow, &titleprop,
   64.56                                   _NET_WM_NAME);
   64.57                  XFree(titleprop.value);
   64.58              }
   64.59 @@ -807,7 +807,7 @@
   64.60          status = XStringListToTextProperty(&icon_locale, 1, &iconprop);
   64.61          SDL_free(icon_locale);
   64.62          if (status) {
   64.63 -            XSetTextProperty(display, data->window, &iconprop,
   64.64 +            XSetTextProperty(display, data->xwindow, &iconprop,
   64.65                               XA_WM_ICON_NAME);
   64.66              XFree(iconprop.value);
   64.67          }
   64.68 @@ -817,7 +817,7 @@
   64.69                  Xutf8TextListToTextProperty(display, (char **) &icon, 1,
   64.70                                              XUTF8StringStyle, &iconprop);
   64.71              if (status == Success) {
   64.72 -                XSetTextProperty(display, data->window, &iconprop,
   64.73 +                XSetTextProperty(display, data->xwindow, &iconprop,
   64.74                                   _NET_WM_ICON_NAME);
   64.75                  XFree(iconprop.value);
   64.76              }
   64.77 @@ -855,13 +855,13 @@
   64.78              propdata[1] = icon->h;
   64.79              SDL_memcpy(&propdata[2], surface->pixels,
   64.80                         surface->h * surface->pitch);
   64.81 -            XChangeProperty(display, data->window, _NET_WM_ICON, XA_CARDINAL,
   64.82 +            XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL,
   64.83                              32, PropModeReplace, (unsigned char *) propdata,
   64.84                              propsize);
   64.85          }
   64.86          SDL_FreeSurface(surface);
   64.87      } else {
   64.88 -        XDeleteProperty(display, data->window, _NET_WM_ICON);
   64.89 +        XDeleteProperty(display, data->xwindow, _NET_WM_ICON);
   64.90      }
   64.91  }
   64.92  
   64.93 @@ -870,7 +870,7 @@
   64.94  {
   64.95      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   64.96      SDL_DisplayData *displaydata =
   64.97 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   64.98 +        (SDL_DisplayData *) window->display->driverdata;
   64.99      Display *display = data->videodata->display;
  64.100      int x, y;
  64.101  
  64.102 @@ -888,7 +888,7 @@
  64.103      } else {
  64.104          y = window->y;
  64.105      }
  64.106 -    XMoveWindow(display, data->window, x, y);
  64.107 +    XMoveWindow(display, data->xwindow, x, y);
  64.108  }
  64.109  
  64.110  void
  64.111 @@ -897,7 +897,7 @@
  64.112      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
  64.113      Display *display = data->videodata->display;
  64.114  
  64.115 -    XResizeWindow(display, data->window, window->w, window->h);
  64.116 +    XResizeWindow(display, data->xwindow, window->w, window->h);
  64.117  }
  64.118  
  64.119  void
  64.120 @@ -906,7 +906,7 @@
  64.121      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
  64.122      Display *display = data->videodata->display;
  64.123  
  64.124 -    XMapRaised(display, data->window);
  64.125 +    XMapRaised(display, data->xwindow);
  64.126  }
  64.127  
  64.128  void
  64.129 @@ -915,7 +915,7 @@
  64.130      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
  64.131      Display *display = data->videodata->display;
  64.132  
  64.133 -    XUnmapWindow(display, data->window);
  64.134 +    XUnmapWindow(display, data->xwindow);
  64.135  }
  64.136  
  64.137  void
  64.138 @@ -924,7 +924,7 @@
  64.139      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
  64.140      Display *display = data->videodata->display;
  64.141  
  64.142 -    XRaiseWindow(display, data->window);
  64.143 +    XRaiseWindow(display, data->xwindow);
  64.144  }
  64.145  
  64.146  static void
  64.147 @@ -932,7 +932,7 @@
  64.148  {
  64.149      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
  64.150      SDL_DisplayData *displaydata =
  64.151 -        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
  64.152 +        (SDL_DisplayData *) window->display->driverdata;
  64.153      Display *display = data->videodata->display;
  64.154      Atom _NET_WM_STATE = XInternAtom(display, "_NET_WM_STATE", False);
  64.155      Atom _NET_WM_STATE_MAXIMIZED_VERT =
  64.156 @@ -942,7 +942,7 @@
  64.157      XEvent e;
  64.158  
  64.159      e.xany.type = ClientMessage;
  64.160 -    e.xany.window = data->window;
  64.161 +    e.xany.window = data->xwindow;
  64.162      e.xclient.message_type = _NET_WM_STATE;
  64.163      e.xclient.format = 32;
  64.164      e.xclient.data.l[0] =
  64.165 @@ -986,8 +986,8 @@
  64.166          /* Try to grab the mouse */
  64.167          for (;;) {
  64.168              int result =
  64.169 -                XGrabPointer(display, data->window, True, 0, GrabModeAsync,
  64.170 -                             GrabModeAsync, data->window, None, CurrentTime);
  64.171 +                XGrabPointer(display, data->xwindow, True, 0, GrabModeAsync,
  64.172 +                             GrabModeAsync, data->xwindow, None, CurrentTime);
  64.173              if (result == GrabSuccess) {
  64.174                  break;
  64.175              }
  64.176 @@ -995,10 +995,10 @@
  64.177          }
  64.178  
  64.179          /* Raise the window if we grab the mouse */
  64.180 -        XRaiseWindow(display, data->window);
  64.181 +        XRaiseWindow(display, data->xwindow);
  64.182  
  64.183          /* Now grab the keyboard */
  64.184 -        XGrabKeyboard(display, data->window, True, GrabModeAsync,
  64.185 +        XGrabKeyboard(display, data->xwindow, True, GrabModeAsync,
  64.186                        GrabModeAsync, CurrentTime);
  64.187      } else {
  64.188          XUngrabPointer(display, CurrentTime);
  64.189 @@ -1021,7 +1021,7 @@
  64.190  
  64.191          if (windowlist) {
  64.192              for (i = 0; i < numwindows; ++i) {
  64.193 -                if (windowlist[i] && (windowlist[i]->windowID == window->id)) {
  64.194 +                if (windowlist[i] && (windowlist[i]->window == window)) {
  64.195                      windowlist[i] = windowlist[numwindows - 1];
  64.196                      windowlist[numwindows - 1] = NULL;
  64.197                      videodata->numwindows--;
  64.198 @@ -1035,7 +1035,7 @@
  64.199          }
  64.200  #endif
  64.201          if (data->created) {
  64.202 -            XDestroyWindow(display, data->window);
  64.203 +            XDestroyWindow(display, data->xwindow);
  64.204          }
  64.205          SDL_free(data);
  64.206      }
    65.1 --- a/src/video/x11/SDL_x11window.h	Thu Jan 21 05:49:41 2010 +0000
    65.2 +++ b/src/video/x11/SDL_x11window.h	Thu Jan 21 06:21:52 2010 +0000
    65.3 @@ -26,8 +26,8 @@
    65.4  
    65.5  typedef struct
    65.6  {
    65.7 -    SDL_WindowID windowID;
    65.8 -    Window window;
    65.9 +    SDL_Window *window;
   65.10 +    Window xwindow;
   65.11      XIC ic;
   65.12      SDL_bool created;
   65.13      struct SDL_VideoData *videodata;
    66.1 --- a/test/automated/render/render.c	Thu Jan 21 05:49:41 2010 +0000
    66.2 +++ b/test/automated/render/render.c	Thu Jan 21 06:21:52 2010 +0000
    66.3 @@ -43,7 +43,7 @@
    66.4  static int render_testBlit (void);
    66.5  static int render_testBlitColour (void);
    66.6  static int render_testBlitAlpha (void);
    66.7 -static int render_testBlitBlendMode( SDL_TextureID tface, int mode );
    66.8 +static int render_testBlitBlendMode( SDL_Texture * tface, int mode );
    66.9  static int render_testBlitBlend (void);
   66.10  
   66.11  
   66.12 @@ -225,10 +225,10 @@
   66.13  /**
   66.14   * @brief Loads the test face.
   66.15   */
   66.16 -static SDL_TextureID render_loadTestFace (void)
   66.17 +static SDL_Texture * render_loadTestFace (void)
   66.18  {
   66.19     SDL_Surface *face;
   66.20 -   SDL_TextureID tface;
   66.21 +   SDL_Texture *tface;
   66.22  
   66.23     /* Create face surface. */
   66.24     face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
   66.25 @@ -261,7 +261,7 @@
   66.26  {
   66.27     int fail;
   66.28     int ret;
   66.29 -   SDL_TextureID tface;
   66.30 +   SDL_Texture *tface;
   66.31     Uint8 r, g, b;
   66.32  
   66.33     /* Get test face. */
   66.34 @@ -296,7 +296,7 @@
   66.35  {
   66.36     int fail;
   66.37     int ret;
   66.38 -   SDL_TextureID tface;
   66.39 +   SDL_Texture *tface;
   66.40     Uint8 a;
   66.41  
   66.42     /* Get test face. */
   66.43 @@ -606,7 +606,7 @@
   66.44  {
   66.45     int ret;
   66.46     SDL_Rect rect;
   66.47 -   SDL_TextureID tface;
   66.48 +   SDL_Texture *tface;
   66.49     int i, j, ni, nj;
   66.50  
   66.51     /* Clear surface. */
   66.52 @@ -658,7 +658,7 @@
   66.53  {
   66.54     int ret;
   66.55     SDL_Rect rect;
   66.56 -   SDL_TextureID tface;
   66.57 +   SDL_Texture *tface;
   66.58     int i, j, ni, nj;
   66.59  
   66.60     /* Clear surface. */
   66.61 @@ -716,7 +716,7 @@
   66.62  {
   66.63     int ret;
   66.64     SDL_Rect rect;
   66.65 -   SDL_TextureID tface;
   66.66 +   SDL_Texture *tface;
   66.67     int i, j, ni, nj;
   66.68  
   66.69     /* Clear surface. */
   66.70 @@ -774,7 +774,7 @@
   66.71  /**
   66.72   * @brief Tests a blend mode.
   66.73   */
   66.74 -static int render_testBlitBlendMode( SDL_TextureID tface, int mode )
   66.75 +static int render_testBlitBlendMode( SDL_Texture * tface, int mode )
   66.76  {
   66.77     int ret;
   66.78     int i, j, ni, nj;
   66.79 @@ -820,7 +820,7 @@
   66.80  {
   66.81     int ret;
   66.82     SDL_Rect rect;
   66.83 -   SDL_TextureID tface;
   66.84 +   SDL_Texture *tface;
   66.85     int i, j, ni, nj;
   66.86     int mode;
   66.87  
   66.88 @@ -1004,7 +1004,7 @@
   66.89     int ret;
   66.90     const char *driver, *str;
   66.91     char msg[256];
   66.92 -   SDL_WindowID wid;
   66.93 +   SDL_Window *w;
   66.94     SDL_RendererInfo renderer;
   66.95  
   66.96     /* Initializes the SDL subsystems. */
   66.97 @@ -1054,12 +1054,12 @@
   66.98        if (SDL_ATassert( "SDL_GetCurrentVideoDriver", SDL_strcmp(driver,str)==0))
   66.99           goto err_cleanup;
  66.100        /* Create window. */
  66.101 -      wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
  66.102 +      w = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
  66.103              80, 60, SDL_WINDOW_SHOWN );
  66.104 -      if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
  66.105 +      if (SDL_ATassert( "SDL_CreateWindow", w!=NULL ))
  66.106           goto err_cleanup;
  66.107        /* Check title. */
  66.108 -      str = SDL_GetWindowTitle( wid );
  66.109 +      str = SDL_GetWindowTitle( w );
  66.110        if (SDL_ATassert( "SDL_GetWindowTitle", SDL_strcmp(msg,str)==0))
  66.111           goto err_cleanup;
  66.112        /* Get renderers. */
  66.113 @@ -1072,10 +1072,10 @@
  66.114  
  66.115           /* We have to recreate window each time, because opengl and opengles renderers */
  66.116           /* both add SDL_WINDOW_OPENGL flag for window, that was last used              */
  66.117 -         SDL_DestroyWindow(wid);
  66.118 -         wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
  66.119 +         SDL_DestroyWindow(w);
  66.120 +         w = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
  66.121                 80, 60, SDL_WINDOW_SHOWN );
  66.122 -         if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
  66.123 +         if (SDL_ATassert( "SDL_CreateWindow", w!=NULL ))
  66.124              goto err_cleanup;
  66.125  
  66.126           /* Get renderer info. */
  66.127 @@ -1089,7 +1089,7 @@
  66.128           SDL_ATbegin( msg );
  66.129  
  66.130           /* Set renderer. */
  66.131 -         ret = SDL_CreateRenderer( wid, j, 0 );
  66.132 +         ret = SDL_CreateRenderer( w, j, 0 );
  66.133           if (SDL_ATassert( "SDL_CreateRenderer", ret==0 ))
  66.134              goto err_cleanup;
  66.135  
    67.1 --- a/test/common.c	Thu Jan 21 05:49:41 2010 +0000
    67.2 +++ b/test/common.c	Thu Jan 21 06:21:52 2010 +0000
    67.3 @@ -761,7 +761,7 @@
    67.4          fullscreen_mode.refresh_rate = state->refresh_rate;
    67.5  
    67.6          state->windows =
    67.7 -            (SDL_WindowID *) SDL_malloc(state->num_windows *
    67.8 +            (SDL_Window **) SDL_malloc(state->num_windows *
    67.9                                          sizeof(*state->windows));
   67.10          if (!state->windows) {
   67.11              fprintf(stderr, "Out of memory!\n");
    68.1 --- a/test/common.h	Thu Jan 21 05:49:41 2010 +0000
    68.2 +++ b/test/common.h	Thu Jan 21 06:21:52 2010 +0000
    68.3 @@ -32,7 +32,7 @@
    68.4      int depth;
    68.5      int refresh_rate;
    68.6      int num_windows;
    68.7 -    SDL_WindowID *windows;
    68.8 +    SDL_Window **windows;
    68.9  
   68.10      /* Renderer info */
   68.11      const char *renderdriver;
    69.1 --- a/test/testdraw2.c	Thu Jan 21 05:49:41 2010 +0000
    69.2 +++ b/test/testdraw2.c	Thu Jan 21 06:21:52 2010 +0000
    69.3 @@ -19,7 +19,7 @@
    69.4  static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
    69.5  
    69.6  void
    69.7 -DrawPoints(SDL_WindowID window)
    69.8 +DrawPoints(SDL_Window * window)
    69.9  {
   69.10      int i;
   69.11      int x, y;
   69.12 @@ -64,7 +64,7 @@
   69.13  }
   69.14  
   69.15  void
   69.16 -DrawLines(SDL_WindowID window)
   69.17 +DrawLines(SDL_Window * window)
   69.18  {
   69.19      int i;
   69.20      int x1, y1, x2, y2;
   69.21 @@ -118,7 +118,7 @@
   69.22  }
   69.23  
   69.24  void
   69.25 -DrawRects(SDL_WindowID window)
   69.26 +DrawRects(SDL_Window * window)
   69.27  {
   69.28      int i;
   69.29      SDL_Rect rect;
   69.30 @@ -249,7 +249,7 @@
   69.31              case SDL_WINDOWEVENT:
   69.32                  switch (event.window.event) {
   69.33                  case SDL_WINDOWEVENT_EXPOSED:
   69.34 -                    SDL_SelectRenderer(event.window.windowID);
   69.35 +                    SDL_SelectRenderer(SDL_GetWindowFromID(event.window.windowID));
   69.36                      SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
   69.37                      SDL_RenderClear();
   69.38                      break;
    70.1 --- a/test/testintersections.c	Thu Jan 21 05:49:41 2010 +0000
    70.2 +++ b/test/testintersections.c	Thu Jan 21 06:21:52 2010 +0000
    70.3 @@ -20,7 +20,7 @@
    70.4  static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
    70.5  
    70.6  void
    70.7 -DrawPoints(SDL_WindowID window)
    70.8 +DrawPoints(SDL_Window * window)
    70.9  {
   70.10      int i;
   70.11      int x, y;
   70.12 @@ -86,7 +86,7 @@
   70.13  
   70.14  
   70.15  void
   70.16 -DrawLines(SDL_WindowID window)
   70.17 +DrawLines(SDL_Window * window)
   70.18  {
   70.19      int i;
   70.20      int x1, y1, x2, y2;
   70.21 @@ -139,7 +139,7 @@
   70.22  }
   70.23  
   70.24  static void
   70.25 -DrawRects(SDL_WindowID window)
   70.26 +DrawRects(SDL_Window * window)
   70.27  {
   70.28      int i;
   70.29      int window_w, window_h;
   70.30 @@ -156,7 +156,7 @@
   70.31  }
   70.32  
   70.33  static void
   70.34 -DrawRectLineIntersections(SDL_WindowID window)
   70.35 +DrawRectLineIntersections(SDL_Window * window)
   70.36  {
   70.37      int i, j, window_w, window_h;
   70.38  
   70.39 @@ -186,7 +186,7 @@
   70.40  }
   70.41  
   70.42  static void
   70.43 -DrawRectRectIntersections(SDL_WindowID window)
   70.44 +DrawRectRectIntersections(SDL_Window * window)
   70.45  {
   70.46      int i, j;
   70.47  
   70.48 @@ -324,7 +324,7 @@
   70.49              case SDL_WINDOWEVENT:
   70.50                  switch (event.window.event) {
   70.51                  case SDL_WINDOWEVENT_EXPOSED:
   70.52 -                    SDL_SelectRenderer(event.window.windowID);
   70.53 +                    SDL_SelectRenderer(SDL_GetWindowFromID(event.window.windowID));
   70.54                      SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
   70.55                      SDL_RenderClear();
   70.56                      break;
    71.1 --- a/test/testnative.c	Thu Jan 21 05:49:41 2010 +0000
    71.2 +++ b/test/testnative.c	Thu Jan 21 06:21:52 2010 +0000
    71.3 @@ -36,11 +36,11 @@
    71.4      exit(rc);
    71.5  }
    71.6  
    71.7 -SDL_TextureID
    71.8 -LoadSprite(SDL_WindowID window, char *file)
    71.9 +SDL_Texture *
   71.10 +LoadSprite(SDL_Window * window, char *file)
   71.11  {
   71.12      SDL_Surface *temp;
   71.13 -    SDL_TextureID sprite;
   71.14 +    SDL_Texture *sprite;
   71.15  
   71.16      /* Load the sprite image */
   71.17      temp = SDL_LoadBMP(file);
   71.18 @@ -69,7 +69,7 @@
   71.19  }
   71.20  
   71.21  void
   71.22 -MoveSprites(SDL_WindowID window, SDL_TextureID sprite)
   71.23 +MoveSprites(SDL_Window * window, SDL_Texture * sprite)
   71.24  {
   71.25      int i, n;
   71.26      int window_w, window_h;
   71.27 @@ -113,8 +113,8 @@
   71.28  {
   71.29      int i, done;
   71.30      const char *driver;
   71.31 -    SDL_WindowID window;
   71.32 -    SDL_TextureID sprite;
   71.33 +    SDL_Window *window;
   71.34 +    SDL_Texture *sprite;
   71.35      int window_w, window_h;
   71.36      int sprite_w, sprite_h;
   71.37      SDL_Event event;
    72.1 --- a/test/testsprite2.c	Thu Jan 21 05:49:41 2010 +0000
    72.2 +++ b/test/testsprite2.c	Thu Jan 21 06:21:52 2010 +0000
    72.3 @@ -11,7 +11,7 @@
    72.4  
    72.5  static CommonState *state;
    72.6  static int num_sprites;
    72.7 -static SDL_TextureID *sprites;
    72.8 +static SDL_Texture **sprites;
    72.9  static SDL_bool cycle_color;
   72.10  static SDL_bool cycle_alpha;
   72.11  static int cycle_direction = 1;
   72.12 @@ -98,7 +98,7 @@
   72.13  }
   72.14  
   72.15  void
   72.16 -MoveSprites(SDL_WindowID window, SDL_TextureID sprite)
   72.17 +MoveSprites(SDL_Window * window, SDL_Texture * sprite)
   72.18  {
   72.19      int i, n;
   72.20      int window_w, window_h;
   72.21 @@ -294,7 +294,7 @@
   72.22  
   72.23      /* Create the windows, initialize the renderers, and load the textures */
   72.24      sprites =
   72.25 -        (SDL_TextureID *) SDL_malloc(state->num_windows * sizeof(*sprites));
   72.26 +        (SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
   72.27      if (!sprites) {
   72.28          fprintf(stderr, "Out of memory!\n");
   72.29          quit(2);
   72.30 @@ -346,7 +346,7 @@
   72.31              case SDL_WINDOWEVENT:
   72.32                  switch (event.window.event) {
   72.33                  case SDL_WINDOWEVENT_EXPOSED:
   72.34 -                    SDL_SelectRenderer(event.window.windowID);
   72.35 +                    SDL_SelectRenderer(SDL_GetWindowFromID(event.window.windowID));
   72.36                      SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
   72.37                      SDL_RenderClear();
   72.38                      break;
    73.1 --- a/test/testspriteminimal.c	Thu Jan 21 05:49:41 2010 +0000
    73.2 +++ b/test/testspriteminimal.c	Thu Jan 21 06:21:52 2010 +0000
    73.3 @@ -12,7 +12,7 @@
    73.4  #define NUM_SPRITES     100
    73.5  #define MAX_SPEED       1
    73.6  
    73.7 -static SDL_TextureID sprite;
    73.8 +static SDL_Texture *sprite;
    73.9  static SDL_Rect positions[NUM_SPRITES];
   73.10  static SDL_Rect velocities[NUM_SPRITES];
   73.11  static int sprite_w, sprite_h;
   73.12 @@ -78,7 +78,7 @@
   73.13  }
   73.14  
   73.15  void
   73.16 -MoveSprites(SDL_WindowID window, SDL_TextureID sprite)
   73.17 +MoveSprites(SDL_Window * window, SDL_Texture * sprite)
   73.18  {
   73.19      int i;
   73.20      int window_w = WINDOW_WIDTH;
   73.21 @@ -115,7 +115,7 @@
   73.22  int
   73.23  main(int argc, char *argv[])
   73.24  {
   73.25 -    SDL_WindowID window;
   73.26 +    SDL_Window *window;
   73.27      int i, done;
   73.28      SDL_Event event;
   73.29