diff --git a/gfx/common/egl_common.c b/gfx/common/egl_common.c index 80e0697e50..3d4cec7166 100644 --- a/gfx/common/egl_common.c +++ b/gfx/common/egl_common.c @@ -330,12 +330,11 @@ bool egl_init_context(egl_ctx_data_t *egl, EGLenum platform, void *display_data, EGLint *major, EGLint *minor, - EGLint *n, const EGLint *attrib_ptr, + EGLint *count, const EGLint *attrib_ptr, egl_accept_config_cb_t cb) { EGLint i; EGLConfig *configs = NULL; - EGLint count = 0; EGLint matched = 0; int config_index = -1; EGLDisplay dpy = get_egl_display(platform, display_data); @@ -353,24 +352,24 @@ bool egl_init_context(egl_ctx_data_t *egl, RARCH_LOG("[EGL]: EGL version: %d.%d\n", *major, *minor); - if (!eglGetConfigs(egl->dpy, NULL, 0, &count) || count < 1) + if (!eglGetConfigs(egl->dpy, NULL, 0, count) || *count < 1) { RARCH_ERR("[EGL]: No configs to choose from.\n"); return false; } - configs = malloc(count * sizeof(*configs)); + configs = malloc(*count * sizeof(*configs)); if (!configs) return false; if (!eglChooseConfig(egl->dpy, attrib_ptr, - configs, count, &matched) || !matched) + configs, *count, &matched) || !matched) { RARCH_ERR("[EGL]: No EGL configs with appropriate attributes.\n"); return false; } - for (i = 0; i < count; i++) + for (i = 0; i < *count; i++) { if (!cb || cb(display_data, egl->dpy, configs[i])) { @@ -381,7 +380,7 @@ bool egl_init_context(egl_ctx_data_t *egl, free(configs); - if (i == count) + if (i == *count) { RARCH_ERR("[EGL]: No EGL config found which satifies requirements.\n"); return false; diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index d83b5667ee..e971e35e65 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -568,7 +568,7 @@ static const struct wl_seat_listener seat_listener = { /* Touch handle functions */ -bool wayland_context_gettouchpos(void *data, unsigned id, +bool wayland_context_gettouchpos(void *data, unsigned id, unsigned* touch_x, unsigned* touch_y) { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; @@ -619,7 +619,7 @@ static const struct xdg_wm_base_listener xdg_shell_listener = { static void handle_surface_config(void *data, struct xdg_surface *surface, uint32_t serial) -{ +{ xdg_surface_ack_configure(surface, serial); } @@ -631,7 +631,7 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, int32_t width, int32_t height, struct wl_array *states) { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - + wl->fullscreen = false; wl->maximized = false; const uint32_t *state; @@ -657,7 +657,7 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, wl->width = width; wl->height = height; } - + wl->configured = false; } @@ -683,7 +683,7 @@ static const struct zxdg_shell_v6_listener zxdg_shell_v6_listener = { static void handle_zxdg_surface_config(void *data, struct zxdg_surface_v6 *surface, uint32_t serial) -{ +{ zxdg_surface_v6_ack_configure(surface, serial); } @@ -695,7 +695,7 @@ static void handle_zxdg_toplevel_config(void *data, struct zxdg_toplevel_v6 *top int32_t width, int32_t height, struct wl_array *states) { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - + wl->fullscreen = false; wl->maximized = false; const uint32_t *state; @@ -721,7 +721,7 @@ static void handle_zxdg_toplevel_config(void *data, struct zxdg_toplevel_v6 *top wl->width = width; wl->height = height; } - + wl->configured = false; } @@ -1147,7 +1147,7 @@ static void gfx_ctx_wl_update_title(void *data, void *data2) else if (wl->zxdg_toplevel) { if (wl->deco) { zxdg_toplevel_decoration_v1_set_mode(wl->deco, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); - } + } zxdg_toplevel_v6_set_title(wl->zxdg_toplevel, title); } else if (wl->shell_surf) @@ -1318,23 +1318,23 @@ static void *gfx_ctx_wl_init(video_frame_info_t *video_info, void *video_driver) { RARCH_LOG("[Wayland]: Using zxdg_shell_v6 interface.\n"); } - + if (!wl->xdg_shell && !wl->zxdg_shell) { RARCH_WARN("[Wayland]: Fallback to deprecated wl_shell interface!.\n"); } - + if (!wl->xdg_shell && !wl->zxdg_shell && !wl->shell) { RARCH_ERR("[Wayland]: Failed to create shell.\n"); goto error; } - + if (!wl->idle_inhibit_manager) { RARCH_WARN("[Wayland]: Compositor doesn't support zwp_idle_inhibit_manager_v1 protocol!\n"); } - + if (!wl->deco_manager) { RARCH_WARN("[Wayland]: Compositor doesn't support zxdg_decoration_manager_v1 protocol!\n"); @@ -1562,26 +1562,26 @@ static bool gfx_ctx_wl_set_video_mode(void *data, default: break; } - + if (wl->xdg_shell) { wl->xdg_surface = xdg_wm_base_get_xdg_surface(wl->xdg_shell, wl->surface); xdg_surface_add_listener(wl->xdg_surface, &xdg_surface_listener, wl); - + wl->xdg_toplevel = xdg_surface_get_toplevel(wl->xdg_surface); xdg_toplevel_add_listener(wl->xdg_toplevel, &xdg_toplevel_listener, wl); xdg_toplevel_set_app_id(wl->xdg_toplevel, "retroarch"); xdg_toplevel_set_title(wl->xdg_toplevel, "RetroArch"); - + if (wl->deco_manager) { wl->deco = zxdg_decoration_manager_v1_get_toplevel_decoration( wl->deco_manager, wl->xdg_toplevel); } - + /* Waiting for xdg_toplevel to be configured before starting to draw */ wl_surface_commit(wl->surface); wl->configured = true; - + while (wl->configured) { wl_display_dispatch(wl->input.dpy); } @@ -1590,22 +1590,22 @@ static bool gfx_ctx_wl_set_video_mode(void *data, } else if (wl->zxdg_shell) { wl->zxdg_surface = zxdg_shell_v6_get_xdg_surface(wl->zxdg_shell, wl->surface); zxdg_surface_v6_add_listener(wl->zxdg_surface, &zxdg_surface_v6_listener, wl); - + wl->zxdg_toplevel = zxdg_surface_v6_get_toplevel(wl->zxdg_surface); zxdg_toplevel_v6_add_listener(wl->zxdg_toplevel, &zxdg_toplevel_v6_listener, wl); zxdg_toplevel_v6_set_app_id(wl->zxdg_toplevel, "retroarch"); zxdg_toplevel_v6_set_title(wl->zxdg_toplevel, "RetroArch"); - + if (wl->deco_manager) { wl->deco = zxdg_decoration_manager_v1_get_toplevel_decoration( wl->deco_manager, wl->xdg_toplevel); } - + /* Waiting for xdg_toplevel to be configured before starting to draw */ wl_surface_commit(wl->surface); wl->configured = true; - + while (wl->configured) { wl_display_dispatch(wl->input.dpy); } @@ -1618,7 +1618,7 @@ static bool gfx_ctx_wl_set_video_mode(void *data, wl_shell_surface_set_class(wl->shell_surf, "RetroArch"); wl_shell_surface_set_title(wl->shell_surf, "RetroArch"); } - + switch (wl_api) { @@ -1718,7 +1718,7 @@ static bool gfx_ctx_wl_has_focus(void *data) static bool gfx_ctx_wl_suppress_screensaver(void *data, bool state) { (void)data; - + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; if (!wl->idle_inhibit_manager)