From d93bfe62dea0374ed2c5aa3d3040e590341cdbbf Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Wed, 8 Jul 2020 08:28:35 +0200 Subject: [PATCH] VIDEO: Add API for querying and setting fullscreen mode. --- sim_video.c | 26 ++++++++++++++++++++++++++ sim_video.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/sim_video.c b/sim_video.c index 7138d65f..e8237b90 100644 --- a/sim_video.c +++ b/sim_video.c @@ -1404,6 +1404,20 @@ if (SDL_SemWait (vid_mouse_events.sem) == 0) { } } +t_bool vid_is_fullscreen (void) +{ + return SDL_GetWindowFlags (vid_window) & SDL_WINDOW_FULLSCREEN_DESKTOP; +} + +t_stat vid_set_fullscreen (t_bool flag) +{ +if (flag) + SDL_SetWindowFullscreen (vid_window, SDL_WINDOW_FULLSCREEN_DESKTOP); +else + SDL_SetWindowFullscreen (vid_window, 0); +return SCPE_OK; +} + void vid_update (void) { SDL_Rect vid_dst; @@ -2368,4 +2382,16 @@ t_stat vid_screenshot (const char *filename) sim_printf ("video support unavailable\n"); return SCPE_NOFNC|SCPE_NOMESSAGE; } + +t_bool vid_is_fullscreen (void) +{ +sim_printf ("video support unavailable\n"); +return FALSE; +} + +t_stat vid_set_fullscreen (t_bool flag) +{ +sim_printf ("video support unavailable\n"); +return SCPE_OK; +} #endif /* defined(USE_SIM_VIDEO) */ diff --git a/sim_video.h b/sim_video.h index d1c04977..1e232ee5 100644 --- a/sim_video.h +++ b/sim_video.h @@ -198,6 +198,8 @@ t_stat vid_show_release_key (FILE* st, UNIT* uptr, int32 val, CONST void* desc); t_stat vid_show_video (FILE* st, UNIT* uptr, int32 val, CONST void* desc); t_stat vid_show (FILE* st, DEVICE *dptr, UNIT* uptr, int32 val, CONST char* desc); t_stat vid_screenshot (const char *filename); +t_bool vid_is_fullscreen (void); +t_stat vid_set_fullscreen (t_bool flag); extern t_bool vid_active; void vid_set_cursor_position (int32 x, int32 y); /* cursor position (set by calling code) */