diff --git a/include/SDL3/SDL_pen.h b/include/SDL3/SDL_pen.h index 787ab8371..6e54b6651 100644 --- a/include/SDL3/SDL_pen.h +++ b/include/SDL3/SDL_pen.h @@ -107,7 +107,13 @@ typedef enum SDL_PenAxis #define SDL_PEN_TIP_INK SDL_PEN_FLAG_INK_BIT_INDEX /**< Regular pen tip (for drawing) touched the surface */ #define SDL_PEN_TIP_ERASER SDL_PEN_FLAG_ERASER_BIT_INDEX /**< Eraser pen tip touched the surface */ -/* Pen capabilities reported by SDL_GetPenCapabilities */ +/** + * Pen capabilities reported by SDL_GetPenCapabilities. + * + * \since This typedef is available since SDL 3.0.0 + */ +typedef Uint64 SDL_PenCapabilityFlags; + #define SDL_PEN_DOWN_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_DOWN_BIT_INDEX) /**< Pen tip is currently touching the drawing surface. */ #define SDL_PEN_INK_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_INK_BIT_INDEX) /**< Pen has a regular drawing tip (SDL_GetPenCapabilities). For events (SDL_PenButtonEvent, SDL_PenMotionEvent, SDL_GetPenStatus) this flag is mutually exclusive with SDL_PEN_ERASER_MASK . */ #define SDL_PEN_ERASER_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_ERASER_BIT_INDEX) /**< Pen has an eraser tip (SDL_GetPenCapabilities) or is being used as eraser (SDL_PenButtonEvent , SDL_PenMotionEvent , SDL_GetPenStatus) */ @@ -117,7 +123,6 @@ typedef enum SDL_PenAxis #define SDL_PEN_AXIS_DISTANCE_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_DISTANCE) /**< Pen provides distance to drawing tablet in SDL_PEN_AXIS_DISTANCE */ #define SDL_PEN_AXIS_ROTATION_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_ROTATION) /**< Pen provides barrel rotation information in axis SDL_PEN_AXIS_ROTATION */ #define SDL_PEN_AXIS_SLIDER_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_SLIDER) /**< Pen provides slider / finger wheel or similar in axis SDL_PEN_AXIS_SLIDER */ - #define SDL_PEN_AXIS_BIDIRECTIONAL_MASKS (SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK) /** @@ -254,7 +259,7 @@ typedef struct SDL_PenCapabilityInfo * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo *capabilities); +extern SDL_DECLSPEC SDL_PenCapabilityFlags SDLCALL SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo *capabilities); /** * Retrieves the pen type for a given SDL_PenID. diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index c78e76d58..13002b9ec 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -395,7 +395,7 @@ SDL_DYNAPI_PROC(int,SDL_GetNumVideoDrivers,(void),(),return) SDL_DYNAPI_PROC(Sint64,SDL_GetNumberProperty,(SDL_PropertiesID a, const char *b, Sint64 c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_GetOriginalMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),) SDL_DYNAPI_PROC(int,SDL_GetPathInfo,(const char *a, SDL_PathInfo *b),(a,b),return) -SDL_DYNAPI_PROC(Uint32,SDL_GetPenCapabilities,(SDL_PenID a, SDL_PenCapabilityInfo *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_PenCapabilityFlags,SDL_GetPenCapabilities,(SDL_PenID a, SDL_PenCapabilityInfo *b),(a,b),return) SDL_DYNAPI_PROC(SDL_PenID,SDL_GetPenFromGUID,(SDL_GUID a),(a),return) SDL_DYNAPI_PROC(SDL_GUID,SDL_GetPenGUID,(SDL_PenID a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetPenName,(SDL_PenID a),(a),return) diff --git a/src/events/SDL_pen.c b/src/events/SDL_pen.c index e1d69115b..de143a609 100644 --- a/src/events/SDL_pen.c +++ b/src/events/SDL_pen.c @@ -227,7 +227,7 @@ SDL_PenSubtype SDL_GetPenType(SDL_PenID instance_id) return result; } -Uint32 SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo *info) +SDL_PenCapabilityFlags SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo *info) { Uint32 result; SDL_LOAD_LOCK_PEN(pen, instance_id, 0u); diff --git a/test/testpen.c b/test/testpen.c index f143e940f..5804ebd6e 100644 --- a/test/testpen.c +++ b/test/testpen.c @@ -228,7 +228,7 @@ static void dump_state(void) int k; SDL_PenCapabilityInfo info; Uint32 status = SDL_GetPenStatus(penid, &x, &y, axes, SDL_PEN_NUM_AXES); - Uint32 capabilities = SDL_GetPenCapabilities(penid, &info); + const SDL_PenCapabilityFlags capabilities = SDL_GetPenCapabilities(penid, &info); char *type; char *buttons_str; @@ -277,7 +277,7 @@ static void dump_state(void) SDL_free(buttons_str); SDL_Log(" pos=(%.2f, %.2f)", x, y); for (k = 0; k < SDL_PEN_NUM_AXES; ++k) { - SDL_bool supported = capabilities & SDL_PEN_AXIS_CAPABILITY(k); + SDL_bool supported = ((capabilities & SDL_PEN_AXIS_CAPABILITY(k)) != 0); if (supported) { if (k == SDL_PEN_AXIS_XTILT || k == SDL_PEN_AXIS_YTILT) { if (info.max_tilt == SDL_PEN_INFO_UNKNOWN) {