diff options
author | Emil Velikov <[email protected]> | 2019-05-16 18:01:37 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-06-05 13:35:21 -0400 |
commit | 5e0f527d609c8300b0308e4400ec41ef20ed569c (patch) | |
tree | 633983132fc9818c7ea4284d9e3571f192d25c40 /src/egl/main | |
parent | 2b29cf2468677a9e9b24b7854e6c2a7acd42a505 (diff) |
egl: fold X11 attrib handling like other platforms
Since we no longer need special handling for X11, refactor the code to
follow the style used by all other platforms.
Reviewed-by: Mathias Fröhlich <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Signed-off-by: Emil Velikov <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/egl/main')
-rw-r--r-- | src/egl/main/egldisplay.c | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index 418ab0ec9b8..422b473844e 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -487,45 +487,22 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type) } #ifdef HAVE_X11_PLATFORM -static EGLBoolean -_eglParseX11DisplayAttribList(_EGLDisplay *display, - const EGLAttrib *attrib_list) -{ - int i; - - if (attrib_list == NULL) { - return EGL_TRUE; - } - - /* EGL_EXT_platform_x11 recognizes exactly one attribute, - * EGL_PLATFORM_X11_SCREEN_EXT, which is optional. - */ - for (i = 0; attrib_list[i] != EGL_NONE; i += 2) { - if (attrib_list[i] != EGL_PLATFORM_X11_SCREEN_EXT) - return _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay"); - } - - return EGL_TRUE; -} - _EGLDisplay* _eglGetX11Display(Display *native_display, const EGLAttrib *attrib_list) { - _EGLDisplay *display = _eglFindDisplay(_EGL_PLATFORM_X11, - native_display, - attrib_list); - - if (!display) { - _eglError(EGL_BAD_ALLOC, "eglGetPlatformDisplay"); - return NULL; - } - - if (!_eglParseX11DisplayAttribList(display, attrib_list)) { - return NULL; + /* EGL_EXT_platform_x11 recognizes exactly one attribute, + * EGL_PLATFORM_X11_SCREEN_EXT, which is optional. + */ + if (attrib_list != NULL) { + for (int i = 0; attrib_list[i] != EGL_NONE; i += 2) { + if (attrib_list[i] != EGL_PLATFORM_X11_SCREEN_EXT) { + _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay"); + return NULL; + } + } } - - return display; + return _eglFindDisplay(_EGL_PLATFORM_X11, native_display, attrib_list); } #endif /* HAVE_X11_PLATFORM */ |