Update check_window - we no longer need runloop.h inside context driver

This commit is contained in:
twinaphex 2017-01-23 01:02:33 +01:00
parent 4ea31e99aa
commit 6247d6ea1d
24 changed files with 49 additions and 36 deletions

View File

@ -633,7 +633,8 @@ bool x11_alive(void *data)
} }
void x11_check_window(void *data, bool *quit, void x11_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height,
bool is_shutdown)
{ {
unsigned new_width = *width; unsigned new_width = *width;
unsigned new_height = *height; unsigned new_height = *height;

View File

@ -72,7 +72,7 @@ bool x11_get_metrics(void *data,
enum display_metric_types type, float *value); enum display_metric_types type, float *value);
void x11_check_window(void *data, bool *quit, void x11_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height); bool *resize, unsigned *width, unsigned *height, bool is_shutdown);
void x11_get_video_size(void *data, unsigned *width, unsigned *height); void x11_get_video_size(void *data, unsigned *width, unsigned *height);

View File

@ -38,8 +38,6 @@
#include "../../frontend/drivers/platform_linux.h" #include "../../frontend/drivers/platform_linux.h"
#include "../../runloop.h"
static enum gfx_ctx_api android_api = GFX_CTX_NONE; static enum gfx_ctx_api android_api = GFX_CTX_NONE;
/* forward declaration */ /* forward declaration */
@ -230,7 +228,8 @@ static void android_gfx_ctx_get_video_size(void *data,
} }
static void android_gfx_ctx_check_window(void *data, bool *quit, static void android_gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height,
bool is_shutdown)
{ {
unsigned new_width = 0; unsigned new_width = 0;
unsigned new_height = 0; unsigned new_height = 0;
@ -271,7 +270,7 @@ static void android_gfx_ctx_check_window(void *data, bool *quit,
} }
/* Check if we are exiting. */ /* Check if we are exiting. */
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL)) if (is_shutdown)
*quit = true; *quit = true;
} }

View File

@ -77,7 +77,7 @@ static void gfx_ctx_cgl_get_video_size(void *data, unsigned *width, unsigned *he
} }
static void gfx_ctx_cgl_check_window(void *data, bool *quit, static void gfx_ctx_cgl_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{ {
unsigned new_width = 0; unsigned new_width = 0;
unsigned new_height = 0; unsigned new_height = 0;

View File

@ -558,7 +558,7 @@ CFStringRef)BOXSTRING(symbol_name)
} }
static void cocoagl_gfx_ctx_check_window(void *data, bool *quit, static void cocoagl_gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{ {
unsigned new_width, new_height; unsigned new_width, new_height;

View File

@ -125,7 +125,7 @@ static void gfx_ctx_d3d_show_mouse(void *data, bool state)
static void gfx_ctx_d3d_check_window(void *data, bool *quit, static void gfx_ctx_d3d_check_window(void *data, bool *quit,
bool *resize, unsigned *width, bool *resize, unsigned *width,
unsigned *height) unsigned *height, bool is_shutdown)
{ {
win32_check_window(quit, resize, width, height); win32_check_window(quit, resize, width, height);
} }

View File

@ -138,7 +138,7 @@ static void gfx_ctx_drm_swap_interval(void *data, unsigned interval)
} }
static void gfx_ctx_drm_check_window(void *data, bool *quit, static void gfx_ctx_drm_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{ {
(void)data; (void)data;
(void)width; (void)width;

View File

@ -52,7 +52,7 @@ static void gfx_ctx_emscripten_swap_interval(void *data, unsigned interval)
} }
static void gfx_ctx_emscripten_check_window(void *data, bool *quit, static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{ {
int input_width; int input_width;
int input_height; int input_height;

View File

@ -64,7 +64,7 @@ static void setup_gdi_pixel_format(HDC hdc)
} }
static void gfx_ctx_gdi_check_window(void *data, bool *quit, static void gfx_ctx_gdi_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{ {
win32_check_window(quit, resize, width, height); win32_check_window(quit, resize, width, height);
} }

View File

@ -25,7 +25,7 @@ static void gfx_ctx_null_swap_interval(void *data, unsigned interval)
} }
static void gfx_ctx_null_check_window(void *data, bool *quit, static void gfx_ctx_null_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{ {
(void)data; (void)data;
(void)quit; (void)quit;

View File

@ -17,7 +17,6 @@
#include "../../config.h" #include "../../config.h"
#endif #endif
#include "../../runloop.h"
#include "../../frontend/frontend_driver.h" #include "../../frontend/frontend_driver.h"
#include "../common/vulkan_common.h" #include "../common/vulkan_common.h"
@ -74,7 +73,7 @@ error:
} }
static void gfx_ctx_khr_display_check_window(void *data, bool *quit, static void gfx_ctx_khr_display_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{ {
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data; khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
@ -87,7 +86,7 @@ static void gfx_ctx_khr_display_check_window(void *data, bool *quit,
*resize = true; *resize = true;
} }
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL) || (bool)frontend_driver_get_signal_handler_state()) if (is_shutdown || (bool)frontend_driver_get_signal_handler_state())
*quit = true; *quit = true;
} }

View File

@ -130,7 +130,7 @@ error:
} }
static void gfx_ctx_mali_fbdev_check_window(void *data, bool *quit, static void gfx_ctx_mali_fbdev_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{ {
unsigned new_width, new_height; unsigned new_width, new_height;

View File

@ -112,7 +112,7 @@ static void gfx_ctx_opendingux_get_video_size(void *data,
} }
static void gfx_ctx_opendingux_check_window(void *data, bool *quit, static void gfx_ctx_opendingux_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{ {
unsigned new_width, new_height; unsigned new_width, new_height;
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data; opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;

View File

@ -308,7 +308,7 @@ static void osmesa_ctx_get_video_size(void *data,
static void osmesa_ctx_check_window(void *data, bool *quit, static void osmesa_ctx_check_window(void *data, bool *quit,
bool *resize,unsigned *width, bool *resize,unsigned *width,
unsigned *height) unsigned *height, bool is_shutdown)
{ {
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data; gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;

View File

@ -148,12 +148,13 @@ static void gfx_ctx_ps3_set_swap_interval(void *data, unsigned interval)
} }
static void gfx_ctx_ps3_check_window(void *data, bool *quit, static void gfx_ctx_ps3_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height,
bool is_shutdown)
{ {
gl_t *gl = data; gl_t *gl = data;
*quit = false; *quit = false;
*resize = false; *resize = false;
if (gl->should_resize) if (gl->should_resize)
*resize = true; *resize = true;

View File

@ -45,7 +45,6 @@
#endif #endif
#include "../../configuration.h" #include "../../configuration.h"
#include "../../runloop.h"
#define WINDOW_BUFFERS 2 #define WINDOW_BUFFERS 2
@ -284,7 +283,8 @@ static void gfx_ctx_qnx_get_video_size(void *data,
} }
static void gfx_ctx_qnx_check_window(void *data, bool *quit, static void gfx_ctx_qnx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height,
bool is_shutdown)
{ {
unsigned new_width, new_height; unsigned new_width, new_height;
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data; qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
@ -303,7 +303,7 @@ static void gfx_ctx_qnx_check_window(void *data, bool *quit,
} }
/* Check if we are exiting. */ /* Check if we are exiting. */
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL)) if (is_shutdown)
*quit = true; *quit = true;
} }

View File

@ -285,8 +285,10 @@ static void sdl_ctx_update_title(void *data, video_frame_info_t *video_info)
#endif #endif
} }
static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *width, static void sdl_ctx_check_window(void *data, bool *quit,
unsigned *height) bool *resize,unsigned *width,
unsigned *height,
bool is_shutdown)
{ {
SDL_Event event; SDL_Event event;
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;

View File

@ -86,7 +86,8 @@ static INLINE bool gfx_ctx_vc_egl_query_extension(vc_ctx_data_t *vc, const char
} }
static void gfx_ctx_vc_check_window(void *data, bool *quit, static void gfx_ctx_vc_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height,
bool is_shutdown)
{ {
(void)data; (void)data;
(void)width; (void)width;

View File

@ -117,7 +117,8 @@ static void gfx_ctx_vivante_get_video_size(void *data,
} }
static void gfx_ctx_vivante_check_window(void *data, bool *quit, static void gfx_ctx_vivante_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height,
bool is_shutdown)
{ {
unsigned new_width, new_height; unsigned new_width, new_height;
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data; vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;

View File

@ -642,7 +642,8 @@ static void flush_wayland_fd(gfx_ctx_wayland_data_t *wl)
} }
static void gfx_ctx_wl_check_window(void *data, bool *quit, static void gfx_ctx_wl_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height,
bool is_shutdown)
{ {
unsigned new_width, new_height; unsigned new_width, new_height;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;

View File

@ -311,7 +311,8 @@ static void gfx_ctx_wgl_swap_interval(void *data, unsigned interval)
} }
static void gfx_ctx_wgl_check_window(void *data, bool *quit, static void gfx_ctx_wgl_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height,
bool is_shutdown)
{ {
win32_check_window(quit, resize, width, height); win32_check_window(quit, resize, width, height);

View File

@ -347,9 +347,11 @@ static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t *video_info)
} }
static void gfx_ctx_x_check_window(void *data, bool *quit, static void gfx_ctx_x_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height) bool *resize, unsigned *width, unsigned *height,
bool is_shutdown)
{ {
x11_check_window(data, quit, resize, width, height); x11_check_window(data, quit, resize, width, height,
is_shutdown);
switch (x_api) switch (x_api)
{ {
@ -787,8 +789,10 @@ static bool gfx_ctx_x_set_video_mode(void *data,
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
{ {
bool quit, resize; bool quit, resize;
bool shutdown = false;
unsigned width = 0, height = 0; unsigned width = 0, height = 0;
x11_check_window(x, &quit, &resize, &width, &height); x11_check_window(x, &quit, &resize, &width, &height,
shutdown);
/* Use XCB surface since it's the most supported WSI. /* Use XCB surface since it's the most supported WSI.
* We can obtain the XCB connection directly from X11. */ * We can obtain the XCB connection directly from X11. */

View File

@ -27,6 +27,7 @@
#endif #endif
#include "../configuration.h" #include "../configuration.h"
#include "../runloop.h"
#include "../verbosity.h" #include "../verbosity.h"
static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
@ -278,11 +279,13 @@ bool video_context_driver_check_window(gfx_ctx_size_t *size_data)
&& current_video_context && current_video_context
&& current_video_context->check_window) && current_video_context->check_window)
{ {
bool is_shutdown = runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL);
current_video_context->check_window(video_context_data, current_video_context->check_window(video_context_data,
size_data->quit, size_data->quit,
size_data->resize, size_data->resize,
size_data->width, size_data->width,
size_data->height); size_data->height,
is_shutdown);
return true; return true;
} }

View File

@ -106,7 +106,7 @@ typedef struct gfx_ctx_driver
/* Queries for resize and quit events. /* Queries for resize and quit events.
* Also processes events. */ * Also processes events. */
void (*check_window)(void*, bool*, bool*, void (*check_window)(void*, bool*, bool*,
unsigned*, unsigned*); unsigned*, unsigned*, bool);
/* Acknowledge a resize event. This is needed for some APIs. /* Acknowledge a resize event. This is needed for some APIs.
* Most backends will ignore this. */ * Most backends will ignore this. */