mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
Fixed various linux compile errors in EglContext
This commit is contained in:
parent
f6edb83acd
commit
86b29c539d
@ -27,6 +27,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/EglContext.hpp>
|
#include <SFML/Window/EglContext.hpp>
|
||||||
|
#include <SFML/Window/WindowImpl.hpp>
|
||||||
#include <SFML/OpenGL.hpp>
|
#include <SFML/OpenGL.hpp>
|
||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
#include <SFML/System/Sleep.hpp>
|
#include <SFML/System/Sleep.hpp>
|
||||||
@ -35,6 +36,9 @@
|
|||||||
#ifdef SFML_SYSTEM_ANDROID
|
#ifdef SFML_SYSTEM_ANDROID
|
||||||
#include <SFML/System/Android/Activity.hpp>
|
#include <SFML/System/Android/Activity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SFML_SYSTEM_LINUX
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -46,7 +50,7 @@ namespace
|
|||||||
|
|
||||||
if (display == EGL_NO_DISPLAY)
|
if (display == EGL_NO_DISPLAY)
|
||||||
{
|
{
|
||||||
eglCheck(eglGetDisplay(EGL_DEFAULT_DISPLAY));
|
display = eglCheck(eglGetDisplay(EGL_DEFAULT_DISPLAY));
|
||||||
eglCheck(eglInitialize(display, NULL, NULL));
|
eglCheck(eglInitialize(display, NULL, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,12 +264,11 @@ XVisualInfo EglContext::selectBestVisual(::Display* XDisplay, unsigned int bitsP
|
|||||||
EGLConfig config = getBestConfig(display, bitsPerPixel, settings);
|
EGLConfig config = getBestConfig(display, bitsPerPixel, settings);
|
||||||
|
|
||||||
// Retrieve the visual id associated with this EGL config
|
// Retrieve the visual id associated with this EGL config
|
||||||
EGLint nativeVisualId, nativeVisualType;
|
EGLint nativeVisualId;
|
||||||
|
|
||||||
eglCheck(eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &nativeVisualId));
|
eglCheck(eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &nativeVisualId));
|
||||||
eglCheck(eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_TYPE, &nativeVisualType));
|
|
||||||
|
|
||||||
if (nativeVisualId = 0 && nativeVisualType == EGL_NONE)
|
if (nativeVisualId == 0)
|
||||||
{
|
{
|
||||||
// Should never happen...
|
// Should never happen...
|
||||||
err() << "No EGL visual found. You should check your graphics driver" << std::endl;
|
err() << "No EGL visual found. You should check your graphics driver" << std::endl;
|
||||||
@ -273,13 +276,14 @@ XVisualInfo EglContext::selectBestVisual(::Display* XDisplay, unsigned int bitsP
|
|||||||
return XVisualInfo();
|
return XVisualInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
VisualID visualId = static_cast<VisualID>(nativeVisualId);
|
XVisualInfo vTemplate;
|
||||||
|
vTemplate.visualid = static_cast<VisualID>(nativeVisualId);
|
||||||
|
|
||||||
// Get X11 visuals compatible with this EGL config
|
// Get X11 visuals compatible with this EGL config
|
||||||
XVisualInfo *availableVisuals, bestVisual;
|
XVisualInfo *availableVisuals, bestVisual;
|
||||||
int visualCount = 0;
|
int visualCount = 0;
|
||||||
|
|
||||||
availableVisuals = XGetVisualInfo(XDisplayy, VisualIDMask, &visualId, &visualCount);
|
availableVisuals = XGetVisualInfo(XDisplay, VisualIDMask, &vTemplate, &visualCount);
|
||||||
|
|
||||||
if (visualCount == 0)
|
if (visualCount == 0)
|
||||||
{
|
{
|
||||||
@ -290,8 +294,8 @@ XVisualInfo EglContext::selectBestVisual(::Display* XDisplay, unsigned int bitsP
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pick up the best one
|
// Pick up the best one
|
||||||
bestVisual = availableVisuals[0]
|
bestVisual = availableVisuals[0];
|
||||||
XFree(chosenVisualInfo);
|
XFree(availableVisuals);
|
||||||
|
|
||||||
return bestVisual;
|
return bestVisual;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user