changeset 4801:506a9165491b

Added #define's for error codes returned from SDL shaped-window API.
author Eli Gottlieb <eligottlieb@gmail.com>
date Sun, 18 Jul 2010 22:24:52 -0400
parents 6d4be626225f
children f14a8c05f5bb
files include/SDL_shape.h src/video/SDL_shape.c
diffstat 2 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/include/SDL_shape.h	Sun Jul 18 22:17:52 2010 -0400
+++ b/include/SDL_shape.h	Sun Jul 18 22:24:52 2010 -0400
@@ -42,6 +42,10 @@
  * Header file for the shaped window API.
  */
 
+#define SDL_NONSHAPEABLE_WINDOW -1
+#define SDL_INVALID_SHAPE_ARGUMENT -2
+#define SDL_WINDOW_LACKS_SHAPE -3
+
 /**
  *  \brief Create a window that can be shaped with the specified position, dimensions, and flags.
  *  
@@ -58,7 +62,7 @@
  *               ::SDL_WINDOW_MAXIMIZED,  ::SDL_WINDOW_MINIMIZED,
  *		 ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
  *  
- *  \return The id of the window created, or zero if window creation failed.
+ *  \return The window created, or NULL if window creation failed.
  *  
  *  \sa SDL_DestroyWindow()
  */
@@ -102,8 +106,8 @@
  * \param shape A surface encoding the desired shape for the window.
  * \param shapeMode The parameters to set for the shaped window.
  *
- * \return 0 on success, -1 on invalid an invalid shape argument, or -2 if the SDL_Window* given does not reference
- *         a valid shaped window.
+ * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
+ *           if the SDL_Window* given does not reference a valid shaped window.
  *
  * \sa SDL_WindowShapeMode
  * \sa SDL_GetShapedWindowMode.
@@ -117,8 +121,8 @@
  * \param shapeMode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
  *
  * \return 0 if the window has a shape and, provided shapeMode was not NULL, shapeMode has been filled with the mode
- *           data, -1 if the SDL_Window given is not a shaped window, or -2 if the SDL_Window* given is a shapeable
- *           window currently lacking a shape.
+ *           data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
+ *           the SDL_Window* given is a shapeable window currently lacking a shape.
  *
  * \sa SDL_WindowShapeMode
  * \sa SDL_SetWindowShape
--- a/src/video/SDL_shape.c	Sun Jul 18 22:17:52 2010 -0400
+++ b/src/video/SDL_shape.c	Sun Jul 18 22:24:52 2010 -0400
@@ -82,10 +82,10 @@
 	int result;
 	if(window == NULL || !SDL_IsShapedWindow(window))
 		//The window given was not a shapeable window.
-		return -2;
+		return SDL_NONSHAPEABLE_WINDOW;
 	if(shape == NULL)
 		//Invalid shape argument.
-		return -1;
+		return SDL_INVALID_SHAPE_ARGUMENT;
 	
 	if(shapeMode != NULL) {
 		switch(shapeMode->mode) {
@@ -123,7 +123,7 @@
 				return 0;
 			else
 				//The window given is shapeable but lacks a shape.
-				return -2;
+				return SDL_WINDOW_LACKS_SHAPE;
 		}
 		else {
 			if(window->shaper->alphacutoff != 1) {
@@ -137,5 +137,5 @@
 	}
 	else
 		//The window given is not a valid shapeable window.
-		return -1;
+		return SDL_NONSHAPEABLE_WINDOW;
 }