From dd3e7f9ddc3082e963f6c8305ea07356893cc91e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 19 Nov 2015 10:35:15 +0100 Subject: [PATCH] No more wrapper function for x11_check_window --- gfx/common/x11_common.c | 16 ++++++++++++++-- gfx/common/x11_common.h | 3 ++- gfx/drivers_context/glx_ctx.c | 19 +------------------ gfx/drivers_context/xegl_ctx.c | 20 +------------------- 4 files changed, 18 insertions(+), 40 deletions(-) diff --git a/gfx/common/x11_common.c b/gfx/common/x11_common.c index a5fedddc10..765798a250 100644 --- a/gfx/common/x11_common.c +++ b/gfx/common/x11_common.c @@ -377,10 +377,22 @@ bool x11_get_metrics(void *data, void x_input_poll_wheel(void *data, XButtonEvent *event, bool latch); -void x11_check_window(bool *quit) +void x11_check_window(void *data, bool *quit, + bool *resize, unsigned *width, unsigned *height, unsigned frame_count) { XEvent event; - driver_t *driver = driver_get_ptr(); + driver_t *driver = driver_get_ptr(); + unsigned new_width = *width; + unsigned new_height = *height; + + x11_get_video_size(data, &new_width, &new_height); + + if (new_width != *width || new_height != *height) + { + *resize = true; + *width = new_width; + *height = new_height; + } while (XPending(g_x11_dpy)) { diff --git a/gfx/common/x11_common.h b/gfx/common/x11_common.h index b846908288..4d1fe79506 100644 --- a/gfx/common/x11_common.h +++ b/gfx/common/x11_common.h @@ -68,7 +68,8 @@ void x11_handle_key_event(XEvent *event, XIC ic, bool filter); bool x11_get_metrics(void *data, enum display_metric_types type, float *value); -void x11_check_window(bool *quit); +void x11_check_window(void *data, bool *quit, + bool *resize, unsigned *width, unsigned *height, unsigned frame_count); void x11_get_video_size(void *data, unsigned *width, unsigned *height); diff --git a/gfx/drivers_context/glx_ctx.c b/gfx/drivers_context/glx_ctx.c index afcb9ae6e4..713bfd1131 100644 --- a/gfx/drivers_context/glx_ctx.c +++ b/gfx/drivers_context/glx_ctx.c @@ -206,23 +206,6 @@ static void gfx_ctx_glx_swap_interval(void *data, unsigned interval) } } -static void gfx_ctx_glx_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) -{ - unsigned new_width = *width, new_height = *height; - - x11_get_video_size(data, &new_width, &new_height); - - if (new_width != *width || new_height != *height) - { - *resize = true; - *width = new_width; - *height = new_height; - } - - x11_check_window(quit); -} - static void gfx_ctx_glx_swap_buffers(void *data) { driver_t *driver = driver_get_ptr(); @@ -690,7 +673,7 @@ const gfx_ctx_driver_t gfx_ctx_glx = { x11_get_metrics, NULL, gfx_ctx_glx_update_window_title, - gfx_ctx_glx_check_window, + x11_check_window, gfx_ctx_glx_set_resize, x11_has_focus, gfx_ctx_glx_suppress_screensaver, diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index c1d4e41bbe..f88dd84d36 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -125,24 +125,6 @@ static void gfx_ctx_xegl_swap_interval(void *data, unsigned interval) } } -static void gfx_ctx_xegl_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) -{ - unsigned new_width = *width; - unsigned new_height = *height; - - x11_get_video_size(data, &new_width, &new_height); - - if (new_width != *width || new_height != *height) - { - *resize = true; - *width = new_width; - *height = new_height; - } - - x11_check_window(quit); -} - static void gfx_ctx_xegl_swap_buffers(void *data) { (void)data; @@ -727,7 +709,7 @@ const gfx_ctx_driver_t gfx_ctx_x_egl = x11_get_metrics, NULL, gfx_ctx_xegl_update_window_title, - gfx_ctx_xegl_check_window, + x11_check_window, gfx_ctx_xegl_set_resize, gfx_ctx_xegl_has_focus, gfx_ctx_xegl_suppress_screensaver,