diff --git a/gfx/drivers_context/android_ctx.c b/gfx/drivers_context/android_ctx.c index 4630ff2e53..3e0cf45ffb 100644 --- a/gfx/drivers_context/android_ctx.c +++ b/gfx/drivers_context/android_ctx.c @@ -328,6 +328,7 @@ static void android_gfx_ctx_update_window_title(void *data, video_frame_info_t v } static bool android_gfx_ctx_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/cgl_ctx.c b/gfx/drivers_context/cgl_ctx.c index 4214e32be9..e836775e66 100644 --- a/gfx/drivers_context/cgl_ctx.c +++ b/gfx/drivers_context/cgl_ctx.c @@ -125,6 +125,7 @@ static void gfx_ctx_cgl_update_window_title(void *data, video_frame_info_t video static bool gfx_ctx_cgl_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index e61f1305d2..7a5de56bae 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -330,39 +330,40 @@ static void cocoagl_gfx_ctx_show_mouse(void *data, bool state) } static bool cocoagl_gfx_ctx_set_video_mode(void *data, - unsigned width, unsigned height, bool fullscreen) + video_frame_info_t video_info, + unsigned width, unsigned height, bool fullscreen) { #if defined(HAVE_COCOA) static bool has_went_fullscreen = false; CocoaView *g_view = (CocoaView*)nsview_get_ptr(); /* TODO: Screen mode support. */ - + if (fullscreen) { - if (!has_went_fullscreen) - { - [g_view enterFullScreenMode:get_chosen_screen() withOptions:nil]; - cocoagl_gfx_ctx_show_mouse(data, false); - } + if (!has_went_fullscreen) + { + [g_view enterFullScreenMode:get_chosen_screen() withOptions:nil]; + cocoagl_gfx_ctx_show_mouse(data, false); + } } else { if (has_went_fullscreen) { - [g_view exitFullScreenModeWithOptions:nil]; - [[g_view window] makeFirstResponder:g_view]; - cocoagl_gfx_ctx_show_mouse(data, true); + [g_view exitFullScreenModeWithOptions:nil]; + [[g_view window] makeFirstResponder:g_view]; + cocoagl_gfx_ctx_show_mouse(data, true); } - - [[g_view window] setContentSize:NSMakeSize(width, height)]; + + [[g_view window] setContentSize:NSMakeSize(width, height)]; } - + has_went_fullscreen = fullscreen; #endif - + (void)data; - // TODO: Maybe iOS users should be able to show/hide the status bar here? + /* TODO: Maybe iOS users should be able to show/hide the status bar here? */ return true; } diff --git a/gfx/drivers_context/d3d_ctx.cpp b/gfx/drivers_context/d3d_ctx.cpp index d9b307de9f..de7cc361e1 100644 --- a/gfx/drivers_context/d3d_ctx.cpp +++ b/gfx/drivers_context/d3d_ctx.cpp @@ -198,6 +198,7 @@ static void gfx_ctx_d3d_input_driver(void *data, } static bool gfx_ctx_d3d_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/drm_ctx.c b/gfx/drivers_context/drm_ctx.c index 57602d9327..56ad2b2ed0 100644 --- a/gfx/drivers_context/drm_ctx.c +++ b/gfx/drivers_context/drm_ctx.c @@ -618,6 +618,7 @@ error: #endif static bool gfx_ctx_drm_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/emscriptenegl_ctx.c b/gfx/drivers_context/emscriptenegl_ctx.c index fc852bc913..8e8b5c478b 100644 --- a/gfx/drivers_context/emscriptenegl_ctx.c +++ b/gfx/drivers_context/emscriptenegl_ctx.c @@ -189,6 +189,7 @@ error: } static bool gfx_ctx_emscripten_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/gfx_null_ctx.c b/gfx/drivers_context/gfx_null_ctx.c index 0610ac5cf7..daa081f616 100644 --- a/gfx/drivers_context/gfx_null_ctx.c +++ b/gfx/drivers_context/gfx_null_ctx.c @@ -62,6 +62,7 @@ static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *h } static bool gfx_ctx_null_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/khr_display_ctx.c b/gfx/drivers_context/khr_display_ctx.c index 339bd0c32d..5cab4992f8 100644 --- a/gfx/drivers_context/khr_display_ctx.c +++ b/gfx/drivers_context/khr_display_ctx.c @@ -124,6 +124,7 @@ static void gfx_ctx_khr_display_update_window_title(void *data, video_frame_info } static bool gfx_ctx_khr_display_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/mali_fbdev_ctx.c b/gfx/drivers_context/mali_fbdev_ctx.c index 260d1b7ea7..fec92defe5 100644 --- a/gfx/drivers_context/mali_fbdev_ctx.c +++ b/gfx/drivers_context/mali_fbdev_ctx.c @@ -172,6 +172,7 @@ static void gfx_ctx_mali_fbdev_update_window_title(void *data, video_frame_info_ } static bool gfx_ctx_mali_fbdev_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/opendingux_fbdev_ctx.c b/gfx/drivers_context/opendingux_fbdev_ctx.c index 8711de8830..f740199263 100644 --- a/gfx/drivers_context/opendingux_fbdev_ctx.c +++ b/gfx/drivers_context/opendingux_fbdev_ctx.c @@ -155,6 +155,7 @@ static void gfx_ctx_opendingux_update_window_title(void *data, video_frame_info_ } static bool gfx_ctx_opendingux_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/osmesa_ctx.c b/gfx/drivers_context/osmesa_ctx.c index 852e4ae96e..f21682d291 100644 --- a/gfx/drivers_context/osmesa_ctx.c +++ b/gfx/drivers_context/osmesa_ctx.c @@ -237,15 +237,14 @@ static void osmesa_ctx_swap_interval(void *data, unsigned interval) (void)interval; } -static bool osmesa_ctx_set_video_mode(void *data, unsigned width, unsigned height, +static bool osmesa_ctx_set_video_mode(void *data, + video_frame_info_t video_info, + unsigned width, unsigned height, bool fullscreen) { gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data; - uint8_t *screen = osmesa->screen; - - (void)fullscreen; - - bool size_changed = (width * height) != (osmesa->width * osmesa->height); + uint8_t *screen = osmesa->screen; + bool size_changed = (width * height) != (osmesa->width * osmesa->height); if (!osmesa->screen || size_changed) screen = (uint8_t*)calloc(1, (width * height) * osmesa->pixsize); diff --git a/gfx/drivers_context/ps3_ctx.c b/gfx/drivers_context/ps3_ctx.c index 90af1e9837..555e7c1fb3 100644 --- a/gfx/drivers_context/ps3_ctx.c +++ b/gfx/drivers_context/ps3_ctx.c @@ -302,6 +302,7 @@ static void *gfx_ctx_ps3_init(void *video_driver) } static bool gfx_ctx_ps3_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/qnx_ctx.c b/gfx/drivers_context/qnx_ctx.c index 73fc163126..21facaff31 100644 --- a/gfx/drivers_context/qnx_ctx.c +++ b/gfx/drivers_context/qnx_ctx.c @@ -333,6 +333,7 @@ static void gfx_ctx_qnx_update_window_title(void *data, video_frame_info_t video } static bool gfx_ctx_qnx_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/sdl_gl_ctx.c b/gfx/drivers_context/sdl_gl_ctx.c index 8197c7d4bb..2aa11b9e37 100644 --- a/gfx/drivers_context/sdl_gl_ctx.c +++ b/gfx/drivers_context/sdl_gl_ctx.c @@ -162,7 +162,9 @@ static void sdl_ctx_swap_interval(void *data, unsigned interval) #endif } -static bool sdl_ctx_set_video_mode(void *data, unsigned width, unsigned height, +static bool sdl_ctx_set_video_mode(void *data, + video_frame_info_t video_info, + unsigned width, unsigned height, bool fullscreen) { unsigned fsflag = 0; diff --git a/gfx/drivers_context/vc_egl_ctx.c b/gfx/drivers_context/vc_egl_ctx.c index 51bdf0e9f6..6141fa1880 100644 --- a/gfx/drivers_context/vc_egl_ctx.c +++ b/gfx/drivers_context/vc_egl_ctx.c @@ -319,6 +319,7 @@ static void gfx_ctx_vc_set_swap_interval(void *data, unsigned swap_interval) } static bool gfx_ctx_vc_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/vivante_fbdev_ctx.c b/gfx/drivers_context/vivante_fbdev_ctx.c index 0c4f7ff230..dc2c7e39e8 100644 --- a/gfx/drivers_context/vivante_fbdev_ctx.c +++ b/gfx/drivers_context/vivante_fbdev_ctx.c @@ -159,6 +159,7 @@ static void gfx_ctx_vivante_update_window_title(void *data, video_frame_info_t v } static bool gfx_ctx_vivante_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index f94984b0fa..baa76bb910 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -1076,6 +1076,7 @@ static void gfx_ctx_wl_set_swap_interval(void *data, unsigned swap_interval) } static bool gfx_ctx_wl_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { @@ -1086,10 +1087,11 @@ static bool gfx_ctx_wl_set_video_mode(void *data, #endif gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - wl->width = width ? width : DEFAULT_WINDOWED_WIDTH; - wl->height = height ? height : DEFAULT_WINDOWED_HEIGHT; + wl->width = width ? width : DEFAULT_WINDOWED_WIDTH; + wl->height = height ? height : DEFAULT_WINDOWED_HEIGHT; + + wl->surface = wl_compositor_create_surface(wl->compositor); - wl->surface = wl_compositor_create_surface(wl->compositor); wl_surface_set_buffer_scale(wl->surface, wl->buffer_scale); switch (wl_api) diff --git a/gfx/drivers_context/wgl_ctx.cpp b/gfx/drivers_context/wgl_ctx.cpp index ee8f08c254..27691a0466 100644 --- a/gfx/drivers_context/wgl_ctx.cpp +++ b/gfx/drivers_context/wgl_ctx.cpp @@ -525,6 +525,7 @@ static void gfx_ctx_wgl_destroy(void *data) } static bool gfx_ctx_wgl_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { diff --git a/gfx/drivers_context/x_ctx.c b/gfx/drivers_context/x_ctx.c index f7841b5690..9904e3bfef 100644 --- a/gfx/drivers_context/x_ctx.c +++ b/gfx/drivers_context/x_ctx.c @@ -448,11 +448,11 @@ error: } static bool gfx_ctx_x_set_video_mode(void *data, + video_frame_info_t video_info, unsigned width, unsigned height, bool fullscreen) { XEvent event; - video_frame_info_t video_info; bool true_full = false; bool windowed_full = false; int val = 0; @@ -564,16 +564,6 @@ static bool gfx_ctx_x_set_video_mode(void *data, break; } - video_info.refresh_rate = settings->video.refresh_rate; - video_info.black_frame_insertion = - settings->video.black_frame_insertion; - video_info.hard_sync = settings->video.hard_sync; - video_info.hard_sync_frames = settings->video.hard_sync_frames; - video_info.fps_show = settings->fps_show; - video_info.scale_integer = settings->video.scale_integer; - video_info.aspect_ratio_idx = settings->video.aspect_ratio_idx; - video_info.post_filter_record = settings->video.post_filter_record; - video_info.max_swapchain_images = settings->video.max_swapchain_images; x11_set_window_attr(g_x11_dpy, g_x11_win); x11_update_window_title(NULL, video_info); diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index b3f77a0b59..4475464f5c 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -258,13 +258,13 @@ static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr) static void gfx_ctx_xegl_set_swap_interval(void *data, unsigned swap_interval); static bool gfx_ctx_xegl_set_video_mode(void *data, - unsigned width, unsigned height, - bool fullscreen) + video_frame_info_t video_info, + unsigned width, unsigned height, + bool fullscreen) { XEvent event; EGLint egl_attribs[16]; EGLint vid, num_visuals; - video_frame_info_t video_info; EGLint *attr = NULL; bool windowed_full = false; bool true_full = false; @@ -356,17 +356,6 @@ static bool gfx_ctx_xegl_set_video_mode(void *data, if (!egl_create_surface(&xegl->egl, (void*)g_x11_win)) goto error; - video_info.refresh_rate = settings->video.refresh_rate; - video_info.black_frame_insertion = - settings->video.black_frame_insertion; - video_info.hard_sync = settings->video.hard_sync; - video_info.hard_sync_frames = settings->video.hard_sync_frames; - video_info.fps_show = settings->fps_show; - video_info.scale_integer = settings->video.scale_integer; - video_info.aspect_ratio_idx = settings->video.aspect_ratio_idx; - video_info.post_filter_record = settings->video.post_filter_record; - video_info.max_swapchain_images = settings->video.max_swapchain_images; - x11_set_window_attr(g_x11_dpy, g_x11_win); x11_update_window_title(NULL, video_info); diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 2f174443a9..a19279e9d9 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -438,10 +438,25 @@ bool video_context_driver_get_ident(gfx_ctx_ident_t *ident) bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info) { + video_frame_info_t video_info; + settings_t *settings = config_get_ptr(); + if (!current_video_context || !current_video_context->set_video_mode) return false; + + video_info.refresh_rate = settings->video.refresh_rate; + video_info.black_frame_insertion = + settings->video.black_frame_insertion; + video_info.hard_sync = settings->video.hard_sync; + video_info.hard_sync_frames = settings->video.hard_sync_frames; + video_info.fps_show = settings->fps_show; + video_info.scale_integer = settings->video.scale_integer; + video_info.aspect_ratio_idx = settings->video.aspect_ratio_idx; + video_info.post_filter_record = settings->video.post_filter_record; + video_info.max_swapchain_images = settings->video.max_swapchain_images; + if (!current_video_context->set_video_mode( - video_context_data, mode_info->width, + video_context_data, video_info, mode_info->width, mode_info->height, mode_info->fullscreen)) return false; return true; diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index c305f90262..96b6364001 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -77,7 +77,7 @@ typedef struct gfx_ctx_driver void (*swap_interval)(void *data, unsigned); /* Sets video mode. Creates a window, etc. */ - bool (*set_video_mode)(void*, unsigned, unsigned, bool); + bool (*set_video_mode)(void*, video_frame_info_t video_info, unsigned, unsigned, bool); /* Gets current window size. * If not initialized yet, it returns current screen size. */