@@ -224,6 +224,7 @@ struct window {
224
224
struct render_surface * (* get_render_surface )(struct window * window , struct vec2i size );
225
225
226
226
#ifdef HAVE_EGL_GLES2
227
+ bool (* has_egl_surface )(struct window * window );
227
228
EGLSurface (* get_egl_surface )(struct window * window );
228
229
#endif
229
230
@@ -401,14 +402,12 @@ static int window_init(
401
402
window -> gl_renderer = NULL ;
402
403
window -> vk_renderer = NULL ;
403
404
window -> render_surface = NULL ;
404
- #ifdef HAVE_EGL_GLES2
405
- window -> egl_surface = NULL ;
406
- #endif
407
405
window -> cursor_enabled = false;
408
406
window -> cursor_pos = VEC2I (0 , 0 );
409
407
window -> push_composition = NULL ;
410
408
window -> get_render_surface = NULL ;
411
409
#ifdef HAVE_EGL_GLES2
410
+ window -> has_egl_surface = NULL ;
412
411
window -> get_egl_surface = NULL ;
413
412
#endif
414
413
window -> set_cursor_locked = NULL ;
@@ -477,6 +476,10 @@ int window_get_next_vblank(struct window *window, uint64_t *next_vblank_ns_out)
477
476
}
478
477
479
478
#ifdef HAVE_EGL_GLES2
479
+ bool window_has_egl_surface (struct window * window ) {
480
+ return window -> egl_surface ;
481
+ }
482
+
480
483
EGLSurface window_get_egl_surface (struct window * window ) {
481
484
ASSERT_NOT_NULL (window );
482
485
ASSERT_NOT_NULL (window -> get_egl_surface );
@@ -863,6 +866,7 @@ static int kms_window_push_composition(struct window *window, struct fl_layer_co
863
866
static struct render_surface * kms_window_get_render_surface (struct window * window , struct vec2i size );
864
867
865
868
#ifdef HAVE_EGL_GLES2
869
+ static bool kms_window_has_egl_surface (struct window * window );
866
870
static EGLSurface kms_window_get_egl_surface (struct window * window );
867
871
#endif
868
872
@@ -1007,6 +1011,7 @@ MUST_CHECK struct window *kms_window_new(
1007
1011
window -> push_composition = kms_window_push_composition ;
1008
1012
window -> get_render_surface = kms_window_get_render_surface ;
1009
1013
#ifdef HAVE_EGL_GLES2
1014
+ window -> has_egl_surface = kms_window_has_egl_surface ;
1010
1015
window -> get_egl_surface = kms_window_get_egl_surface ;
1011
1016
#endif
1012
1017
window -> deinit = kms_window_deinit ;
@@ -1486,6 +1491,14 @@ static struct render_surface *kms_window_get_render_surface(struct window *windo
1486
1491
}
1487
1492
1488
1493
#ifdef HAVE_EGL_GLES2
1494
+ static bool kms_window_has_egl_surface (struct window * window ) {
1495
+ if (window -> renderer_type == kOpenGL_RendererType ) {
1496
+ return window -> render_surface != NULL ;
1497
+ } else {
1498
+ return false;
1499
+ }
1500
+ }
1501
+
1489
1502
static EGLSurface kms_window_get_egl_surface (struct window * window ) {
1490
1503
if (window -> renderer_type == kOpenGL_RendererType ) {
1491
1504
struct render_surface * render_surface = kms_window_get_render_surface_internal (window , false, VEC2I (0 , 0 ));
0 commit comments