diff --git a/src/WallpaperEngine/Application/CApplicationContext.cpp b/src/WallpaperEngine/Application/CApplicationContext.cpp index 8d3b475..c9cb69e 100644 --- a/src/WallpaperEngine/Application/CApplicationContext.cpp +++ b/src/WallpaperEngine/Application/CApplicationContext.cpp @@ -25,6 +25,8 @@ struct option long_options [] = { {"list-properties", no_argument, nullptr, 'l'}, {"set-property", required_argument, nullptr, 'o'}, {"class", required_argument, nullptr, 'x'}, + {"x", required_argument, nullptr, 'z'}, + {"y", required_argument, nullptr, 'y'}, {"width", required_argument, nullptr, 'w'}, {"height", required_argument, nullptr, 't'}, {nullptr, 0, nullptr, 0} @@ -53,6 +55,8 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) : audioEnabled (true), onlyListProperties (false), window_class (""), + window_pos_x(0), + window_pos_y(0), window_width(1280), window_height(720) { @@ -120,6 +124,15 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) : case 'x': this->window_class = optarg; break; + + case 'z': + this->window_pos_x = atoi(optarg); + break; + + case 'y': + this->window_pos_y = atoi(optarg); + break; + case 'w': this->window_width = atoi(optarg); break; @@ -214,6 +227,8 @@ void CApplicationContext::printHelp (const char* route) sLog.out ("\t--list-properties\t\t\tList all the available properties and their possible values"); sLog.out ("\t--set-property \tOverrides the default value of the given property"); sLog.out ("\t--class \t\t\tSets X11 window class"); + sLog.out ("\t--x \t\t\tSets the window x pos"); + sLog.out ("\t--y \t\t\tSets the window y pos"); sLog.out ("\t--width \t\t\tSets the window width"); sLog.out ("\t--height \t\t\tSets the window height"); } \ No newline at end of file diff --git a/src/WallpaperEngine/Application/CApplicationContext.h b/src/WallpaperEngine/Application/CApplicationContext.h index 910dac4..fe450a5 100644 --- a/src/WallpaperEngine/Application/CApplicationContext.h +++ b/src/WallpaperEngine/Application/CApplicationContext.h @@ -25,6 +25,8 @@ namespace WallpaperEngine::Application bool onlyListProperties; FREE_IMAGE_FORMAT screenshotFormat; std::string window_class; + int window_pos_x; + int window_pos_y; int window_width; int window_height; diff --git a/src/WallpaperEngine/Render/CRenderContext.cpp b/src/WallpaperEngine/Render/CRenderContext.cpp index e886219..c7145a2 100644 --- a/src/WallpaperEngine/Render/CRenderContext.cpp +++ b/src/WallpaperEngine/Render/CRenderContext.cpp @@ -80,6 +80,7 @@ void CRenderContext::setupWindow () { this->m_driver.showWindow (); this->m_driver.resizeWindow ({this->m_app.get_context().window_width, this->m_app.get_context().window_height}); + this->m_driver.reposWindow({this->m_app.get_context().window_pos_x, this->m_app.get_context().window_pos_y}); } void CRenderContext::setupScreens () diff --git a/src/WallpaperEngine/Render/Drivers/COpenGLDriver.cpp b/src/WallpaperEngine/Render/Drivers/COpenGLDriver.cpp index 9a34adb..e317ff6 100644 --- a/src/WallpaperEngine/Render/Drivers/COpenGLDriver.cpp +++ b/src/WallpaperEngine/Render/Drivers/COpenGLDriver.cpp @@ -60,6 +60,11 @@ bool COpenGLDriver::closeRequested () return glfwWindowShouldClose (this->m_window); } +void COpenGLDriver::reposWindow (glm::ivec2 pos) +{ + glfwSetWindowPos (this->m_window, pos.x, pos.y); +} + void COpenGLDriver::resizeWindow (glm::ivec2 size) { glfwSetWindowSize (this->m_window, size.x, size.y); diff --git a/src/WallpaperEngine/Render/Drivers/COpenGLDriver.h b/src/WallpaperEngine/Render/Drivers/COpenGLDriver.h index 8273221..56be4d3 100644 --- a/src/WallpaperEngine/Render/Drivers/COpenGLDriver.h +++ b/src/WallpaperEngine/Render/Drivers/COpenGLDriver.h @@ -21,6 +21,7 @@ namespace WallpaperEngine::Render::Drivers float getRenderTime () override; bool closeRequested () override; + void reposWindow (glm::ivec2 size) override; void resizeWindow (glm::ivec2 size) override; void showWindow () override; void hideWindow () override; diff --git a/src/WallpaperEngine/Render/Drivers/CVideoDriver.h b/src/WallpaperEngine/Render/Drivers/CVideoDriver.h index 5da1d4d..3e8f1b2 100644 --- a/src/WallpaperEngine/Render/Drivers/CVideoDriver.h +++ b/src/WallpaperEngine/Render/Drivers/CVideoDriver.h @@ -9,6 +9,7 @@ namespace WallpaperEngine::Render::Drivers public: virtual float getRenderTime () = 0; virtual bool closeRequested () = 0; + virtual void reposWindow (glm::ivec2 size) = 0; virtual void resizeWindow (glm::ivec2 size) = 0; virtual void showWindow () = 0; virtual void hideWindow () = 0;