Added some window hints

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2023-03-27 01:36:01 +02:00
parent a89d8ebb22
commit 93380ae229
4 changed files with 17 additions and 6 deletions

View File

@ -135,11 +135,11 @@ CApplicationContext::CApplicationContext (int argc, char* argv[])
if (pos != nullptr) if (pos != nullptr)
this->settings.render.window.geometry.x = atoi (pos); 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); 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); 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); this->settings.render.window.geometry.w = atoi (pos + 1);
} }
break; break;

View File

@ -267,7 +267,7 @@ namespace WallpaperEngine::Application
void CWallpaperApplication::show () void CWallpaperApplication::show ()
{ {
// initialize OpenGL driver // initialize OpenGL driver
WallpaperEngine::Render::Drivers::CX11OpenGLDriver videoDriver ("wallpaperengine"); WallpaperEngine::Render::Drivers::CX11OpenGLDriver videoDriver ("wallpaperengine", this->m_context);
// initialize the input subsystem // initialize the input subsystem
WallpaperEngine::Input::CInputContext inputContext (videoDriver); WallpaperEngine::Input::CInputContext inputContext (videoDriver);
// output requested // output requested

View File

@ -12,7 +12,7 @@ void CustomGLFWErrorHandler (int errorCode, const char* reason)
sLog.error ("GLFW error ", errorCode, ": ", reason); sLog.error ("GLFW error ", errorCode, ": ", reason);
} }
CX11OpenGLDriver::CX11OpenGLDriver (const char* windowTitle) : CX11OpenGLDriver::CX11OpenGLDriver (const char* windowTitle, CApplicationContext& context) :
m_frameCounter (0) m_frameCounter (0)
{ {
glfwSetErrorCallback (CustomGLFWErrorHandler); glfwSetErrorCallback (CustomGLFWErrorHandler);
@ -27,6 +27,17 @@ CX11OpenGLDriver::CX11OpenGLDriver (const char* windowTitle) :
glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint (GLFW_VISIBLE, GLFW_FALSE); 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 #if !NDEBUG
glfwWindowHint (GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE); glfwWindowHint (GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);

View File

@ -17,7 +17,7 @@ namespace WallpaperEngine::Render::Drivers
class CX11OpenGLDriver : public CVideoDriver class CX11OpenGLDriver : public CVideoDriver
{ {
public: public:
explicit CX11OpenGLDriver (const char* windowTitle); explicit CX11OpenGLDriver (const char* windowTitle, CApplicationContext& context);
~CX11OpenGLDriver(); ~CX11OpenGLDriver();
void* getWindowHandle () const; void* getWindowHandle () const;