internal: add a new monitor auto system
This commit is contained in:
parent
a0cf890292
commit
13886a264f
6 changed files with 54 additions and 2 deletions
|
|
@ -489,6 +489,8 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
|||
// remove from mvmonitors
|
||||
std::erase_if(g_pCompositor->m_vMonitors, [&](const auto& other) { return other.get() == this; });
|
||||
|
||||
g_pCompositor->arrangeMonitors();
|
||||
|
||||
g_pCompositor->setActiveMonitor(g_pCompositor->m_vMonitors.front().get());
|
||||
|
||||
g_pCompositor->sanityCheckWorkspaces();
|
||||
|
|
@ -622,3 +624,10 @@ void CMonitor::setSpecialWorkspace(CWorkspace* const pWorkspace) {
|
|||
void CMonitor::setSpecialWorkspace(const int& id) {
|
||||
setSpecialWorkspace(g_pCompositor->getWorkspaceByID(id));
|
||||
}
|
||||
|
||||
void CMonitor::moveTo(const Vector2D& pos) {
|
||||
vecPosition = pos;
|
||||
|
||||
if (!isMirror())
|
||||
wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, output, (int)vecPosition.x, (int)vecPosition.y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ class CMonitor {
|
|||
void changeWorkspace(const int& id, bool internal = false);
|
||||
void setSpecialWorkspace(CWorkspace* const pWorkspace);
|
||||
void setSpecialWorkspace(const int& id);
|
||||
void moveTo(const Vector2D& pos);
|
||||
|
||||
std::shared_ptr<CMonitor>* m_pThisWrap = nullptr;
|
||||
bool m_bEnabled = false;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,14 @@ class Vector2D {
|
|||
return Vector2D(this->x / a.x, this->y / a.y);
|
||||
}
|
||||
|
||||
bool operator>(const Vector2D& a) const {
|
||||
return this->x > a.x && this->y > a.y;
|
||||
}
|
||||
|
||||
bool operator<(const Vector2D& a) const {
|
||||
return this->x < a.x && this->y < a.y;
|
||||
}
|
||||
|
||||
double distance(const Vector2D& other) const;
|
||||
|
||||
Vector2D clamp(const Vector2D& min, const Vector2D& max = Vector2D()) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue