mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
Make the window position customizable
This commit is contained in:
parent
0b0609e090
commit
fee0de1488
@ -25,6 +25,8 @@ struct option long_options [] = {
|
|||||||
{"list-properties", no_argument, nullptr, 'l'},
|
{"list-properties", no_argument, nullptr, 'l'},
|
||||||
{"set-property", required_argument, nullptr, 'o'},
|
{"set-property", required_argument, nullptr, 'o'},
|
||||||
{"class", required_argument, nullptr, 'x'},
|
{"class", required_argument, nullptr, 'x'},
|
||||||
|
{"x", required_argument, nullptr, 'z'},
|
||||||
|
{"y", required_argument, nullptr, 'y'},
|
||||||
{"width", required_argument, nullptr, 'w'},
|
{"width", required_argument, nullptr, 'w'},
|
||||||
{"height", required_argument, nullptr, 't'},
|
{"height", required_argument, nullptr, 't'},
|
||||||
{nullptr, 0, nullptr, 0}
|
{nullptr, 0, nullptr, 0}
|
||||||
@ -53,6 +55,8 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) :
|
|||||||
audioEnabled (true),
|
audioEnabled (true),
|
||||||
onlyListProperties (false),
|
onlyListProperties (false),
|
||||||
window_class (""),
|
window_class (""),
|
||||||
|
window_pos_x(0),
|
||||||
|
window_pos_y(0),
|
||||||
window_width(1280),
|
window_width(1280),
|
||||||
window_height(720)
|
window_height(720)
|
||||||
{
|
{
|
||||||
@ -120,6 +124,15 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) :
|
|||||||
case 'x':
|
case 'x':
|
||||||
this->window_class = optarg;
|
this->window_class = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'z':
|
||||||
|
this->window_pos_x = atoi(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'y':
|
||||||
|
this->window_pos_y = atoi(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'w':
|
case 'w':
|
||||||
this->window_width = atoi(optarg);
|
this->window_width = atoi(optarg);
|
||||||
break;
|
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--list-properties\t\t\tList all the available properties and their possible values");
|
||||||
sLog.out ("\t--set-property <name=value>\tOverrides the default value of the given property");
|
sLog.out ("\t--set-property <name=value>\tOverrides the default value of the given property");
|
||||||
sLog.out ("\t--class <class name>\t\t\tSets X11 window class");
|
sLog.out ("\t--class <class name>\t\t\tSets X11 window class");
|
||||||
|
sLog.out ("\t--x <x>\t\t\tSets the window x pos");
|
||||||
|
sLog.out ("\t--y <y>\t\t\tSets the window y pos");
|
||||||
sLog.out ("\t--width <width>\t\t\tSets the window width");
|
sLog.out ("\t--width <width>\t\t\tSets the window width");
|
||||||
sLog.out ("\t--height <height>\t\t\tSets the window height");
|
sLog.out ("\t--height <height>\t\t\tSets the window height");
|
||||||
}
|
}
|
@ -25,6 +25,8 @@ namespace WallpaperEngine::Application
|
|||||||
bool onlyListProperties;
|
bool onlyListProperties;
|
||||||
FREE_IMAGE_FORMAT screenshotFormat;
|
FREE_IMAGE_FORMAT screenshotFormat;
|
||||||
std::string window_class;
|
std::string window_class;
|
||||||
|
int window_pos_x;
|
||||||
|
int window_pos_y;
|
||||||
int window_width;
|
int window_width;
|
||||||
int window_height;
|
int window_height;
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ void CRenderContext::setupWindow ()
|
|||||||
{
|
{
|
||||||
this->m_driver.showWindow ();
|
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.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 ()
|
void CRenderContext::setupScreens ()
|
||||||
|
@ -60,6 +60,11 @@ bool COpenGLDriver::closeRequested ()
|
|||||||
return glfwWindowShouldClose (this->m_window);
|
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)
|
void COpenGLDriver::resizeWindow (glm::ivec2 size)
|
||||||
{
|
{
|
||||||
glfwSetWindowSize (this->m_window, size.x, size.y);
|
glfwSetWindowSize (this->m_window, size.x, size.y);
|
||||||
|
@ -21,6 +21,7 @@ namespace WallpaperEngine::Render::Drivers
|
|||||||
|
|
||||||
float getRenderTime () override;
|
float getRenderTime () override;
|
||||||
bool closeRequested () override;
|
bool closeRequested () override;
|
||||||
|
void reposWindow (glm::ivec2 size) override;
|
||||||
void resizeWindow (glm::ivec2 size) override;
|
void resizeWindow (glm::ivec2 size) override;
|
||||||
void showWindow () override;
|
void showWindow () override;
|
||||||
void hideWindow () override;
|
void hideWindow () override;
|
||||||
|
@ -9,6 +9,7 @@ namespace WallpaperEngine::Render::Drivers
|
|||||||
public:
|
public:
|
||||||
virtual float getRenderTime () = 0;
|
virtual float getRenderTime () = 0;
|
||||||
virtual bool closeRequested () = 0;
|
virtual bool closeRequested () = 0;
|
||||||
|
virtual void reposWindow (glm::ivec2 size) = 0;
|
||||||
virtual void resizeWindow (glm::ivec2 size) = 0;
|
virtual void resizeWindow (glm::ivec2 size) = 0;
|
||||||
virtual void showWindow () = 0;
|
virtual void showWindow () = 0;
|
||||||
virtual void hideWindow () = 0;
|
virtual void hideWindow () = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user