tpl_buffer_t *current_rendering_buffer;
tpl_list_t done_rendering_queue;
tbm_surface_queue_h tbm_queue;
+ tpl_bool_t resized;
};
struct _tpl_wayland_buffer
/* Do nothing. */
}
+static void
+__cb_client_window_resize_callback(struct wl_egl_window* wl_egl_window, void* private);
+
static tpl_bool_t
__tpl_wayland_surface_init(tpl_surface_t *surface)
{
surface->backend.data = (void *)wayland_surface;
wayland_surface->tbm_queue = NULL;
+ wayland_surface->resized = TPL_FALSE;
__tpl_list_init(&wayland_surface->done_rendering_queue);
int tbm_format;
struct wl_egl_window *wl_egl_window = (struct wl_egl_window *)surface->native_handle;
wl_egl_window->private = surface;
+ wl_egl_window->resize_callback = (void*)__cb_client_window_resize_callback;
switch (surface->format)
{
static tpl_bool_t
__tpl_wayland_surface_validate_frame(tpl_surface_t *surface)
{
- TPL_IGNORE(surface);
+ TPL_ASSERT(surface);
+ TPL_ASSERT(surface->backend.data);
+
+ tpl_wayland_surface_t *wayland_surface = (tpl_wayland_surface_t*)surface->backend.data;
+
+ if (wayland_surface->resized)
+ return TPL_FALSE;
return TPL_TRUE;
}
format = tbm_surface_queue_get_format(wayland_surface->tbm_queue);
/* Check whether the surface was resized by wayland_egl */
- if (width != tbm_surface_queue_get_width(wayland_surface->tbm_queue) ||
- height != tbm_surface_queue_get_height(wayland_surface->tbm_queue))
+ if (wayland_surface->resized == TPL_TRUE ||
+ width != tbm_surface_queue_get_width(wayland_surface->tbm_queue) ||
+ height != tbm_surface_queue_get_height(wayland_surface->tbm_queue))
{
tbm_surface_queue_reset(wayland_surface->tbm_queue, width, height, format);
__tpl_wayland_surface_buffer_cache_remove_all(&wayland_display->cached_buffers);
if (reset_buffers != NULL)
*reset_buffers = TPL_TRUE;
+
+ wayland_surface->resized = TPL_FALSE;
}
TPL_OBJECT_UNLOCK(surface);
return NULL;
}
- if (wayland_surface->current_rendering_buffer == NULL)
+ if (wayland_surface->resized || wayland_surface->current_rendering_buffer == NULL)
{
if (surface->type == TPL_SURFACE_TYPE_WINDOW)
{
static const struct wl_buffer_listener buffer_release_listener = {
(void *)__cb_client_buffer_release_callback,
};
+
+static void
+__cb_client_window_resize_callback(struct wl_egl_window* wl_egl_window, void* private)
+{
+ TPL_ASSERT(private);
+
+ tpl_surface_t *surface = (tpl_surface_t*)private;
+ tpl_wayland_surface_t *wayland_surface = (tpl_wayland_surface_t*)surface->backend.data;
+ wayland_surface->resized = TPL_TRUE;
+}