diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj
index 3d6451e2fbe6e5..6cae7db9582cd1 100644
--- a/VisualC-GDK/SDL/SDL.vcxproj
+++ b/VisualC-GDK/SDL/SDL.vcxproj
@@ -342,7 +342,6 @@
-
@@ -523,7 +522,6 @@
-
@@ -538,7 +536,6 @@
-
@@ -774,7 +771,6 @@
-
@@ -790,7 +786,6 @@
-
diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters
index 2396f04b6ee46a..5b5c77da102e2f 100644
--- a/VisualC-GDK/SDL/SDL.vcxproj.filters
+++ b/VisualC-GDK/SDL/SDL.vcxproj.filters
@@ -339,9 +339,6 @@
API Headers
-
- API Headers
-
API Headers
@@ -600,9 +597,6 @@
video
-
- video
-
video
@@ -660,9 +654,6 @@
video\windows
-
- video\windows
-
video\windows
@@ -1195,9 +1186,6 @@
video
-
- video
-
video
@@ -1255,9 +1243,6 @@
video\windows
-
- video\windows
-
video\windows
diff --git a/VisualC-WinRT/SDL-UWP.vcxproj b/VisualC-WinRT/SDL-UWP.vcxproj
index 2fad76fd31f82e..9c2d387d23cfad 100644
--- a/VisualC-WinRT/SDL-UWP.vcxproj
+++ b/VisualC-WinRT/SDL-UWP.vcxproj
@@ -80,7 +80,6 @@
-
@@ -180,7 +179,6 @@
-
@@ -520,7 +518,6 @@
-
diff --git a/VisualC-WinRT/SDL-UWP.vcxproj.filters b/VisualC-WinRT/SDL-UWP.vcxproj.filters
index 747841ba1b484a..586b0d2a5d2a1d 100644
--- a/VisualC-WinRT/SDL-UWP.vcxproj.filters
+++ b/VisualC-WinRT/SDL-UWP.vcxproj.filters
@@ -138,9 +138,6 @@
Header Files
-
- Header Files
-
Header Files
@@ -405,9 +402,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -807,9 +801,6 @@
Source Files
-
- Source Files
-
Source Files
diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj
index 0dee2d50069f12..528a3fba58ee59 100644
--- a/VisualC/SDL/SDL.vcxproj
+++ b/VisualC/SDL/SDL.vcxproj
@@ -293,7 +293,6 @@
-
@@ -451,7 +450,6 @@
-
@@ -466,7 +464,6 @@
-
@@ -650,7 +647,6 @@
-
@@ -667,7 +663,6 @@
-
diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters
index fbaadb802a5c5c..8a79f83f0ca790 100644
--- a/VisualC/SDL/SDL.vcxproj.filters
+++ b/VisualC/SDL/SDL.vcxproj.filters
@@ -333,9 +333,6 @@
API Headers
-
- API Headers
-
API Headers
@@ -594,9 +591,6 @@
video
-
- video
-
video
@@ -654,9 +648,6 @@
video\windows
-
- video\windows
-
video\windows
@@ -1176,9 +1167,6 @@
video
-
- video
-
video
@@ -1239,9 +1227,6 @@
video\windows
-
- video\windows
-
video\windows
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 0601988fcfce24..ff1e8f9763ae01 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -1084,6 +1084,10 @@ The following functions have been removed:
* SDL_SensorGetDeviceType() - replaced with SDL_GetSensorInstanceType()
* SDL_UnlockSensors()
+## SDL_shape.h
+
+This header has been removed. You can create a window with the SDL_WINDOW_TRANSPARENT flag and then render using the alpha channel to achieve a similar effect. You can see an example of this in test/testshape.c
+
## SDL_stdinc.h
The standard C headers like stdio.h and stdlib.h are no longer included, you should include them directly in your project if you use non-SDL C runtime functions.
diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h
index 6db0e69d47e588..422c6cc4a52e75 100644
--- a/include/SDL3/SDL.h
+++ b/include/SDL3/SDL.h
@@ -68,7 +68,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff --git a/include/SDL3/SDL_shape.h b/include/SDL3/SDL_shape.h
deleted file mode 100644
index 92d7db7a5cbb42..00000000000000
--- a/include/SDL3/SDL_shape.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2023 Sam Lantinga
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_shape_h_
-#define SDL_shape_h_
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** \file SDL_shape.h
- *
- * Header file for the shaped window API.
- */
-
-#define SDL_NONSHAPEABLE_WINDOW -1
-#define SDL_INVALID_SHAPE_ARGUMENT -2
-#define SDL_WINDOW_LACKS_SHAPE -3
-
-/**
- * Create a window that can be shaped with the specified dimensions and flags.
- *
- * \param title The title of the window, in UTF-8 encoding.
- * \param w The width of the window.
- * \param h The height of the window.
- * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with
- * any of the following: ::SDL_WINDOW_OPENGL,
- * ::SDL_WINDOW_MOUSE_GRABBED, ::SDL_WINDOW_HIDDEN,
- * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
- * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_BORDERLESS is always set,
- * and ::SDL_WINDOW_FULLSCREEN is always unset.
- * \returns the window created, or NULL if window creation failed.
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_DestroyWindow
- */
-extern DECLSPEC SDL_Window *SDLCALL SDL_CreateShapedWindow(const char *title, int w, int h, Uint32 flags);
-
-/**
- * Return whether the given window is a shaped window.
- *
- * \param window The window to query for being shaped.
- * \returns SDL_TRUE if the window is a window that can be shaped, SDL_FALSE
- * if the window is unshaped or NULL.
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_CreateShapedWindow
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
-
-/** An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
-typedef enum {
- /** The default mode, a binarized alpha cutoff of 1. */
- ShapeModeDefault,
- /** A binarized alpha cutoff with a given integer value. */
- ShapeModeBinarizeAlpha,
- /** A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
- ShapeModeReverseBinarizeAlpha,
- /** A color key is applied. */
- ShapeModeColorKey
-} WindowShapeMode;
-
-#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
-
-/** A union containing parameters for shaped windows. */
-typedef union {
- /** A cutoff alpha value for binarization of the window shape's alpha channel. */
- Uint8 binarizationCutoff;
- SDL_Color colorKey;
-} SDL_WindowShapeParams;
-
-/** A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
-typedef struct SDL_WindowShapeMode {
- /** The mode of these window-shape parameters. */
- WindowShapeMode mode;
- /** Window-shape parameters. */
- SDL_WindowShapeParams parameters;
-} SDL_WindowShapeMode;
-
-/**
- * Set the shape and parameters of a shaped window.
- *
- * \param window The shaped window whose parameters should be set.
- * \param shape A surface encoding the desired shape for the window.
- * \param shape_mode The parameters to set for the shaped window.
- * \returns 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape
- * argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does
- * not reference a valid shaped window.
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_WindowShapeMode
- * \sa SDL_GetShapedWindowMode
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
-
-/**
- * Get the shape parameters of a shaped window.
- *
- * \param window The shaped window whose parameters should be retrieved.
- * \param shape_mode An empty shape-mode structure to fill, or NULL to check
- * whether the window has a shape.
- * \returns 0 if the window has a shape and, provided shape_mode was not NULL,
- * shape_mode has been filled with the mode 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.
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_WindowShapeMode
- * \sa SDL_SetWindowShape
- */
-extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include
-
-#endif /* SDL_shape_h_ */
diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
index 14bc32ae91eacf..0cb08454f4315d 100644
--- a/src/dynapi/SDL_dynapi.sym
+++ b/src/dynapi/SDL_dynapi.sym
@@ -57,7 +57,6 @@ SDL3_0.0.0 {
SDL_CreateRWLock;
SDL_CreateRenderer;
SDL_CreateSemaphore;
- SDL_CreateShapedWindow;
SDL_CreateSoftwareRenderer;
SDL_CreateSurface;
SDL_CreateSurfaceFrom;
@@ -314,7 +313,6 @@ SDL3_0.0.0 {
SDL_GetSensorNonPortableType;
SDL_GetSensorType;
SDL_GetSensors;
- SDL_GetShapedWindowMode;
SDL_GetSurfaceAlphaMod;
SDL_GetSurfaceBlendMode;
SDL_GetSurfaceClipRect;
@@ -420,7 +418,6 @@ SDL3_0.0.0 {
SDL_IsDeXMode;
SDL_IsGamepad;
SDL_IsJoystickVirtual;
- SDL_IsShapedWindow;
SDL_IsTablet;
SDL_JoystickConnected;
SDL_JoystickEventsEnabled;
@@ -612,7 +609,6 @@ SDL3_0.0.0 {
SDL_SetWindowOpacity;
SDL_SetWindowPosition;
SDL_SetWindowResizable;
- SDL_SetWindowShape;
SDL_SetWindowSize;
SDL_SetWindowTitle;
SDL_SetWindowsMessageHook;
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index 83ec2ca332f7d3..fcd77a293013d4 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -81,7 +81,6 @@
#define SDL_CreateRWLock SDL_CreateRWLock_REAL
#define SDL_CreateRenderer SDL_CreateRenderer_REAL
#define SDL_CreateSemaphore SDL_CreateSemaphore_REAL
-#define SDL_CreateShapedWindow SDL_CreateShapedWindow_REAL
#define SDL_CreateSoftwareRenderer SDL_CreateSoftwareRenderer_REAL
#define SDL_CreateSurface SDL_CreateSurface_REAL
#define SDL_CreateSurfaceFrom SDL_CreateSurfaceFrom_REAL
@@ -338,7 +337,6 @@
#define SDL_GetSensorNonPortableType SDL_GetSensorNonPortableType_REAL
#define SDL_GetSensorType SDL_GetSensorType_REAL
#define SDL_GetSensors SDL_GetSensors_REAL
-#define SDL_GetShapedWindowMode SDL_GetShapedWindowMode_REAL
#define SDL_GetSurfaceAlphaMod SDL_GetSurfaceAlphaMod_REAL
#define SDL_GetSurfaceBlendMode SDL_GetSurfaceBlendMode_REAL
#define SDL_GetSurfaceClipRect SDL_GetSurfaceClipRect_REAL
@@ -444,7 +442,6 @@
#define SDL_IsDeXMode SDL_IsDeXMode_REAL
#define SDL_IsGamepad SDL_IsGamepad_REAL
#define SDL_IsJoystickVirtual SDL_IsJoystickVirtual_REAL
-#define SDL_IsShapedWindow SDL_IsShapedWindow_REAL
#define SDL_IsTablet SDL_IsTablet_REAL
#define SDL_JoystickConnected SDL_JoystickConnected_REAL
#define SDL_JoystickEventsEnabled SDL_JoystickEventsEnabled_REAL
@@ -635,7 +632,6 @@
#define SDL_SetWindowOpacity SDL_SetWindowOpacity_REAL
#define SDL_SetWindowPosition SDL_SetWindowPosition_REAL
#define SDL_SetWindowResizable SDL_SetWindowResizable_REAL
-#define SDL_SetWindowShape SDL_SetWindowShape_REAL
#define SDL_SetWindowSize SDL_SetWindowSize_REAL
#define SDL_SetWindowTitle SDL_SetWindowTitle_REAL
#define SDL_SetWindowsMessageHook SDL_SetWindowsMessageHook_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 7ddba0e8c8c2a7..4149b05cd805b2 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -147,7 +147,6 @@ SDL_DYNAPI_PROC(SDL_RWops*,SDL_CreateRW,(void),(),return)
SDL_DYNAPI_PROC(SDL_RWLock*,SDL_CreateRWLock,(void),(),return)
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, const char *b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_Semaphore*,SDL_CreateSemaphore,(Uint32 a),(a),return)
-SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateShapedWindow,(const char *a, int b, int c, Uint32 d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateSoftwareRenderer,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateSurface,(int a, int b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateSurfaceFrom,(void *a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return)
@@ -397,7 +396,6 @@ SDL_DYNAPI_PROC(const char*,SDL_GetSensorName,(SDL_Sensor *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GetSensorNonPortableType,(SDL_Sensor *a),(a),return)
SDL_DYNAPI_PROC(SDL_SensorType,SDL_GetSensorType,(SDL_Sensor *a),(a),return)
SDL_DYNAPI_PROC(SDL_SensorID*,SDL_GetSensors,(int *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_GetShapedWindowMode,(SDL_Window *a, SDL_WindowShapeMode *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_GetSurfaceAlphaMod,(SDL_Surface *a, Uint8 *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_GetSurfaceClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),return)
@@ -500,7 +498,6 @@ SDL_DYNAPI_PROC(int,SDL_Init,(Uint32 a),(a),return)
SDL_DYNAPI_PROC(int,SDL_InitSubSystem,(Uint32 a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsGamepad,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsJoystickVirtual,(SDL_JoystickID a),(a),return)
-SDL_DYNAPI_PROC(SDL_bool,SDL_IsShapedWindow,(const SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsTablet,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickConnected,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickEventsEnabled,(void),(),return)
@@ -678,7 +675,6 @@ SDL_DYNAPI_PROC(int,SDL_SetWindowMouseRect,(SDL_Window *a, const SDL_Rect *b),(a
SDL_DYNAPI_PROC(int,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_SetWindowPosition,(SDL_Window *a, int b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),return)
-SDL_DYNAPI_PROC(int,SDL_SetWindowShape,(SDL_Window *a, SDL_Surface *b, SDL_WindowShapeMode *c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_SetWindowSize,(SDL_Window *a, int b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_SetWindowTitle,(SDL_Window *a, const char *b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_SetYUVConversionMode,(SDL_YUV_CONVERSION_MODE a),(a),)
diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c
deleted file mode 100644
index 2362ed7f7f3800..00000000000000
--- a/src/video/SDL_shape.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2023 Sam Lantinga
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_internal.h"
-
-#include "SDL_sysvideo.h"
-#include "SDL_shape_internals.h"
-#include "SDL_video_c.h"
-
-SDL_Window *SDL_CreateShapedWindow(const char *title, int w, int h, Uint32 flags)
-{
- SDL_Window *result = NULL;
- result = SDL_CreateWindow(title, w, h, (flags | SDL_WINDOW_BORDERLESS | SDL_WINDOW_HIDDEN) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE));
- if (result) {
- if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) {
- SDL_DestroyWindow(result);
- return NULL;
- }
- result->shaper = SDL_GetVideoDevice()->shape_driver.CreateShaper(result);
- if (result->shaper) {
- result->shaper->mode.mode = ShapeModeDefault;
- result->shaper->mode.parameters.binarizationCutoff = 1;
- result->shaper->hasshape = SDL_FALSE;
- return result;
- } else {
- SDL_DestroyWindow(result);
- return NULL;
- }
- }
- return NULL;
-}
-
-SDL_bool SDL_IsShapedWindow(const SDL_Window *window)
-{
- if (window == NULL) {
- return SDL_FALSE;
- }
- return (window->shaper != NULL);
-}
-
-/* REQUIRES that bitmap point to a w-by-h bitmap with ppb pixels-per-byte. */
-void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode, SDL_Surface *shape, Uint8 *bitmap, Uint8 ppb)
-{
- int x = 0;
- int y = 0;
- Uint8 r = 0, g = 0, b = 0, alpha = 0;
- Uint32 mask_value = 0;
- size_t bytes_per_scanline = (size_t)(shape->w + (ppb - 1)) / ppb;
- Uint8 *bitmap_scanline;
- SDL_Color key;
-
- if (SDL_MUSTLOCK(shape)) {
- SDL_LockSurface(shape);
- }
-
- SDL_memset(bitmap, 0, shape->h * bytes_per_scanline);
-
- for (y = 0; y < shape->h; y++) {
- bitmap_scanline = bitmap + y * bytes_per_scanline;
- for (x = 0; x < shape->w; x++) {
- if (SDL_ReadSurfacePixel(shape, x, y, &r, &g, &b, &alpha) != 0) {
- continue;
- }
-
- switch (mode.mode) {
- case (ShapeModeDefault):
- mask_value = (alpha >= 1 ? 1 : 0);
- break;
- case (ShapeModeBinarizeAlpha):
- mask_value = (alpha >= mode.parameters.binarizationCutoff ? 1 : 0);
- break;
- case (ShapeModeReverseBinarizeAlpha):
- mask_value = (alpha <= mode.parameters.binarizationCutoff ? 1 : 0);
- break;
- case (ShapeModeColorKey):
- key = mode.parameters.colorKey;
- mask_value = ((key.r != r || key.g != g || key.b != b) ? 1 : 0);
- break;
- }
- bitmap_scanline[x / ppb] |= mask_value << (x % ppb);
- }
- }
-
- if (SDL_MUSTLOCK(shape)) {
- SDL_UnlockSurface(shape);
- }
-}
-
-static SDL_ShapeTree *RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode, SDL_Surface *mask, SDL_Rect dimensions)
-{
- int x = 0, y = 0;
- Uint8 r = 0, g = 0, b = 0, a = 0;
- SDL_bool pixel_opaque = SDL_FALSE;
- int last_opaque = -1;
- SDL_Color key;
- SDL_ShapeTree *result = (SDL_ShapeTree *)SDL_malloc(sizeof(SDL_ShapeTree));
- SDL_Rect next = { 0, 0, 0, 0 };
-
- if (!result) {
- SDL_OutOfMemory();
- return NULL;
- }
-
- for (y = dimensions.y; y < dimensions.y + dimensions.h; y++) {
- for (x = dimensions.x; x < dimensions.x + dimensions.w; x++) {
- if (SDL_ReadSurfacePixel(mask, x, y, &r, &g, &b, &a) != 0) {
- continue;
- }
- switch (mode.mode) {
- case (ShapeModeDefault):
- pixel_opaque = (a >= 1);
- break;
- case (ShapeModeBinarizeAlpha):
- pixel_opaque = (a >= mode.parameters.binarizationCutoff);
- break;
- case (ShapeModeReverseBinarizeAlpha):
- pixel_opaque = (a <= mode.parameters.binarizationCutoff);
- break;
- case (ShapeModeColorKey):
- key = mode.parameters.colorKey;
- pixel_opaque = (key.r != r || key.g != g || key.b != b);
- break;
- }
- if (last_opaque == -1) {
- last_opaque = pixel_opaque;
- }
- if (last_opaque != pixel_opaque) {
- const int halfwidth = dimensions.w / 2;
- const int halfheight = dimensions.h / 2;
-
- result->kind = QuadShape;
-
- next.x = dimensions.x;
- next.y = dimensions.y;
- next.w = halfwidth;
- next.h = halfheight;
- result->data.children.upleft = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode, mask, next);
-
- next.x = dimensions.x + halfwidth;
- next.w = dimensions.w - halfwidth;
- result->data.children.upright = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode, mask, next);
-
- next.x = dimensions.x;
- next.w = halfwidth;
- next.y = dimensions.y + halfheight;
- next.h = dimensions.h - halfheight;
- result->data.children.downleft = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode, mask, next);
-
- next.x = dimensions.x + halfwidth;
- next.w = dimensions.w - halfwidth;
- result->data.children.downright = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode, mask, next);
-
- return result;
- }
- }
- }
-
- /* If we never recursed, all the pixels in this quadrant have the same "value". */
- result->kind = (last_opaque == SDL_TRUE ? OpaqueShape : TransparentShape);
- result->data.shape = dimensions;
- return result;
-}
-
-SDL_ShapeTree *SDL_CalculateShapeTree(SDL_WindowShapeMode mode, SDL_Surface *shape)
-{
- SDL_Rect dimensions;
- SDL_ShapeTree *result = NULL;
-
- dimensions.x = 0;
- dimensions.y = 0;
- dimensions.w = shape->w;
- dimensions.h = shape->h;
-
- if (SDL_MUSTLOCK(shape)) {
- SDL_LockSurface(shape);
- }
- result = RecursivelyCalculateShapeTree(mode, shape, dimensions);
- if (SDL_MUSTLOCK(shape)) {
- SDL_UnlockSurface(shape);
- }
- return result;
-}
-
-void SDL_TraverseShapeTree(SDL_ShapeTree *tree, SDL_TraversalFunction function, void *closure)
-{
- SDL_assert(tree != NULL);
- if (tree->kind == QuadShape) {
- SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upleft, function, closure);
- SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upright, function, closure);
- SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.downleft, function, closure);
- SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.downright, function, closure);
- } else {
- function(tree, closure);
- }
-}
-
-void SDL_FreeShapeTree(SDL_ShapeTree **shape_tree)
-{
- if ((*shape_tree)->kind == QuadShape) {
- SDL_FreeShapeTree((SDL_ShapeTree **)(char *)&(*shape_tree)->data.children.upleft);
- SDL_FreeShapeTree((SDL_ShapeTree **)(char *)&(*shape_tree)->data.children.upright);
- SDL_FreeShapeTree((SDL_ShapeTree **)(char *)&(*shape_tree)->data.children.downleft);
- SDL_FreeShapeTree((SDL_ShapeTree **)(char *)&(*shape_tree)->data.children.downright);
- }
- SDL_free(*shape_tree);
- *shape_tree = NULL;
-}
-
-int SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
-{
- SDL_VideoDevice *_this = SDL_GetVideoDevice();
- int result;
-
- if (!window || !SDL_IsShapedWindow(window)) {
- /* The window given was not a shapeable window. */
- return SDL_NONSHAPEABLE_WINDOW;
- }
- if (!shape) {
- /* Invalid shape argument. */
- return SDL_INVALID_SHAPE_ARGUMENT;
- }
-
- if (shape_mode) {
- window->shaper->mode = *shape_mode;
- }
- result = _this->shape_driver.SetWindowShape(window->shaper, shape, shape_mode);
- if (result == 0) {
- window->shaper->hasshape = SDL_TRUE;
- SDL_ShowWindow(window);
- }
- return result;
-}
-
-static SDL_bool SDL_WindowHasAShape(SDL_Window *window)
-{
- if (!window || !SDL_IsShapedWindow(window)) {
- return SDL_FALSE;
- }
- return window->shaper->hasshape;
-}
-
-int SDL_GetShapedWindowMode(SDL_Window *window, SDL_WindowShapeMode *shape_mode)
-{
- if (window && SDL_IsShapedWindow(window)) {
- if (!shape_mode) {
- if (SDL_WindowHasAShape(window)) {
- return 0; /* The window given has a shape. */
- } else {
- return SDL_WINDOW_LACKS_SHAPE; /* The window given is shapeable but lacks a shape. */
- }
- } else {
- *shape_mode = window->shaper->mode;
- return 0;
- }
- }
- return SDL_NONSHAPEABLE_WINDOW; /* The window given is not a valid shapeable window. */
-}
diff --git a/src/video/SDL_shape_internals.h b/src/video/SDL_shape_internals.h
deleted file mode 100644
index fa8e90adbf8906..00000000000000
--- a/src/video/SDL_shape_internals.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2023 Sam Lantinga
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_internal.h"
-
-#ifndef SDL_shape_internals_h_
-#define SDL_shape_internals_h_
-
-struct SDL_ShapeTree;
-
-typedef struct
-{
- struct SDL_ShapeTree *upleft, *upright, *downleft, *downright;
-} SDL_QuadTreeChildren;
-
-typedef union
-{
- SDL_QuadTreeChildren children;
- SDL_Rect shape;
-} SDL_ShapeUnion;
-
-typedef enum
-{
- QuadShape,
- TransparentShape,
- OpaqueShape
-} SDL_ShapeKind;
-
-typedef struct SDL_ShapeTree
-{
- SDL_ShapeKind kind;
- SDL_ShapeUnion data;
-} SDL_ShapeTree;
-
-typedef void (*SDL_TraversalFunction)(SDL_ShapeTree *, void *);
-
-extern void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode, SDL_Surface *shape, Uint8 *bitmap, Uint8 ppb);
-extern SDL_ShapeTree *SDL_CalculateShapeTree(SDL_WindowShapeMode mode, SDL_Surface *shape);
-extern void SDL_TraverseShapeTree(SDL_ShapeTree *tree, SDL_TraversalFunction function, void *closure);
-extern void SDL_FreeShapeTree(SDL_ShapeTree **shape_tree);
-
-#endif /* SDL_shape_internals_h_ */
diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index 2dccb30d2b7977..df986bdf87e166 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -27,8 +27,6 @@
/* The SDL video driver */
-typedef struct SDL_WindowShaper SDL_WindowShaper;
-typedef struct SDL_ShapeDriver SDL_ShapeDriver;
typedef struct SDL_VideoDisplay SDL_VideoDisplay;
typedef struct SDL_VideoDevice SDL_VideoDevice;
typedef struct SDL_VideoData SDL_VideoData;
@@ -36,28 +34,6 @@ typedef struct SDL_DisplayData SDL_DisplayData;
typedef struct SDL_DisplayModeData SDL_DisplayModeData;
typedef struct SDL_WindowData SDL_WindowData;
-/* Define the SDL window-shaper structure */
-struct SDL_WindowShaper
-{
- /* The window associated with the shaper */
- SDL_Window *window;
-
- /* The parameters for shape calculation. */
- SDL_WindowShapeMode mode;
-
- /* Has this window been assigned a shape? */
- SDL_bool hasshape;
-
- void *driverdata;
-};
-
-/* Define the SDL shape driver structure */
-struct SDL_ShapeDriver
-{
- SDL_WindowShaper *(*CreateShaper)(SDL_Window *window);
- int (*SetWindowShape)(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode);
-};
-
/* Define the SDL window structure, corresponding to toplevel windows */
struct SDL_Window
{
@@ -99,8 +75,6 @@ struct SDL_Window
SDL_Rect mouse_rect;
- SDL_WindowShaper *shaper;
-
SDL_HitTest hit_test;
void *hit_test_data;
@@ -257,12 +231,6 @@ struct SDL_VideoDevice
int (*FlashWindow)(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
int (*SetWindowFocusable)(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool focusable);
- /* * * */
- /*
- * Shaped-window functions
- */
- SDL_ShapeDriver shape_driver;
-
/* * * */
/*
* OpenGL support
diff --git a/src/video/cocoa/SDL_cocoashape.h b/src/video/cocoa/SDL_cocoashape.h
deleted file mode 100644
index a7c6d14a5a8a85..00000000000000
--- a/src/video/cocoa/SDL_cocoashape.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2023 Sam Lantinga
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "SDL_internal.h"
-
-#ifndef SDL_cocoashape_h_
-#define SDL_cocoashape_h_
-
-#include "../SDL_shape_internals.h"
-
-@interface SDL_ShapeData : NSObject
-@property(nonatomic) NSGraphicsContext *context;
-@property(nonatomic) SDL_bool saved;
-@property(nonatomic) SDL_ShapeTree *shape;
-@end
-
-extern SDL_WindowShaper *Cocoa_CreateShaper(SDL_Window *window);
-extern int Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode);
-
-#endif /* SDL_cocoashape_h_ */
diff --git a/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m
deleted file mode 100644
index 2e16741b7e8490..00000000000000
--- a/src/video/cocoa/SDL_cocoashape.m
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2023 Sam Lantinga
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_internal.h"
-
-#ifdef SDL_VIDEO_DRIVER_COCOA
-
-#include "SDL_cocoavideo.h"
-#include "SDL_cocoashape.h"
-#include "../SDL_sysvideo.h"
-
-@implementation SDL_ShapeData
-@end
-
-@interface SDL_CocoaClosure : NSObject
-@property(nonatomic) NSView *view;
-@property(nonatomic) NSBezierPath *path;
-@property(nonatomic) SDL_Window *window;
-@end
-
-@implementation SDL_CocoaClosure
-@end
-
-SDL_WindowShaper *Cocoa_CreateShaper(SDL_Window *window)
-{
- @autoreleasepool {
- SDL_WindowShaper *result;
- SDL_ShapeData *data;
- SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
-
- result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper));
- if (!result) {
- SDL_OutOfMemory();
- return NULL;
- }
-
- [windata.nswindow setOpaque:NO];
-
- [windata.nswindow setStyleMask:NSWindowStyleMaskBorderless];
-
- result->window = window;
- result->mode.mode = ShapeModeDefault;
- result->mode.parameters.binarizationCutoff = 1;
- window->shaper = result;
-
- data = [[SDL_ShapeData alloc] init];
- data.context = [windata.nswindow graphicsContext];
- data.saved = SDL_FALSE;
- data.shape = NULL;
-
- /* TODO: There's no place to release this... */
- result->driverdata = (void *)CFBridgingRetain(data);
-
- return result;
- }
-}
-
-void ConvertRects(SDL_ShapeTree *tree, void *closure)
-{
- SDL_CocoaClosure *data = (__bridge SDL_CocoaClosure *)closure;
- if (tree->kind == OpaqueShape) {
- NSRect rect = NSMakeRect(tree->data.shape.x, data.window->h - tree->data.shape.y, tree->data.shape.w, tree->data.shape.h);
- [data.path appendBezierPathWithRect:[data.view convertRect:rect toView:nil]];
- }
-}
-
-int Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
-{
- @autoreleasepool {
- SDL_ShapeData *data = (__bridge SDL_ShapeData *)shaper->driverdata;
- SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)shaper->window->driverdata;
- SDL_CocoaClosure *closure;
- if (data.saved == SDL_TRUE) {
- [data.context restoreGraphicsState];
- data.saved = SDL_FALSE;
- }
-
- /*[data.context saveGraphicsState];*/
- /*data.saved = SDL_TRUE;*/
- [NSGraphicsContext setCurrentContext:data.context];
-
- [[NSColor clearColor] set];
- NSRectFill([windata.sdlContentView frame]);
- data.shape = SDL_CalculateShapeTree(*shape_mode, shape);
-
- closure = [[SDL_CocoaClosure alloc] init];
-
- closure.view = windata.sdlContentView;
- closure.path = [NSBezierPath bezierPath];
- closure.window = shaper->window;
- SDL_TraverseShapeTree(data.shape, &ConvertRects, (__bridge void *)closure);
- [closure.path addClip];
-
- return 0;
- }
-}
-
-#endif /* SDL_VIDEO_DRIVER_COCOA */
diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m
index 1153b26350d2e0..0d93a5ef0649aa 100644
--- a/src/video/cocoa/SDL_cocoavideo.m
+++ b/src/video/cocoa/SDL_cocoavideo.m
@@ -27,7 +27,6 @@
#endif
#include "SDL_cocoavideo.h"
-#include "SDL_cocoashape.h"
#include "SDL_cocoavulkan.h"
#include "SDL_cocoametalview.h"
#include "SDL_cocoaopengles.h"
@@ -119,9 +118,6 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice *device)
device->FlashWindow = Cocoa_FlashWindow;
device->SetWindowFocusable = Cocoa_SetWindowFocusable;
- device->shape_driver.CreateShaper = Cocoa_CreateShaper;
- device->shape_driver.SetWindowShape = Cocoa_SetWindowShape;
-
#ifdef SDL_VIDEO_OPENGL_CGL
device->GL_LoadLibrary = Cocoa_GL_LoadLibrary;
device->GL_GetProcAddress = Cocoa_GL_GetProcAddress;
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index b4c0bf7d2a8985..964cfa0e674277 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -36,7 +36,6 @@
#include "../../events/SDL_dropevents_c.h"
#include "SDL_cocoavideo.h"
-#include "SDL_cocoashape.h"
#include "SDL_cocoamouse.h"
#include "SDL_cocoaopengl.h"
#include "SDL_cocoaopengles.h"
@@ -2563,12 +2562,6 @@ void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
#endif /* SDL_VIDEO_OPENGL */
-
- if (window->shaper) {
- CFBridgingRelease(window->shaper->driverdata);
- SDL_free(window->shaper);
- window->shaper = NULL;
- }
}
window->driverdata = NULL;
}
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index ef6b3d655c3b9d..5202955bf0543f 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -23,7 +23,6 @@
#ifdef SDL_VIDEO_DRIVER_WINDOWS
#include "SDL_windowsvideo.h"
-#include "SDL_windowsshape.h"
#include "SDL_vkeys.h"
#include "../../events/SDL_events_c.h"
#include "../../events/SDL_touch_c.h"
diff --git a/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c
deleted file mode 100644
index 74026601f55853..00000000000000
--- a/src/video/windows/SDL_windowsshape.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2023 Sam Lantinga
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_internal.h"
-
-#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
-
-#include "SDL_windowsshape.h"
-#include "SDL_windowsvideo.h"
-
-SDL_WindowShaper *Win32_CreateShaper(SDL_Window *window)
-{
- SDL_WindowShaper *result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper));
- if (!result) {
- SDL_OutOfMemory();
- return NULL;
- }
- result->window = window;
- result->mode.mode = ShapeModeDefault;
- result->mode.parameters.binarizationCutoff = 1;
- result->hasshape = SDL_FALSE;
- result->driverdata = (SDL_ShapeData *)SDL_calloc(1, sizeof(SDL_ShapeData));
- if (!result->driverdata) {
- SDL_free(result);
- SDL_OutOfMemory();
- return NULL;
- }
- window->shaper = result;
-
- return result;
-}
-
-static void CombineRectRegions(SDL_ShapeTree *node, void *closure)
-{
- HRGN mask_region = *((HRGN *)closure), temp_region = NULL;
- if (node->kind == OpaqueShape) {
- /* Win32 API regions exclude their outline, so we widen the region by one pixel in each direction to include the real outline. */
- temp_region = CreateRectRgn(node->data.shape.x, node->data.shape.y, node->data.shape.x + node->data.shape.w + 1, node->data.shape.y + node->data.shape.h + 1);
- if (mask_region != NULL) {
- CombineRgn(mask_region, mask_region, temp_region, RGN_OR);
- DeleteObject(temp_region);
- } else {
- *((HRGN *)closure) = temp_region;
- }
- }
-}
-
-int Win32_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
-{
- SDL_ShapeData *data;
- HRGN mask_region = NULL;
-
- if ((!shaper) ||
- (!shape) ||
- ((shape->format->Amask == 0) && (shape_mode->mode != ShapeModeColorKey))) {
- return SDL_INVALID_SHAPE_ARGUMENT;
- }
-
- data = (SDL_ShapeData *)shaper->driverdata;
- if (data->mask_tree) {
- SDL_FreeShapeTree(&data->mask_tree);
- }
- data->mask_tree = SDL_CalculateShapeTree(*shape_mode, shape);
-
- SDL_TraverseShapeTree(data->mask_tree, &CombineRectRegions, &mask_region);
- SDL_assert(mask_region != NULL);
-
- SetWindowRgn(shaper->window->driverdata->hwnd, mask_region, TRUE);
-
- return 0;
-}
-
-#endif /* SDL_VIDEO_DRIVER_WINDOWS */
diff --git a/src/video/windows/SDL_windowsshape.h b/src/video/windows/SDL_windowsshape.h
deleted file mode 100644
index 074f7edf4fb63b..00000000000000
--- a/src/video/windows/SDL_windowsshape.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2023 Sam Lantinga
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "SDL_internal.h"
-
-#ifndef SDL_windowsshape_h_
-#define SDL_windowsshape_h_
-
-#include "../SDL_sysvideo.h"
-#include "../SDL_shape_internals.h"
-
-typedef struct
-{
- SDL_ShapeTree *mask_tree;
-} SDL_ShapeData;
-
-extern SDL_WindowShaper *Win32_CreateShaper(SDL_Window *window);
-extern int Win32_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode);
-
-#endif /* SDL_windowsshape_h_ */
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index 15ef5a8fee05d2..6cfbc35d2f29c5 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -31,7 +31,6 @@
#include "SDL_windowsvideo.h"
#include "SDL_windowsframebuffer.h"
-#include "SDL_windowsshape.h"
#include "SDL_windowsvulkan.h"
#ifdef SDL_GDK_TEXTINPUT
@@ -210,9 +209,6 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
device->FlashWindow = WIN_FlashWindow;
device->ShowWindowSystemMenu = WIN_ShowWindowSystemMenu;
device->SetWindowFocusable = WIN_SetWindowFocusable;
-
- device->shape_driver.CreateShaper = Win32_CreateShaper;
- device->shape_driver.SetWindowShape = Win32_SetWindowShape;
#endif
#ifdef SDL_VIDEO_OPENGL_WGL
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index 2665a21ae91a3c..55e2d700ed09f4 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -33,7 +33,6 @@
#include "SDL_windowsvideo.h"
#include "SDL_windowswindow.h"
-#include "SDL_windowsshape.h"
/* Dropfile support */
#include
@@ -1230,18 +1229,6 @@ void WIN_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_b
void WIN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
{
- if (window->shaper) {
- SDL_ShapeData *shapedata = (SDL_ShapeData *)window->shaper->driverdata;
- if (shapedata) {
- if (shapedata->mask_tree) {
- SDL_FreeShapeTree(&shapedata->mask_tree);
- }
- SDL_free(shapedata);
- }
- SDL_free(window->shaper);
- window->shaper = NULL;
- }
-
CleanupWindowData(_this, window);
}
diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c
deleted file mode 100644
index 373d6eba1ae4b1..00000000000000
--- a/src/video/x11/SDL_x11shape.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2023 Sam Lantinga
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_internal.h"
-
-#ifdef SDL_VIDEO_DRIVER_X11
-
-#include "SDL_x11video.h"
-#include "SDL_x11shape.h"
-#include "SDL_x11window.h"
-#include "../SDL_shape_internals.h"
-
-SDL_WindowShaper *X11_CreateShaper(SDL_Window *window)
-{
- SDL_WindowShaper *result = NULL;
-
-#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE
- SDL_ShapeData *data = NULL;
-
- if (SDL_X11_HAVE_XSHAPE) { /* Make sure X server supports it. */
- result = SDL_malloc(sizeof(SDL_WindowShaper));
- if (!result) {
- SDL_OutOfMemory();
- return NULL;
- }
- result->window = window;
- result->mode.mode = ShapeModeDefault;
- result->mode.parameters.binarizationCutoff = 1;
- data = SDL_malloc(sizeof(SDL_ShapeData));
- if (!data) {
- SDL_free(result);
- SDL_OutOfMemory();
- return NULL;
- }
- result->driverdata = data;
- data->bitmapsize = 0;
- data->bitmap = NULL;
- window->shaper = result;
- }
-#endif
-
- return result;
-}
-
-int X11_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
-{
-#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE
- SDL_ShapeData *data = NULL;
- SDL_WindowData *windowdata = NULL;
- Pixmap shapemask;
-#endif
-
- if (!shaper || !shape || !shaper->driverdata) {
- return -1;
- }
-
-#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE
- if (shape->format->Amask == 0 && SDL_SHAPEMODEALPHA(shape_mode->mode)) {
- return -2;
- }
- if (shape->w != shaper->window->w || shape->h != shaper->window->h) {
- return -3;
- }
- data = shaper->driverdata;
-
- /* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
- SDL_CalculateShapeBitmap(shaper->mode, shape, data->bitmap, 8);
-
- windowdata = shaper->window->driverdata;
- shapemask = X11_XCreateBitmapFromData(windowdata->videodata->display, windowdata->xwindow, data->bitmap, shaper->window->w, shaper->window->h);
-
- X11_XShapeCombineMask(windowdata->videodata->display, windowdata->xwindow, ShapeBounding, 0, 0, shapemask, ShapeSet);
- X11_XSync(windowdata->videodata->display, False);
-
- X11_XFreePixmap(windowdata->videodata->display, shapemask);
-#endif
-
- return 0;
-}
-
-#endif /* SDL_VIDEO_DRIVER_X11 */
diff --git a/src/video/x11/SDL_x11shape.h b/src/video/x11/SDL_x11shape.h
deleted file mode 100644
index 96ec12184fc09a..00000000000000
--- a/src/video/x11/SDL_x11shape.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2023 Sam Lantinga
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_internal.h"
-
-#ifndef SDL_x11shape_h_
-#define SDL_x11shape_h_
-
-#include "../SDL_sysvideo.h"
-
-typedef struct
-{
- void *bitmap;
- Uint32 bitmapsize;
-} SDL_ShapeData;
-
-extern SDL_WindowShaper *X11_CreateShaper(SDL_Window *window);
-extern int X11_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode);
-
-#endif /* SDL_x11shape_h_ */
diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c
index 8e9b91d2a963d7..32a28ee1ac01b2 100644
--- a/src/video/x11/SDL_x11video.c
+++ b/src/video/x11/SDL_x11video.c
@@ -30,7 +30,6 @@
#include "SDL_x11framebuffer.h"
#include "SDL_x11pen.h"
-#include "SDL_x11shape.h"
#include "SDL_x11touch.h"
#include "SDL_x11video.h"
#include "SDL_x11xfixes.h"
@@ -217,9 +216,6 @@ static SDL_VideoDevice *X11_CreateDevice(void)
device->SetWindowMouseRect = X11_SetWindowMouseRect;
#endif /* SDL_VIDEO_DRIVER_X11_XFIXES */
- device->shape_driver.CreateShaper = X11_CreateShaper;
- device->shape_driver.SetWindowShape = X11_SetWindowShape;
-
#ifdef SDL_VIDEO_OPENGL_GLX
device->GL_LoadLibrary = X11_GL_LoadLibrary;
device->GL_GetProcAddress = X11_GL_GetProcAddress;
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index c750ea76090a22..5d8000d21579a7 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -31,7 +31,6 @@
#include "SDL_x11video.h"
#include "SDL_x11mouse.h"
-#include "SDL_x11shape.h"
#include "SDL_x11xinput2.h"
#include "SDL_x11xfixes.h"
@@ -1821,16 +1820,6 @@ void X11_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
{
SDL_WindowData *data = window->driverdata;
- if (window->shaper) {
- SDL_ShapeData *shapedata = (SDL_ShapeData *)window->shaper->driverdata;
- if (shapedata) {
- SDL_free(shapedata->bitmap);
- SDL_free(shapedata);
- }
- SDL_free(window->shaper);
- window->shaper = NULL;
- }
-
if (data) {
SDL_VideoData *videodata = data->videodata;
Display *display = videodata->display;
diff --git a/test/testshape.c b/test/testshape.c
index c5950b3f7be543..459badabee0301 100644
--- a/test/testshape.c
+++ b/test/testshape.c
@@ -17,6 +17,36 @@
#define SHAPED_WINDOW_DIMENSION 640
+/** An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
+typedef enum
+{
+ /** The default mode, a binarized alpha cutoff of 1. */
+ ShapeModeDefault,
+ /** A binarized alpha cutoff with a given integer value. */
+ ShapeModeBinarizeAlpha,
+ /** A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
+ ShapeModeReverseBinarizeAlpha,
+ /** A color key is applied. */
+ ShapeModeColorKey
+} WindowShapeMode;
+
+/** A union containing parameters for shaped windows. */
+typedef union
+{
+ /** A cutoff alpha value for binarization of the window shape's alpha channel. */
+ Uint8 binarizationCutoff;
+ SDL_Color colorKey;
+} SDL_WindowShapeParams;
+
+/** A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
+typedef struct SDL_WindowShapeMode
+{
+ /** The mode of these window-shape parameters. */
+ WindowShapeMode mode;
+ /** Window-shape parameters. */
+ SDL_WindowShapeParams parameters;
+} SDL_WindowShapeMode;
+
typedef struct LoadedPicture
{
SDL_Surface *surface;