[client] egl: fix building without EGL support

This commit is contained in:
Geoffrey McRae 2021-01-27 19:20:13 +11:00
parent cf3e816603
commit 8919d2718f
4 changed files with 38 additions and 26 deletions

View File

@ -58,9 +58,12 @@ void app_setFullscreen(bool fs);
bool app_getFullscreen(void); bool app_getFullscreen(void);
bool app_getProp(LG_DSProperty prop, void * ret); bool app_getProp(LG_DSProperty prop, void * ret);
#ifdef ENABLE_EGL
EGLDisplay app_getEGLDisplay(void); EGLDisplay app_getEGLDisplay(void);
EGLNativeWindowType app_getEGLNativeWindow(void); EGLNativeWindowType app_getEGLNativeWindow(void);
void app_eglSwapBuffers(EGLDisplay display, EGLSurface surface); void app_eglSwapBuffers(EGLDisplay display, EGLSurface surface);
#endif
void app_glSwapBuffers(void); void app_glSwapBuffers(void);
void app_clipboardRelease(void); void app_clipboardRelease(void);

View File

@ -136,35 +136,42 @@ struct LG_DisplayServerOps
bool (*getFullscreen)(void); bool (*getFullscreen)(void);
void (*setFullscreen)(bool fs); void (*setFullscreen)(bool fs);
/* clipboard support */ /* clipboard support, optional, if not supported set to NULL */
bool (*cbInit)(void); bool (*cbInit)(void);
void (*cbNotice)(LG_ClipboardData type); void (*cbNotice)(LG_ClipboardData type);
void (*cbRelease)(void); void (*cbRelease)(void);
void (*cbRequest)(LG_ClipboardData type); void (*cbRequest)(LG_ClipboardData type);
}; };
#define IS_LG_DS_VALID(x) \ #ifdef ENABLE_EGL
((x)->probe && \ #define ASSERT_EGL_FN(x) assert(x);
(x)->earlyInit && \ #else
(x)->init && \ #define ASSERT_EGL_FN(x)
(x)->startup && \ #endif
(x)->shutdown && \
(x)->free && \ #define ASSERT_LG_DS_VALID(x) \
(x)->getProp && \ assert((x)->probe ); \
(x)->getEGLDisplay && \ assert((x)->earlyInit ); \
(x)->getEGLNativeWindow && \ assert((x)->init ); \
(x)->eglSwapBuffers && \ assert((x)->startup ); \
(x)->glSwapBuffers && \ assert((x)->shutdown ); \
(x)->showPointer && \ assert((x)->free ); \
(x)->grabPointer && \ assert((x)->getProp ); \
(x)->ungrabPointer && \ ASSERT_EGL_FN((x)->getEGLDisplay ); \
(x)->warpPointer && \ ASSERT_EGL_FN((x)->getEGLNativeWindow ); \
(x)->realignPointer && \ ASSERT_EGL_FN((x)->eglSwapBuffers ); \
(x)->isValidPointerPos && \ assert((x)->glSwapBuffers ); \
(x)->inhibitIdle && \ assert((x)->showPointer ); \
(x)->uninhibitIdle && \ assert((x)->grabPointer ); \
(x)->wait && \ assert((x)->ungrabPointer ); \
(x)->setWindowSize && \ assert((x)->warpPointer ); \
(x)->setFullscreen && \ assert((x)->realignPointer ); \
(x)->getFullscreen) assert((x)->isValidPointerPos ); \
assert((x)->inhibitIdle ); \
assert((x)->uninhibitIdle ); \
assert((x)->wait ); \
assert((x)->setWindowSize ); \
assert((x)->setFullscreen ); \
assert((x)->getFullscreen );
#endif #endif

View File

@ -566,6 +566,7 @@ bool app_getProp(LG_DSProperty prop, void * ret)
return g_state.ds->getProp(prop, ret); return g_state.ds->getProp(prop, ret);
} }
#ifdef ENABLE_EGL
EGLDisplay app_getEGLDisplay(void) EGLDisplay app_getEGLDisplay(void)
{ {
return g_state.ds->getEGLDisplay(); return g_state.ds->getEGLDisplay();
@ -580,6 +581,7 @@ void app_eglSwapBuffers(EGLDisplay display, EGLSurface surface)
{ {
g_state.ds->eglSwapBuffers(display, surface); g_state.ds->eglSwapBuffers(display, surface);
} }
#endif
void app_glSwapBuffers(void) void app_glSwapBuffers(void)
{ {

View File

@ -633,7 +633,7 @@ static int lg_run(void)
} }
assert(g_state.ds); assert(g_state.ds);
assert(IS_LG_DS_VALID(g_state.ds)); ASSERT_LG_DS_VALID(g_state.ds);
// init the subsystem // init the subsystem
if (!g_state.ds->earlyInit()) if (!g_state.ds->earlyInit())