mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 17:43:02 +00:00
Update set_video_mode context driver callback function
This commit is contained in:
parent
d0df067e84
commit
80f79130c0
@ -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,
|
static bool android_gfx_ctx_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -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,
|
static bool gfx_ctx_cgl_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -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,
|
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)
|
#if defined(HAVE_COCOA)
|
||||||
static bool has_went_fullscreen = false;
|
static bool has_went_fullscreen = false;
|
||||||
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
||||||
/* TODO: Screen mode support. */
|
/* TODO: Screen mode support. */
|
||||||
|
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
{
|
{
|
||||||
if (!has_went_fullscreen)
|
if (!has_went_fullscreen)
|
||||||
{
|
{
|
||||||
[g_view enterFullScreenMode:get_chosen_screen() withOptions:nil];
|
[g_view enterFullScreenMode:get_chosen_screen() withOptions:nil];
|
||||||
cocoagl_gfx_ctx_show_mouse(data, false);
|
cocoagl_gfx_ctx_show_mouse(data, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (has_went_fullscreen)
|
if (has_went_fullscreen)
|
||||||
{
|
{
|
||||||
[g_view exitFullScreenModeWithOptions:nil];
|
[g_view exitFullScreenModeWithOptions:nil];
|
||||||
[[g_view window] makeFirstResponder:g_view];
|
[[g_view window] makeFirstResponder:g_view];
|
||||||
cocoagl_gfx_ctx_show_mouse(data, true);
|
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;
|
has_went_fullscreen = fullscreen;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(void)data;
|
(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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -198,6 +198,7 @@ static void gfx_ctx_d3d_input_driver(void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool gfx_ctx_d3d_set_video_mode(void *data,
|
static bool gfx_ctx_d3d_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -618,6 +618,7 @@ error:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool gfx_ctx_drm_set_video_mode(void *data,
|
static bool gfx_ctx_drm_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -189,6 +189,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool gfx_ctx_emscripten_set_video_mode(void *data,
|
static bool gfx_ctx_emscripten_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -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,
|
static bool gfx_ctx_null_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -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,
|
static bool gfx_ctx_khr_display_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -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,
|
static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -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,
|
static bool gfx_ctx_opendingux_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -237,15 +237,14 @@ static void osmesa_ctx_swap_interval(void *data, unsigned interval)
|
|||||||
(void)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)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
|
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
|
||||||
uint8_t *screen = osmesa->screen;
|
uint8_t *screen = osmesa->screen;
|
||||||
|
bool size_changed = (width * height) != (osmesa->width * osmesa->height);
|
||||||
(void)fullscreen;
|
|
||||||
|
|
||||||
bool size_changed = (width * height) != (osmesa->width * osmesa->height);
|
|
||||||
|
|
||||||
if (!osmesa->screen || size_changed)
|
if (!osmesa->screen || size_changed)
|
||||||
screen = (uint8_t*)calloc(1, (width * height) * osmesa->pixsize);
|
screen = (uint8_t*)calloc(1, (width * height) * osmesa->pixsize);
|
||||||
|
@ -302,6 +302,7 @@ static void *gfx_ctx_ps3_init(void *video_driver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool gfx_ctx_ps3_set_video_mode(void *data,
|
static bool gfx_ctx_ps3_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -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,
|
static bool gfx_ctx_qnx_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -162,7 +162,9 @@ static void sdl_ctx_swap_interval(void *data, unsigned interval)
|
|||||||
#endif
|
#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)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
unsigned fsflag = 0;
|
unsigned fsflag = 0;
|
||||||
|
@ -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,
|
static bool gfx_ctx_vc_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -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,
|
static bool gfx_ctx_vivante_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -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,
|
static bool gfx_ctx_wl_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
@ -1086,10 +1087,11 @@ static bool gfx_ctx_wl_set_video_mode(void *data,
|
|||||||
#endif
|
#endif
|
||||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||||
|
|
||||||
wl->width = width ? width : DEFAULT_WINDOWED_WIDTH;
|
wl->width = width ? width : DEFAULT_WINDOWED_WIDTH;
|
||||||
wl->height = height ? height : DEFAULT_WINDOWED_HEIGHT;
|
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);
|
wl_surface_set_buffer_scale(wl->surface, wl->buffer_scale);
|
||||||
|
|
||||||
switch (wl_api)
|
switch (wl_api)
|
||||||
|
@ -525,6 +525,7 @@ static void gfx_ctx_wgl_destroy(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool gfx_ctx_wgl_set_video_mode(void *data,
|
static bool gfx_ctx_wgl_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -448,11 +448,11 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool gfx_ctx_x_set_video_mode(void *data,
|
static bool gfx_ctx_x_set_video_mode(void *data,
|
||||||
|
video_frame_info_t video_info,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
video_frame_info_t video_info;
|
|
||||||
bool true_full = false;
|
bool true_full = false;
|
||||||
bool windowed_full = false;
|
bool windowed_full = false;
|
||||||
int val = 0;
|
int val = 0;
|
||||||
@ -564,16 +564,6 @@ static bool gfx_ctx_x_set_video_mode(void *data,
|
|||||||
break;
|
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_set_window_attr(g_x11_dpy, g_x11_win);
|
||||||
x11_update_window_title(NULL, video_info);
|
x11_update_window_title(NULL, video_info);
|
||||||
|
@ -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 void gfx_ctx_xegl_set_swap_interval(void *data, unsigned swap_interval);
|
||||||
|
|
||||||
static bool gfx_ctx_xegl_set_video_mode(void *data,
|
static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||||
unsigned width, unsigned height,
|
video_frame_info_t video_info,
|
||||||
bool fullscreen)
|
unsigned width, unsigned height,
|
||||||
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
EGLint egl_attribs[16];
|
EGLint egl_attribs[16];
|
||||||
EGLint vid, num_visuals;
|
EGLint vid, num_visuals;
|
||||||
video_frame_info_t video_info;
|
|
||||||
EGLint *attr = NULL;
|
EGLint *attr = NULL;
|
||||||
bool windowed_full = false;
|
bool windowed_full = false;
|
||||||
bool true_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))
|
if (!egl_create_surface(&xegl->egl, (void*)g_x11_win))
|
||||||
goto error;
|
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_set_window_attr(g_x11_dpy, g_x11_win);
|
||||||
x11_update_window_title(NULL, video_info);
|
x11_update_window_title(NULL, video_info);
|
||||||
|
|
||||||
|
@ -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)
|
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)
|
if (!current_video_context || !current_video_context->set_video_mode)
|
||||||
return false;
|
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(
|
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))
|
mode_info->height, mode_info->fullscreen))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -77,7 +77,7 @@ typedef struct gfx_ctx_driver
|
|||||||
void (*swap_interval)(void *data, unsigned);
|
void (*swap_interval)(void *data, unsigned);
|
||||||
|
|
||||||
/* Sets video mode. Creates a window, etc. */
|
/* 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.
|
/* Gets current window size.
|
||||||
* If not initialized yet, it returns current screen size. */
|
* If not initialized yet, it returns current screen size. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user