Mercurial > sdl-ios-xcode
changeset 3685:64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
line wrap: on
line diff
--- a/README.iphoneos Thu Jan 21 05:49:41 2010 +0000 +++ b/README.iphoneos Thu Jan 21 06:21:52 2010 +0000 @@ -67,13 +67,13 @@ 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. -int SDL_iPhoneKeyboardShow(SDL_WindowID windowID) +int SDL_iPhoneKeyboardShow(SDL_Window * window) -- reveals the onscreen keyboard. Returns 0 on success and -1 on error. -int SDL_iPhoneKeyboardHide(SDL_WindowID windowID) +int SDL_iPhoneKeyboardHide(SDL_Window * window) -- hides the onscreen keyboard. Returns 0 on success and -1 on error. -SDL_bool SDL_iPhoneKeyboardIsShown(SDL_WindowID windowID) +SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) -- returns whether or not the onscreen keyboard is currently visible. -int SDL_iPhoneKeyboardToggle(SDL_WindowID windowID) +int SDL_iPhoneKeyboardToggle(SDL_Window * window) -- toggles the visibility of the onscreen keyboard. Returns 0 on success and -1 on error. ==============================================================================
--- a/Xcode-iPhoneOS/Demos/src/accelerometer.c Thu Jan 21 05:49:41 2010 +0000 +++ b/Xcode-iPhoneOS/Demos/src/accelerometer.c Thu Jan 21 06:21:52 2010 +0000 @@ -27,8 +27,8 @@ SDL_Rect rect; /* (drawn) position and size of ship */ } ship; -static SDL_TextureID shipID = 0; /* texture for spaceship */ -static SDL_TextureID spaceID = 0; /* texture for space (background */ +static SDL_Texture *ship = 0; /* texture for spaceship */ +static SDL_Texture *space = 0; /* texture for space (background */ void render(void) @@ -97,13 +97,13 @@ } /* draw the background */ - SDL_RenderCopy(spaceID, NULL, NULL); + SDL_RenderCopy(space, NULL, NULL); /* draw the ship */ ship.rect.x = ship.x; ship.rect.y = ship.y; - SDL_RenderCopy(shipID, NULL, &ship.rect); + SDL_RenderCopy(ship, NULL, &ship.rect); /* update screen */ SDL_RenderPresent(); @@ -141,11 +141,11 @@ SDL_BlitSurface(bmp_surface, NULL, bmp_surface_rgba, NULL); /* create ship texture from surface */ - shipID = SDL_CreateTextureFromSurface(format, bmp_surface_rgba); - if (shipID == 0) { + ship = SDL_CreateTextureFromSurface(format, bmp_surface_rgba); + if (ship == 0) { fatalError("could not create ship texture"); } - SDL_SetTextureBlendMode(shipID, SDL_BLENDMODE_BLEND); + SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND); /* set the width and height of the ship from the surface dimensions */ ship.rect.w = bmp_surface->w; @@ -160,8 +160,8 @@ fatalError("could not load space.bmp"); } /* create space texture from surface */ - spaceID = SDL_CreateTextureFromSurface(format, bmp_surface); - if (spaceID == 0) { + space = SDL_CreateTextureFromSurface(format, bmp_surface); + if (space == 0) { fatalError("could not create space texture"); } SDL_FreeSurface(bmp_surface); @@ -174,7 +174,7 @@ main(int argc, char *argv[]) { - SDL_WindowID windowID; /* ID of main window */ + SDL_Window *window; /* main window */ Uint32 startFrame; /* time frame began to process */ Uint32 endFrame; /* time frame ended processing */ Uint32 delay; /* time to pause waiting to draw next frame */ @@ -186,10 +186,10 @@ } /* create main window and renderer */ - windowID = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, + window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS); - SDL_CreateRenderer(windowID, 0, 0); + SDL_CreateRenderer(window, 0, 0); /* print out some info about joysticks and try to open accelerometer for use */ printf("There are %d joysticks available\n", SDL_NumJoysticks()); @@ -240,8 +240,8 @@ } /* delete textures */ - SDL_DestroyTexture(shipID); - SDL_DestroyTexture(spaceID); + SDL_DestroyTexture(ship); + SDL_DestroyTexture(space); /* shutdown SDL */ SDL_Quit();
--- a/Xcode-iPhoneOS/Demos/src/fireworks.c Thu Jan 21 05:49:41 2010 +0000 +++ b/Xcode-iPhoneOS/Demos/src/fireworks.c Thu Jan 21 06:21:52 2010 +0000 @@ -363,8 +363,7 @@ int main(int argc, char *argv[]) { - - SDL_WindowID windowID; /* ID of main window */ + SDL_Window *window; /* main window */ Uint32 startFrame; /* time frame began to process */ Uint32 endFrame; /* time frame ended processing */ Uint32 delay; /* time to pause waiting to draw next frame */ @@ -389,10 +388,10 @@ SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); /* create main window and renderer */ - windowID = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, + window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS); - SDL_CreateRenderer(windowID, 0, 0); + SDL_CreateRenderer(window, 0, 0); /* load the particle texture */ initializeTexture();
--- a/Xcode-iPhoneOS/Demos/src/happy.c Thu Jan 21 05:49:41 2010 +0000 +++ b/Xcode-iPhoneOS/Demos/src/happy.c Thu Jan 21 06:21:52 2010 +0000 @@ -11,7 +11,7 @@ #define MILLESECONDS_PER_FRAME 16 /* about 60 frames per second */ #define HAPPY_FACE_SIZE 32 /* width and height of happyface (pixels) */ -static SDL_TextureID texture_id = 0; /* reference to texture holding happyface */ +static SDL_Texture *texture = 0; /* reference to texture holding happyface */ static struct { @@ -86,7 +86,7 @@ } dstRect.x = faces[i].x; dstRect.y = faces[i].y; - SDL_RenderCopy(texture_id, &srcRect, &dstRect); + SDL_RenderCopy(texture, &srcRect, &dstRect); } /* update screen */ SDL_RenderPresent(); @@ -124,11 +124,11 @@ SDL_BlitSurface(bmp_surface, NULL, bmp_surface_rgba, NULL); /* convert RGBA surface to texture */ - texture_id = SDL_CreateTextureFromSurface(format, bmp_surface_rgba); - if (texture_id == 0) { + texture = SDL_CreateTextureFromSurface(format, bmp_surface_rgba); + if (texture == 0) { fatalError("could not create texture"); } - SDL_SetTextureBlendMode(texture_id, SDL_BLENDMODE_BLEND); + SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); /* free up allocated memory */ SDL_FreeSurface(bmp_surface_rgba); @@ -139,7 +139,7 @@ main(int argc, char *argv[]) { - SDL_WindowID windowID; + SDL_Window *window; Uint32 startFrame; Uint32 endFrame; Uint32 delay; @@ -149,11 +149,11 @@ if (SDL_Init(SDL_INIT_VIDEO) < 0) { fatalError("Could not initialize SDL"); } - windowID = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, + window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS); - SDL_CreateRenderer(windowID, -1, 0); + SDL_CreateRenderer(window, -1, 0); initializeTexture(); initializeHappyFaces(); @@ -182,7 +182,7 @@ } /* cleanup */ - SDL_DestroyTexture(texture_id); + SDL_DestroyTexture(texture); /* shutdown SDL */ SDL_Quit();
--- a/Xcode-iPhoneOS/Demos/src/keyboard.c Thu Jan 21 05:49:41 2010 +0000 +++ b/Xcode-iPhoneOS/Demos/src/keyboard.c Thu Jan 21 06:21:52 2010 +0000 @@ -10,14 +10,14 @@ #define GLYPH_SIZE_IMAGE 16 /* size of glyphs (characters) in the bitmap font file */ #define GLYPH_SIZE_SCREEN 32 /* size of glyphs (characters) as shown on the screen */ -static SDL_TextureID textureID; /* texture where we'll hold our font */ +static SDL_Texture *texture; /* texture where we'll hold our font */ /* iPhone SDL addition keyboard related function definitions */ -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_WindowID windowID); -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardHide(SDL_WindowID windowID); -extern DECLSPEC SDL_bool SDLCALL SDL_iPhoneKeyboardIsShown(SDL_WindowID - windowID); -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_WindowID windowID); +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_Window * window); +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardHide(SDL_Window * window); +extern DECLSPEC SDL_bool SDLCALL SDL_iPhoneKeyboardIsShown(SDL_Window * + window); +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_Window * window); /* function declarations */ void cleanup(void); @@ -157,7 +157,7 @@ { GLYPH_SIZE_IMAGE * index, 0, GLYPH_SIZE_IMAGE, GLYPH_SIZE_IMAGE }; SDL_Rect dstRect = { x, y, GLYPH_SIZE_SCREEN, GLYPH_SIZE_SCREEN }; drawBlank(x, y); - SDL_RenderCopy(textureID, &srcRect, &dstRect); + SDL_RenderCopy(texture, &srcRect, &dstRect); } /* draws the cursor icon at the current end position of the text */ @@ -194,8 +194,8 @@ } } -/* this function loads our font into an SDL_Texture and returns the SDL_TextureID */ -SDL_TextureID +/* this function loads our font into an SDL_Texture and returns the SDL_Texture */ +SDL_Texture* loadFont(void) { @@ -218,17 +218,17 @@ Bmask, Amask); SDL_BlitSurface(surface, NULL, converted, NULL); /* create our texture */ - textureID = + texture = SDL_CreateTextureFromSurface(SDL_PIXELFORMAT_ABGR8888, converted); - if (textureID == 0) { + if (texture == 0) { printf("texture creation failed: %s\n", SDL_GetError()); } else { /* set blend mode for our texture */ - SDL_SetTextureBlendMode(textureID, SDL_BLENDMODE_BLEND); + SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); } SDL_FreeSurface(surface); SDL_FreeSurface(converted); - return textureID; + return texture; } } @@ -237,6 +237,7 @@ { int index; /* index of last key we pushed in the bitmap font */ + SDL_Window *window; SDL_Event event; /* last event received */ SDLMod mod; /* key modifiers of last key we pushed */ SDL_scancode scancode; /* scancode of last key we pushed */ @@ -245,11 +246,9 @@ printf("Error initializing SDL: %s", SDL_GetError()); } /* create window */ - SDL_WindowID windowID = - SDL_CreateWindow("iPhone keyboard test", 0, 0, SCREEN_WIDTH, - SCREEN_HEIGHT, 0); + window = SDL_CreateWindow("iPhone keyboard test", 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0); /* create renderer */ - SDL_CreateRenderer(windowID, 0, 0); + SDL_CreateRenderer(window, 0, 0); /* load up our font */ loadFont(); @@ -301,7 +300,7 @@ /* mouse up toggles onscreen keyboard visibility this function is available ONLY on iPhone OS */ - SDL_iPhoneKeyboardToggle(windowID); + SDL_iPhoneKeyboardToggle(window); break; #endif } @@ -314,6 +313,6 @@ void cleanup(void) { - SDL_DestroyTexture(textureID); + SDL_DestroyTexture(texture); SDL_Quit(); }
--- a/Xcode-iPhoneOS/Demos/src/mixer.c Thu Jan 21 05:49:41 2010 +0000 +++ b/Xcode-iPhoneOS/Demos/src/mixer.c Thu Jan 21 06:21:52 2010 +0000 @@ -274,7 +274,7 @@ { int done; /* has user tried to quit ? */ - SDL_WindowID windowID; /* our main window */ + SDL_Window *window; /* main window */ SDL_Event event; Uint32 startFrame; /* holds when frame started processing */ Uint32 endFrame; /* holds when frame ended processing */ @@ -283,10 +283,10 @@ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) { fatalError("could not initialize SDL"); } - windowID = + window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS); - SDL_CreateRenderer(windowID, 0, 0); + SDL_CreateRenderer(window, 0, 0); /* initialize the mixer */ SDL_memset(&mixer, 0, sizeof(mixer));
--- a/Xcode-iPhoneOS/Demos/src/rectangles.c Thu Jan 21 05:49:41 2010 +0000 +++ b/Xcode-iPhoneOS/Demos/src/rectangles.c Thu Jan 21 06:21:52 2010 +0000 @@ -38,7 +38,7 @@ main(int argc, char *argv[]) { - SDL_WindowID windowID; + SDL_Window *window; int done; SDL_Event event; @@ -51,13 +51,13 @@ srand(time(NULL)); /* create window and renderer */ - windowID = + window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN); - if (windowID == 0) { + if (window == 0) { fatalError("Could not initialize Window"); } - if (SDL_CreateRenderer(windowID, -1, 0) != 0) { + if (SDL_CreateRenderer(window, -1, 0) != 0) { fatalError("Could not create renderer"); }
--- a/Xcode-iPhoneOS/Demos/src/touch.c Thu Jan 21 05:49:41 2010 +0000 +++ b/Xcode-iPhoneOS/Demos/src/touch.c Thu Jan 21 06:21:52 2010 +0000 @@ -11,7 +11,7 @@ #define BRUSH_SIZE 32 /* width and height of the brush */ #define PIXELS_PER_ITERATION 5 /* number of pixels between brush blots when forming a line */ -static SDL_TextureID brushID = 0; /* texture for the brush */ +static SDL_Texture *brush = 0; /* texture for the brush */ /* draws a line from (startx, starty) to (startx + dx, starty + dy) @@ -43,7 +43,7 @@ x += dx_prime; y += dy_prime; /* draw brush blot */ - SDL_RenderCopy(brushID, NULL, &dstRect); + SDL_RenderCopy(brush, NULL, &dstRect); } } @@ -58,16 +58,16 @@ if (bmp_surface == NULL) { fatalError("could not load stroke.bmp"); } - brushID = + brush = SDL_CreateTextureFromSurface(SDL_PIXELFORMAT_ABGR8888, bmp_surface); SDL_FreeSurface(bmp_surface); - if (brushID == 0) { + if (brush == 0) { fatalError("could not create brush texture"); } /* additive blending -- laying strokes on top of eachother makes them brighter */ - SDL_SetTextureBlendMode(brushID, SDL_BLENDMODE_ADD); + SDL_SetTextureBlendMode(brush, SDL_BLENDMODE_ADD); /* set brush color (red) */ - SDL_SetTextureColorMod(brushID, 255, 100, 100); + SDL_SetTextureColorMod(brush, 255, 100, 100); } int @@ -77,7 +77,7 @@ int x, y, dx, dy; /* mouse location */ Uint8 state; /* mouse (touch) state */ SDL_Event event; - SDL_WindowID windowID; /* main window */ + SDL_Window *window; /* main window */ int done; /* does user want to quit? */ /* initialize SDL */ @@ -86,10 +86,10 @@ } /* create main window and renderer */ - windowID = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, + window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS); - SDL_CreateRenderer(windowID, 0, 0); + SDL_CreateRenderer(window, 0, 0); /*load brush texture */ initializeTexture(); @@ -118,7 +118,7 @@ } /* cleanup */ - SDL_DestroyTexture(brushID); + SDL_DestroyTexture(brush); SDL_Quit(); return 0;
--- a/include/SDL_compat.h Thu Jan 21 05:49:41 2010 +0000 +++ b/include/SDL_compat.h Thu Jan 21 06:21:52 2010 +0000 @@ -295,6 +295,8 @@ extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval); extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); +#define SDL_TextureID SDL_Texture* +#define SDL_WindowID SDL_Window* #define SDL_RenderPoint SDL_RenderDrawPoint #define SDL_RenderLine SDL_RenderDrawLine #define SDL_RenderFill(X) (X) ? SDL_RenderFillRect(X) : SDL_RenderClear()
--- a/include/SDL_events.h Thu Jan 21 05:49:41 2010 +0000 +++ b/include/SDL_events.h Thu Jan 21 06:21:52 2010 +0000 @@ -127,7 +127,7 @@ typedef struct SDL_WindowEvent { Uint8 type; /**< ::SDL_WINDOWEVENT */ - SDL_WindowID windowID; /**< The associated window */ + Uint32 windowID; /**< The associated window */ Uint8 event; /**< ::SDL_WindowEventID */ int data1; /**< event dependent data */ int data2; /**< event dependent data */ @@ -139,7 +139,7 @@ typedef struct SDL_KeyboardEvent { Uint8 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */ - SDL_WindowID windowID; /**< The window with keyboard focus, if any */ + Uint32 windowID; /**< The window with keyboard focus, if any */ Uint8 which; /**< The keyboard device index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ SDL_keysym keysym; /**< The key that was pressed or released */ @@ -165,7 +165,7 @@ typedef struct SDL_TextInputEvent { Uint8 type; /**< ::SDL_TEXTINPUT */ - SDL_WindowID windowID; /**< The window with keyboard focus, if any */ + Uint32 windowID; /**< The window with keyboard focus, if any */ Uint8 which; /**< The keyboard device index */ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */ } SDL_TextInputEvent; @@ -176,7 +176,7 @@ typedef struct SDL_MouseMotionEvent { Uint8 type; /**< ::SDL_MOUSEMOTION */ - SDL_WindowID windowID; /**< The window with mouse focus, if any */ + Uint32 windowID; /**< The window with mouse focus, if any */ Uint8 which; /**< The mouse device index */ Uint8 state; /**< The current button state */ int x; /**< X coordinate, relative to window */ @@ -199,7 +199,7 @@ typedef struct SDL_MouseButtonEvent { Uint8 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ - SDL_WindowID windowID; /**< The window with mouse focus, if any */ + Uint32 windowID; /**< The window with mouse focus, if any */ Uint8 which; /**< The mouse device index */ Uint8 button; /**< The mouse button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -213,7 +213,7 @@ typedef struct SDL_MouseWheelEvent { Uint8 type; /**< ::SDL_MOUSEWHEEL */ - SDL_WindowID windowID; /**< The window with mouse focus, if any */ + Uint32 windowID; /**< The window with mouse focus, if any */ Uint8 which; /**< The mouse device index */ int x; /**< The amount scrolled horizontally */ int y; /**< The amount scrolled vertically */ @@ -284,7 +284,7 @@ typedef struct SDL_UserEvent { Uint8 type; /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */ - SDL_WindowID windowID; /**< The associated window if any*/ + Uint32 windowID; /**< The associated window if any*/ int code; /**< User defined event code */ void *data1; /**< User defined data pointer */ void *data2; /**< User defined data pointer */ @@ -307,7 +307,7 @@ typedef struct SDL_ProximityEvent { Uint8 type; - SDL_WindowID windowID; /**< The associated window */ + Uint32 windowID; /**< The associated window */ Uint8 which; int cursor; int x;
--- a/include/SDL_mouse.h Thu Jan 21 05:49:41 2010 +0000 +++ b/include/SDL_mouse.h Thu Jan 21 06:21:52 2010 +0000 @@ -75,7 +75,7 @@ /** * \brief Get the window which currently has focus for the specified mouse. */ -extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(int index); +extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocusWindow(int index); /** * \brief Set relative mouse mode for the specified mouse. @@ -126,13 +126,13 @@ /** * \brief Moves the currently selected mouse to the given position within the window. * - * \param windowID The window to move the mouse into, or 0 for the current mouse focus + * \param window The window to move the mouse into, or NULL for the current mouse focus * \param x The x coordinate within the window * \param y The y coordinate within the window * * \note This function generates a mouse motion event */ -extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_WindowID windowID, +extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, int x, int y); /**
--- a/include/SDL_syswm.h Thu Jan 21 05:49:41 2010 +0000 +++ b/include/SDL_syswm.h Thu Jan 21 06:21:52 2010 +0000 @@ -245,7 +245,7 @@ * if ( SDL_GetWindowWMInfo(&info) ) { ... } * \endcode */ -extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID, +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, SDL_SysWMinfo * info);
--- a/include/SDL_video.h Thu Jan 21 05:49:41 2010 +0000 +++ b/include/SDL_video.h Thu Jan 21 06:21:52 2010 +0000 @@ -88,7 +88,8 @@ * \sa SDL_SetWindowTitle() * \sa SDL_ShowWindow() */ -typedef Uint32 SDL_WindowID; +struct SDL_Window; +typedef struct SDL_Window SDL_Window; /** * \brief The flags on a window @@ -248,7 +249,8 @@ /** * \brief An efficient driver-specific representation of pixel data */ -typedef Uint32 SDL_TextureID; +struct SDL_Texture; +typedef struct SDL_Texture SDL_Texture; /** * \brief An opaque handle to an OpenGL context. @@ -449,7 +451,7 @@ * \sa SDL_GetWindowDisplayMode() * \sa SDL_SetWindowFullscreen() */ -extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_WindowID windowID, +extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode); @@ -460,7 +462,7 @@ * \sa SDL_SetWindowDisplayMode() * \sa SDL_SetWindowFullscreen() */ -extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_WindowID windowID, +extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode); /** @@ -551,7 +553,7 @@ * * \sa SDL_DestroyWindow() */ -extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title, +extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags); @@ -564,19 +566,29 @@ * * \sa SDL_DestroyWindow() */ -extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data); +extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data); + +/** + * \brief Get the numeric ID of the window, for logging purposes. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window); + +/** + * \brief Get a window from a stored ID, or NULL if it doesn't exist. + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id); /** * \brief Get the window flags. */ -extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID); +extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window); /** * \brief Set the title of the window, in UTF-8 format. * * \sa SDL_GetWindowTitle() */ -extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID, +extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, const char *title); /** @@ -584,14 +596,14 @@ * * \sa SDL_SetWindowTitle() */ -extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID); +extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window); /** * \brief Set the icon of the window. * * \param icon The icon for the window. */ -extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_WindowID windowID, +extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, SDL_Surface * icon); /** @@ -599,7 +611,7 @@ * * \sa SDL_GetWindowData() */ -extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID, +extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_Window * window, void *userdata); /** @@ -607,12 +619,12 @@ * * \sa SDL_SetWindowData() */ -extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID); +extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window); /** * \brief Set the position of the window. * - * \param windowID The window to reposition. + * \param window The window to reposition. * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or @@ -622,7 +634,7 @@ * * \sa SDL_GetWindowPosition() */ -extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID, +extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, int x, int y); /** @@ -630,7 +642,7 @@ * * \sa SDL_SetWindowPosition() */ -extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID, +extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, int *x, int *y); /** @@ -641,7 +653,7 @@ * * \sa SDL_GetWindowSize() */ -extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w, +extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, int h); /** @@ -649,7 +661,7 @@ * * \sa SDL_SetWindowSize() */ -extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w, +extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, int *h); /** @@ -657,33 +669,33 @@ * * \sa SDL_HideWindow() */ -extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID); +extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window); /** * \brief Hide the window. * * \sa SDL_ShowWindow() */ -extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID); +extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window); /** * \brief Raise the window above other windows and set the input focus. */ -extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID); +extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window); /** * \brief Make the window as large as possible. * * \sa SDL_RestoreWindow() */ -extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID); +extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window); /** * \brief Minimize the window to an iconic representation. * * \sa SDL_RestoreWindow() */ -extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID); +extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window); /** * \brief Restore the size and position of a minimized or maximized window. @@ -691,7 +703,7 @@ * \sa SDL_MaximizeWindow() * \sa SDL_MinimizeWindow() */ -extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID); +extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window); /** * \brief Set the window's fullscreen state. @@ -701,7 +713,7 @@ * \sa SDL_SetWindowDisplayMode() * \sa SDL_GetWindowDisplayMode() */ -extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID, +extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, int fullscreen); /** @@ -711,7 +723,7 @@ * * \sa SDL_GetWindowGrab() */ -extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID, +extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, int mode); /** @@ -721,7 +733,7 @@ * * \sa SDL_SetWindowGrab() */ -extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID); +extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_Window * window); /** * \brief Get driver specific information about a window. @@ -729,14 +741,14 @@ * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo. */ struct SDL_SysWMinfo; -extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID, +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info); /** * \brief Destroy a window. */ -extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID); +extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); /** * \brief Get the number of 2D rendering drivers available for the current @@ -769,7 +781,7 @@ /** * \brief Create and make active a 2D rendering context for a window. * - * \param windowID The window where rendering is displayed. + * \param window The window where rendering is displayed. * \param index The index of the rendering driver to initialize, or -1 to * initialize the first one supporting the requested flags. * \param flags ::SDL_RendererFlags. @@ -780,7 +792,7 @@ * \sa SDL_GetRendererInfo() * \sa SDL_DestroyRenderer() */ -extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID, +extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags); /** @@ -789,7 +801,7 @@ * \return 0 on success, -1 if the selected window doesn't have a * rendering context. */ -extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID); +extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_Window * window); /** * \brief Get information about the current rendering context. @@ -811,7 +823,7 @@ * \sa SDL_QueryTexture() * \sa SDL_DestroyTexture() */ -extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format, +extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(Uint32 format, int access, int w, int h); @@ -830,7 +842,7 @@ * \sa SDL_QueryTexture() * \sa SDL_DestroyTexture() */ -extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32 +extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface); @@ -838,7 +850,7 @@ /** * \brief Query the attributes of a texture * - * \param textureID A texture to be queried. + * \param texture A texture to be queried. * \param format A pointer filled in with the raw format of the texture. The * actual format may differ, but pixel transfers will use this * format. @@ -848,7 +860,7 @@ * * \return 0 on success, or -1 if the texture is not valid. */ -extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access, int *w, int *h); @@ -856,7 +868,7 @@ * \brief Query the pixels of a texture, if the texture does not need to be * locked for pixel access. * - * \param textureID A texture to be queried, which was created with + * \param texture A texture to be queried, which was created with * ::SDL_TEXTUREACCESS_STREAMING. * \param pixels A pointer filled with a pointer to the pixels for the * texture. @@ -865,13 +877,13 @@ * \return 0 on success, or -1 if the texture is not valid, or must be locked * for pixel access. */ -extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_Texture * texture, void **pixels, int *pitch); /** * \brief Set the color palette of an indexed texture. * - * \param textureID The texture to update. + * \param texture The texture to update. * \param colors The array of RGB color data. * \param firstcolor The first index to update. * \param ncolors The number of palette entries to fill with the color data. @@ -879,7 +891,7 @@ * \return 0 on success, or -1 if the texture is not valid or not an indexed * texture. */ -extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_Texture * texture, const SDL_Color * colors, int firstcolor, int ncolors); @@ -887,7 +899,7 @@ /** * \brief Get the color palette from an indexed texture if it has one. * - * \param textureID The texture to update. + * \param texture The texture to update. * \param colors The array to fill with RGB color data. * \param firstcolor The first index to retrieve. * \param ncolors The number of palette entries to retrieve. @@ -895,7 +907,7 @@ * \return 0 on success, or -1 if the texture is not valid or not an indexed * texture. */ -extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_Texture * texture, SDL_Color * colors, int firstcolor, int ncolors); @@ -903,7 +915,7 @@ /** * \brief Set an additional color value used in render copy operations. * - * \param textureID The texture to update. + * \param texture The texture to update. * \param r The red source color value multiplied into copy operations. * \param g The green source color value multiplied into copy operations. * \param b The blue source color value multiplied into copy operations. @@ -913,14 +925,14 @@ * * \sa SDL_GetTextureColorMod() */ -extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b); /** * \brief Get the additional color value used in render copy operations. * - * \param textureID The texture to query. + * \param texture The texture to query. * \param r A pointer filled in with the source red color value. * \param g A pointer filled in with the source green color value. * \param b A pointer filled in with the source blue color value. @@ -929,14 +941,14 @@ * * \sa SDL_SetTextureColorMod() */ -extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g, Uint8 * b); /** * \brief Set an additional alpha value used in render copy operations. * - * \param textureID The texture to update. + * \param texture The texture to update. * \param alpha The source alpha value multiplied into copy operations. * * \return 0 on success, or -1 if the texture is not valid or alpha modulation @@ -944,26 +956,26 @@ * * \sa SDL_GetTextureAlphaMod() */ -extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha); /** * \brief Get the additional alpha value used in render copy operations. * - * \param textureID The texture to query. + * \param texture The texture to query. * \param alpha A pointer filled in with the source alpha value. * * \return 0 on success, or -1 if the texture is not valid. * * \sa SDL_SetTextureAlphaMod() */ -extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture, Uint8 * alpha); /** * \brief Set the blend mode used for texture copy operations. * - * \param textureID The texture to update. + * \param texture The texture to update. * \param blendMode ::SDL_BlendMode to use for texture blending. * * \return 0 on success, or -1 if the texture is not valid or the blend mode is @@ -974,26 +986,26 @@ * * \sa SDL_GetTextureBlendMode() */ -extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, int blendMode); /** * \brief Get the blend mode used for texture copy operations. * - * \param textureID The texture to query. + * \param texture The texture to query. * \param blendMode A pointer filled in with the current blend mode. * * \return 0 on success, or -1 if the texture is not valid. * * \sa SDL_SetTextureBlendMode() */ -extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, int *blendMode); /** * \brief Set the scale mode used for texture copy operations. * - * \param textureID The texture to update. + * \param texture The texture to update. * \param scaleMode ::SDL_TextureScaleMode to use for texture scaling. * * \return 0 on success, or -1 if the texture is not valid or the scale mode is @@ -1004,26 +1016,26 @@ * * \sa SDL_GetTextureScaleMode() */ -extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture, int scaleMode); /** * \brief Get the scale mode used for texture copy operations. * - * \param textureID The texture to query. + * \param texture The texture to query. * \param scaleMode A pointer filled in with the current scale mode. * * \return 0 on success, or -1 if the texture is not valid. * * \sa SDL_SetTextureScaleMode() */ -extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture, int *scaleMode); /** * \brief Update the given texture rectangle with new pixel data. * - * \param textureID The texture to update + * \param texture The texture to update * \param rect A pointer to the rectangle of pixels to update, or NULL to * update the entire texture. * \param pixels The raw pixel data. @@ -1033,14 +1045,14 @@ * * \note This is a fairly slow function. */ -extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); /** * \brief Lock a portion of the texture for pixel access. * - * \param textureID The texture to lock for access, which was created with + * \param texture The texture to lock for access, which was created with * ::SDL_TEXTUREACCESS_STREAMING. * \param rect A pointer to the rectangle to lock for access. If the rect * is NULL, the entire texture will be locked. @@ -1056,7 +1068,7 @@ * \sa SDL_DirtyTexture() * \sa SDL_UnlockTexture() */ -extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty, void **pixels, int *pitch); @@ -1067,12 +1079,12 @@ * \sa SDL_LockTexture() * \sa SDL_DirtyTexture() */ -extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID); +extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); /** * \brief Mark the specified rectangles of the texture as dirty. * - * \param textureID The texture to mark dirty, which was created with + * \param texture The texture to mark dirty, which was created with * ::SDL_TEXTUREACCESS_STREAMING. * \param numrects The number of rectangles pointed to by rects. * \param rects The pointer to an array of dirty rectangles. @@ -1080,7 +1092,7 @@ * \sa SDL_LockTexture() * \sa SDL_UnlockTexture() */ -extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID, +extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_Texture * texture, int numrects, const SDL_Rect * rects); @@ -1228,7 +1240,7 @@ /** * \brief Copy a portion of the texture to the current rendering target. * - * \param textureID The source texture. + * \param texture The source texture. * \param srcrect A pointer to the source rectangle, or NULL for the entire * texture. * \param dstrect A pointer to the destination rectangle, or NULL for the @@ -1237,7 +1249,7 @@ * \return 0 on success, or -1 if there is no rendering context current, or the * driver doesn't support the requested operation. */ -extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID, +extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect); @@ -1289,7 +1301,7 @@ * \sa SDL_CreateTexture() * \sa SDL_CreateTextureFromSurface() */ -extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID); +extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture); /** * \brief Destroy the rendering context for a window and free associated @@ -1297,7 +1309,7 @@ * * \sa SDL_CreateRenderer() */ -extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID); +extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Window * window); /** * \brief Returns whether the screensaver is currently enabled (default off). @@ -1384,15 +1396,15 @@ * * \sa SDL_GL_DeleteContext() */ -extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID - windowID); +extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window * + window); /** * \brief Set up an OpenGL context for rendering into an OpenGL window. * * \note The context must have been created with a compatible window. */ -extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID, +extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext context); /** @@ -1422,7 +1434,7 @@ * \brief Swap the OpenGL buffers for the window, if double-buffering is * supported. */ -extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_WindowID windowID); +extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window); /** * \brief Delete an OpenGL context.
--- a/src/SDL_assert.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/SDL_assert.c Thu Jan 21 06:21:52 2010 +0000 @@ -265,7 +265,7 @@ { const char *envr; SDL_assert_state state = SDL_ASSERTION_ABORT; - SDL_WindowID window; + SDL_Window *window; (void) userdata; /* unused in default handler. */
--- a/src/SDL_compat.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/SDL_compat.c Thu Jan 21 06:21:52 2010 +0000 @@ -30,9 +30,9 @@ #include "video/SDL_pixels_c.h" #include "video/SDL_yuv_sw_c.h" -static SDL_WindowID SDL_VideoWindow = 0; +static SDL_Window *SDL_VideoWindow = NULL; static SDL_RendererInfo SDL_VideoRendererInfo; -static SDL_TextureID SDL_VideoTexture = 0; +static SDL_Texture *SDL_VideoTexture = NULL; static SDL_Surface *SDL_VideoSurface = NULL; static SDL_Surface *SDL_ShadowSurface = NULL; static SDL_Surface *SDL_PublicSurface = NULL; @@ -294,7 +294,7 @@ button = SDL_BUTTON_WHEELDOWN; } - fake.button.which = event->wheel.windowID; + fake.button.which = event->wheel.which; fake.button.button = button; fake.button.x = x; fake.button.y = y; @@ -357,7 +357,7 @@ } static SDL_Surface * -CreateVideoSurface(SDL_TextureID textureID) +CreateVideoSurface(SDL_Texture * texture) { SDL_Surface *surface; Uint32 format; @@ -367,7 +367,7 @@ void *pixels; int pitch; - if (SDL_QueryTexture(textureID, &format, NULL, &w, &h) < 0) { + if (SDL_QueryTexture(texture, &format, NULL, &w, &h) < 0) { return NULL; } @@ -377,7 +377,7 @@ return NULL; } - if (SDL_QueryTexturePixels(textureID, &pixels, &pitch) == 0) { + if (SDL_QueryTexturePixels(texture, &pixels, &pitch) == 0) { surface = SDL_CreateRGBSurfaceFrom(pixels, w, h, bpp, pitch, Rmask, Gmask, Bmask, Amask); @@ -1504,7 +1504,7 @@ SDL_SW_YUVTexture *sw; - SDL_TextureID textureID; + SDL_Texture *texture; Uint32 texture_format; }; @@ -1585,9 +1585,9 @@ break; } - overlay->hwdata->textureID = + overlay->hwdata->texture = SDL_CreateTexture(texture_format, SDL_TEXTUREACCESS_STREAMING, w, h); - if (overlay->hwdata->textureID) { + if (overlay->hwdata->texture) { overlay->hwdata->sw = NULL; } else { SDL_DisplayMode current_mode; @@ -1601,11 +1601,11 @@ /* Create a supported RGB format texture for display */ SDL_GetCurrentDisplayMode(¤t_mode); texture_format = current_mode.format; - overlay->hwdata->textureID = + overlay->hwdata->texture = SDL_CreateTexture(texture_format, SDL_TEXTUREACCESS_STREAMING, w, h); } - if (!overlay->hwdata->textureID) { + if (!overlay->hwdata->texture) { SDL_FreeYUVOverlay(overlay); return NULL; } @@ -1631,7 +1631,7 @@ } } else { if (SDL_LockTexture - (overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) + (overlay->hwdata->texture, NULL, 1, &pixels, &pitch) < 0) { return -1; } @@ -1666,7 +1666,7 @@ void *pixels; int pitch; if (SDL_LockTexture - (overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) == 0) { + (overlay->hwdata->texture, NULL, 1, &pixels, &pitch) == 0) { SDL_Rect srcrect; srcrect.x = 0; @@ -1676,10 +1676,10 @@ SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect, overlay->hwdata->texture_format, overlay->w, overlay->h, pixels, pitch); - SDL_UnlockTexture(overlay->hwdata->textureID); + SDL_UnlockTexture(overlay->hwdata->texture); } } else { - SDL_UnlockTexture(overlay->hwdata->textureID); + SDL_UnlockTexture(overlay->hwdata->texture); } } @@ -1690,7 +1690,7 @@ SDL_SetError("Passed a NULL overlay or dstrect"); return -1; } - if (SDL_RenderCopy(overlay->hwdata->textureID, NULL, dstrect) < 0) { + if (SDL_RenderCopy(overlay->hwdata->texture, NULL, dstrect) < 0) { return -1; } SDL_RenderPresent(); @@ -1704,8 +1704,8 @@ return; } if (overlay->hwdata) { - if (overlay->hwdata->textureID) { - SDL_DestroyTexture(overlay->hwdata->textureID); + if (overlay->hwdata->texture) { + SDL_DestroyTexture(overlay->hwdata->texture); } SDL_free(overlay->hwdata); }
--- a/src/events/SDL_keyboard.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/events/SDL_keyboard.c Thu Jan 21 06:21:52 2010 +0000 @@ -646,7 +646,7 @@ } void -SDL_SetKeyboardFocus(int index, SDL_WindowID windowID) +SDL_SetKeyboardFocus(int index, SDL_Window * window) { SDL_Keyboard *keyboard = SDL_GetKeyboard(index); int i; @@ -657,7 +657,7 @@ } /* See if the current window has lost focus */ - if (keyboard->focus && keyboard->focus != windowID) { + if (keyboard->focus && keyboard->focus != window) { focus = SDL_FALSE; for (i = 0; i < SDL_num_keyboards; ++i) { if (i != index) { @@ -674,7 +674,7 @@ } } - keyboard->focus = windowID; + keyboard->focus = window; if (keyboard->focus) { SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED, @@ -809,7 +809,7 @@ event.key.keysym.sym = keyboard->keymap[scancode]; event.key.keysym.mod = modstate; event.key.keysym.unicode = 0; - event.key.windowID = keyboard->focus; + event.key.windowID = keyboard->focus->id; posted = (SDL_PushEvent(&event) > 0); } return (posted); @@ -832,7 +832,7 @@ event.text.type = SDL_TEXTINPUT; event.text.which = (Uint8) index; SDL_strlcpy(event.text.text, text, SDL_arraysize(event.text.text)); - event.text.windowID = keyboard->focus; + event.text.windowID = keyboard->focus->id; posted = (SDL_PushEvent(&event) > 0); } return (posted);
--- a/src/events/SDL_keyboard_c.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/events/SDL_keyboard_c.h Thu Jan 21 06:21:52 2010 +0000 @@ -35,7 +35,7 @@ void (*FreeKeyboard) (SDL_Keyboard * keyboard); /* Data common to all keyboards */ - SDL_WindowID focus; + SDL_Window *focus; Uint16 modstate; Uint8 keystate[SDL_NUM_SCANCODES]; SDLKey keymap[SDL_NUM_SCANCODES]; @@ -73,7 +73,7 @@ extern void SDL_SetScancodeName(SDL_scancode scancode, const char *name); /* Set the keyboard focus window */ -extern void SDL_SetKeyboardFocus(int index, SDL_WindowID windowID); +extern void SDL_SetKeyboardFocus(int index, SDL_Window * window); /* Send a keyboard event for a keyboard at an index */ extern int SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode);
--- a/src/events/SDL_mouse.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/events/SDL_mouse.c Thu Jan 21 06:21:52 2010 +0000 @@ -26,6 +26,7 @@ #include "SDL_events.h" #include "SDL_events_c.h" #include "default_cursor.h" +#include "../video/SDL_sysvideo.h" static int SDL_num_mice = 0; @@ -190,7 +191,7 @@ return SDL_current_mouse; } -SDL_WindowID +SDL_Window * SDL_GetMouseFocusWindow(int index) { SDL_Mouse *mouse = SDL_GetMouse(index); @@ -302,14 +303,14 @@ } void -SDL_SetMouseFocus(int id, SDL_WindowID windowID) +SDL_SetMouseFocus(int id, SDL_Window * window) { int index = SDL_GetMouseIndexId(id); SDL_Mouse *mouse = SDL_GetMouse(index); int i; SDL_bool focus; - if (!mouse || (mouse->focus == windowID)) { + if (!mouse || (mouse->focus == window)) { return; } @@ -331,7 +332,7 @@ } } - mouse->focus = windowID; + mouse->focus = window; if (mouse->focus) { focus = SDL_FALSE; @@ -372,7 +373,7 @@ event.proximity.cursor = mouse->current_end; event.proximity.type = type; /* FIXME: is this right? */ - event.proximity.windowID = mouse->focus; + event.proximity.windowID = mouse->focus->id; posted = (SDL_PushEvent(&event) > 0); if (type == SDL_PROXIMITYIN) { mouse->proximity = SDL_TRUE; @@ -478,7 +479,7 @@ event.motion.cursor = mouse->current_end; event.motion.xrel = xrel; event.motion.yrel = yrel; - event.motion.windowID = mouse->focus; + event.motion.windowID = mouse->focus->id; posted = (SDL_PushEvent(&event) > 0); } mouse->last_x = mouse->x; @@ -531,7 +532,7 @@ event.button.button = button; event.button.x = mouse->x; event.button.y = mouse->y; - event.button.windowID = mouse->focus; + event.button.windowID = mouse->focus->id; posted = (SDL_PushEvent(&event) > 0); } return posted; @@ -555,14 +556,14 @@ event.wheel.which = (Uint8) index; event.wheel.x = x; event.wheel.y = y; - event.wheel.windowID = mouse->focus; + event.wheel.windowID = mouse->focus->id; posted = (SDL_PushEvent(&event) > 0); } return posted; } void -SDL_WarpMouseInWindow(SDL_WindowID windowID, int x, int y) +SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) { SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); @@ -571,9 +572,9 @@ } if (mouse->WarpMouse) { - mouse->WarpMouse(mouse, windowID, x, y); + mouse->WarpMouse(mouse, window, x, y); } else { - SDL_SetMouseFocus(SDL_current_mouse, windowID); + SDL_SetMouseFocus(SDL_current_mouse, window); SDL_SendMouseMotion(SDL_current_mouse, 0, x, y, 0); } }
--- a/src/events/SDL_mouse_c.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/events/SDL_mouse_c.h Thu Jan 21 06:21:52 2010 +0000 @@ -48,7 +48,7 @@ void (*FreeCursor) (SDL_Cursor * cursor); /* Warp the mouse to (x,y) */ - void (*WarpMouse) (SDL_Mouse * mouse, SDL_WindowID windowID, int x, + void (*WarpMouse) (SDL_Mouse * mouse, SDL_Window * window, int x, int y); /* Free the mouse when it's time */ @@ -65,7 +65,7 @@ /* Data common to all mice */ int id; - SDL_WindowID focus; + SDL_Window *focus; int which; int x; int y; @@ -106,7 +106,7 @@ extern void SDL_ResetMouse(int index); /* Set the mouse focus window */ -extern void SDL_SetMouseFocus(int id, SDL_WindowID windowID); +extern void SDL_SetMouseFocus(int id, SDL_Window * window); /* Send a mouse motion event for a mouse */ extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z);
--- a/src/events/SDL_windowevents.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/events/SDL_windowevents.c Thu Jan 21 06:21:52 2010 +0000 @@ -44,13 +44,11 @@ } int -SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent, int data1, +SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, int data2) { int posted; - SDL_Window *window; - window = SDL_GetWindowFromID(windowID); if (!window) { return 0; } @@ -152,7 +150,7 @@ event.window.event = windowevent; event.window.data1 = data1; event.window.data2 = data2; - event.window.windowID = windowID; + event.window.windowID = window->id; /* Fixes queue overflow with resize events that aren't processed */ if (windowevent == SDL_WINDOWEVENT_RESIZED) {
--- a/src/events/SDL_windowevents_c.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/events/SDL_windowevents_c.h Thu Jan 21 06:21:52 2010 +0000 @@ -24,7 +24,7 @@ #ifndef _SDL_windowevents_c_h #define _SDL_windowevents_c_h -extern int SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent, +extern int SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, int data2); #endif /* _SDL_windowevents_c_h */
--- a/src/video/SDL_gamma.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/SDL_gamma.c Thu Jan 21 06:21:52 2010 +0000 @@ -171,7 +171,7 @@ SDL_UninitializedVideo(); return -1; } - return SDL_SetGammaRampForDisplay(&SDL_CurrentDisplay, red, green, blue); + return SDL_SetGammaRampForDisplay(SDL_CurrentDisplay, red, green, blue); } int @@ -230,7 +230,7 @@ SDL_UninitializedVideo(); return -1; } - return SDL_GetGammaRampForDisplay(&SDL_CurrentDisplay, red, green, blue); + return SDL_GetGammaRampForDisplay(SDL_CurrentDisplay, red, green, blue); } /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_renderer_gl.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/SDL_renderer_gl.c Thu Jan 21 06:21:52 2010 +0000 @@ -321,7 +321,7 @@ renderer->DestroyTexture = GL_DestroyTexture; renderer->DestroyRenderer = GL_DestroyRenderer; renderer->info = GL_RenderDriver.info; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = data; renderer->info.flags = @@ -332,12 +332,12 @@ return NULL; } - data->context = SDL_GL_CreateContext(window->id); + data->context = SDL_GL_CreateContext(window); if (!data->context) { GL_DestroyRenderer(renderer); return NULL; } - if (SDL_GL_MakeCurrent(window->id, data->context) < 0) { + if (SDL_GL_MakeCurrent(window, data->context) < 0) { GL_DestroyRenderer(renderer); return NULL; } @@ -442,9 +442,9 @@ GL_ActivateRenderer(SDL_Renderer * renderer) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; - if (SDL_GL_MakeCurrent(window->id, data->context) < 0) { + if (SDL_GL_MakeCurrent(window, data->context) < 0) { return -1; } if (data->updateSize) { @@ -752,7 +752,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; GL_TextureData *data; GLint internalFormat; GLenum format, type; @@ -1407,7 +1407,7 @@ Uint32 pixel_format, void * pixels, int pitch) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; GLint internalFormat; GLenum format, type; Uint8 *src, *dst, *tmp; @@ -1454,7 +1454,7 @@ Uint32 pixel_format, const void * pixels, int pitch) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; GLint internalFormat; GLenum format, type; Uint8 *src, *dst, *tmp;
--- a/src/video/SDL_renderer_gles.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/SDL_renderer_gles.c Thu Jan 21 06:21:52 2010 +0000 @@ -332,7 +332,7 @@ { GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; if (SDL_GL_MakeCurrent(window->id, data->context) < 0) { return -1; @@ -872,7 +872,7 @@ if (data->GL_OES_draw_texture_supported && data->useDrawTexture) { /* this code is a little funny because the viewport is upside down vs SDL's coordinate system */ - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; GLint cropRect[4]; cropRect[0] = srcrect->x; cropRect[1] = srcrect->y + srcrect->h;
--- a/src/video/SDL_renderer_sw.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/SDL_renderer_sw.c Thu Jan 21 06:21:52 2010 +0000 @@ -201,7 +201,7 @@ SDL_Renderer * SW_CreateRenderer(SDL_Window * window, Uint32 flags) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayMode *displayMode = &display->current_mode; SDL_Renderer *renderer; SW_RenderData *data; @@ -243,7 +243,7 @@ renderer->DestroyRenderer = SW_DestroyRenderer; renderer->info.name = SW_RenderDriver.info.name; renderer->info.flags = 0; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = data; Setup_SoftwareRenderer(renderer); @@ -321,7 +321,7 @@ SW_ActivateRenderer(SDL_Renderer * renderer) { SW_RenderData *data = (SW_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; int i, n; if (data->renderer && data->renderer->ActivateRenderer) { @@ -794,7 +794,7 @@ const SDL_Rect * srcrect, const SDL_Rect * dstrect) { SW_RenderData *data = (SW_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; int status; if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) { @@ -928,8 +928,8 @@ SW_DestroyRenderer(SDL_Renderer * renderer) { SW_RenderData *data = (SW_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; int i; if (data) {
--- a/src/video/SDL_sysvideo.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/SDL_sysvideo.h Thu Jan 21 06:21:52 2010 +0000 @@ -29,8 +29,6 @@ /* The SDL video driver */ -typedef struct SDL_Window SDL_Window; -typedef struct SDL_Texture SDL_Texture; typedef struct SDL_Renderer SDL_Renderer; typedef struct SDL_RenderDriver SDL_RenderDriver; typedef struct SDL_VideoDisplay SDL_VideoDisplay; @@ -39,21 +37,20 @@ /* Define the SDL texture structure */ struct SDL_Texture { - Uint32 id; - Uint32 format; /**< The pixel format of the texture */ int access; /**< SDL_TextureAccess */ int w; /**< The width of the texture */ int h; /**< The height of the texture */ int modMode; /**< The texture modulation mode */ - int blendMode; /**< The texture blend mode */ - int scaleMode; /**< The texture scale mode */ - Uint8 r, g, b, a; /**< Texture modulation values */ + int blendMode; /**< The texture blend mode */ + int scaleMode; /**< The texture scale mode */ + Uint8 r, g, b, a; /**< Texture modulation values */ SDL_Renderer *renderer; - void *driverdata; /**< Driver specific texture representation */ + void *driverdata; /**< Driver specific texture representation */ + SDL_Texture *prev; SDL_Texture *next; }; @@ -118,7 +115,10 @@ SDL_RendererInfo info; /* The window associated with the renderer */ - SDL_WindowID window; + SDL_Window *window; + + /* The list of textures */ + SDL_Texture *textures; Uint8 r, g, b, a; /**< Color for drawing operations values */ int blendMode; /**< The drawing blend mode */ @@ -139,19 +139,21 @@ struct SDL_Window { Uint32 id; - char *title; int x, y; int w, h; Uint32 flags; - int display; + SDL_VideoDisplay *display; SDL_Renderer *renderer; SDL_DisplayMode fullscreen_mode; void *userdata; void *driverdata; + + SDL_Window *prev; + SDL_Window *next; }; #define FULLSCREEN_VISIBLE(W) \ (((W)->flags & SDL_WINDOW_FULLSCREEN) && \ @@ -184,9 +186,6 @@ SDL_Renderer *current_renderer; - /* The hash list of textures */ - SDL_Texture *textures[64]; - SDL_VideoDevice *device; void *driverdata; @@ -413,8 +412,8 @@ extern VideoBootStrap PND_bootstrap; #endif -#define SDL_CurrentDisplay (_this->displays[_this->current_display]) -#define SDL_CurrentRenderer (SDL_CurrentDisplay.current_renderer) +#define SDL_CurrentDisplay (&_this->displays[_this->current_display]) +#define SDL_CurrentRenderer (SDL_CurrentDisplay->current_renderer) extern SDL_VideoDevice *SDL_GetVideoDevice(); extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); @@ -433,8 +432,6 @@ extern void SDL_AddRenderDriver(SDL_VideoDisplay *display, const SDL_RenderDriver * driver); extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags); -extern SDL_Window *SDL_GetWindowFromID(SDL_WindowID windowID); -extern SDL_VideoDisplay *SDL_GetDisplayFromWindow(SDL_Window * window); extern void SDL_OnWindowShown(SDL_Window * window); extern void SDL_OnWindowHidden(SDL_Window * window); @@ -443,7 +440,7 @@ extern void SDL_OnWindowRestored(SDL_Window * window); extern void SDL_OnWindowFocusGained(SDL_Window * window); extern void SDL_OnWindowFocusLost(SDL_Window * window); -extern SDL_WindowID SDL_GetFocusWindow(void); +extern SDL_Window * SDL_GetFocusWindow(void); #endif /* _SDL_sysvideo_h */
--- a/src/video/SDL_video.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/SDL_video.c Thu Jan 21 06:21:52 2010 +0000 @@ -443,7 +443,7 @@ SDL_GetNumDisplayModes() { if (_this) { - return SDL_GetNumDisplayModesForDisplay(&SDL_CurrentDisplay); + return SDL_GetNumDisplayModesForDisplay(SDL_CurrentDisplay); } return 0; } @@ -465,7 +465,7 @@ int SDL_GetDisplayMode(int index, SDL_DisplayMode * mode) { - return SDL_GetDisplayModeForDisplay(&SDL_CurrentDisplay, index, mode); + return SDL_GetDisplayModeForDisplay(SDL_CurrentDisplay, index, mode); } int @@ -484,7 +484,7 @@ SDL_UninitializedVideo(); return -1; } - return SDL_GetDesktopDisplayModeForDisplay(&SDL_CurrentDisplay, mode); + return SDL_GetDesktopDisplayModeForDisplay(SDL_CurrentDisplay, mode); } int @@ -503,7 +503,7 @@ SDL_UninitializedVideo(); return -1; } - return SDL_GetCurrentDisplayModeForDisplay(&SDL_CurrentDisplay, mode); + return SDL_GetCurrentDisplayModeForDisplay(SDL_CurrentDisplay, mode); } SDL_DisplayMode * @@ -621,7 +621,7 @@ SDL_UninitializedVideo(); return NULL; } - return SDL_GetClosestDisplayModeForDisplay(&SDL_CurrentDisplay, mode, closest); + return SDL_GetClosestDisplayModeForDisplay(SDL_CurrentDisplay, mode, closest); } int @@ -702,14 +702,12 @@ SDL_UninitializedVideo(); return -1; } - return SDL_SetDisplayModeForDisplay(&SDL_CurrentDisplay, mode); + return SDL_SetDisplayModeForDisplay(SDL_CurrentDisplay, mode); } int -SDL_SetWindowDisplayMode(SDL_WindowID windowID, const SDL_DisplayMode * mode) +SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return -1; } @@ -723,9 +721,8 @@ } int -SDL_GetWindowDisplayMode(SDL_WindowID windowID, SDL_DisplayMode * mode) +SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode) { - SDL_Window *window = SDL_GetWindowFromID(windowID); SDL_DisplayMode fullscreen_mode; if (!window) { @@ -740,7 +737,7 @@ fullscreen_mode.h = window->h; } - if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayFromWindow(window), + if (!SDL_GetClosestDisplayModeForDisplay(window->display, &fullscreen_mode, &fullscreen_mode)) { SDL_SetError("Couldn't find display mode match"); @@ -756,7 +753,7 @@ static void SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool attempt) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; int i; /* See if we're already processing a window */ @@ -772,13 +769,13 @@ if (attempt) { /* We just gained some state, try to gain all states */ if (window->flags & SDL_WINDOW_MINIMIZED) { - SDL_RestoreWindow(window->id); + SDL_RestoreWindow(window); } else { - SDL_RaiseWindow(window->id); + SDL_RaiseWindow(window); } } else { /* We just lost some state, try to release all states */ - SDL_MinimizeWindow(window->id); + SDL_MinimizeWindow(window); } } @@ -787,7 +784,7 @@ for (i = 0; i < display->num_windows; ++i) { SDL_Window *other = &display->windows[i]; if (other != window && FULLSCREEN_VISIBLE(other)) { - SDL_MinimizeWindow(other->id); + SDL_MinimizeWindow(other); } } } @@ -799,7 +796,7 @@ window = &display->windows[i]; if (FULLSCREEN_VISIBLE(window)) { SDL_DisplayMode fullscreen_mode; - if (SDL_GetWindowDisplayMode(window->id, &fullscreen_mode) == 0) { + if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) { SDL_SetDisplayModeForDisplay(display, &fullscreen_mode); display->fullscreen_window = window; return; @@ -840,7 +837,7 @@ SDL_UninitializedVideo(); return -1; } - return SDL_SetPaletteForDisplay(&SDL_CurrentDisplay, colors, firstcolor, ncolors); + return SDL_SetPaletteForDisplay(SDL_CurrentDisplay, colors, firstcolor, ncolors); } int @@ -869,10 +866,10 @@ SDL_UninitializedVideo(); return -1; } - return SDL_GetPaletteForDisplay(&SDL_CurrentDisplay, colors, firstcolor, ncolors); + return SDL_GetPaletteForDisplay(SDL_CurrentDisplay, colors, firstcolor, ncolors); } -SDL_WindowID +SDL_Window * SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) { const Uint32 allowed_flags = (SDL_WINDOW_FULLSCREEN | @@ -881,112 +878,79 @@ SDL_WINDOW_RESIZABLE | SDL_WINDOW_INPUT_GRABBED); SDL_VideoDisplay *display; - SDL_Window window; - int num_windows; - SDL_Window *windows; + SDL_Window *window; if (!_this) { /* Initialize the video system if needed */ if (SDL_VideoInit(NULL, 0) < 0) { - return 0; + return NULL; } } if (flags & SDL_WINDOW_OPENGL) { if (!_this->GL_CreateContext) { SDL_SetError("No OpenGL support in video driver"); - return 0; + return NULL; } SDL_GL_LoadLibrary(NULL); } - SDL_zero(window); - window.id = _this->next_object_id++; - window.x = x; - window.y = y; - window.w = w; - window.h = h; - window.flags = (flags & allowed_flags); - window.display = _this->current_display; - - if (_this->CreateWindow && _this->CreateWindow(_this, &window) < 0) { - if (flags & SDL_WINDOW_OPENGL) { - SDL_GL_UnloadLibrary(); - } - return 0; - } - display = &SDL_CurrentDisplay; - num_windows = display->num_windows; - windows = - SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows)); - if (!windows) { - if (_this->DestroyWindow) { - _this->DestroyWindow(_this, &window); - } - if (flags & SDL_WINDOW_OPENGL) { - SDL_GL_UnloadLibrary(); - } - return 0; - } - windows[num_windows] = window; - display->windows = windows; - display->num_windows++; + display = SDL_CurrentDisplay; + window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); + window->id = _this->next_object_id++; + window->x = x; + window->y = y; + window->w = w; + window->h = h; + window->flags = (flags & allowed_flags); + window->display = display; + window->next = display->windows; + display->windows = window; + + if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) { + SDL_DestroyWindow(window); + return NULL; + } if (title) { - SDL_SetWindowTitle(window.id, title); + SDL_SetWindowTitle(window, title); } if (flags & SDL_WINDOW_MAXIMIZED) { - SDL_MaximizeWindow(window.id); + SDL_MaximizeWindow(window); } if (flags & SDL_WINDOW_MINIMIZED) { - SDL_MinimizeWindow(window.id); + SDL_MinimizeWindow(window); } if (flags & SDL_WINDOW_SHOWN) { - SDL_ShowWindow(window.id); - } - SDL_UpdateWindowGrab(&window); - - return window.id; + SDL_ShowWindow(window); + } + SDL_UpdateWindowGrab(window); + + return window; } -SDL_WindowID +SDL_Window * SDL_CreateWindowFrom(const void *data) { SDL_VideoDisplay *display; - SDL_Window window; - int num_windows; - SDL_Window *windows; + SDL_Window *window; if (!_this) { SDL_UninitializedVideo(); - return (0); - } - SDL_zero(window); - window.id = _this->next_object_id++; - window.display = _this->current_display; - window.flags = SDL_WINDOW_FOREIGN; + return NULL; + } + display = SDL_CurrentDisplay; + window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); + window->id = _this->next_object_id++; + window->flags = SDL_WINDOW_FOREIGN; + window->display = display; + window->next = display->windows; + display->windows = window; if (!_this->CreateWindowFrom || - _this->CreateWindowFrom(_this, &window, data) < 0) { - return 0; - } - /* FIXME: Find out what display this window is actually on... */ - display = &SDL_CurrentDisplay; - num_windows = display->num_windows; - windows = - SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows)); - if (!windows) { - if (_this->DestroyWindow) { - _this->DestroyWindow(_this, &window); - } - if (window.title) { - SDL_free(window.title); - } - return 0; - } - windows[num_windows] = window; - display->windows = windows; - display->num_windows++; - - return window.id; + _this->CreateWindowFrom(_this, window, data) < 0) { + SDL_DestroyWindow(window); + return NULL; + } + return window; } int @@ -1036,70 +1000,23 @@ } if (title) { - SDL_SetWindowTitle(window->id, title); + SDL_SetWindowTitle(window, title); SDL_free(title); } if (flags & SDL_WINDOW_MAXIMIZED) { - SDL_MaximizeWindow(window->id); + SDL_MaximizeWindow(window); } if (flags & SDL_WINDOW_MINIMIZED) { - SDL_MinimizeWindow(window->id); + SDL_MinimizeWindow(window); } if (flags & SDL_WINDOW_SHOWN) { - SDL_ShowWindow(window->id); + SDL_ShowWindow(window); } SDL_UpdateWindowGrab(window); return 0; } -SDL_Window * -SDL_GetWindowFromID(SDL_WindowID windowID) -{ - int i, j; - - if (!_this) { - SDL_UninitializedVideo(); - return NULL; - } - if (windowID) { - for (i = 0; i < _this->num_displays; ++i) { - SDL_VideoDisplay *display = &_this->displays[i]; - for (j = 0; j < display->num_windows; ++j) { - SDL_Window *window = &display->windows[j]; - if (window->id == windowID) { - return window; - } - } - } - } else { - /* Just return the first active window */ - for (i = 0; i < _this->num_displays; ++i) { - SDL_VideoDisplay *display = &_this->displays[i]; - for (j = 0; j < display->num_windows; ++j) { - SDL_Window *window = &display->windows[j]; - return window; - } - } - } - /* Couldn't find the window with the requested ID */ - SDL_SetError("Invalid window ID"); - return NULL; -} - -SDL_VideoDisplay * -SDL_GetDisplayFromWindow(SDL_Window * window) -{ - if (!_this) { - SDL_UninitializedVideo(); - return NULL; - } - if (!window) { - return NULL; - } - return &_this->displays[window->display]; -} - static __inline__ SDL_Renderer * SDL_GetCurrentRenderer(SDL_bool create) { @@ -1120,10 +1037,38 @@ } Uint32 -SDL_GetWindowFlags(SDL_WindowID windowID) +SDL_GetWindowID(SDL_Window * window) +{ + if (!window) { + return 0; + } + return window->id; +} + +SDL_Window * +SDL_GetWindowFromID(Uint32 id) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - + SDL_Window *window; + int i; + + if (!_this) { + return NULL; + } + /* FIXME: Should we keep a separate hash table for these? */ + for (i = _this->num_displays; i--;) { + SDL_VideoDisplay *display = &_this->displays[i]; + for (window = display->windows; window; window = window->next) { + if (window->id == id) { + return window; + } + } + } + return NULL; +} + +Uint32 +SDL_GetWindowFlags(SDL_Window * window) +{ if (!window) { return 0; } @@ -1131,10 +1076,8 @@ } void -SDL_SetWindowTitle(SDL_WindowID windowID, const char *title) +SDL_SetWindowTitle(SDL_Window * window, const char *title) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window || title == window->title) { return; } @@ -1153,10 +1096,8 @@ } const char * -SDL_GetWindowTitle(SDL_WindowID windowID) +SDL_GetWindowTitle(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return NULL; } @@ -1164,10 +1105,8 @@ } void -SDL_SetWindowIcon(SDL_WindowID windowID, SDL_Surface * icon) +SDL_SetWindowIcon(SDL_Window * window, SDL_Surface * icon) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return; } @@ -1177,10 +1116,8 @@ } void -SDL_SetWindowData(SDL_WindowID windowID, void *userdata) +SDL_SetWindowData(SDL_Window * window, void *userdata) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return; } @@ -1188,10 +1125,8 @@ } void * -SDL_GetWindowData(SDL_WindowID windowID) +SDL_GetWindowData(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return NULL; } @@ -1199,11 +1134,8 @@ } void -SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y) +SDL_SetWindowPosition(SDL_Window * window, int x, int y) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); - if (!window) { return; } @@ -1216,14 +1148,12 @@ if (_this->SetWindowPosition) { _this->SetWindowPosition(_this, window); } - SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MOVED, x, y); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y); } void -SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y) +SDL_GetWindowPosition(SDL_Window * window, int *x, int *y) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return; } @@ -1236,10 +1166,8 @@ } void -SDL_SetWindowSize(SDL_WindowID windowID, int w, int h) +SDL_SetWindowSize(SDL_Window * window, int w, int h) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return; } @@ -1253,10 +1181,8 @@ } void -SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *h) +SDL_GetWindowSize(SDL_Window * window, int *w, int *h) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (window) { if (w) { *w = window->w; @@ -1275,10 +1201,8 @@ } void -SDL_ShowWindow(SDL_WindowID windowID) +SDL_ShowWindow(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window || (window->flags & SDL_WINDOW_SHOWN)) { return; } @@ -1286,14 +1210,12 @@ if (_this->ShowWindow) { _this->ShowWindow(_this, window); } - SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_SHOWN, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0); } void -SDL_HideWindow(SDL_WindowID windowID) +SDL_HideWindow(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window || !(window->flags & SDL_WINDOW_SHOWN)) { return; } @@ -1301,14 +1223,12 @@ if (_this->HideWindow) { _this->HideWindow(_this, window); } - SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_HIDDEN, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } void -SDL_RaiseWindow(SDL_WindowID windowID) +SDL_RaiseWindow(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window || !(window->flags & SDL_WINDOW_SHOWN)) { return; } @@ -1316,15 +1236,13 @@ _this->RaiseWindow(_this, window); } else { /* FIXME: What we really want is a way to request focus */ - SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); } } void -SDL_MaximizeWindow(SDL_WindowID windowID) +SDL_MaximizeWindow(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window || (window->flags & SDL_WINDOW_MAXIMIZED)) { return; } @@ -1332,14 +1250,12 @@ if (_this->MaximizeWindow) { _this->MaximizeWindow(_this, window); } - SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); } void -SDL_MinimizeWindow(SDL_WindowID windowID) +SDL_MinimizeWindow(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window || (window->flags & SDL_WINDOW_MINIMIZED)) { return; } @@ -1347,14 +1263,12 @@ if (_this->MinimizeWindow) { _this->MinimizeWindow(_this, window); } - SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MINIMIZED, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } void -SDL_RestoreWindow(SDL_WindowID windowID) +SDL_RestoreWindow(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window || !(window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) { return; @@ -1363,14 +1277,12 @@ if (_this->RestoreWindow) { _this->RestoreWindow(_this, window); } - SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_RESTORED, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); } int -SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen) +SDL_SetWindowFullscreen(SDL_Window * window, int fullscreen) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return -1; } @@ -1393,10 +1305,8 @@ } void -SDL_SetWindowGrab(SDL_WindowID windowID, int mode) +SDL_SetWindowGrab(SDL_Window * window, int mode) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window || (!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) { return; } @@ -1417,10 +1327,8 @@ } int -SDL_GetWindowGrab(SDL_WindowID windowID) +SDL_GetWindowGrab(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return 0; } @@ -1430,7 +1338,7 @@ void SDL_OnWindowShown(SDL_Window * window) { - SDL_RaiseWindow(window->id); + SDL_RaiseWindow(window); SDL_UpdateFullscreenMode(window, SDL_TRUE); } @@ -1459,14 +1367,14 @@ void SDL_OnWindowRestored(SDL_Window * window) { - SDL_RaiseWindow(window->id); + SDL_RaiseWindow(window); SDL_UpdateFullscreenMode(window, SDL_TRUE); } void SDL_OnWindowFocusGained(SDL_Window * window) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; if (display->gamma && _this->SetDisplayGammaRamp) { _this->SetDisplayGammaRamp(_this, display, display->gamma); @@ -1480,12 +1388,12 @@ void SDL_OnWindowFocusLost(SDL_Window * window) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; /* If we're fullscreen on a single-head system and lose focus, minimize */ if ((window->flags & SDL_WINDOW_FULLSCREEN) && _this->num_displays == 1) { - SDL_MinimizeWindow(window->id); + SDL_MinimizeWindow(window); } if (display->gamma && _this->SetDisplayGammaRamp) { @@ -1497,69 +1405,63 @@ } } -SDL_WindowID +SDL_Window * SDL_GetFocusWindow(void) { SDL_VideoDisplay *display; - int i; + SDL_Window *window; if (!_this) { - return 0; - } - display = &SDL_CurrentDisplay; - for (i = 0; i < display->num_windows; ++i) { - SDL_Window *window = &display->windows[i]; - + return NULL; + } + display = SDL_CurrentDisplay; + for (window = display->windows; window; window = window->next) { if (window->flags & SDL_WINDOW_INPUT_FOCUS) { - return window->id; + return window; } } - return 0; + return NULL; } void -SDL_DestroyWindow(SDL_WindowID windowID) +SDL_DestroyWindow(SDL_Window * window) { - int i, j; - - if (!_this) { + SDL_VideoDisplay *display; + + if (!_this || !window || !window->id) { + SDL_SetError("Invalid window"); return; } - for (i = 0; i < _this->num_displays; ++i) { - SDL_VideoDisplay *display = &_this->displays[i]; - for (j = 0; j < display->num_windows; ++j) { - SDL_Window *window = &display->windows[j]; - if (window->id != windowID) { - continue; - } - if (window->title) { - SDL_free(window->title); - window->title = NULL; - } - if (window->renderer) { - SDL_DestroyRenderer(window->id); - window->renderer = NULL; - } - - /* Restore video mode, etc. */ - SDL_UpdateFullscreenMode(window, SDL_FALSE); - - if (_this->DestroyWindow) { - _this->DestroyWindow(_this, window); - } - if (window->flags & SDL_WINDOW_OPENGL) { - SDL_GL_UnloadLibrary(); - } - if (j != display->num_windows - 1) { - SDL_memcpy(&display->windows[i], - &display->windows[i + 1], - (display->num_windows - i - 1) * sizeof(*window)); - } - --display->num_windows; - return; - } - } + if (window->title) { + SDL_free(window->title); + } + if (window->renderer) { + SDL_DestroyRenderer(window); + } + + /* Restore video mode, etc. */ + SDL_UpdateFullscreenMode(window, SDL_FALSE); + + if (_this->DestroyWindow) { + _this->DestroyWindow(_this, window); + } + if (window->flags & SDL_WINDOW_OPENGL) { + SDL_GL_UnloadLibrary(); + } + + /* Unlink the window from the list */ + display = window->display; + if (window->prev) { + window->prev->next = window->next; + } else { + display->windows = window->next; + } + + /* Clear the ID so we know it was destroyed */ + window->id = 0; + + SDL_free(window); } void @@ -1582,7 +1484,7 @@ SDL_GetNumRenderDrivers(void) { if (_this) { - return SDL_CurrentDisplay.num_render_drivers; + return SDL_CurrentDisplay->num_render_drivers; } return 0; } @@ -1599,22 +1501,20 @@ SDL_GetNumRenderDrivers() - 1); return -1; } - *info = SDL_CurrentDisplay.render_drivers[index].info; + *info = SDL_CurrentDisplay->render_drivers[index].info; return 0; } int -SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags) +SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { - SDL_SetError("Invalid window ID"); + SDL_SetError("Invalid window"); return -1; } /* Free any existing renderer */ - SDL_DestroyRenderer(windowID); + SDL_DestroyRenderer(window); if (index < 0) { char *override = SDL_getenv("SDL_VIDEO_RENDERER"); @@ -1633,7 +1533,7 @@ if (override) { for (index = 0; index < n; ++index) { SDL_RenderDriver *driver = - &SDL_CurrentDisplay.render_drivers[index]; + &SDL_CurrentDisplay->render_drivers[index]; if (SDL_strcasecmp(override, driver->info.name) == 0) { /* Create a new renderer instance */ @@ -1644,7 +1544,7 @@ } else { for (index = 0; index < n; ++index) { SDL_RenderDriver *driver = - &SDL_CurrentDisplay.render_drivers[index]; + &SDL_CurrentDisplay->render_drivers[index]; if ((driver->info.flags & flags) == flags) { /* Create a new renderer instance */ @@ -1667,7 +1567,7 @@ return -1; } /* Create a new renderer instance */ - window->renderer = SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window, flags); + window->renderer = SDL_CurrentDisplay->render_drivers[index].CreateRenderer(window, flags); } if (window->renderer == NULL) { @@ -1675,19 +1575,18 @@ return -1; } - SDL_SelectRenderer(window->id); + SDL_SelectRenderer(window); return 0; } int -SDL_SelectRenderer(SDL_WindowID windowID) +SDL_SelectRenderer(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); SDL_Renderer *renderer; if (!window) { - SDL_SetError("Invalid window ID"); + SDL_SetError("Invalid window"); return -1; } renderer = window->renderer; @@ -1700,7 +1599,7 @@ return -1; } } - SDL_CurrentDisplay.current_renderer = renderer; + SDL_CurrentDisplay->current_renderer = renderer; return 0; } @@ -1715,10 +1614,9 @@ return 0; } -SDL_TextureID +SDL_Texture * SDL_CreateTexture(Uint32 format, int access, int w, int h) { - int hash; SDL_Renderer *renderer; SDL_Texture *texture; @@ -1735,7 +1633,6 @@ SDL_OutOfMemory(); return 0; } - texture->id = _this->next_object_id++; texture->format = format; texture->access = access; texture->w = w; @@ -1745,25 +1642,20 @@ texture->b = 255; texture->a = 255; texture->renderer = renderer; + texture->next = renderer->textures; + renderer->textures = texture; if (renderer->CreateTexture(renderer, texture) < 0) { - if (renderer->DestroyTexture) { - renderer->DestroyTexture(renderer, texture); - } - SDL_free(texture); + SDL_DestroyTexture(texture); return 0; } - hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures)); - texture->next = SDL_CurrentDisplay.textures[hash]; - SDL_CurrentDisplay.textures[hash] = texture; - - return texture->id; + return texture; } -SDL_TextureID +SDL_Texture * SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface) { - SDL_TextureID textureID; + SDL_Texture *texture; Uint32 requested_format = format; SDL_PixelFormat *fmt; SDL_Renderer *renderer; @@ -1980,29 +1872,29 @@ } } - textureID = + texture = SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, surface->w, surface->h); - if (!textureID && !requested_format) { + if (!texture && !requested_format) { SDL_DisplayMode desktop_mode; SDL_GetDesktopDisplayMode(&desktop_mode); format = desktop_mode.format; - textureID = + texture = SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, surface->w, surface->h); } - if (!textureID) { + if (!texture) { return 0; } if (bpp == fmt->BitsPerPixel && Rmask == fmt->Rmask && Gmask == fmt->Gmask && Bmask == fmt->Bmask && Amask == fmt->Amask) { if (SDL_MUSTLOCK(surface)) { SDL_LockSurface(surface); - SDL_UpdateTexture(textureID, NULL, surface->pixels, + SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch); SDL_UnlockSurface(surface); } else { - SDL_UpdateTexture(textureID, NULL, surface->pixels, + SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch); } } else { @@ -2025,14 +1917,14 @@ } dst = SDL_ConvertSurface(surface, &dst_fmt, 0); if (dst) { - SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch); + SDL_UpdateTexture(texture, NULL, dst->pixels, dst->pitch); SDL_FreeSurface(dst); } if (dst_fmt.palette) { SDL_FreePalette(dst_fmt.palette); } if (!dst) { - SDL_DestroyTexture(textureID); + SDL_DestroyTexture(texture); return 0; } } @@ -2043,50 +1935,29 @@ int scaleMode; SDL_GetSurfaceColorMod(surface, &r, &g, &b); - SDL_SetTextureColorMod(textureID, r, g, b); + SDL_SetTextureColorMod(texture, r, g, b); SDL_GetSurfaceAlphaMod(surface, &a); - SDL_SetTextureAlphaMod(textureID, a); + SDL_SetTextureAlphaMod(texture, a); SDL_GetSurfaceBlendMode(surface, &blendMode); - SDL_SetTextureBlendMode(textureID, blendMode); + SDL_SetTextureBlendMode(texture, blendMode); SDL_GetSurfaceScaleMode(surface, &scaleMode); - SDL_SetTextureScaleMode(textureID, scaleMode); + SDL_SetTextureScaleMode(texture, scaleMode); } if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) { - SDL_SetTexturePalette(textureID, fmt->palette->colors, 0, + SDL_SetTexturePalette(texture, fmt->palette->colors, 0, fmt->palette->ncolors); } - return textureID; -} - -static __inline__ SDL_Texture * -SDL_GetTextureFromID(SDL_TextureID textureID) -{ - int hash; - SDL_Texture *texture; - - if (!_this) { - return NULL; - } - hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures)); - for (texture = SDL_CurrentDisplay.textures[hash]; texture; - texture = texture->next) { - if (texture->id == textureID) { - return texture; - } - } - return NULL; + return texture; } int -SDL_QueryTexture(SDL_TextureID textureID, Uint32 * format, int *access, +SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access, int *w, int *h) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); - if (!texture) { return -1; } @@ -2106,9 +1977,8 @@ } int -SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int *pitch) +SDL_QueryTexturePixels(SDL_Texture * texture, void **pixels, int *pitch) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; if (!texture) { @@ -2123,10 +1993,9 @@ } int -SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, +SDL_SetTexturePalette(SDL_Texture * texture, const SDL_Color * colors, int firstcolor, int ncolors) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; if (!texture) { @@ -2142,10 +2011,9 @@ } int -SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, +SDL_GetTexturePalette(SDL_Texture * texture, SDL_Color * colors, int firstcolor, int ncolors) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; if (!texture) { @@ -2161,9 +2029,8 @@ } int -SDL_SetTextureColorMod(SDL_TextureID textureID, Uint8 r, Uint8 g, Uint8 b) +SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; if (!texture) { @@ -2186,10 +2053,9 @@ } int -SDL_GetTextureColorMod(SDL_TextureID textureID, Uint8 * r, Uint8 * g, +SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g, Uint8 * b) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; if (!texture) { @@ -2209,9 +2075,8 @@ } int -SDL_SetTextureAlphaMod(SDL_TextureID textureID, Uint8 alpha) +SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; if (!texture) { @@ -2232,10 +2097,8 @@ } int -SDL_GetTextureAlphaMod(SDL_TextureID textureID, Uint8 * alpha) +SDL_GetTextureAlphaMod(SDL_Texture * texture, Uint8 * alpha) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); - if (!texture) { return -1; } @@ -2246,9 +2109,8 @@ } int -SDL_SetTextureBlendMode(SDL_TextureID textureID, int blendMode) +SDL_SetTextureBlendMode(SDL_Texture * texture, int blendMode) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; if (!texture) { @@ -2264,10 +2126,8 @@ } int -SDL_GetTextureBlendMode(SDL_TextureID textureID, int *blendMode) +SDL_GetTextureBlendMode(SDL_Texture * texture, int *blendMode) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); - if (!texture) { return -1; } @@ -2278,9 +2138,8 @@ } int -SDL_SetTextureScaleMode(SDL_TextureID textureID, int scaleMode) +SDL_SetTextureScaleMode(SDL_Texture * texture, int scaleMode) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; if (!texture) { @@ -2296,10 +2155,8 @@ } int -SDL_GetTextureScaleMode(SDL_TextureID textureID, int *scaleMode) +SDL_GetTextureScaleMode(SDL_Texture * texture, int *scaleMode) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); - if (!texture) { return -1; } @@ -2310,10 +2167,9 @@ } int -SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect * rect, +SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; SDL_Rect full_rect; @@ -2336,10 +2192,9 @@ } int -SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect * rect, int markDirty, +SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty, void **pixels, int *pitch) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; SDL_Rect full_rect; @@ -2367,9 +2222,8 @@ } void -SDL_UnlockTexture(SDL_TextureID textureID) +SDL_UnlockTexture(SDL_Texture * texture) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; if (!texture) { @@ -2386,10 +2240,9 @@ } void -SDL_DirtyTexture(SDL_TextureID textureID, int numrects, +SDL_DirtyTexture(SDL_Texture * texture, int numrects, const SDL_Rect * rects) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; if (!texture) { @@ -2607,11 +2460,10 @@ /* Check for NULL rect, which means fill entire window */ for (i = 0; i < count; ++i) { if (rects[i] == NULL) { - SDL_Window *window; + SDL_Window *window = renderer->window; SDL_Rect full_rect; const SDL_Rect *rect; - window = SDL_GetWindowFromID(renderer->window); full_rect.x = 0; full_rect.y = 0; full_rect.w = window->w; @@ -2654,11 +2506,10 @@ /* Check for NULL rect, which means fill entire window */ for (i = 0; i < count; ++i) { if (rects[i] == NULL) { - SDL_Window *window; + SDL_Window *window = renderer->window; SDL_Rect full_rect; const SDL_Rect *rect; - window = SDL_GetWindowFromID(renderer->window); full_rect.x = 0; full_rect.y = 0; full_rect.w = window->w; @@ -2671,10 +2522,9 @@ } int -SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect, +SDL_RenderCopy(SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect) { - SDL_Texture *texture = SDL_GetTextureFromID(textureID); SDL_Renderer *renderer; SDL_Window *window; SDL_Rect real_srcrect; @@ -2696,7 +2546,7 @@ SDL_Unsupported(); return -1; } - window = SDL_GetWindowFromID(renderer->window); + window = renderer->window; real_srcrect.x = 0; real_srcrect.y = 0; @@ -2751,10 +2601,10 @@ SDL_Unsupported(); return -1; } - window = SDL_GetWindowFromID(renderer->window); + window = renderer->window; if (!format) { - format = SDL_GetDisplayFromWindow(window)->current_mode.format; + format = window->display->current_mode.format; } real_rect.x = 0; @@ -2769,7 +2619,7 @@ pixels = (Uint8 *)pixels + pitch * (real_rect.y - rect->y); } if (real_rect.x > rect->x) { - Uint32 format = SDL_CurrentDisplay.current_mode.format; + Uint32 format = SDL_CurrentDisplay->current_mode.format; int bpp = SDL_BYTESPERPIXEL(format); pixels = (Uint8 *)pixels + bpp * (real_rect.x - rect->x); } @@ -2795,10 +2645,10 @@ SDL_Unsupported(); return -1; } - window = SDL_GetWindowFromID(renderer->window); + window = renderer->window; if (!format) { - format = SDL_GetDisplayFromWindow(window)->current_mode.format; + format = window->display->current_mode.format; } real_rect.x = 0; @@ -2813,7 +2663,7 @@ pixels = (const Uint8 *)pixels + pitch * (real_rect.y - rect->y); } if (real_rect.x > rect->x) { - Uint32 format = SDL_CurrentDisplay.current_mode.format; + Uint32 format = SDL_CurrentDisplay->current_mode.format; int bpp = SDL_BYTESPERPIXEL(format); pixels = (const Uint8 *)pixels + bpp * (real_rect.x - rect->x); } @@ -2836,45 +2686,30 @@ } void -SDL_DestroyTexture(SDL_TextureID textureID) +SDL_DestroyTexture(SDL_Texture * texture) { - int hash; - SDL_Texture *prev, *texture; SDL_Renderer *renderer; - if (!_this) { - SDL_UninitializedVideo(); + if (!texture || !texture->renderer) { + SDL_SetError("Invalid texture"); return; } - /* Look up the texture in the hash table */ - hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures)); - prev = NULL; - for (texture = SDL_CurrentDisplay.textures[hash]; texture; - prev = texture, texture = texture->next) { - if (texture->id == textureID) { - break; - } - } - if (!texture) { - return; - } - /* Unlink the texture from the list */ - if (prev) { - prev->next = texture->next; + + renderer = texture->renderer; + if (texture->prev) { + texture->prev->next = texture->next; } else { - SDL_CurrentDisplay.textures[hash] = texture->next; - } - - /* Free the texture */ - renderer = texture->renderer; + renderer->textures = texture->next; + } + texture->renderer = NULL; + renderer->DestroyTexture(renderer, texture); SDL_free(texture); } void -SDL_DestroyRenderer(SDL_WindowID windowID) +SDL_DestroyRenderer(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); SDL_Renderer *renderer; int i; @@ -2885,26 +2720,10 @@ if (!renderer) { return; } + /* Free existing textures for this renderer */ - for (i = 0; i < SDL_arraysize(SDL_CurrentDisplay.textures); ++i) { - SDL_Texture *texture; - SDL_Texture *prev = NULL; - SDL_Texture *next; - for (texture = SDL_CurrentDisplay.textures[i]; texture; - texture = next) { - next = texture->next; - if (texture->renderer == renderer) { - if (prev) { - prev->next = next; - } else { - SDL_CurrentDisplay.textures[i] = next; - } - renderer->DestroyTexture(renderer, texture); - SDL_free(texture); - } else { - prev = texture; - } - } + while (renderer->textures) { + SDL_DestroyTexture(renderer->textures); } /* Free the renderer instance */ @@ -2912,8 +2731,8 @@ /* Clear references */ window->renderer = NULL; - if (SDL_CurrentDisplay.current_renderer == renderer) { - SDL_CurrentDisplay.current_renderer = NULL; + if (SDL_CurrentDisplay->current_renderer == renderer) { + SDL_CurrentDisplay->current_renderer = NULL; } } @@ -2971,14 +2790,9 @@ /* Clean up the system video */ for (i = _this->num_displays; i--;) { SDL_VideoDisplay *display = &_this->displays[i]; - for (j = display->num_windows; j--;) { - SDL_DestroyWindow(display->windows[i].id); + while (display->windows) { + SDL_DestroyWindow(display->windows); } - if (display->windows) { - SDL_free(display->windows); - display->windows = NULL; - } - display->num_windows = 0; if (display->render_drivers) { SDL_free(display->render_drivers); display->render_drivers = NULL; @@ -3383,10 +3197,8 @@ } SDL_GLContext -SDL_GL_CreateContext(SDL_WindowID windowID) +SDL_GL_CreateContext(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return NULL; } @@ -3398,10 +3210,8 @@ } int -SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context) +SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext context) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (window && !(window->flags & SDL_WINDOW_OPENGL)) { SDL_SetError("The specified window isn't an OpenGL window"); return -1; @@ -3443,10 +3253,8 @@ } void -SDL_GL_SwapWindow(SDL_WindowID windowID) +SDL_GL_SwapWindow(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window) { return; } @@ -3567,10 +3375,8 @@ #endif SDL_bool -SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo *info) +SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - if (!window || !_this->GetWindowWMInfo) { return SDL_FALSE; }
--- a/src/video/cocoa/SDL_cocoamouse.m Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/cocoa/SDL_cocoamouse.m Thu Jan 21 06:21:52 2010 +0000 @@ -76,7 +76,7 @@ if (point.x < 0 || point.x >= candidate->w || point.y < 0 || point.y >= candidate->h) { /* The mouse is out of this fullscreen display */ - if (mouse->focus == candidate->id) { + if (mouse->focus == candidate) { SDL_SetMouseFocus(data->mouse, 0); } } else { @@ -91,8 +91,8 @@ } /* Set the focus appropriately */ - if (mouse->focus != window->id) { - SDL_SetMouseFocus(data->mouse, window->id); + if (mouse->focus != window) { + SDL_SetMouseFocus(data->mouse, window); } switch ([event type]) {
--- a/src/video/cocoa/SDL_cocoaopengl.m Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/cocoa/SDL_cocoaopengl.m Thu Jan 21 06:21:52 2010 +0000 @@ -82,7 +82,7 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) { NSAutoreleasePool *pool; - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; NSOpenGLPixelFormatAttribute attr[32]; NSOpenGLPixelFormat *fmt;
--- a/src/video/cocoa/SDL_cocoawindow.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/cocoa/SDL_cocoawindow.h Thu Jan 21 06:21:52 2010 +0000 @@ -69,8 +69,8 @@ struct SDL_WindowData { - SDL_WindowID windowID; - NSWindow *window; + SDL_Window *window; + NSWindow *nswindow; SDL_bool created; CGDirectDisplayID display; Cocoa_WindowListener *listener;
--- a/src/video/cocoa/SDL_cocoawindow.m Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/cocoa/SDL_cocoawindow.m Thu Jan 21 06:21:52 2010 +0000 @@ -86,13 +86,13 @@ - (BOOL)windowShouldClose:(id)sender { - SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_CLOSE, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); return NO; } - (void)windowDidExpose:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_EXPOSED, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0); } - (void)windowDidMove:(NSNotification *)aNotification @@ -102,7 +102,7 @@ ConvertNSRect(&rect); x = (int)rect.origin.x; y = (int)rect.origin.y; - SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_MOVED, x, y); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MOVED, x, y); } - (void)windowDidResize:(NSNotification *)aNotification @@ -111,17 +111,17 @@ NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]]; w = (int)rect.size.width; h = (int)rect.size.height; - SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_RESIZED, w, h); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h); } - (void)windowDidMiniaturize:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_MINIMIZED, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } - (void)windowDidDeminiaturize:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_RESTORED, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESTORED, 0, 0); } - (void)windowDidBecomeKey:(NSNotification *)aNotification @@ -130,7 +130,7 @@ /* We're going to get keyboard events, since we're key. */ index = _data->videodata->keyboard; - SDL_SetKeyboardFocus(index, _data->windowID); + SDL_SetKeyboardFocus(index, _data->window); } - (void)windowDidResignKey:(NSNotification *)aNotification @@ -141,7 +141,7 @@ /* Some other window will get mouse events, since we're not key. */ index = _data->videodata->mouse; mouse = SDL_GetMouse(index); - if (mouse->focus == _data->windowID) { + if (mouse->focus == _data->window) { SDL_SetMouseFocus(index, 0); } @@ -152,12 +152,12 @@ - (void)windowDidHide:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_HIDDEN, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } - (void)windowDidUnhide:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_SHOWN, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); } - (void)mouseDown:(NSEvent *)theEvent @@ -228,7 +228,7 @@ - (void)mouseMoved:(NSEvent *)theEvent { - SDL_Window *window = SDL_GetWindowFromID(_data->windowID); + SDL_Window *window = _data->window; int index; SDL_Mouse *mouse; NSPoint point; @@ -243,8 +243,8 @@ SDL_SetMouseFocus(index, 0); } } else { - if (mouse->focus != _data->windowID) { - SDL_SetMouseFocus(index, _data->windowID); + if (mouse->focus != _data->window) { + SDL_SetMouseFocus(index, _data->window); } SDL_SendMouseMotion(index, 0, (int)point.x, (int)point.y, 0); } @@ -298,7 +298,7 @@ { NSAutoreleasePool *pool; SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; SDL_WindowData *data; @@ -308,7 +308,7 @@ SDL_OutOfMemory(); return -1; } - data->windowID = window->id; + data->window = window; data->window = nswindow; data->created = created; data->display = displaydata->display; @@ -363,7 +363,7 @@ if ([nswindow isKeyWindow]) { int index = data->videodata->keyboard; window->flags |= SDL_WINDOW_INPUT_FOCUS; - SDL_SetKeyboardFocus(index, data->windowID); + SDL_SetKeyboardFocus(index, data->window); if (window->flags & SDL_WINDOW_INPUT_GRABBED) { /* FIXME */ @@ -381,7 +381,7 @@ { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSWindow *nswindow; - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; NSRect rect; SDL_Rect bounds; unsigned int style; @@ -490,7 +490,7 @@ { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window; - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; NSRect rect; SDL_Rect bounds;
--- a/src/video/directfb/SDL_DirectFB_WM.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/directfb/SDL_DirectFB_WM.c Thu Jan 21 06:21:52 2010 +0000 @@ -196,7 +196,7 @@ DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window) { SDL_DFB_WINDOWDATA(window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; windata->window->GetPosition(windata->window, &windata->restore.x, &windata->restore.y);
--- a/src/video/directfb/SDL_DirectFB_events.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/directfb/SDL_DirectFB_events.c Thu Jan 21 06:21:52 2010 +0000 @@ -46,7 +46,7 @@ static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button); static void -DirectFB_SetContext(_THIS, SDL_WindowID id) +DirectFB_SetContext(_THIS, SDL_Window *window) { #if (DFB_VERSION_ATLEAST(1,0,0)) /* FIXME: does not work on 1.0/1.2 with radeon driver @@ -55,7 +55,7 @@ */ SDL_Window *window = SDL_GetWindowFromID(id); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; int ret; @@ -70,7 +70,7 @@ } static void -FocusAllMice(_THIS, SDL_WindowID id) +FocusAllMice(_THIS, SDL_Window *window) { SDL_DFB_DEVICEDATA(_this); int index; @@ -81,7 +81,7 @@ static void -FocusAllKeyboards(_THIS, SDL_WindowID id) +FocusAllKeyboards(_THIS, SDL_Window *window) { SDL_DFB_DEVICEDATA(_this); int index; @@ -177,7 +177,7 @@ break; case DWET_MOTION: if (ClientXY(p, &evt->x, &evt->y)) { - SDL_Window *window = SDL_GetWindowFromID(p->sdl_id); + SDL_Window *window = p->window; if (!devdata->use_linux_input) { if (!(flags & SDL_WINDOW_INPUT_GRABBED)) SDL_SendMouseMotion(devdata->mouse_id[0], 0, @@ -193,7 +193,7 @@ } } if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS)) - SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_ENTER, 0, + SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_ENTER, 0, 0); } break; @@ -218,13 +218,13 @@ break; case DWET_POSITION: if (ClientXY(p, &evt->x, &evt->y)) { - SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_MOVED, + SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_MOVED, evt->x, evt->y); } break; case DWET_POSITION_SIZE: if (ClientXY(p, &evt->x, &evt->y)) { - SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_MOVED, + SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_MOVED, evt->x, evt->y); } /* fall throught */ @@ -234,32 +234,32 @@ evt->h -= (p->theme.top_size + p->theme.bottom_size + p->theme.caption_size); - SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_RESIZED, + SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_RESIZED, evt->w, evt->h); break; case DWET_CLOSE: - SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_CLOSE, 0, 0); + SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_CLOSE, 0, 0); break; case DWET_GOTFOCUS: - DirectFB_SetContext(_this, p->sdl_id); - FocusAllKeyboards(_this, p->sdl_id); - SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_FOCUS_GAINED, + DirectFB_SetContext(_this, p->window); + FocusAllKeyboards(_this, p->window); + SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); break; case DWET_LOSTFOCUS: - SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); + SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); FocusAllKeyboards(_this, 0); break; case DWET_ENTER: /* SDL_DirectFB_ReshowCursor(_this, 0); */ - FocusAllMice(_this, p->sdl_id); + FocusAllMice(_this, p->window); // FIXME: when do we really enter ? if (ClientXY(p, &evt->x, &evt->y)) MotionAllMice(_this, evt->x, evt->y); - SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_ENTER, 0, 0); + SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_ENTER, 0, 0); break; case DWET_LEAVE: - SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_LEAVE, 0, 0); + SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_LEAVE, 0, 0); FocusAllMice(_this, 0); /* SDL_DirectFB_ReshowCursor(_this, 1); */ break; @@ -372,16 +372,16 @@ SDL_DFB_DEVICEDATA(_this); DFB_WindowData *p; DFBInputEvent ievt; - Sint32 /* SDL_WindowID */ grabbed_window; + SDL_Window *grabbed_window; - grabbed_window = -1; + grabbed_window = NULL; for (p = devdata->firstwin; p != NULL; p = p->next) { DFBWindowEvent evt; - SDL_Window *w = SDL_GetWindowFromID(p->sdl_id); + SDL_Window *w = SDL_GetWindowFromID(p->window); if (w->flags & SDL_WINDOW_INPUT_GRABBED) { - grabbed_window = p->sdl_id; + grabbed_window = w; } while (p->eventbuffer->GetEvent(p->eventbuffer,
--- a/src/video/directfb/SDL_DirectFB_mouse.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/directfb/SDL_DirectFB_mouse.c Thu Jan 21 06:21:52 2010 +0000 @@ -31,7 +31,7 @@ static int DirectFB_ShowCursor(SDL_Cursor * cursor); static void DirectFB_MoveCursor(SDL_Cursor * cursor); static void DirectFB_FreeCursor(SDL_Cursor * cursor); -static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_WindowID windowID, +static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y); static void DirectFB_FreeMouse(SDL_Mouse * mouse); @@ -159,14 +159,13 @@ { SDL_DFB_CURSORDATA(cursor); DFBResult ret; - SDL_WindowID wid; + SDL_Window *window; - wid = SDL_GetFocusWindow(); - if (wid <= 0) + window = SDL_GetFocusWindow(); + if (!window) return -1; else { - SDL_Window *window = SDL_GetWindowFromID(wid); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; if (display) { DFB_DisplayData *dispdata = @@ -216,10 +215,9 @@ /* Warp the mouse to (x,y) */ static void -DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y) +DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y) { - SDL_Window *window = SDL_GetWindowFromID(windowID); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; DFB_WindowData *windata = (DFB_WindowData *) window->driverdata; DFBResult ret;
--- a/src/video/directfb/SDL_DirectFB_render.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/directfb/SDL_DirectFB_render.c Thu Jan 21 06:21:52 2010 +0000 @@ -280,7 +280,7 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) { SDL_DFB_WINDOWDATA(window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_Renderer *renderer = NULL; DirectFB_RenderData *data = NULL; DFBResult ret; @@ -313,7 +313,7 @@ renderer->DestroyTexture = DirectFB_DestroyTexture; renderer->DestroyRenderer = DirectFB_DestroyRenderer; renderer->info = DirectFB_RenderDriver.info; - renderer->window = window->id; /* SDL window id */ + renderer->window = window; /* SDL window */ renderer->driverdata = data; renderer->info.flags = @@ -446,7 +446,7 @@ { SDL_DFB_RENDERERDATA(renderer); SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DFB_DEVICEDATA(display->device); DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; DirectFB_TextureData *data = texture->driverdata; @@ -502,7 +502,7 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DFB_DEVICEDATA(display->device); DirectFB_TextureData *data; DFBResult ret;
--- a/src/video/directfb/SDL_DirectFB_window.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/directfb/SDL_DirectFB_window.c Thu Jan 21 06:21:52 2010 +0000 @@ -140,7 +140,7 @@ windata->window->RaiseToTop(windata->window); /* remember parent */ - windata->sdl_id = window->id; + windata->window = window; /* Add to list ... */
--- a/src/video/directfb/SDL_DirectFB_window.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/directfb/SDL_DirectFB_window.h Thu Jan 21 06:21:52 2010 +0000 @@ -36,7 +36,7 @@ IDirectFBWindow *window; DirectFB_GLContext *gl_context; IDirectFBEventBuffer *eventbuffer; - SDL_WindowID sdl_id; + SDL_Window *window; DFB_WindowData *next; Uint8 opacity; DFBRectangle client;
--- a/src/video/dummy/SDL_nullrender.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/dummy/SDL_nullrender.c Thu Jan 21 06:21:52 2010 +0000 @@ -74,7 +74,7 @@ SDL_Renderer * SDL_DUMMY_CreateRenderer(SDL_Window * window, Uint32 flags) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayMode *displayMode = &display->current_mode; SDL_Renderer *renderer; SDL_DUMMY_RenderData *data; @@ -113,7 +113,7 @@ renderer->DestroyRenderer = SDL_DUMMY_DestroyRenderer; renderer->info.name = SDL_DUMMY_RenderDriver.info.name; renderer->info.flags = 0; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = data; Setup_SoftwareRenderer(renderer); @@ -238,8 +238,8 @@ { SDL_DUMMY_RenderData *data = (SDL_DUMMY_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { SDL_Surface *target = data->screens[data->current_screen]; @@ -266,8 +266,8 @@ { SDL_DUMMY_RenderData *data = (SDL_DUMMY_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; SDL_Surface *screen = data->screens[data->current_screen]; Uint32 screen_format = display->current_mode.format; Uint8 *screen_pixels = (Uint8 *) screen->pixels + @@ -286,8 +286,8 @@ { SDL_DUMMY_RenderData *data = (SDL_DUMMY_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; SDL_Surface *screen = data->screens[data->current_screen]; Uint32 screen_format = display->current_mode.format; Uint8 *screen_pixels = (Uint8 *) screen->pixels + @@ -311,7 +311,7 @@ if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) { char file[128]; SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp", - renderer->window, ++frame_number); + renderer->window->id, ++frame_number); SDL_SaveBMP(data->screens[data->current_screen], file); }
--- a/src/video/nds/SDL_ndsrender.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/nds/SDL_ndsrender.c Thu Jan 21 06:21:52 2010 +0000 @@ -126,7 +126,7 @@ SDL_Renderer * NDS_CreateRenderer(SDL_Window * window, Uint32 flags) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayMode *displayMode = &display->current_mode; SDL_Renderer *renderer; NDS_RenderData *data; @@ -175,7 +175,7 @@ renderer->DestroyRenderer = NDS_DestroyRenderer; renderer->info.name = NDS_RenderDriver.info.name; renderer->info.flags = 0; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = data; renderer->CreateTexture = NDS_CreateTexture; renderer->QueryTexturePixels = NDS_QueryTexturePixels; @@ -490,8 +490,8 @@ { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; int Bpp = SDL_BYTESPERPIXEL(texture->format); if (txdat->type == NDSTX_BG) { @@ -515,8 +515,8 @@ NDS_RenderPresent(SDL_Renderer * renderer) { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; /* update sprites */ // NDS_OAM_Update(&(data->oam_copy), data->sub); @@ -538,8 +538,6 @@ NDS_DestroyRenderer(SDL_Renderer * renderer) { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); int i; if (data) {
--- a/src/video/pandora/SDL_pandora.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/pandora/SDL_pandora.c Thu Jan 21 06:21:52 2010 +0000 @@ -417,7 +417,7 @@ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; EGLBoolean status; int32_t gfstatus; EGLint configs; @@ -816,7 +816,7 @@ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; if (phdata->egl_initialized != SDL_TRUE) {
--- a/src/video/photon/SDL_photon.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/photon/SDL_photon.c Thu Jan 21 06:21:52 2010 +0000 @@ -777,7 +777,7 @@ { SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; SDL_WindowData *wdata; PhDim_t winsize; PhPoint_t winpos; @@ -997,7 +997,7 @@ PtFlush(); /* By default last created window got a input focus */ - SDL_SetKeyboardFocus(0, window->id); + SDL_SetKeyboardFocus(0, window); /* Emit focus gained event, because photon is not sending it */ SDL_OnWindowFocusGained(window); @@ -1055,7 +1055,7 @@ { SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; PhPoint_t winpos; int32_t status; @@ -1223,7 +1223,7 @@ { SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; int32_t status; @@ -1414,7 +1414,7 @@ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; EGLBoolean status; int32_t gfstatus; EGLint configs; @@ -1941,7 +1941,7 @@ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; PhRect_t dst_rect; PhRect_t src_rect; int32_t status; @@ -2050,7 +2050,7 @@ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; SDL_bool makecurrent=SDL_FALSE; int32_t gfstatus; @@ -2199,10 +2199,10 @@ { /* Mouse cursor over handled window */ if (window != NULL) { - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_ENTER, 0, 0); - SDL_SetMouseFocus(0, window->id); + SDL_SetMouseFocus(0, window); } } break; @@ -2210,7 +2210,7 @@ { /* Mouse cursor out of handled window */ if (window != NULL) { - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_LEAVE, 0, 0); } @@ -2682,7 +2682,7 @@ case Ph_WM_CLOSE: { if (window != NULL) { - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0, 0); } @@ -2695,10 +2695,10 @@ if (window != NULL) { PhRegion_t wregion; - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); - SDL_SetKeyboardFocus(0, window->id); + SDL_SetKeyboardFocus(0, window); /* Set window region sensible to mouse motion events */ PhRegionQuery(PtWidgetRid @@ -2712,7 +2712,7 @@ &wregion, NULL, NULL); /* If window got a focus, then it is visible */ - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0); } @@ -2722,7 +2722,7 @@ if (window != NULL) { PhRegion_t wregion; - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); @@ -2743,7 +2743,7 @@ case Ph_WM_MOVE: { if (window != NULL) { - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, wmevent->pos.x, wmevent->pos.y); @@ -2754,7 +2754,7 @@ { if (window != NULL) { /* Set new window position after resize */ - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, wmevent->pos.x, wmevent->pos.y); @@ -2766,7 +2766,7 @@ } /* Set new window size after resize */ - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, wmevent->size.w, wmevent->size.h); @@ -2777,11 +2777,11 @@ { if (window != NULL) { /* Send new window state: minimized */ - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); /* In case window is minimized, then it is hidden */ - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } @@ -2792,7 +2792,7 @@ if (window != NULL) { if ((window->flags & SDL_WINDOW_RESIZABLE)==SDL_WINDOW_RESIZABLE) { - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); } @@ -2806,7 +2806,7 @@ case Ph_WM_RESTORE: { if (window != NULL) { - SDL_SendWindowEvent(window->id, + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); }
--- a/src/video/photon/SDL_photon_input.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/photon/SDL_photon_input.c Thu Jan 21 06:21:52 2010 +0000 @@ -38,7 +38,7 @@ int photon_showcursor(SDL_Cursor * cursor); void photon_movecursor(SDL_Cursor * cursor); void photon_freecursor(SDL_Cursor * cursor); -void photon_warpmouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y); +void photon_warpmouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y); void photon_freemouse(SDL_Mouse * mouse); int32_t @@ -228,13 +228,12 @@ SDL_DisplayData *didata; SDL_Window *window; SDL_WindowData *wdata; - SDL_WindowID window_id; PhCursorDef_t *internal_cursor; int32_t status; /* Get current window id */ - window_id = SDL_GetFocusWindow(); - if (window_id <= 0) { + window = SDL_GetFocusWindow(); + if (!window) { SDL_MouseData *mdata = NULL; /* If there is no current window, then someone calls this function */ @@ -264,17 +263,12 @@ } } else { /* Sanity checks */ - window = SDL_GetWindowFromID(window_id); - if (window != NULL) { - display = SDL_GetDisplayFromWindow(window); - if (display != NULL) { - didata = (SDL_DisplayData *) display->driverdata; - if (didata != NULL) { - wdata = (SDL_WindowData *) window->driverdata; - if (wdata == NULL) { - return -1; - } - } else { + display = window->display; + if (display != NULL) { + didata = (SDL_DisplayData *) display->driverdata; + if (didata != NULL) { + wdata = (SDL_WindowData *) window->driverdata; + if (wdata == NULL) { return -1; } } else { @@ -379,7 +373,7 @@ /* Sanity checks */ window = SDL_GetWindowFromID(window_id); if (window != NULL) { - display = SDL_GetDisplayFromWindow(window); + display = window->display; if (display != NULL) { didata = (SDL_DisplayData *) display->driverdata; if (didata != NULL) { @@ -418,19 +412,17 @@ } void -photon_warpmouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y) +photon_warpmouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y) { SDL_VideoDisplay *display; SDL_DisplayData *didata; - SDL_Window *window; SDL_WindowData *wdata; int16_t wx; int16_t wy; /* Sanity checks */ - window = SDL_GetWindowFromID(windowID); if (window != NULL) { - display = SDL_GetDisplayFromWindow(window); + display = window->display; if (display != NULL) { didata = (SDL_DisplayData *) display->driverdata; if (didata != NULL) {
--- a/src/video/photon/SDL_photon_render.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/photon/SDL_photon_render.c Thu Jan 21 06:21:52 2010 +0000 @@ -124,7 +124,7 @@ static SDL_Renderer * photon_createrenderer(SDL_Window * window, Uint32 flags) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_Renderer *renderer = NULL; @@ -171,7 +171,7 @@ renderer->DestroyTexture = photon_destroytexture; renderer->DestroyRenderer = photon_destroyrenderer; renderer->info = photon_renderdriver.info; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = rdata; /* Copy direct_mode status */ @@ -298,7 +298,7 @@ /* Obtain window and display structures */ window=SDL_GetWindowFromID(renderer->window); wdata=(SDL_WindowData*)window->driverdata; - display=SDL_GetDisplayFromWindow(window); + display=window->display; didata=(SDL_DisplayData *) display->driverdata; phdata=(SDL_VideoData *) display->device->driverdata; @@ -723,7 +723,7 @@ { SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; /* Copy direct_mode status */ @@ -738,7 +738,7 @@ { SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; SDL_TextureData *tdata = NULL; uint32_t it;
--- a/src/video/ps3/SDL_ps3render.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/ps3/SDL_ps3render.c Thu Jan 21 06:21:52 2010 +0000 @@ -133,7 +133,7 @@ SDL_PS3_CreateRenderer(SDL_Window * window, Uint32 flags) { deprintf(1, "+SDL_PS3_CreateRenderer()\n"); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayMode *displayMode = &display->current_mode; SDL_VideoData *devdata = display->device->driverdata; SDL_Renderer *renderer; @@ -179,7 +179,7 @@ renderer->DestroyRenderer = SDL_PS3_DestroyRenderer; renderer->info.name = SDL_PS3_RenderDriver.info.name; renderer->info.flags = 0; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = data; deprintf(1, "window->w = %u\n", window->w); @@ -518,7 +518,7 @@ SDL_PS3_RenderData *data = (SDL_PS3_RenderData *) renderer->driverdata; SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; PS3_TextureData *txdata = (PS3_TextureData *) texture->driverdata; SDL_VideoData *devdata = display->device->driverdata; @@ -640,7 +640,7 @@ SDL_PS3_RenderData *data = (SDL_PS3_RenderData *) renderer->driverdata; SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_VideoData *devdata = display->device->driverdata; /* Send the data to the screen */
--- a/src/video/qnxgf/SDL_gf_input.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/qnxgf/SDL_gf_input.c Thu Jan 21 06:21:52 2010 +0000 @@ -41,7 +41,7 @@ int gf_showcursor(SDL_Cursor * cursor); void gf_movecursor(SDL_Cursor * cursor); void gf_freecursor(SDL_Cursor * cursor); -void gf_warpmouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y); +void gf_warpmouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y); void gf_freemouse(SDL_Mouse * mouse); /* HIDDI interacting functions */ @@ -278,7 +278,7 @@ /* Sanity checks */ window = SDL_GetWindowFromID(window_id); if (window != NULL) { - display = SDL_GetDisplayFromWindow(window); + display = window->display; if (display != NULL) { didata = (SDL_DisplayData *) display->driverdata; if (didata == NULL) { @@ -399,7 +399,7 @@ /* Sanity checks */ window = SDL_GetWindowFromID(window_id); if (window != NULL) { - display = SDL_GetDisplayFromWindow(window); + display = window->display; if (display != NULL) { didata = (SDL_DisplayData *) display->driverdata; if (didata == NULL) { @@ -461,19 +461,17 @@ } void -gf_warpmouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y) +gf_warpmouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y) { SDL_VideoDisplay *display; SDL_DisplayData *didata; - SDL_Window *window; uint32_t xmax; uint32_t ymax; int32_t status; /* Sanity checks */ - window = SDL_GetWindowFromID(windowID); if (window != NULL) { - display = SDL_GetDisplayFromWindow(window); + display = window->display; if (display != NULL) { didata = (SDL_DisplayData *) display->driverdata; if (didata == NULL) { @@ -495,7 +493,7 @@ } /* Get window size to clamp maximum coordinates */ - SDL_GetWindowSize(windowID, &xmax, &ymax); + SDL_GetWindowSize(window, &xmax, &ymax); if (x >= xmax) { x = xmax - 1; }
--- a/src/video/qnxgf/SDL_gf_render.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/qnxgf/SDL_gf_render.c Thu Jan 21 06:21:52 2010 +0000 @@ -110,7 +110,7 @@ static SDL_Renderer * gf_createrenderer(SDL_Window * window, Uint32 flags) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_Renderer *renderer = NULL; @@ -162,7 +162,7 @@ renderer->DestroyTexture = gf_destroytexture; renderer->DestroyRenderer = gf_destroyrenderer; renderer->info = gf_renderdriver.info; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = rdata; /* Set render acceleration flag in case it is accelerated */ @@ -284,7 +284,7 @@ gf_activaterenderer(SDL_Renderer * renderer) { SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(rdata->window); + SDL_VideoDisplay *display = rdata->window->display; SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; /* Setup current surface as visible */ @@ -301,7 +301,7 @@ { SDL_RenderData *renderdata = (SDL_RenderData *) renderer->driverdata; SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_TextureData *tdata = NULL; /* Allocate texture driver data */
--- a/src/video/qnxgf/SDL_qnxgf.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/qnxgf/SDL_qnxgf.c Thu Jan 21 06:21:52 2010 +0000 @@ -978,7 +978,7 @@ qnxgf_createwindow(_THIS, SDL_Window * window) { SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; SDL_WindowData *wdata; int32_t status; @@ -1081,8 +1081,8 @@ hiddi_enable_mouse(); /* By default last created window got a input focus */ - SDL_SetKeyboardFocus(0, window->id); - SDL_SetMouseFocus(0, window->id); + SDL_SetKeyboardFocus(0, window); + SDL_SetMouseFocus(0, window); /* Window has been successfully created */ return 0; @@ -1155,7 +1155,7 @@ { SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; if (wdata != NULL) { @@ -1309,7 +1309,7 @@ SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; EGLBoolean status; int32_t gfstatus; EGLint configs;
--- a/src/video/uikit/SDL_uikitappdelegate.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/uikit/SDL_uikitappdelegate.h Thu Jan 21 06:21:52 2010 +0000 @@ -25,12 +25,12 @@ /* *INDENT-OFF* */ @interface SDLUIKitDelegate:NSObject<UIApplicationDelegate> { - UIWindow *window; - SDL_WindowID windowID; + SDL_Window *window; + UIWindow *uiwindow; } -@property (readwrite, retain) UIWindow *window; -@property (readwrite, assign) SDL_WindowID windowID; +@property (readwrite, assign) SDL_Window *window; +@property (readwrite, retain) UIWindow *uiwindow; +(SDLUIKitDelegate *)sharedAppDelegate;
--- a/src/video/uikit/SDL_uikitappdelegate.m Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/uikit/SDL_uikitappdelegate.m Thu Jan 21 06:21:52 2010 +0000 @@ -56,7 +56,7 @@ @implementation SDLUIKitDelegate @synthesize window; -@synthesize windowID; +@synthesize uiwindow; /* convenience method */ +(SDLUIKitDelegate *)sharedAppDelegate { @@ -66,8 +66,8 @@ - (id)init { self = [super init]; - window = nil; - windowID = 0; + window = NULL; + uiwindow = nil; return self; } @@ -107,19 +107,19 @@ - (void) applicationWillResignActive:(UIApplication*)application { // NSLog(@"%@", NSStringFromSelector(_cmd)); - SDL_SendWindowEvent(self.windowID, SDL_WINDOWEVENT_MINIMIZED, 0, 0); + SDL_SendWindowEvent(self.window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } - (void) applicationDidBecomeActive:(UIApplication*)application { // NSLog(@"%@", NSStringFromSelector(_cmd)); - SDL_SendWindowEvent(self.windowID, SDL_WINDOWEVENT_RESTORED, 0, 0); + SDL_SendWindowEvent(self.window, SDL_WINDOWEVENT_RESTORED, 0, 0); } -(void)dealloc { - [window release]; + [uiwindow release]; [super dealloc]; }
--- a/src/video/uikit/SDL_uikitkeyboard.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/uikit/SDL_uikitkeyboard.h Thu Jan 21 06:21:52 2010 +0000 @@ -23,10 +23,9 @@ #ifndef sdl_uikitkeyboard_h #define sdl_uikitkeyboard_h -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_WindowID windowID); -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardHide(SDL_WindowID windowID); -extern DECLSPEC SDL_bool SDLCALL SDL_iPhoneKeyboardIsShown(SDL_WindowID - windowID); -extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_WindowID windowID); +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_Window * window); +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardHide(SDL_Window * window); +extern DECLSPEC SDL_bool SDLCALL SDL_iPhoneKeyboardIsShown(SDL_Window * window); +extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_Window * window); #endif
--- a/src/video/uikit/SDL_uikitview.m Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/uikit/SDL_uikitview.m Thu Jan 21 06:21:52 2010 +0000 @@ -272,9 +272,8 @@ /* iPhone keyboard addition functions */ #if SDL_IPHONE_KEYBOARD -int SDL_iPhoneKeyboardShow(SDL_WindowID windowID) { +int SDL_iPhoneKeyboardShow(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); SDL_WindowData *data; SDL_uikitview *view; @@ -296,9 +295,8 @@ } } -int SDL_iPhoneKeyboardHide(SDL_WindowID windowID) { +int SDL_iPhoneKeyboardHide(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); SDL_WindowData *data; SDL_uikitview *view; @@ -320,9 +318,8 @@ } } -SDL_bool SDL_iPhoneKeyboardIsShown(SDL_WindowID windowID) { +SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); SDL_WindowData *data; SDL_uikitview *view; @@ -343,9 +340,8 @@ } } -int SDL_iPhoneKeyboardToggle(SDL_WindowID windowID) { +int SDL_iPhoneKeyboardToggle(SDL_Window * window) { - SDL_Window *window = SDL_GetWindowFromID(windowID); SDL_WindowData *data; SDL_uikitview *view; @@ -362,11 +358,11 @@ return -1; } else { - if (SDL_iPhoneKeyboardIsShown(windowID)) { - SDL_iPhoneKeyboardHide(windowID); + if (SDL_iPhoneKeyboardIsShown(window)) { + SDL_iPhoneKeyboardHide(window); } else { - SDL_iPhoneKeyboardShow(windowID); + SDL_iPhoneKeyboardShow(window); } return 0; } @@ -376,21 +372,21 @@ /* stubs, used if compiled without keyboard support */ -int SDL_iPhoneKeyboardShow(SDL_WindowID windowID) { +int SDL_iPhoneKeyboardShow(SDL_Window * window) { SDL_SetError("Not compiled with keyboard support"); return -1; } -int SDL_iPhoneKeyboardHide(SDL_WindowID windowID) { +int SDL_iPhoneKeyboardHide(SDL_Window * window) { SDL_SetError("Not compiled with keyboard support"); return -1; } -SDL_bool SDL_iPhoneKeyboardIsShown(SDL_WindowID windowID) { +SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) { return 0; } -int SDL_iPhoneKeyboardToggle(SDL_WindowID windowID) { +int SDL_iPhoneKeyboardToggle(SDL_Window * window) { SDL_SetError("Not compiled with keyboard support"); return -1; }
--- a/src/video/uikit/SDL_uikitwindow.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/uikit/SDL_uikitwindow.h Thu Jan 21 06:21:52 2010 +0000 @@ -36,7 +36,7 @@ struct SDL_WindowData { - SDL_WindowID windowID; + SDL_Window *window; UIWindow *uiwindow; SDL_uikitopenglview *view; };
--- a/src/video/uikit/SDL_uikitwindow.m Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/uikit/SDL_uikitwindow.m Thu Jan 21 06:21:52 2010 +0000 @@ -41,83 +41,82 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created) { SDL_WindowData *data; - + /* Allocate the window data */ data = (SDL_WindowData *)SDL_malloc(sizeof(*data)); if (!data) { SDL_OutOfMemory(); return -1; } - data->windowID = window->id; + data->window = window; data->uiwindow = uiwindow; - data->view = nil; - + data->view = nil; + /* Fill in the SDL window with the window data */ - { + { window->x = 0; window->y = 0; window->w = (int)uiwindow.frame.size.width; window->h = (int)uiwindow.frame.size.height; } - - window->driverdata = data; - - window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */ - window->flags |= SDL_WINDOW_OPENGL; /* window is always OpenGL */ - window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */ - window->flags |= SDL_WINDOW_SHOWN; /* only one window on iPod touch, always shown */ - window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ + + window->driverdata = data; + + window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */ + window->flags |= SDL_WINDOW_OPENGL; /* window is always OpenGL */ + window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */ + window->flags |= SDL_WINDOW_SHOWN; /* only one window on iPod touch, always shown */ + window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ - /* SDL_WINDOW_BORDERLESS controls whether status bar is hidden */ - if (window->flags & SDL_WINDOW_BORDERLESS) { - [UIApplication sharedApplication].statusBarHidden = YES; - } - else { - [UIApplication sharedApplication].statusBarHidden = NO; - } - + /* SDL_WINDOW_BORDERLESS controls whether status bar is hidden */ + if (window->flags & SDL_WINDOW_BORDERLESS) { + [UIApplication sharedApplication].statusBarHidden = YES; + } + else { + [UIApplication sharedApplication].statusBarHidden = NO; + } + return 0; - + } int UIKit_CreateWindow(_THIS, SDL_Window *window) { - - /* We currently only handle single window applications on iPhone */ - if (nil != [SDLUIKitDelegate sharedAppDelegate].window) { - SDL_SetError("Window already exists, no multi-window support."); - return -1; - } - - /* ignore the size user requested, and make a fullscreen window */ - UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - - if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) { + + /* We currently only handle single window applications on iPhone */ + if (nil != [SDLUIKitDelegate sharedAppDelegate].window) { + SDL_SetError("Window already exists, no multi-window support."); + return -1; + } + + /* ignore the size user requested, and make a fullscreen window */ + UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + + if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) { [uiwindow release]; return -1; - } - - // This saves the main window in the app delegate so event callbacks can do stuff on the window. - // This assumes a single window application design and needs to be fixed for multiple windows. - [SDLUIKitDelegate sharedAppDelegate].window = uiwindow; - [SDLUIKitDelegate sharedAppDelegate].windowID = window->id; - [uiwindow release]; /* release the window (the app delegate has retained it) */ - - return 1; - + } + + // This saves the main window in the app delegate so event callbacks can do stuff on the window. + // This assumes a single window application design and needs to be fixed for multiple windows. + [SDLUIKitDelegate sharedAppDelegate].window = window; + [SDLUIKitDelegate sharedAppDelegate].uiwindow = uiwindow; + [uiwindow release]; /* release the window (the app delegate has retained it) */ + + return 1; + } void UIKit_DestroyWindow(_THIS, SDL_Window * window) { - /* don't worry, the delegate will automatically release the window */ - - SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - if (data) { - SDL_free( window->driverdata ); - } + /* don't worry, the delegate will automatically release the window */ + + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + if (data) { + SDL_free( window->driverdata ); + } - /* this will also destroy the window */ - [SDLUIKitDelegate sharedAppDelegate].window = nil; - [SDLUIKitDelegate sharedAppDelegate].windowID = 0; - + /* this will also destroy the window */ + [SDLUIKitDelegate sharedAppDelegate].window = NULL; + [SDLUIKitDelegate sharedAppDelegate].uiwindow = nil; } /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/win32/SDL_ceddrawrender.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/win32/SDL_ceddrawrender.c Thu Jan 21 06:21:52 2010 +0000 @@ -391,7 +391,7 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_RendererInfo *info = &DDRAW_RenderDriver.info; - SDL_DisplayMode *mode = &SDL_CurrentDisplay.desktop_mode; + SDL_DisplayMode *mode = &SDL_CurrentDisplay->desktop_mode; if (data->ddraw) { int i; @@ -437,7 +437,7 @@ SDL_Renderer * DDRAW_CreateRenderer(SDL_Window * window, Uint32 flags) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_VideoData *videodata = (SDL_VideoData *) display->device->driverdata; SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; SDL_Renderer *renderer; @@ -479,7 +479,7 @@ renderer->DestroyTexture = DDRAW_DestroyTexture; renderer->DestroyRenderer = DDRAW_DestroyRenderer; renderer->info = DDRAW_RenderDriver.info; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = data; renderer->info.flags = SDL_RENDERER_ACCELERATED; @@ -568,8 +568,8 @@ { //TODO implement /*D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; data->pparams.BackBufferWidth = window->w; data->pparams.BackBufferHeight = window->h; @@ -587,8 +587,8 @@ DDRAW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { DDRAW_RenderData *renderdata = (DDRAW_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; Uint32 display_format = display->current_mode.format; DDRAW_TextureData *data; DDSURFACEDESC ddsd;
--- a/src/video/win32/SDL_d3drender.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/win32/SDL_d3drender.c Thu Jan 21 06:21:52 2010 +0000 @@ -427,7 +427,7 @@ SDL_Renderer * D3D_CreateRenderer(SDL_Window * window, Uint32 flags) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_VideoData *videodata = (SDL_VideoData *) display->device->driverdata; SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; SDL_Renderer *renderer; @@ -475,7 +475,7 @@ renderer->DestroyTexture = D3D_DestroyTexture; renderer->DestroyRenderer = D3D_DestroyRenderer; renderer->info = D3D_RenderDriver.info; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = data; renderer->info.flags = SDL_RENDERER_ACCELERATED; @@ -677,8 +677,8 @@ D3D_DisplayModeChanged(SDL_Renderer * renderer) { D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; data->pparams.BackBufferWidth = window->w; data->pparams.BackBufferHeight = window->h; @@ -695,8 +695,8 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; Uint32 display_format = display->current_mode.format; D3D_TextureData *data; HRESULT result; @@ -1398,8 +1398,8 @@ Uint32 format, void * pixels, int pitch) { D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; D3DSURFACE_DESC desc; LPDIRECT3DSURFACE9 backBuffer; LPDIRECT3DSURFACE9 surface;
--- a/src/video/win32/SDL_gapirender.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/win32/SDL_gapirender.c Thu Jan 21 06:21:52 2010 +0000 @@ -430,7 +430,7 @@ SDL_Renderer * GAPI_CreateRenderer(SDL_Window * window, Uint32 flags) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; SDL_DisplayMode *displayMode = &display->current_mode; SDL_Renderer *renderer; @@ -472,7 +472,7 @@ renderer->DestroyRenderer = GAPI_DestroyRenderer; renderer->info.name = GAPI_RenderDriver.info.name; renderer->info.flags = 0; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = data; /* Gapi provides only a framebuffer so lets use software implementation */
--- a/src/video/win32/SDL_gdirender.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/win32/SDL_gdirender.c Thu Jan 21 06:21:52 2010 +0000 @@ -207,7 +207,7 @@ renderer->DestroyTexture = GDI_DestroyTexture; renderer->DestroyRenderer = GDI_DestroyRenderer; renderer->info = GDI_RenderDriver.info; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = data; renderer->info.flags = SDL_RENDERER_ACCELERATED; @@ -274,7 +274,7 @@ GDI_DisplayModeChanged(SDL_Renderer * renderer) { GDI_RenderData *data = (GDI_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; int i, n; if (renderer->info.flags & SDL_RENDERER_SINGLEBUFFER) { @@ -378,8 +378,8 @@ GDI_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; GDI_TextureData *data; data = (GDI_TextureData *) SDL_calloc(1, sizeof(*data)); @@ -699,7 +699,7 @@ if (data->makedirty) { /* Get the smallest rectangle that contains everything */ - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; SDL_Rect rect; rect.x = 0; @@ -732,7 +732,7 @@ if (data->makedirty) { /* Get the smallest rectangle that contains everything */ - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; SDL_Rect clip, rect; clip.x = 0; @@ -787,7 +787,7 @@ int i, status = 1; if (data->makedirty) { - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; SDL_Rect clip, rect; clip.x = 0; @@ -844,7 +844,7 @@ int i, status = 1; if (data->makedirty) { - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; SDL_Rect clip, rect; clip.x = 0; @@ -943,8 +943,8 @@ Uint32 format, void * pixels, int pitch) { GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; struct { HBITMAP hbm; void *pixels; @@ -984,8 +984,8 @@ Uint32 format, const void * pixels, int pitch) { GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; struct { HBITMAP hbm; void *pixels;
--- a/src/video/win32/SDL_win32events.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/win32/SDL_win32events.c Thu Jan 21 06:21:52 2010 +0000 @@ -169,11 +169,9 @@ case WM_SHOWWINDOW: { if (wParam) { - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN, 0, - 0); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); } else { - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_HIDDEN, 0, - 0); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } } break; @@ -188,26 +186,25 @@ index = data->videodata->keyboard; keyboard = SDL_GetKeyboard(index); if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) { - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN, - 0, 0); - SDL_SendWindowEvent(data->windowID, + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0); #ifndef _WIN32_WCE /* WinCE misses IsZoomed() */ if (IsZoomed(hwnd)) { - SDL_SendWindowEvent(data->windowID, + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); } #endif - if (keyboard && keyboard->focus != data->windowID) { - SDL_SetKeyboardFocus(index, data->windowID); + if (keyboard && keyboard->focus != data->window) { + SDL_SetKeyboardFocus(index, data->window); } /* FIXME: Update keyboard state */ } else { - if (keyboard && keyboard->focus == data->windowID) { + if (keyboard && keyboard->focus == data->window) { SDL_SetKeyboardFocus(index, 0); } if (minimized) { - SDL_SendWindowEvent(data->windowID, + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } } @@ -272,9 +269,9 @@ GetCursorPos(&point); ScreenToClient(hwnd, &point); - SDL_GetWindowSize(data->windowID, &w, &h); + SDL_GetWindowSize(data->window, &w, &h); if (point.x >= 0 && point.y >= 0 && point.x < w && point.y < h) { - SDL_SetMouseFocus(index, data->windowID); + SDL_SetMouseFocus(index, data->window); } else { SDL_SetMouseFocus(index, 0); /* FIXME: Should we be doing anything else here? */ @@ -330,7 +327,7 @@ for (i = 0; i < SDL_GetNumMice(); ++i) { SDL_Mouse *mouse = SDL_GetMouse(i); - if (mouse->focus == data->windowID) { + if (mouse->focus == data->window) { SDL_SetMouseFocus(i, 0); } } @@ -490,7 +487,7 @@ BOOL menu; /* If we allow resizing, let the resize happen naturally */ - if (SDL_GetWindowFlags(data->windowID) & SDL_WINDOW_RESIZABLE) { + if (SDL_GetWindowFlags(data->window) & SDL_WINDOW_RESIZABLE) { returnCode = 0; break; } @@ -501,7 +498,7 @@ y = size.top; /* Calculate current size of our window */ - SDL_GetWindowSize(data->windowID, &w, &h); + SDL_GetWindowSize(data->window, &w, &h); size.top = 0; size.left = 0; size.bottom = h; @@ -551,7 +548,7 @@ ClientToScreen(hwnd, (LPPOINT) & rect); ClientToScreen(hwnd, (LPPOINT) & rect + 1); - window_flags = SDL_GetWindowFlags(data->windowID); + window_flags = SDL_GetWindowFlags(data->window); if ((window_flags & SDL_WINDOW_INPUT_GRABBED) && (window_flags & SDL_WINDOW_INPUT_FOCUS)) { ClipCursor(&rect); @@ -559,11 +556,11 @@ x = rect.left; y = rect.top; - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MOVED, x, y); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y); w = rect.right - rect.left; h = rect.bottom - rect.top; - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESIZED, w, + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w, h); } break; @@ -610,7 +607,7 @@ RECT rect; if (GetUpdateRect(hwnd, &rect, FALSE)) { ValidateRect(hwnd, &rect); - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_EXPOSED, + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0); } } @@ -637,7 +634,7 @@ case WM_CLOSE: { - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_CLOSE, 0, 0); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); } returnCode = 0; break;
--- a/src/video/win32/SDL_win32window.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/win32/SDL_win32window.c Thu Jan 21 06:21:52 2010 +0000 @@ -86,7 +86,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_WindowData *data; /* Allocate the window data */ @@ -95,7 +95,7 @@ SDL_OutOfMemory(); return -1; } - data->windowID = window->id; + data->window = window; data->hwnd = hwnd; data->hdc = GetDC(hwnd); data->created = created; @@ -167,7 +167,7 @@ if (GetFocus() == hwnd) { int index = data->videodata->keyboard; window->flags |= SDL_WINDOW_INPUT_FOCUS; - SDL_SetKeyboardFocus(index, data->windowID); + SDL_SetKeyboardFocus(index, data->window); if (window->flags & SDL_WINDOW_INPUT_GRABBED) { RECT rect; @@ -187,7 +187,7 @@ WIN_CreateWindow(_THIS, SDL_Window * window) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; RAWINPUTDEVICE Rid; AXIS TabX, TabY; LOGCONTEXTA lc; @@ -429,7 +429,7 @@ void WIN_SetWindowPosition(_THIS, SDL_Window * window) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; RECT rect; SDL_Rect bounds;
--- a/src/video/win32/SDL_win32window.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/win32/SDL_win32window.h Thu Jan 21 06:21:52 2010 +0000 @@ -26,7 +26,7 @@ typedef struct { - SDL_WindowID windowID; + SDL_Window *window; HWND hwnd; HDC hdc; WNDPROC wndproc;
--- a/src/video/x11/SDL_x11events.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/x11/SDL_x11events.c Thu Jan 21 06:21:52 2010 +0000 @@ -66,7 +66,7 @@ if (videodata && videodata->windowlist) { for (i = 0; i < videodata->numwindows; ++i) { if ((videodata->windowlist[i] != NULL) && - (videodata->windowlist[i]->window == xevent.xany.window)) { + (videodata->windowlist[i]->xwindow == xevent.xany.window)) { data = videodata->windowlist[i]; break; } @@ -97,7 +97,7 @@ /* FIXME: Should we reset data for all mice? */ for (i = 0; i < SDL_GetNumMice(); ++i) { SDL_Mouse *mouse = SDL_GetMouse(i); - SDL_SetMouseFocus(mouse->id, data->windowID); + SDL_SetMouseFocus(mouse->id, data->window); } #endif } @@ -132,7 +132,7 @@ #ifdef DEBUG_XEVENTS printf("FocusIn!\n"); #endif - SDL_SetKeyboardFocus(videodata->keyboard, data->windowID); + SDL_SetKeyboardFocus(videodata->keyboard, data->window); #ifdef X_HAVE_UTF8_STRING if (data->ic) { XSetICFocus(data->ic); @@ -232,9 +232,8 @@ #ifdef DEBUG_XEVENTS printf("UnmapNotify!\n"); #endif - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_HIDDEN, 0, 0); - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MINIMIZED, 0, - 0); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } break; @@ -243,9 +242,8 @@ #ifdef DEBUG_XEVENTS printf("MapNotify!\n"); #endif - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN, 0, 0); - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESTORED, 0, - 0); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0); } break; @@ -255,9 +253,9 @@ printf("ConfigureNotify! (resize: %dx%d)\n", xevent.xconfigure.width, xevent.xconfigure.height); #endif - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MOVED, + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, xevent.xconfigure.x, xevent.xconfigure.y); - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESIZED, + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, xevent.xconfigure.width, xevent.xconfigure.height); } @@ -268,8 +266,7 @@ if ((xevent.xclient.format == 32) && (xevent.xclient.data.l[0] == videodata->WM_DELETE_WINDOW)) { - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_CLOSE, 0, - 0); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); } } break; @@ -279,8 +276,7 @@ #ifdef DEBUG_XEVENTS printf("Expose (count = %d)\n", xevent.xexpose.count); #endif - SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_EXPOSED, 0, - 0); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0); } break;
--- a/src/video/x11/SDL_x11opengl.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/x11/SDL_x11opengl.c Thu Jan 21 06:21:52 2010 +0000 @@ -221,7 +221,7 @@ X11_GL_InitExtensions(_THIS) { Display *display = ((SDL_VideoData *) _this->driverdata)->display; - int screen = ((SDL_DisplayData *) SDL_CurrentDisplay.driverdata)->screen; + int screen = ((SDL_DisplayData *) SDL_CurrentDisplay->driverdata)->screen; XVisualInfo *vinfo; XSetWindowAttributes xattr; Window w; @@ -394,8 +394,7 @@ SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; int screen = - ((SDL_DisplayData *) SDL_GetDisplayFromWindow(window)-> - driverdata)->screen; + ((SDL_DisplayData *) window->display->driverdata)->screen; XWindowAttributes xattr; XVisualInfo v, *vinfo; int n; @@ -403,7 +402,7 @@ /* We do this to create a clean separation between X and GLX errors. */ XSync(display, False); - XGetWindowAttributes(display, data->window, &xattr); + XGetWindowAttributes(display, data->xwindow, &xattr); v.screen = screen; v.visualid = XVisualIDFromVisual(xattr.visual); vinfo = XGetVisualInfo(display, VisualScreenMask | VisualIDMask, &v, &n); @@ -492,7 +491,7 @@ { Display *display = ((SDL_VideoData *) _this->driverdata)->display; Window drawable = - (window ? ((SDL_WindowData *) window->driverdata)->window : None); + (window ? ((SDL_WindowData *) window->driverdata)->xwindow : None); GLXContext glx_context = (GLXContext) context; int status; @@ -560,7 +559,7 @@ SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; - _this->gl_data->glXSwapBuffers(display, data->window); + _this->gl_data->glXSwapBuffers(display, data->xwindow); } void
--- a/src/video/x11/SDL_x11render.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/x11/SDL_x11render.c Thu Jan 21 06:21:52 2010 +0000 @@ -93,7 +93,7 @@ Visual *visual; int depth; int scanline_pad; - Window window; + Window xwindow; Pixmap pixmaps[3]; int current_pixmap; Drawable drawable; @@ -153,7 +153,7 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_RendererInfo *info = &X11_RenderDriver.info; - SDL_DisplayMode *mode = &SDL_CurrentDisplay.desktop_mode; + SDL_DisplayMode *mode = &SDL_CurrentDisplay->desktop_mode; int i; info->texture_formats[info->num_texture_formats++] = mode->format; @@ -171,7 +171,7 @@ SDL_Renderer * X11_CreateRenderer(SDL_Window * window, Uint32 flags) { - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_VideoDisplay *display = window->display; SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; SDL_Renderer *renderer; @@ -199,7 +199,7 @@ data->visual = displaydata->visual; data->depth = displaydata->depth; data->scanline_pad = displaydata->scanline_pad; - data->window = windowdata->window; + data->xwindow = windowdata->xwindow; renderer->DisplayModeChanged = X11_DisplayModeChanged; renderer->CreateTexture = X11_CreateTexture; @@ -221,7 +221,7 @@ renderer->DestroyTexture = X11_DestroyTexture; renderer->DestroyRenderer = X11_DestroyRenderer; renderer->info = X11_RenderDriver.info; - renderer->window = window->id; + renderer->window = window; renderer->driverdata = data; renderer->info.flags = SDL_RENDERER_ACCELERATED; @@ -242,7 +242,7 @@ } for (i = 0; i < n; ++i) { data->pixmaps[i] = - XCreatePixmap(data->display, data->window, window->w, window->h, + XCreatePixmap(data->display, data->xwindow, window->w, window->h, displaydata->depth); if (data->pixmaps[i] == None) { X11_DestroyRenderer(renderer); @@ -254,7 +254,7 @@ data->drawable = data->pixmaps[0]; data->makedirty = SDL_TRUE; } else { - data->drawable = data->window; + data->drawable = data->xwindow; data->makedirty = SDL_FALSE; } data->current_pixmap = 0; @@ -272,7 +272,7 @@ /* Create the drawing context */ gcv.graphics_exposures = False; data->gc = - XCreateGC(data->display, data->window, GCGraphicsExposures, &gcv); + XCreateGC(data->display, data->xwindow, GCGraphicsExposures, &gcv); if (!data->gc) { X11_DestroyRenderer(renderer); SDL_SetError("XCreateGC() failed"); @@ -286,7 +286,7 @@ X11_DisplayModeChanged(SDL_Renderer * renderer) { X11_RenderData *data = (X11_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; int i, n; if (renderer->info.flags & SDL_RENDERER_SINGLEBUFFER) { @@ -306,7 +306,7 @@ } for (i = 0; i < n; ++i) { data->pixmaps[i] = - XCreatePixmap(data->display, data->window, window->w, window->h, + XCreatePixmap(data->display, data->xwindow, window->w, window->h, data->depth); if (data->pixmaps[i] == None) { SDL_SetError("XCreatePixmap() failed"); @@ -325,8 +325,8 @@ X11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { X11_RenderData *renderdata = (X11_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; X11_TextureData *data; int pitch_alignmask = ((renderdata->scanline_pad / 8) - 1); @@ -425,7 +425,7 @@ } } else { data->pixmap = - XCreatePixmap(renderdata->display, renderdata->window, texture->w, + XCreatePixmap(renderdata->display, renderdata->xwindow, texture->w, texture->h, renderdata->depth); if (data->pixmap == None) { X11_DestroyTexture(renderer, texture); @@ -607,7 +607,7 @@ int count) { X11_RenderData *data = (X11_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; unsigned long foreground; XPoint *xpoints, *xpoint; int i, xcount; @@ -657,7 +657,7 @@ int count) { X11_RenderData *data = (X11_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; SDL_Rect clip, rect; unsigned long foreground; XPoint *xpoints, *xpoint; @@ -795,7 +795,7 @@ X11_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count) { X11_RenderData *data = (X11_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; SDL_Rect clip, rect; unsigned long foreground; XRectangle *xrects, *xrect; @@ -840,7 +840,7 @@ X11_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count) { X11_RenderData *data = (X11_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_Window *window = renderer->window; SDL_Rect clip, rect; unsigned long foreground; XRectangle *xrects, *xrect; @@ -998,8 +998,8 @@ Uint32 format, void * pixels, int pitch) { X11_RenderData *data = (X11_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; Uint32 screen_format = display->current_mode.format; XImage *image; @@ -1019,8 +1019,8 @@ Uint32 format, const void * pixels, int pitch) { X11_RenderData *data = (X11_RenderData *) renderer->driverdata; - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_Window *window = renderer->window; + SDL_VideoDisplay *display = window->display; Uint32 screen_format = display->current_mode.format; XImage *image; void *image_pixels; @@ -1067,7 +1067,7 @@ if (!(renderer->info.flags & SDL_RENDERER_SINGLEBUFFER)) { for (dirty = data->dirty.list; dirty; dirty = dirty->next) { const SDL_Rect *rect = &dirty->rect; - XCopyArea(data->display, data->drawable, data->window, + XCopyArea(data->display, data->drawable, data->xwindow, data->gc, rect->x, rect->y, rect->w, rect->h, rect->x, rect->y); }
--- a/src/video/x11/SDL_x11window.c Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/x11/SDL_x11window.c Thu Jan 21 06:21:52 2010 +0000 @@ -45,7 +45,7 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_DisplayData *displaydata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; XWindowAttributes attr; XGetWindowAttributes(data->display, RootWindow(data->display, @@ -75,8 +75,8 @@ SDL_OutOfMemory(); return -1; } - data->windowID = window->id; - data->window = w; + data->window = window; + data->xwindow = w; #ifdef X_HAVE_UTF8_STRING if (SDL_X11_HAVE_UTF8) { data->ic = @@ -193,7 +193,7 @@ if (GetFocus() == hwnd) { int index = data->videodata->keyboard; window->flags |= SDL_WINDOW_INPUT_FOCUS; - SDL_SetKeyboardFocus(index, data->windowID); + SDL_SetKeyboardFocus(index, data->window); if (window->flags & SDL_WINDOW_INPUT_GRABBED) { RECT rect; @@ -215,7 +215,7 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_DisplayData *displaydata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; Visual *visual; int depth; XSetWindowAttributes xattr; @@ -782,7 +782,7 @@ status = XStringListToTextProperty(&title_locale, 1, &titleprop); SDL_free(title_locale); if (status) { - XSetTextProperty(display, data->window, &titleprop, XA_WM_NAME); + XSetTextProperty(display, data->xwindow, &titleprop, XA_WM_NAME); XFree(titleprop.value); } #ifdef X_HAVE_UTF8_STRING @@ -791,7 +791,7 @@ Xutf8TextListToTextProperty(display, (char **) &title, 1, XUTF8StringStyle, &titleprop); if (status == Success) { - XSetTextProperty(display, data->window, &titleprop, + XSetTextProperty(display, data->xwindow, &titleprop, _NET_WM_NAME); XFree(titleprop.value); } @@ -807,7 +807,7 @@ status = XStringListToTextProperty(&icon_locale, 1, &iconprop); SDL_free(icon_locale); if (status) { - XSetTextProperty(display, data->window, &iconprop, + XSetTextProperty(display, data->xwindow, &iconprop, XA_WM_ICON_NAME); XFree(iconprop.value); } @@ -817,7 +817,7 @@ Xutf8TextListToTextProperty(display, (char **) &icon, 1, XUTF8StringStyle, &iconprop); if (status == Success) { - XSetTextProperty(display, data->window, &iconprop, + XSetTextProperty(display, data->xwindow, &iconprop, _NET_WM_ICON_NAME); XFree(iconprop.value); } @@ -855,13 +855,13 @@ propdata[1] = icon->h; SDL_memcpy(&propdata[2], surface->pixels, surface->h * surface->pitch); - XChangeProperty(display, data->window, _NET_WM_ICON, XA_CARDINAL, + XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) propdata, propsize); } SDL_FreeSurface(surface); } else { - XDeleteProperty(display, data->window, _NET_WM_ICON); + XDeleteProperty(display, data->xwindow, _NET_WM_ICON); } } @@ -870,7 +870,7 @@ { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_DisplayData *displaydata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; Display *display = data->videodata->display; int x, y; @@ -888,7 +888,7 @@ } else { y = window->y; } - XMoveWindow(display, data->window, x, y); + XMoveWindow(display, data->xwindow, x, y); } void @@ -897,7 +897,7 @@ SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; - XResizeWindow(display, data->window, window->w, window->h); + XResizeWindow(display, data->xwindow, window->w, window->h); } void @@ -906,7 +906,7 @@ SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; - XMapRaised(display, data->window); + XMapRaised(display, data->xwindow); } void @@ -915,7 +915,7 @@ SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; - XUnmapWindow(display, data->window); + XUnmapWindow(display, data->xwindow); } void @@ -924,7 +924,7 @@ SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; - XRaiseWindow(display, data->window); + XRaiseWindow(display, data->xwindow); } static void @@ -932,7 +932,7 @@ { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_DisplayData *displaydata = - (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; + (SDL_DisplayData *) window->display->driverdata; Display *display = data->videodata->display; Atom _NET_WM_STATE = XInternAtom(display, "_NET_WM_STATE", False); Atom _NET_WM_STATE_MAXIMIZED_VERT = @@ -942,7 +942,7 @@ XEvent e; e.xany.type = ClientMessage; - e.xany.window = data->window; + e.xany.window = data->xwindow; e.xclient.message_type = _NET_WM_STATE; e.xclient.format = 32; e.xclient.data.l[0] = @@ -986,8 +986,8 @@ /* Try to grab the mouse */ for (;;) { int result = - XGrabPointer(display, data->window, True, 0, GrabModeAsync, - GrabModeAsync, data->window, None, CurrentTime); + XGrabPointer(display, data->xwindow, True, 0, GrabModeAsync, + GrabModeAsync, data->xwindow, None, CurrentTime); if (result == GrabSuccess) { break; } @@ -995,10 +995,10 @@ } /* Raise the window if we grab the mouse */ - XRaiseWindow(display, data->window); + XRaiseWindow(display, data->xwindow); /* Now grab the keyboard */ - XGrabKeyboard(display, data->window, True, GrabModeAsync, + XGrabKeyboard(display, data->xwindow, True, GrabModeAsync, GrabModeAsync, CurrentTime); } else { XUngrabPointer(display, CurrentTime); @@ -1021,7 +1021,7 @@ if (windowlist) { for (i = 0; i < numwindows; ++i) { - if (windowlist[i] && (windowlist[i]->windowID == window->id)) { + if (windowlist[i] && (windowlist[i]->window == window)) { windowlist[i] = windowlist[numwindows - 1]; windowlist[numwindows - 1] = NULL; videodata->numwindows--; @@ -1035,7 +1035,7 @@ } #endif if (data->created) { - XDestroyWindow(display, data->window); + XDestroyWindow(display, data->xwindow); } SDL_free(data); }
--- a/src/video/x11/SDL_x11window.h Thu Jan 21 05:49:41 2010 +0000 +++ b/src/video/x11/SDL_x11window.h Thu Jan 21 06:21:52 2010 +0000 @@ -26,8 +26,8 @@ typedef struct { - SDL_WindowID windowID; - Window window; + SDL_Window *window; + Window xwindow; XIC ic; SDL_bool created; struct SDL_VideoData *videodata;
--- a/test/automated/render/render.c Thu Jan 21 05:49:41 2010 +0000 +++ b/test/automated/render/render.c Thu Jan 21 06:21:52 2010 +0000 @@ -43,7 +43,7 @@ static int render_testBlit (void); static int render_testBlitColour (void); static int render_testBlitAlpha (void); -static int render_testBlitBlendMode( SDL_TextureID tface, int mode ); +static int render_testBlitBlendMode( SDL_Texture * tface, int mode ); static int render_testBlitBlend (void); @@ -225,10 +225,10 @@ /** * @brief Loads the test face. */ -static SDL_TextureID render_loadTestFace (void) +static SDL_Texture * render_loadTestFace (void) { SDL_Surface *face; - SDL_TextureID tface; + SDL_Texture *tface; /* Create face surface. */ face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, @@ -261,7 +261,7 @@ { int fail; int ret; - SDL_TextureID tface; + SDL_Texture *tface; Uint8 r, g, b; /* Get test face. */ @@ -296,7 +296,7 @@ { int fail; int ret; - SDL_TextureID tface; + SDL_Texture *tface; Uint8 a; /* Get test face. */ @@ -606,7 +606,7 @@ { int ret; SDL_Rect rect; - SDL_TextureID tface; + SDL_Texture *tface; int i, j, ni, nj; /* Clear surface. */ @@ -658,7 +658,7 @@ { int ret; SDL_Rect rect; - SDL_TextureID tface; + SDL_Texture *tface; int i, j, ni, nj; /* Clear surface. */ @@ -716,7 +716,7 @@ { int ret; SDL_Rect rect; - SDL_TextureID tface; + SDL_Texture *tface; int i, j, ni, nj; /* Clear surface. */ @@ -774,7 +774,7 @@ /** * @brief Tests a blend mode. */ -static int render_testBlitBlendMode( SDL_TextureID tface, int mode ) +static int render_testBlitBlendMode( SDL_Texture * tface, int mode ) { int ret; int i, j, ni, nj; @@ -820,7 +820,7 @@ { int ret; SDL_Rect rect; - SDL_TextureID tface; + SDL_Texture *tface; int i, j, ni, nj; int mode; @@ -1004,7 +1004,7 @@ int ret; const char *driver, *str; char msg[256]; - SDL_WindowID wid; + SDL_Window *w; SDL_RendererInfo renderer; /* Initializes the SDL subsystems. */ @@ -1054,12 +1054,12 @@ if (SDL_ATassert( "SDL_GetCurrentVideoDriver", SDL_strcmp(driver,str)==0)) goto err_cleanup; /* Create window. */ - wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + w = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 80, 60, SDL_WINDOW_SHOWN ); - if (SDL_ATassert( "SDL_CreateWindow", wid!=0 )) + if (SDL_ATassert( "SDL_CreateWindow", w!=NULL )) goto err_cleanup; /* Check title. */ - str = SDL_GetWindowTitle( wid ); + str = SDL_GetWindowTitle( w ); if (SDL_ATassert( "SDL_GetWindowTitle", SDL_strcmp(msg,str)==0)) goto err_cleanup; /* Get renderers. */ @@ -1072,10 +1072,10 @@ /* We have to recreate window each time, because opengl and opengles renderers */ /* both add SDL_WINDOW_OPENGL flag for window, that was last used */ - SDL_DestroyWindow(wid); - wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + SDL_DestroyWindow(w); + w = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 80, 60, SDL_WINDOW_SHOWN ); - if (SDL_ATassert( "SDL_CreateWindow", wid!=0 )) + if (SDL_ATassert( "SDL_CreateWindow", w!=NULL )) goto err_cleanup; /* Get renderer info. */ @@ -1089,7 +1089,7 @@ SDL_ATbegin( msg ); /* Set renderer. */ - ret = SDL_CreateRenderer( wid, j, 0 ); + ret = SDL_CreateRenderer( w, j, 0 ); if (SDL_ATassert( "SDL_CreateRenderer", ret==0 )) goto err_cleanup;
--- a/test/common.c Thu Jan 21 05:49:41 2010 +0000 +++ b/test/common.c Thu Jan 21 06:21:52 2010 +0000 @@ -761,7 +761,7 @@ fullscreen_mode.refresh_rate = state->refresh_rate; state->windows = - (SDL_WindowID *) SDL_malloc(state->num_windows * + (SDL_Window **) SDL_malloc(state->num_windows * sizeof(*state->windows)); if (!state->windows) { fprintf(stderr, "Out of memory!\n");
--- a/test/common.h Thu Jan 21 05:49:41 2010 +0000 +++ b/test/common.h Thu Jan 21 06:21:52 2010 +0000 @@ -32,7 +32,7 @@ int depth; int refresh_rate; int num_windows; - SDL_WindowID *windows; + SDL_Window **windows; /* Renderer info */ const char *renderdriver;
--- a/test/testdraw2.c Thu Jan 21 05:49:41 2010 +0000 +++ b/test/testdraw2.c Thu Jan 21 06:21:52 2010 +0000 @@ -19,7 +19,7 @@ static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE; void -DrawPoints(SDL_WindowID window) +DrawPoints(SDL_Window * window) { int i; int x, y; @@ -64,7 +64,7 @@ } void -DrawLines(SDL_WindowID window) +DrawLines(SDL_Window * window) { int i; int x1, y1, x2, y2; @@ -118,7 +118,7 @@ } void -DrawRects(SDL_WindowID window) +DrawRects(SDL_Window * window) { int i; SDL_Rect rect; @@ -249,7 +249,7 @@ case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_EXPOSED: - SDL_SelectRenderer(event.window.windowID); + SDL_SelectRenderer(SDL_GetWindowFromID(event.window.windowID)); SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); SDL_RenderClear(); break;
--- a/test/testintersections.c Thu Jan 21 05:49:41 2010 +0000 +++ b/test/testintersections.c Thu Jan 21 06:21:52 2010 +0000 @@ -20,7 +20,7 @@ static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE; void -DrawPoints(SDL_WindowID window) +DrawPoints(SDL_Window * window) { int i; int x, y; @@ -86,7 +86,7 @@ void -DrawLines(SDL_WindowID window) +DrawLines(SDL_Window * window) { int i; int x1, y1, x2, y2; @@ -139,7 +139,7 @@ } static void -DrawRects(SDL_WindowID window) +DrawRects(SDL_Window * window) { int i; int window_w, window_h; @@ -156,7 +156,7 @@ } static void -DrawRectLineIntersections(SDL_WindowID window) +DrawRectLineIntersections(SDL_Window * window) { int i, j, window_w, window_h; @@ -186,7 +186,7 @@ } static void -DrawRectRectIntersections(SDL_WindowID window) +DrawRectRectIntersections(SDL_Window * window) { int i, j; @@ -324,7 +324,7 @@ case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_EXPOSED: - SDL_SelectRenderer(event.window.windowID); + SDL_SelectRenderer(SDL_GetWindowFromID(event.window.windowID)); SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); SDL_RenderClear(); break;
--- a/test/testnative.c Thu Jan 21 05:49:41 2010 +0000 +++ b/test/testnative.c Thu Jan 21 06:21:52 2010 +0000 @@ -36,11 +36,11 @@ exit(rc); } -SDL_TextureID -LoadSprite(SDL_WindowID window, char *file) +SDL_Texture * +LoadSprite(SDL_Window * window, char *file) { SDL_Surface *temp; - SDL_TextureID sprite; + SDL_Texture *sprite; /* Load the sprite image */ temp = SDL_LoadBMP(file); @@ -69,7 +69,7 @@ } void -MoveSprites(SDL_WindowID window, SDL_TextureID sprite) +MoveSprites(SDL_Window * window, SDL_Texture * sprite) { int i, n; int window_w, window_h; @@ -113,8 +113,8 @@ { int i, done; const char *driver; - SDL_WindowID window; - SDL_TextureID sprite; + SDL_Window *window; + SDL_Texture *sprite; int window_w, window_h; int sprite_w, sprite_h; SDL_Event event;
--- a/test/testsprite2.c Thu Jan 21 05:49:41 2010 +0000 +++ b/test/testsprite2.c Thu Jan 21 06:21:52 2010 +0000 @@ -11,7 +11,7 @@ static CommonState *state; static int num_sprites; -static SDL_TextureID *sprites; +static SDL_Texture **sprites; static SDL_bool cycle_color; static SDL_bool cycle_alpha; static int cycle_direction = 1; @@ -98,7 +98,7 @@ } void -MoveSprites(SDL_WindowID window, SDL_TextureID sprite) +MoveSprites(SDL_Window * window, SDL_Texture * sprite) { int i, n; int window_w, window_h; @@ -294,7 +294,7 @@ /* Create the windows, initialize the renderers, and load the textures */ sprites = - (SDL_TextureID *) SDL_malloc(state->num_windows * sizeof(*sprites)); + (SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites)); if (!sprites) { fprintf(stderr, "Out of memory!\n"); quit(2); @@ -346,7 +346,7 @@ case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_EXPOSED: - SDL_SelectRenderer(event.window.windowID); + SDL_SelectRenderer(SDL_GetWindowFromID(event.window.windowID)); SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); SDL_RenderClear(); break;
--- a/test/testspriteminimal.c Thu Jan 21 05:49:41 2010 +0000 +++ b/test/testspriteminimal.c Thu Jan 21 06:21:52 2010 +0000 @@ -12,7 +12,7 @@ #define NUM_SPRITES 100 #define MAX_SPEED 1 -static SDL_TextureID sprite; +static SDL_Texture *sprite; static SDL_Rect positions[NUM_SPRITES]; static SDL_Rect velocities[NUM_SPRITES]; static int sprite_w, sprite_h; @@ -78,7 +78,7 @@ } void -MoveSprites(SDL_WindowID window, SDL_TextureID sprite) +MoveSprites(SDL_Window * window, SDL_Texture * sprite) { int i; int window_w = WINDOW_WIDTH; @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) { - SDL_WindowID window; + SDL_Window *window; int i, done; SDL_Event event;