mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-08 12:28:14 +00:00
Added display properties
This commit is contained in:
@@ -339,6 +339,20 @@ extern DECLSPEC SDL_DisplayID *SDLCALL SDL_GetDisplays(int *count);
|
|||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_DisplayID SDLCALL SDL_GetPrimaryDisplay(void);
|
extern DECLSPEC SDL_DisplayID SDLCALL SDL_GetPrimaryDisplay(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the properties associated with a display.
|
||||||
|
*
|
||||||
|
* \param displayID the instance ID of the display to query
|
||||||
|
* \returns a valid property ID on success or 0 on failure; call
|
||||||
|
* SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 3.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetProperty
|
||||||
|
* \sa SDL_SetProperty
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_DisplayID displayID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of a display in UTF-8 encoding.
|
* Get the name of a display in UTF-8 encoding.
|
||||||
*
|
*
|
||||||
|
@@ -923,6 +923,7 @@ SDL3_0.0.0 {
|
|||||||
SDL_RWprintf;
|
SDL_RWprintf;
|
||||||
SDL_RWvprintf;
|
SDL_RWvprintf;
|
||||||
SDL_AllocateEventMemory;
|
SDL_AllocateEventMemory;
|
||||||
|
SDL_GetDisplayProperties;
|
||||||
# extra symbols go here (don't modify this line)
|
# extra symbols go here (don't modify this line)
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
@@ -948,3 +948,4 @@
|
|||||||
#define SDL_RWprintf SDL_RWprintf_REAL
|
#define SDL_RWprintf SDL_RWprintf_REAL
|
||||||
#define SDL_RWvprintf SDL_RWvprintf_REAL
|
#define SDL_RWvprintf SDL_RWvprintf_REAL
|
||||||
#define SDL_AllocateEventMemory SDL_AllocateEventMemory_REAL
|
#define SDL_AllocateEventMemory SDL_AllocateEventMemory_REAL
|
||||||
|
#define SDL_GetDisplayProperties SDL_GetDisplayProperties_REAL
|
||||||
|
@@ -981,3 +981,4 @@ SDL_DYNAPI_PROC(int,SDL_ClearProperty,(SDL_PropertiesID a, const char *b),(a,b),
|
|||||||
SDL_DYNAPI_PROC(int,SDL_EnterAppMainCallbacks,(int a, char *b[], SDL_AppInit_func c, SDL_AppIterate_func d, SDL_AppEvent_func e, SDL_AppQuit_func f),(a,b,c,d,e,f),return)
|
SDL_DYNAPI_PROC(int,SDL_EnterAppMainCallbacks,(int a, char *b[], SDL_AppInit_func c, SDL_AppIterate_func d, SDL_AppEvent_func e, SDL_AppQuit_func f),(a,b,c,d,e,f),return)
|
||||||
SDL_DYNAPI_PROC(size_t,SDL_RWvprintf,(SDL_RWops *a, const char *b, va_list c),(a,b,c),return)
|
SDL_DYNAPI_PROC(size_t,SDL_RWvprintf,(SDL_RWops *a, const char *b, va_list c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(void*,SDL_AllocateEventMemory,(size_t a),(a),return)
|
SDL_DYNAPI_PROC(void*,SDL_AllocateEventMemory,(size_t a),(a),return)
|
||||||
|
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetDisplayProperties,(SDL_DisplayID a),(a),return)
|
||||||
|
@@ -146,6 +146,8 @@ struct SDL_VideoDisplay
|
|||||||
|
|
||||||
SDL_VideoDevice *device;
|
SDL_VideoDevice *device;
|
||||||
|
|
||||||
|
SDL_PropertiesID props;
|
||||||
|
|
||||||
SDL_DisplayData *driverdata;
|
SDL_DisplayData *driverdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -717,6 +717,7 @@ void SDL_DelVideoDisplay(SDL_DisplayID displayID, SDL_bool send_event)
|
|||||||
SDL_SendDisplayEvent(display, SDL_EVENT_DISPLAY_REMOVED, 0);
|
SDL_SendDisplayEvent(display, SDL_EVENT_DISPLAY_REMOVED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_DestroyProperties(display->props);
|
||||||
SDL_free(display->name);
|
SDL_free(display->name);
|
||||||
SDL_ResetFullscreenDisplayModes(display);
|
SDL_ResetFullscreenDisplayModes(display);
|
||||||
SDL_free(display->desktop_mode.driverdata);
|
SDL_free(display->desktop_mode.driverdata);
|
||||||
@@ -820,6 +821,18 @@ SDL_DisplayData *SDL_GetDisplayDriverDataForWindow(SDL_Window *window)
|
|||||||
return SDL_GetDisplayDriverData(SDL_GetDisplayForWindow(window));
|
return SDL_GetDisplayDriverData(SDL_GetDisplayForWindow(window));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_PropertiesID SDL_GetDisplayProperties(SDL_DisplayID displayID)
|
||||||
|
{
|
||||||
|
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID);
|
||||||
|
|
||||||
|
CHECK_DISPLAY_MAGIC(display, 0);
|
||||||
|
|
||||||
|
if (display->props == 0) {
|
||||||
|
display->props = SDL_CreateProperties();
|
||||||
|
}
|
||||||
|
return display->props;
|
||||||
|
}
|
||||||
|
|
||||||
const char *SDL_GetDisplayName(SDL_DisplayID displayID)
|
const char *SDL_GetDisplayName(SDL_DisplayID displayID)
|
||||||
{
|
{
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID);
|
||||||
|
Reference in New Issue
Block a user