x11: Cast Window to EGLNativeWindowType using a C cast

reinterpret_cast<>() will fail if the types we cast from and to have
mismatching sizes.

Unfortunately, there are platforms that have Window and
EGLNativeWindowType of different size. This results in compilation
errors.

In order to work around those problematic platforms, this change
replaces reinterpret_cast cast with a c style cast.
This commit is contained in:
Vlad Zahorodnii 2021-09-21 17:34:59 +03:00
parent 51925567f6
commit df11acd467

View file

@ -221,8 +221,11 @@ EGLSurface EglOnXBackend::createSurface(xcb_window_t window)
// eglCreatePlatformWindowSurfaceEXT() expects a pointer to the Window.
surface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(), (void *) &nativeWindow, nullptr);
} else {
// eglCreateWindowSurface() expects a Window, not a pointer to the Window.
surface = eglCreateWindowSurface(eglDisplay(), config(), reinterpret_cast<EGLNativeWindowType>(nativeWindow), nullptr);
// eglCreateWindowSurface() expects a Window, not a pointer to the Window. Use
// a c style cast as there are (buggy) platforms where the size of the Window
// type is not the same as the size of EGLNativeWindowType, reinterpret_cast<>()
// may not compile.
surface = eglCreateWindowSurface(eglDisplay(), config(), (EGLNativeWindowType) nativeWindow, nullptr);
}
return surface;