From 9a74e0756852243648f3f0bfb1cbf0f7bae07961 Mon Sep 17 00:00:00 2001 From: Carlos Aragones <> Date: Tue, 15 Sep 2020 15:24:05 +0200 Subject: [PATCH] prepare Linux Wayland & iOS --- src/ios/iOSMiniFB.m | 13 ++++++++++++- src/wayland/WaylandMiniFB.c | 20 +++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/ios/iOSMiniFB.m b/src/ios/iOSMiniFB.m index bd28900..dbac380 100644 --- a/src/ios/iOSMiniFB.m +++ b/src/ios/iOSMiniFB.m @@ -123,8 +123,19 @@ destroy_window_data(SWindowData *window_data) { } //------------------------------------- -mfb_update_state +mfb_update_state mfb_update(struct mfb_window *window, void *buffer) { + if (window == 0x0) { + return STATE_INVALID_WINDOW; + } + + SWindowData *window_data = (SWindowData *) window; + mfb_update_ex(window, buffer, window_data->buffer_width, window_data->buffer_height); +} + +//------------------------------------- +mfb_update_state +mfb_update_ex(struct mfb_window *window, void *buffer, unsigned width, unsigned height) { if(window == 0x0) { return STATE_INVALID_WINDOW; } diff --git a/src/wayland/WaylandMiniFB.c b/src/wayland/WaylandMiniFB.c index 1151433..974440a 100644 --- a/src/wayland/WaylandMiniFB.c +++ b/src/wayland/WaylandMiniFB.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -703,8 +704,22 @@ wl_callback_listener frame_listener = { .done = frame_done, }; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + mfb_update_state -mfb_update(struct mfb_window *window, void *buffer) +mfb_update(struct mfb_window *window, void *buffer) { + if (window == 0x0) { + return STATE_INVALID_WINDOW; + } + + SWindowData *window_data = (SWindowData *) window; + return mfb_update_ex(window, buffer, window_data->buffer_width, window_data->buffer_height); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +mfb_update_state +mfb_update_ex(struct mfb_window *window, void *buffer, unsigned width, unsigned height) { uint32_t done = 0; @@ -726,6 +741,9 @@ mfb_update(struct mfb_window *window, void *buffer) if (!window_data_way->display || wl_display_get_error(window_data_way->display) != 0) return STATE_INTERNAL_ERROR; + if(window_data->buffer_width != width || window_data->buffer_height != height) { + } + // update shm buffer memcpy(window_data_way->shm_ptr, buffer, window_data->buffer_stride * window_data->buffer_height);