renderer: add r_unclaim_window API
Must be called before destroying a window. Implementation is optional.
This commit is contained in:
parent
7acdad7531
commit
48568b9227
4 changed files with 12 additions and 2 deletions
|
@ -258,6 +258,12 @@ SDL_Window* r_create_window(const char *title, int x, int y, int w, int h, uint3
|
|||
return B.create_window(title, x, y, w, h, flags);
|
||||
}
|
||||
|
||||
void r_unclaim_window(SDL_Window *window) {
|
||||
if(B.unclaim_window) {
|
||||
B.unclaim_window(window);
|
||||
}
|
||||
}
|
||||
|
||||
r_feature_bits_t r_features(void) {
|
||||
return B.features();
|
||||
}
|
||||
|
|
|
@ -531,6 +531,7 @@ void r_post_init(void);
|
|||
void r_release_resources(void);
|
||||
void r_shutdown(void);
|
||||
const char *r_backend_name(void);
|
||||
void r_unclaim_window(SDL_Window *window);
|
||||
|
||||
r_feature_bits_t r_features(void);
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ typedef struct RendererFuncs {
|
|||
void (*post_init)(void);
|
||||
void (*shutdown)(void);
|
||||
|
||||
SDL_Window* (*create_window)(const char *title, int x, int y, int w, int h, uint32_t flags);
|
||||
SDL_Window *(*create_window)(const char *title, int x, int y, int w, int h, uint32_t flags);
|
||||
void (*unclaim_window)(SDL_Window *window);
|
||||
|
||||
r_feature_bits_t (*features)(void);
|
||||
|
||||
|
|
|
@ -463,6 +463,7 @@ static const char *modeflagsstr(uint32_t flags) {
|
|||
|
||||
static void video_new_window_internal(uint display, uint w, uint h, uint32_t flags, bool fallback) {
|
||||
if(video.window) {
|
||||
r_unclaim_window(video.window);
|
||||
SDL_DestroyWindow(video.window);
|
||||
video.window = NULL;
|
||||
video.num_resize_events = 0;
|
||||
|
@ -1063,8 +1064,9 @@ void video_shutdown(void) {
|
|||
fbmgr_shutdown();
|
||||
events_unregister_handler(video_handle_window_event);
|
||||
events_unregister_handler(video_handle_config_event);
|
||||
r_shutdown();
|
||||
r_unclaim_window(video.window);
|
||||
SDL_DestroyWindow(video.window);
|
||||
r_shutdown();
|
||||
dynarray_free_data(&video.win_modes);
|
||||
dynarray_free_data(&video.fs_modes);
|
||||
SDL_VideoQuit();
|
||||
|
|
Loading…
Reference in a new issue