int event_fd;
struct wl_surface *surf;
struct wl_egl_window *wl_egl_window;
- tbm_surface_queue_h tbm_surface_queue;
+ tbm_surface_queue_h tbm_queue;
twe_wl_disp_source *disp_source;
};
};
static void
+__cb_client_window_resize_callback(struct wl_egl_window *wl_egl_window,
+ void *private)
+{
+ TPL_ASSERT(private);
+ TPL_ASSERT(wl_egl_window);
+
+ twe_wl_surf_source *source = (twe_wl_surf_source *)private;
+ int cur_w, cur_h, req_w, req_h, format;
+
+ format = tbm_surface_queue_get_format(source->tbm_queue);
+ cur_w = tbm_surface_queue_get_width(source->tbm_queue);
+ cur_h = tbm_surface_queue_get_height(source->tbm_queue);
+ req_w = wl_egl_window->width;
+ req_h = wl_egl_window->height;
+
+ TPL_LOG_T("WL_EGL", "[RESIZE_CB] wl_egl_window(%p) (%dx%d) -> (%dx%d)",
+ wl_egl_window, cur_w, cur_h, req_w, req_h);
+
+ if (tbm_surface_queue_reset(source->tbm_queue, req_w, req_h, format)
+ != TBM_SURFACE_QUEUE_ERROR_NONE) {
+ TPL_ERR("Failed to reset tbm_surface_queue(%p)", source->tbm_queue);
+ return;
+ }
+}
+
+static void
__cb_tbm_surface_queue_reset_callback(tbm_surface_queue_h tbm_queue,
void *data)
{
return NULL;
}
- if (!source->tbm_surface_queue) {
+ if (!source->tbm_queue) {
TPL_ERR("Invalid parameters. twe_surface(%p) tbm_surface_queue(%p)",
- source, source->tbm_surface_queue);
+ source, source->tbm_queue);
return NULL;
}
- return source->tbm_surface_queue;
+ return source->tbm_queue;
}
G_IO_IN);
source->surf = surface;
source->wl_egl_window = wl_egl_window;
- source->tbm_surface_queue = tbm_queue;
+ source->tbm_queue = tbm_queue;
source->disp_source = (twe_wl_disp_source *)twe_display;
+ wl_egl_window->private = (void *)source;
+ wl_egl_window->resize_callback = (void *)__cb_client_window_resize_callback;
+
g_source_set_callback(&source->gsource, NULL, surface, NULL);
g_source_attach(&source->gsource, g_main_loop_get_context(ctx->twe_loop));
g_source_unref(&source->gsource);
TPL_LOG_T("WL_EGL", "twe_surface(%p) wl_egl_window(%p) wl_surface(%p)",
surf_source, surf_source->wl_egl_window, surf_source->surf);
- if (surf_source->tbm_surface_queue) {
- tbm_surface_queue_destroy(surf_source->tbm_surface_queue);
- surf_source->tbm_surface_queue = NULL;
+ if (surf_source->tbm_queue) {
+ tbm_surface_queue_destroy(surf_source->tbm_queue);
+ surf_source->tbm_queue = NULL;
}
/* TODO : surf_source will be removed from surfaces list in disp_source */