Added #define's for error codes returned from SDL shaped-window API.
authorEli Gottlieb <eligottlieb@gmail.com>
Sun, 18 Jul 2010 22:24:52 -0400
changeset 4801506a9165491b
parent 4800 6d4be626225f
child 4802 f14a8c05f5bb
Added #define's for error codes returned from SDL shaped-window API.
include/SDL_shape.h
src/video/SDL_shape.c
     1.1 --- a/include/SDL_shape.h	Sun Jul 18 22:17:52 2010 -0400
     1.2 +++ b/include/SDL_shape.h	Sun Jul 18 22:24:52 2010 -0400
     1.3 @@ -42,6 +42,10 @@
     1.4   * Header file for the shaped window API.
     1.5   */
     1.6  
     1.7 +#define SDL_NONSHAPEABLE_WINDOW -1
     1.8 +#define SDL_INVALID_SHAPE_ARGUMENT -2
     1.9 +#define SDL_WINDOW_LACKS_SHAPE -3
    1.10 +
    1.11  /**
    1.12   *  \brief Create a window that can be shaped with the specified position, dimensions, and flags.
    1.13   *  
    1.14 @@ -58,7 +62,7 @@
    1.15   *               ::SDL_WINDOW_MAXIMIZED,  ::SDL_WINDOW_MINIMIZED,
    1.16   *		 ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
    1.17   *  
    1.18 - *  \return The id of the window created, or zero if window creation failed.
    1.19 + *  \return The window created, or NULL if window creation failed.
    1.20   *  
    1.21   *  \sa SDL_DestroyWindow()
    1.22   */
    1.23 @@ -102,8 +106,8 @@
    1.24   * \param shape A surface encoding the desired shape for the window.
    1.25   * \param shapeMode The parameters to set for the shaped window.
    1.26   *
    1.27 - * \return 0 on success, -1 on invalid an invalid shape argument, or -2 if the SDL_Window* given does not reference
    1.28 - *         a valid shaped window.
    1.29 + * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
    1.30 + *           if the SDL_Window* given does not reference a valid shaped window.
    1.31   *
    1.32   * \sa SDL_WindowShapeMode
    1.33   * \sa SDL_GetShapedWindowMode.
    1.34 @@ -117,8 +121,8 @@
    1.35   * \param shapeMode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
    1.36   *
    1.37   * \return 0 if the window has a shape and, provided shapeMode was not NULL, shapeMode has been filled with the mode
    1.38 - *           data, -1 if the SDL_Window given is not a shaped window, or -2 if the SDL_Window* given is a shapeable
    1.39 - *           window currently lacking a shape.
    1.40 + *           data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
    1.41 + *           the SDL_Window* given is a shapeable window currently lacking a shape.
    1.42   *
    1.43   * \sa SDL_WindowShapeMode
    1.44   * \sa SDL_SetWindowShape
     2.1 --- a/src/video/SDL_shape.c	Sun Jul 18 22:17:52 2010 -0400
     2.2 +++ b/src/video/SDL_shape.c	Sun Jul 18 22:24:52 2010 -0400
     2.3 @@ -82,10 +82,10 @@
     2.4  	int result;
     2.5  	if(window == NULL || !SDL_IsShapedWindow(window))
     2.6  		//The window given was not a shapeable window.
     2.7 -		return -2;
     2.8 +		return SDL_NONSHAPEABLE_WINDOW;
     2.9  	if(shape == NULL)
    2.10  		//Invalid shape argument.
    2.11 -		return -1;
    2.12 +		return SDL_INVALID_SHAPE_ARGUMENT;
    2.13  	
    2.14  	if(shapeMode != NULL) {
    2.15  		switch(shapeMode->mode) {
    2.16 @@ -123,7 +123,7 @@
    2.17  				return 0;
    2.18  			else
    2.19  				//The window given is shapeable but lacks a shape.
    2.20 -				return -2;
    2.21 +				return SDL_WINDOW_LACKS_SHAPE;
    2.22  		}
    2.23  		else {
    2.24  			if(window->shaper->alphacutoff != 1) {
    2.25 @@ -137,5 +137,5 @@
    2.26  	}
    2.27  	else
    2.28  		//The window given is not a valid shapeable window.
    2.29 -		return -1;
    2.30 +		return SDL_NONSHAPEABLE_WINDOW;
    2.31  }