Re-added a simplified version of SDL_SetWindowShape()

In order to handle mouse click transparency this needs to be implemented inside SDL
This commit is contained in:
Sam Lantinga
2024-02-09 07:09:59 -08:00
parent 1143bdc351
commit f6b92c9b88
33 changed files with 128676 additions and 59 deletions

View File

@@ -141,6 +141,8 @@ extern DECLSPEC void SDLCALL SDL_UnlockProperties(SDL_PropertiesID props);
* Set a property on a set of properties with a cleanup function that is
* called when the property is deleted
*
* The cleanup function is also called if setting the property fails for any reason.
*
* \param props the properties to modify
* \param name the name of the property to modify
* \param value the new value of the property, or NULL to delete the property

View File

@@ -1028,6 +1028,8 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowParent(SDL_Window *window);
*
* The following read-only properties are provided by SDL:
*
* - `SDL_PROP_WINDOW_SHAPE_POINTER`: the surface associated with a shaped window
*
* On Android:
*
* - `SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER`: the ANativeWindow associated
@@ -1120,6 +1122,7 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowParent(SDL_Window *window);
*/
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window *window);
#define SDL_PROP_WINDOW_SHAPE_POINTER "SDL.window.shape"
#define SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER "SDL.window.android.window"
#define SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER "SDL.window.android.surface"
#define SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER "SDL.window.uikit.window"
@@ -2119,6 +2122,22 @@ typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
*/
extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *callback_data);
/**
* Set the shape of a transparent window.
*
* This sets the alpha channel of a transparent window and any fully transparent areas are also transparent to mouse clicks. If you are using something besides the SDL render API, then you are responsible for setting the alpha channel of the window yourself.
*
* The window must have been created with the SDL_WINDOW_TRANSPARENT flag.
*
* \param window the window
* \param shape the surface representing the shape of the window, or NULL to remove any current shape
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape);
/**
* Request a window to demand attention from the user.
*