Update set_video_mode context driver callback function

This commit is contained in:
twinaphex 2017-01-11 06:35:50 +01:00
parent d0df067e84
commit 80f79130c0
22 changed files with 64 additions and 52 deletions

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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);

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)

View File

@ -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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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. */