From 761d9d81d02613a289e3766965e795b7a4e54648 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Mon, 19 Apr 2021 16:46:11 +0200 Subject: [PATCH] Fix several unused warnings --- src/SFML/Graphics/RenderTextureImplFBO.cpp | 2 +- src/SFML/Window/EglContext.cpp | 4 +++- src/SFML/Window/EglContext.hpp | 1 + src/SFML/Window/Unix/GlxContext.cpp | 5 ++++- src/SFML/Window/Unix/WindowImplX11.cpp | 4 ++-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/SFML/Graphics/RenderTextureImplFBO.cpp b/src/SFML/Graphics/RenderTextureImplFBO.cpp index 9651d1f7..a2a67bf9 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.cpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.cpp @@ -77,7 +77,7 @@ namespace } // Callback that is called every time a context is destroyed - void contextDestroyCallback(void* arg) + void contextDestroyCallback(void* /*arg*/) { sf::Lock lock(mutex); diff --git a/src/SFML/Window/EglContext.cpp b/src/SFML/Window/EglContext.cpp index 305354f2..013c376f 100644 --- a/src/SFML/Window/EglContext.cpp +++ b/src/SFML/Window/EglContext.cpp @@ -169,13 +169,15 @@ m_config (NULL) //////////////////////////////////////////////////////////// -EglContext::EglContext(EglContext* shared, const ContextSettings& settings, unsigned int width, unsigned int height) : +EglContext::EglContext(EglContext* /*shared*/, const ContextSettings& /*settings*/, unsigned int /*width*/, unsigned int /*height*/) : m_display (EGL_NO_DISPLAY), m_context (EGL_NO_CONTEXT), m_surface (EGL_NO_SURFACE), m_config (NULL) { EglContextImpl::ensureInit(); + + sf::err() << "Warning: context has not been initialized. The constructor EglContext(shared, settings, width, height) is currently not implemented." << std::endl; } diff --git a/src/SFML/Window/EglContext.hpp b/src/SFML/Window/EglContext.hpp index 6ff6a4af..824648e8 100644 --- a/src/SFML/Window/EglContext.hpp +++ b/src/SFML/Window/EglContext.hpp @@ -67,6 +67,7 @@ public: //////////////////////////////////////////////////////////// /// \brief Create a new context that embeds its own rendering target + /// \warning This constructor is currently not implemented; use a different overload. /// /// \param shared Context to share the new one with /// \param settings Creation parameters diff --git a/src/SFML/Window/Unix/GlxContext.cpp b/src/SFML/Window/Unix/GlxContext.cpp index 12be1092..843b37e1 100644 --- a/src/SFML/Window/Unix/GlxContext.cpp +++ b/src/SFML/Window/Unix/GlxContext.cpp @@ -132,7 +132,7 @@ m_ownsWindow(false) //////////////////////////////////////////////////////////// -GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const WindowImpl* owner, unsigned int bitsPerPixel) : +GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const WindowImpl* owner, unsigned int /*bitsPerPixel*/) : m_display (NULL), m_window (0), m_context (NULL), @@ -547,6 +547,9 @@ void GlxContext::createSurface(GlxContext* shared, unsigned int width, unsigned XSetWindowAttributes attributes; attributes.colormap = XCreateColormap(m_display, RootWindow(m_display, screen), visualInfo.visual, AllocNone); + // Note: bitsPerPixel is explicitly ignored. Instead, DefaultDepth() is used in order to avoid window creation failure due to + // a depth not supported by the X window system. On Unix/Linux, the window's pixel format is not directly associated with the + // rendering surface (unlike on Windows, for example). m_window = XCreateWindow(m_display, RootWindow(m_display, screen), 0, 0, diff --git a/src/SFML/Window/Unix/WindowImplX11.cpp b/src/SFML/Window/Unix/WindowImplX11.cpp index ef1f8ec9..cc73877b 100644 --- a/src/SFML/Window/Unix/WindowImplX11.cpp +++ b/src/SFML/Window/Unix/WindowImplX11.cpp @@ -1357,8 +1357,8 @@ void WindowImplX11::setVideoMode(const VideoMode& mode) std::swap(res->modes[i].height, res->modes[i].width); // Check if screen size match - if (res->modes[i].width == static_cast(mode.width) && - res->modes[i].height == static_cast(mode.height)) + if ((res->modes[i].width == mode.width) && + (res->modes[i].height == mode.height)) { xRandMode = res->modes[i].id; modeFound = true;