From 93380ae229d5a5f0d00df00fff7fc62ec990286f Mon Sep 17 00:00:00 2001 From: Alexis Maiquez Date: Mon, 27 Mar 2023 01:36:01 +0200 Subject: [PATCH] Added some window hints Signed-off-by: Alexis Maiquez --- .../Application/CApplicationContext.cpp | 6 +++--- .../Application/CWallpaperApplication.cpp | 2 +- .../Render/Drivers/CX11OpenGLDriver.cpp | 13 ++++++++++++- .../Render/Drivers/CX11OpenGLDriver.h | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/WallpaperEngine/Application/CApplicationContext.cpp b/src/WallpaperEngine/Application/CApplicationContext.cpp index f056dfb..8b6cbd8 100644 --- a/src/WallpaperEngine/Application/CApplicationContext.cpp +++ b/src/WallpaperEngine/Application/CApplicationContext.cpp @@ -135,11 +135,11 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) if (pos != nullptr) this->settings.render.window.geometry.x = atoi (pos); - if ((pos = strchr (pos, '.')) != nullptr) + if ((pos = strchr (pos, 'x')) != nullptr) this->settings.render.window.geometry.y = atoi (pos + 1); - if ((pos = strchr (pos + 1, '.')) != nullptr) + if ((pos = strchr (pos + 1, 'x')) != nullptr) this->settings.render.window.geometry.z = atoi (pos + 1); - if ((pos = strchr (pos + 1, '.')) != nullptr) + if ((pos = strchr (pos + 1, 'x')) != nullptr) this->settings.render.window.geometry.w = atoi (pos + 1); } break; diff --git a/src/WallpaperEngine/Application/CWallpaperApplication.cpp b/src/WallpaperEngine/Application/CWallpaperApplication.cpp index 61be637..b56c8cf 100644 --- a/src/WallpaperEngine/Application/CWallpaperApplication.cpp +++ b/src/WallpaperEngine/Application/CWallpaperApplication.cpp @@ -267,7 +267,7 @@ namespace WallpaperEngine::Application void CWallpaperApplication::show () { // initialize OpenGL driver - WallpaperEngine::Render::Drivers::CX11OpenGLDriver videoDriver ("wallpaperengine"); + WallpaperEngine::Render::Drivers::CX11OpenGLDriver videoDriver ("wallpaperengine", this->m_context); // initialize the input subsystem WallpaperEngine::Input::CInputContext inputContext (videoDriver); // output requested diff --git a/src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.cpp b/src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.cpp index a0cf65c..28038a6 100644 --- a/src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.cpp +++ b/src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.cpp @@ -12,7 +12,7 @@ void CustomGLFWErrorHandler (int errorCode, const char* reason) sLog.error ("GLFW error ", errorCode, ": ", reason); } -CX11OpenGLDriver::CX11OpenGLDriver (const char* windowTitle) : +CX11OpenGLDriver::CX11OpenGLDriver (const char* windowTitle, CApplicationContext& context) : m_frameCounter (0) { glfwSetErrorCallback (CustomGLFWErrorHandler); @@ -27,6 +27,17 @@ CX11OpenGLDriver::CX11OpenGLDriver (const char* windowTitle) : glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint (GLFW_VISIBLE, GLFW_FALSE); + // set X11-specific hints + glfwWindowHintString (GLFW_X11_CLASS_NAME, "linux-wallpaperengine"); + glfwWindowHintString (GLFW_X11_INSTANCE_NAME, "linux-wallpaperengine"); + + // for forced window mode, we can set some hints that'll help position the window + if (context.settings.render.mode == Application::CApplicationContext::EXPLICIT_WINDOW) + { + glfwWindowHint (GLFW_RESIZABLE, GLFW_FALSE); + glfwWindowHint (GLFW_DECORATED, GLFW_FALSE); + glfwWindowHint (GLFW_FLOATING, GLFW_TRUE); + } #if !NDEBUG glfwWindowHint (GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE); diff --git a/src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h b/src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h index 1140479..99ca118 100644 --- a/src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h +++ b/src/WallpaperEngine/Render/Drivers/CX11OpenGLDriver.h @@ -17,7 +17,7 @@ namespace WallpaperEngine::Render::Drivers class CX11OpenGLDriver : public CVideoDriver { public: - explicit CX11OpenGLDriver (const char* windowTitle); + explicit CX11OpenGLDriver (const char* windowTitle, CApplicationContext& context); ~CX11OpenGLDriver(); void* getWindowHandle () const;