mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 15:26:00 +01:00
added DPMS
This commit is contained in:
parent
50b991674b
commit
31a079b347
24 changed files with 287 additions and 211 deletions
|
@ -298,7 +298,7 @@ void CCompositor::startCompositor() {
|
||||||
wl_display_run(m_sWLDisplay);
|
wl_display_run(m_sWLDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitor* CCompositor::getMonitorFromID(const int& id) {
|
CMonitor* CCompositor::getMonitorFromID(const int& id) {
|
||||||
for (auto& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m->ID == (uint64_t)id) {
|
if (m->ID == (uint64_t)id) {
|
||||||
return m.get();
|
return m.get();
|
||||||
|
@ -308,7 +308,7 @@ SMonitor* CCompositor::getMonitorFromID(const int& id) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitor* CCompositor::getMonitorFromName(const std::string& name) {
|
CMonitor* CCompositor::getMonitorFromName(const std::string& name) {
|
||||||
for (auto& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m->szName == name) {
|
if (m->szName == name) {
|
||||||
return m.get();
|
return m.get();
|
||||||
|
@ -318,18 +318,18 @@ SMonitor* CCompositor::getMonitorFromName(const std::string& name) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitor* CCompositor::getMonitorFromCursor() {
|
CMonitor* CCompositor::getMonitorFromCursor() {
|
||||||
const auto COORDS = Vector2D(m_sWLRCursor->x, m_sWLRCursor->y);
|
const auto COORDS = Vector2D(m_sWLRCursor->x, m_sWLRCursor->y);
|
||||||
|
|
||||||
return getMonitorFromVector(COORDS);
|
return getMonitorFromVector(COORDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) {
|
CMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) {
|
||||||
const auto OUTPUT = wlr_output_layout_output_at(m_sWLROutputLayout, point.x, point.y);
|
const auto OUTPUT = wlr_output_layout_output_at(m_sWLROutputLayout, point.x, point.y);
|
||||||
|
|
||||||
if (!OUTPUT) {
|
if (!OUTPUT) {
|
||||||
float bestDistance = 0.f;
|
float bestDistance = 0.f;
|
||||||
SMonitor* pBestMon = nullptr;
|
CMonitor* pBestMon = nullptr;
|
||||||
|
|
||||||
for (auto& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
float dist = vecToRectDistanceSquared(point, m->vecPosition, m->vecPosition + m->vecSize);
|
float dist = vecToRectDistanceSquared(point, m->vecPosition, m->vecPosition + m->vecSize);
|
||||||
|
@ -582,7 +582,7 @@ wlr_surface* CCompositor::vectorWindowToSurface(const Vector2D& pos, CWindow* pW
|
||||||
return PSURFACE->surface;
|
return PSURFACE->surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitor* CCompositor::getMonitorFromOutput(wlr_output* out) {
|
CMonitor* CCompositor::getMonitorFromOutput(wlr_output* out) {
|
||||||
for (auto& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m->output == out) {
|
if (m->output == out) {
|
||||||
return m.get();
|
return m.get();
|
||||||
|
@ -1145,12 +1145,12 @@ CWindow* CCompositor::getConstraintWindow(SMouse* pMouse) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitor* CCompositor::getMonitorInDirection(const char& dir) {
|
CMonitor* CCompositor::getMonitorInDirection(const char& dir) {
|
||||||
const auto POSA = m_pLastMonitor->vecPosition;
|
const auto POSA = m_pLastMonitor->vecPosition;
|
||||||
const auto SIZEA = m_pLastMonitor->vecSize;
|
const auto SIZEA = m_pLastMonitor->vecSize;
|
||||||
|
|
||||||
auto longestIntersect = -1;
|
auto longestIntersect = -1;
|
||||||
SMonitor* longestIntersectMonitor = nullptr;
|
CMonitor* longestIntersectMonitor = nullptr;
|
||||||
|
|
||||||
for (auto& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m.get() == m_pLastMonitor)
|
if (m.get() == m_pLastMonitor)
|
||||||
|
@ -1281,7 +1281,7 @@ int CCompositor::getNextAvailableMonitorID() {
|
||||||
return topID + 1;
|
return topID + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, SMonitor* pMonitor) {
|
void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMonitor) {
|
||||||
|
|
||||||
// We trust the workspace and monitor to be correct.
|
// We trust the workspace and monitor to be correct.
|
||||||
|
|
||||||
|
@ -1416,7 +1416,7 @@ void CCompositor::updateWorkspaceWindowDecos(const int& id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::scheduleFrameForMonitor(SMonitor* pMonitor) {
|
void CCompositor::scheduleFrameForMonitor(CMonitor* pMonitor) {
|
||||||
if ((m_sWLRSession && !m_sWLRSession->active) || !m_bSessionActive)
|
if ((m_sWLRSession && !m_sWLRSession->active) || !m_bSessionActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,8 @@ public:
|
||||||
std::string m_szInstanceSignature = "";
|
std::string m_szInstanceSignature = "";
|
||||||
std::string m_szCurrentSplash = "error";
|
std::string m_szCurrentSplash = "error";
|
||||||
|
|
||||||
std::vector<std::unique_ptr<SMonitor>> m_vMonitors;
|
std::vector<std::shared_ptr<CMonitor>> m_vMonitors;
|
||||||
|
std::vector<std::shared_ptr<CMonitor>> m_vRealMonitors; // for all monitors, even those turned off
|
||||||
std::vector<std::unique_ptr<CWindow>> m_vWindows;
|
std::vector<std::unique_ptr<CWindow>> m_vWindows;
|
||||||
std::deque<std::unique_ptr<CWindow>> m_dUnmanagedX11Windows;
|
std::deque<std::unique_ptr<CWindow>> m_dUnmanagedX11Windows;
|
||||||
std::vector<std::unique_ptr<SXDGPopup>> m_vXDGPopups;
|
std::vector<std::unique_ptr<SXDGPopup>> m_vXDGPopups;
|
||||||
|
@ -86,7 +87,7 @@ public:
|
||||||
|
|
||||||
wlr_surface* m_pLastFocus = nullptr;
|
wlr_surface* m_pLastFocus = nullptr;
|
||||||
CWindow* m_pLastWindow = nullptr;
|
CWindow* m_pLastWindow = nullptr;
|
||||||
SMonitor* m_pLastMonitor = nullptr;
|
CMonitor* m_pLastMonitor = nullptr;
|
||||||
|
|
||||||
SSeat m_sSeat;
|
SSeat m_sSeat;
|
||||||
|
|
||||||
|
@ -95,10 +96,10 @@ public:
|
||||||
|
|
||||||
// ------------------------------------------------- //
|
// ------------------------------------------------- //
|
||||||
|
|
||||||
SMonitor* getMonitorFromID(const int&);
|
CMonitor* getMonitorFromID(const int&);
|
||||||
SMonitor* getMonitorFromName(const std::string&);
|
CMonitor* getMonitorFromName(const std::string&);
|
||||||
SMonitor* getMonitorFromCursor();
|
CMonitor* getMonitorFromCursor();
|
||||||
SMonitor* getMonitorFromVector(const Vector2D&);
|
CMonitor* getMonitorFromVector(const Vector2D&);
|
||||||
void removeWindowFromVectorSafe(CWindow*);
|
void removeWindowFromVectorSafe(CWindow*);
|
||||||
void focusWindow(CWindow*, wlr_surface* pSurface = nullptr);
|
void focusWindow(CWindow*, wlr_surface* pSurface = nullptr);
|
||||||
void focusSurface(wlr_surface*, CWindow* pWindowOwner = nullptr);
|
void focusSurface(wlr_surface*, CWindow* pWindowOwner = nullptr);
|
||||||
|
@ -111,7 +112,7 @@ public:
|
||||||
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
|
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
|
||||||
CWindow* windowFromCursor();
|
CWindow* windowFromCursor();
|
||||||
CWindow* windowFloatingFromCursor();
|
CWindow* windowFloatingFromCursor();
|
||||||
SMonitor* getMonitorFromOutput(wlr_output*);
|
CMonitor* getMonitorFromOutput(wlr_output*);
|
||||||
CWindow* getWindowForPopup(wlr_xdg_popup*);
|
CWindow* getWindowForPopup(wlr_xdg_popup*);
|
||||||
CWindow* getWindowFromSurface(wlr_surface*);
|
CWindow* getWindowFromSurface(wlr_surface*);
|
||||||
bool isWorkspaceVisible(const int&);
|
bool isWorkspaceVisible(const int&);
|
||||||
|
@ -135,17 +136,17 @@ public:
|
||||||
int getNextAvailableNamedWorkspace();
|
int getNextAvailableNamedWorkspace();
|
||||||
bool isPointOnAnyMonitor(const Vector2D&);
|
bool isPointOnAnyMonitor(const Vector2D&);
|
||||||
CWindow* getConstraintWindow(SMouse*);
|
CWindow* getConstraintWindow(SMouse*);
|
||||||
SMonitor* getMonitorInDirection(const char&);
|
CMonitor* getMonitorInDirection(const char&);
|
||||||
void updateAllWindowsAnimatedDecorationValues();
|
void updateAllWindowsAnimatedDecorationValues();
|
||||||
void updateWindowAnimatedDecorationValues(CWindow*);
|
void updateWindowAnimatedDecorationValues(CWindow*);
|
||||||
void moveWindowToWorkspace(CWindow*, const std::string&);
|
void moveWindowToWorkspace(CWindow*, const std::string&);
|
||||||
int getNextAvailableMonitorID();
|
int getNextAvailableMonitorID();
|
||||||
void moveWorkspaceToMonitor(CWorkspace*, SMonitor*);
|
void moveWorkspaceToMonitor(CWorkspace*, CMonitor*);
|
||||||
bool workspaceIDOutOfBounds(const int&);
|
bool workspaceIDOutOfBounds(const int&);
|
||||||
void setWindowFullscreen(CWindow*, bool, eFullscreenMode);
|
void setWindowFullscreen(CWindow*, bool, eFullscreenMode);
|
||||||
void moveUnmanagedX11ToWindows(CWindow*);
|
void moveUnmanagedX11ToWindows(CWindow*);
|
||||||
CWindow* getX11Parent(CWindow*);
|
CWindow* getX11Parent(CWindow*);
|
||||||
void scheduleFrameForMonitor(SMonitor*);
|
void scheduleFrameForMonitor(CMonitor*);
|
||||||
void addToFadingOutSafe(SLayerSurface*);
|
void addToFadingOutSafe(SLayerSurface*);
|
||||||
void addToFadingOutSafe(CWindow*);
|
void addToFadingOutSafe(CWindow*);
|
||||||
CWindow* getWindowByRegex(const std::string&);
|
CWindow* getWindowByRegex(const std::string&);
|
||||||
|
|
|
@ -958,6 +958,9 @@ void CConfigManager::loadConfigLoadVars() {
|
||||||
// and they'll be taken care of in the newMonitor event
|
// and they'll be taken care of in the newMonitor event
|
||||||
if (!isFirstLaunch) {
|
if (!isFirstLaunch) {
|
||||||
m_bWantsMonitorReload = true;
|
m_bWantsMonitorReload = true;
|
||||||
|
|
||||||
|
// check
|
||||||
|
ensureDPMS();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update window border colors
|
// Update window border colors
|
||||||
|
@ -1212,3 +1215,14 @@ bool CConfigManager::shouldBlurLS(const std::string& ns) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CConfigManager::ensureDPMS() {
|
||||||
|
for (auto& rm : g_pCompositor->m_vRealMonitors) {
|
||||||
|
auto rule = getMonitorRuleFor(rm->szName);
|
||||||
|
|
||||||
|
if (rule.disabled == rm->m_bEnabled) {
|
||||||
|
rm->m_pThisWrap = &rm;
|
||||||
|
g_pHyprRenderer->applyMonitorRule(rm.get(), &rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -111,6 +111,7 @@ private:
|
||||||
// internal methods
|
// internal methods
|
||||||
void setDefaultVars();
|
void setDefaultVars();
|
||||||
void setDeviceDefaultVars(const std::string&);
|
void setDeviceDefaultVars(const std::string&);
|
||||||
|
void ensureDPMS();
|
||||||
|
|
||||||
void applyUserDefinedVars(std::string&, const size_t);
|
void applyUserDefinedVars(std::string&, const size_t);
|
||||||
void loadConfigLoadVars();
|
void loadConfigLoadVars();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "HyprDebugOverlay.hpp"
|
#include "HyprDebugOverlay.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
void CHyprMonitorDebugOverlay::renderData(SMonitor* pMonitor, float µs) {
|
void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
|
||||||
m_dLastRenderTimes.push_back(µs / 1000.f);
|
m_dLastRenderTimes.push_back(µs / 1000.f);
|
||||||
|
|
||||||
if (m_dLastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate)
|
if (m_dLastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate)
|
||||||
|
@ -11,7 +11,7 @@ void CHyprMonitorDebugOverlay::renderData(SMonitor* pMonitor, float µs) {
|
||||||
m_pMonitor = pMonitor;
|
m_pMonitor = pMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMonitorDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs) {
|
void CHyprMonitorDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) {
|
||||||
m_dLastRenderTimesNoOverlay.push_back(µs / 1000.f);
|
m_dLastRenderTimesNoOverlay.push_back(µs / 1000.f);
|
||||||
|
|
||||||
if (m_dLastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate)
|
if (m_dLastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate)
|
||||||
|
@ -21,7 +21,7 @@ void CHyprMonitorDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs
|
||||||
m_pMonitor = pMonitor;
|
m_pMonitor = pMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMonitorDebugOverlay::frameData(SMonitor* pMonitor) {
|
void CHyprMonitorDebugOverlay::frameData(CMonitor* pMonitor) {
|
||||||
m_dLastFrametimes.push_back(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - m_tpLastFrame).count() / 1000.f);
|
m_dLastFrametimes.push_back(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - m_tpLastFrame).count() / 1000.f);
|
||||||
|
|
||||||
if (m_dLastFrametimes.size() > (long unsigned int)pMonitor->refreshRate)
|
if (m_dLastFrametimes.size() > (long unsigned int)pMonitor->refreshRate)
|
||||||
|
@ -126,15 +126,15 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
||||||
return yOffset - offset;
|
return yOffset - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDebugOverlay::renderData(SMonitor* pMonitor, float µs) {
|
void CHyprDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
|
||||||
m_mMonitorOverlays[pMonitor].renderData(pMonitor, µs);
|
m_mMonitorOverlays[pMonitor].renderData(pMonitor, µs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs) {
|
void CHyprDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) {
|
||||||
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, µs);
|
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, µs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDebugOverlay::frameData(SMonitor* pMonitor) {
|
void CHyprDebugOverlay::frameData(CMonitor* pMonitor) {
|
||||||
m_mMonitorOverlays[pMonitor].frameData(pMonitor);
|
m_mMonitorOverlays[pMonitor].frameData(pMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,16 +11,16 @@ class CHyprMonitorDebugOverlay {
|
||||||
public:
|
public:
|
||||||
int draw(int offset);
|
int draw(int offset);
|
||||||
|
|
||||||
void renderData(SMonitor* pMonitor, float µs);
|
void renderData(CMonitor* pMonitor, float µs);
|
||||||
void renderDataNoOverlay(SMonitor* pMonitor, float µs);
|
void renderDataNoOverlay(CMonitor* pMonitor, float µs);
|
||||||
void frameData(SMonitor* pMonitor);
|
void frameData(CMonitor* pMonitor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::deque<float> m_dLastFrametimes;
|
std::deque<float> m_dLastFrametimes;
|
||||||
std::deque<float> m_dLastRenderTimes;
|
std::deque<float> m_dLastRenderTimes;
|
||||||
std::deque<float> m_dLastRenderTimesNoOverlay;
|
std::deque<float> m_dLastRenderTimesNoOverlay;
|
||||||
std::chrono::high_resolution_clock::time_point m_tpLastFrame;
|
std::chrono::high_resolution_clock::time_point m_tpLastFrame;
|
||||||
SMonitor* m_pMonitor = nullptr;
|
CMonitor* m_pMonitor = nullptr;
|
||||||
wlr_box m_wbLastDrawnBox;
|
wlr_box m_wbLastDrawnBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,13 +28,13 @@ class CHyprDebugOverlay {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
void renderData(SMonitor*, float µs);
|
void renderData(CMonitor*, float µs);
|
||||||
void renderDataNoOverlay(SMonitor*, float µs);
|
void renderDataNoOverlay(CMonitor*, float µs);
|
||||||
void frameData(SMonitor*);
|
void frameData(CMonitor*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::unordered_map<SMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
|
std::unordered_map<CMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
|
||||||
|
|
||||||
cairo_surface_t* m_pCairoSurface = nullptr;
|
cairo_surface_t* m_pCairoSurface = nullptr;
|
||||||
cairo_t* m_pCairo = nullptr;
|
cairo_t* m_pCairo = nullptr;
|
||||||
|
|
|
@ -31,7 +31,7 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
|
||||||
WLRLAYERSURFACE->output = PMONITOR->output;
|
WLRLAYERSURFACE->output = PMONITOR->output;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PMONITOR = (SMonitor*)g_pCompositor->getMonitorFromOutput(WLRLAYERSURFACE->output);
|
const auto PMONITOR = (CMonitor*)g_pCompositor->getMonitorFromOutput(WLRLAYERSURFACE->output);
|
||||||
SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].emplace_back(std::make_unique<SLayerSurface>()).get();
|
SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].emplace_back(std::make_unique<SLayerSurface>()).get();
|
||||||
|
|
||||||
layerSurface->szNamespace = WLRLAYERSURFACE->_namespace;
|
layerSurface->szNamespace = WLRLAYERSURFACE->_namespace;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
// //
|
// //
|
||||||
// --------------------------------------------------------- //
|
// --------------------------------------------------------- //
|
||||||
|
|
||||||
SMonitor* pMostHzMonitor = nullptr;
|
CMonitor* pMostHzMonitor = nullptr;
|
||||||
|
|
||||||
void Events::listener_change(wl_listener* listener, void* data) {
|
void Events::listener_change(wl_listener* listener, void* data) {
|
||||||
// layout got changed, let's update monitors.
|
// layout got changed, let's update monitors.
|
||||||
|
@ -58,118 +58,35 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get monitor rule that matches
|
// add it to real
|
||||||
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(OUTPUT->name);
|
const auto PNEWMONITORWRAP = &g_pCompositor->m_vRealMonitors.emplace_back(std::make_shared<CMonitor>());
|
||||||
|
const auto PNEWMONITOR = PNEWMONITORWRAP->get();
|
||||||
// if it's disabled, disable and ignore
|
|
||||||
if (monitorRule.disabled) {
|
|
||||||
wlr_output_enable(OUTPUT, 0);
|
|
||||||
wlr_output_commit(OUTPUT);
|
|
||||||
|
|
||||||
if (const auto PMONITOR = g_pCompositor->getMonitorFromName(std::string(OUTPUT->name)); PMONITOR) {
|
|
||||||
listener_monitorDestroy(nullptr, PMONITOR->output);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto PNEWMONITOR = g_pCompositor->m_vMonitors.emplace_back(std::make_unique<SMonitor>()).get();
|
|
||||||
|
|
||||||
PNEWMONITOR->output = OUTPUT;
|
|
||||||
PNEWMONITOR->ID = g_pCompositor->getNextAvailableMonitorID();
|
|
||||||
PNEWMONITOR->szName = OUTPUT->name;
|
|
||||||
|
|
||||||
wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
|
wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
|
||||||
|
|
||||||
wlr_output_set_scale(OUTPUT, monitorRule.scale);
|
PNEWMONITOR->output = OUTPUT;
|
||||||
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, monitorRule.scale);
|
PNEWMONITOR->m_pThisWrap = PNEWMONITORWRAP;
|
||||||
wlr_output_set_transform(OUTPUT, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: support other transforms
|
|
||||||
|
|
||||||
wlr_output_enable_adaptive_sync(OUTPUT, 1);
|
PNEWMONITOR->onConnect(false);
|
||||||
|
|
||||||
// create it in the arr
|
if (!pMostHzMonitor || PNEWMONITOR->refreshRate > pMostHzMonitor->refreshRate)
|
||||||
PNEWMONITOR->vecPosition = monitorRule.offset;
|
|
||||||
PNEWMONITOR->vecSize = monitorRule.resolution;
|
|
||||||
PNEWMONITOR->refreshRate = monitorRule.refreshRate;
|
|
||||||
|
|
||||||
PNEWMONITOR->hyprListener_monitorFrame.initCallback(&OUTPUT->events.frame, &Events::listener_monitorFrame, PNEWMONITOR);
|
|
||||||
PNEWMONITOR->hyprListener_monitorDestroy.initCallback(&OUTPUT->events.destroy, &Events::listener_monitorDestroy, PNEWMONITOR);
|
|
||||||
|
|
||||||
wlr_output_enable(OUTPUT, 1);
|
|
||||||
|
|
||||||
// TODO: this doesn't seem to set the X and Y correctly,
|
|
||||||
// wlr_output_layout_output_coords returns invalid values, I think...
|
|
||||||
wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, OUTPUT, monitorRule.offset.x, monitorRule.offset.y);
|
|
||||||
|
|
||||||
// set mode, also applies
|
|
||||||
g_pHyprRenderer->applyMonitorRule(PNEWMONITOR, &monitorRule, true);
|
|
||||||
|
|
||||||
Debug::log(LOG, "Added new monitor with name %s at %i,%i with size %ix%i, pointer %x", OUTPUT->name, (int)monitorRule.offset.x, (int)monitorRule.offset.y, (int)monitorRule.resolution.x, (int)monitorRule.resolution.y, OUTPUT);
|
|
||||||
|
|
||||||
PNEWMONITOR->damage = wlr_output_damage_create(PNEWMONITOR->output);
|
|
||||||
|
|
||||||
// add a WLR workspace group
|
|
||||||
PNEWMONITOR->pWLRWorkspaceGroupHandle = wlr_ext_workspace_group_handle_v1_create(g_pCompositor->m_sWLREXTWorkspaceMgr);
|
|
||||||
wlr_ext_workspace_group_handle_v1_output_enter(PNEWMONITOR->pWLRWorkspaceGroupHandle, PNEWMONITOR->output);
|
|
||||||
|
|
||||||
// Workspace
|
|
||||||
std::string newDefaultWorkspaceName = "";
|
|
||||||
auto WORKSPACEID = monitorRule.defaultWorkspace == "" ? g_pCompositor->m_vWorkspaces.size() + 1 : getWorkspaceIDFromString(monitorRule.defaultWorkspace, newDefaultWorkspaceName);
|
|
||||||
|
|
||||||
if (WORKSPACEID == INT_MAX || WORKSPACEID == (long unsigned int)SPECIAL_WORKSPACE_ID) {
|
|
||||||
WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1;
|
|
||||||
newDefaultWorkspaceName = std::to_string(WORKSPACEID);
|
|
||||||
|
|
||||||
Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"%s\" is invalid.", monitorRule.defaultWorkspace.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID);
|
|
||||||
|
|
||||||
Debug::log(LOG, "New monitor: WORKSPACEID %d, exists: %d", WORKSPACEID, (int)(PNEWWORKSPACE != nullptr));
|
|
||||||
|
|
||||||
if (PNEWWORKSPACE) {
|
|
||||||
// workspace exists, move it to the newly connected monitor
|
|
||||||
g_pCompositor->moveWorkspaceToMonitor(PNEWWORKSPACE, PNEWMONITOR);
|
|
||||||
PNEWMONITOR->activeWorkspace = PNEWWORKSPACE->m_iID;
|
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PNEWMONITOR->ID);
|
|
||||||
PNEWWORKSPACE->startAnim(true,true,true);
|
|
||||||
} else {
|
|
||||||
PNEWWORKSPACE = g_pCompositor->m_vWorkspaces.emplace_back(std::make_unique<CWorkspace>(PNEWMONITOR->ID, newDefaultWorkspaceName)).get();
|
|
||||||
|
|
||||||
// We are required to set the name here immediately
|
|
||||||
wlr_ext_workspace_handle_v1_set_name(PNEWWORKSPACE->m_pWlrHandle, newDefaultWorkspaceName.c_str());
|
|
||||||
|
|
||||||
PNEWWORKSPACE->m_iID = WORKSPACEID;
|
|
||||||
}
|
|
||||||
|
|
||||||
PNEWMONITOR->activeWorkspace = PNEWWORKSPACE->m_iID;
|
|
||||||
PNEWMONITOR->scale = monitorRule.scale;
|
|
||||||
|
|
||||||
PNEWMONITOR->forceFullFrames = 3; // force 3 full frames to make sure there is no blinking due to double-buffering.
|
|
||||||
|
|
||||||
g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle);
|
|
||||||
PNEWWORKSPACE->setActive(true);
|
|
||||||
//
|
|
||||||
|
|
||||||
if (!pMostHzMonitor || monitorRule.refreshRate > pMostHzMonitor->refreshRate)
|
|
||||||
pMostHzMonitor = PNEWMONITOR;
|
pMostHzMonitor = PNEWMONITOR;
|
||||||
|
|
||||||
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
|
|
||||||
g_pCompositor->m_pLastMonitor = PNEWMONITOR;
|
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", PNEWMONITOR->szName});
|
|
||||||
|
|
||||||
// ready to process cuz we have a monitor
|
// ready to process cuz we have a monitor
|
||||||
g_pCompositor->m_bReadyToProcess = true;
|
g_pCompositor->m_bReadyToProcess = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_monitorFrame(void* owner, void* data) {
|
void Events::listener_monitorFrame(void* owner, void* data) {
|
||||||
SMonitor* const PMONITOR = (SMonitor*)owner;
|
CMonitor* const PMONITOR = (CMonitor*)owner;
|
||||||
|
|
||||||
if ((g_pCompositor->m_sWLRSession && !g_pCompositor->m_sWLRSession->active) || !g_pCompositor->m_bSessionActive) {
|
if ((g_pCompositor->m_sWLRSession && !g_pCompositor->m_sWLRSession->active) || !g_pCompositor->m_bSessionActive) {
|
||||||
Debug::log(WARN, "Attempted to render frame on inactive session!");
|
Debug::log(WARN, "Attempted to render frame on inactive session!");
|
||||||
return; // cannot draw on session inactive (different tty)
|
return; // cannot draw on session inactive (different tty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!PMONITOR->m_bEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
static std::chrono::high_resolution_clock::time_point startRender = std::chrono::high_resolution_clock::now();
|
static std::chrono::high_resolution_clock::time_point startRender = std::chrono::high_resolution_clock::now();
|
||||||
static std::chrono::high_resolution_clock::time_point startRenderOverlay = std::chrono::high_resolution_clock::now();
|
static std::chrono::high_resolution_clock::time_point startRenderOverlay = std::chrono::high_resolution_clock::now();
|
||||||
static std::chrono::high_resolution_clock::time_point endRenderOverlay = std::chrono::high_resolution_clock::now();
|
static std::chrono::high_resolution_clock::time_point endRenderOverlay = std::chrono::high_resolution_clock::now();
|
||||||
|
@ -352,7 +269,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
||||||
void Events::listener_monitorDestroy(void* owner, void* data) {
|
void Events::listener_monitorDestroy(void* owner, void* data) {
|
||||||
const auto OUTPUT = (wlr_output*)data;
|
const auto OUTPUT = (wlr_output*)data;
|
||||||
|
|
||||||
SMonitor* pMonitor = nullptr;
|
CMonitor* pMonitor = nullptr;
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m->szName == OUTPUT->name) {
|
if (m->szName == OUTPUT->name) {
|
||||||
|
@ -364,46 +281,14 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
|
||||||
if (!pMonitor)
|
if (!pMonitor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Cleanup everything. Move windows back, snap cursor, shit.
|
pMonitor->onDisconnect();
|
||||||
const auto BACKUPMON = g_pCompositor->m_vMonitors.front().get();
|
|
||||||
|
|
||||||
if (!BACKUPMON) {
|
// cleanup
|
||||||
Debug::log(CRIT, "No monitors! Unplugged last! Exiting.");
|
g_pCompositor->m_vRealMonitors.erase(std::remove_if(g_pCompositor->m_vRealMonitors.begin(), g_pCompositor->m_vRealMonitors.end(), [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; }));
|
||||||
g_pCompositor->cleanup();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto BACKUPWORKSPACE = BACKUPMON->activeWorkspace > 0 ? std::to_string(BACKUPMON->activeWorkspace) : "name:" + g_pCompositor->getWorkspaceByID(BACKUPMON->activeWorkspace)->m_szName;
|
|
||||||
|
|
||||||
// snap cursor
|
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, BACKUPMON->vecPosition.x + BACKUPMON->vecTransformedSize.x / 2.f, BACKUPMON->vecPosition.y + BACKUPMON->vecTransformedSize.y / 2.f);
|
|
||||||
|
|
||||||
// move workspaces
|
|
||||||
std::deque<CWorkspace*> wspToMove;
|
|
||||||
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
|
||||||
if (w->m_iMonitorID == pMonitor->ID) {
|
|
||||||
wspToMove.push_back(w.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto& w : wspToMove) {
|
|
||||||
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
|
|
||||||
w->startAnim(true, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
pMonitor->activeWorkspace = -1;
|
|
||||||
|
|
||||||
g_pCompositor->m_vWorkspaces.erase(std::remove_if(g_pCompositor->m_vWorkspaces.begin(), g_pCompositor->m_vWorkspaces.end(), [&](std::unique_ptr<CWorkspace>& el) { return el->m_iMonitorID == pMonitor->ID; }));
|
|
||||||
|
|
||||||
Debug::log(LOG, "Removed monitor %s!", pMonitor->szName.c_str());
|
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", pMonitor->szName});
|
|
||||||
|
|
||||||
g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](std::unique_ptr<SMonitor>& el) { return el.get() == pMonitor; }));
|
|
||||||
|
|
||||||
if (pMostHzMonitor == pMonitor) {
|
if (pMostHzMonitor == pMonitor) {
|
||||||
int mostHz = 0;
|
int mostHz = 0;
|
||||||
SMonitor* pMonitorMostHz = nullptr;
|
CMonitor* pMonitorMostHz = nullptr;
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m->refreshRate > mostHz) {
|
if (m->refreshRate > mostHz) {
|
||||||
|
|
162
src/helpers/Monitor.cpp
Normal file
162
src/helpers/Monitor.cpp
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
#include "Monitor.hpp"
|
||||||
|
|
||||||
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
|
void CMonitor::onConnect(bool noRule) {
|
||||||
|
// get monitor rule that matches
|
||||||
|
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(output->name);
|
||||||
|
|
||||||
|
hyprListener_monitorFrame.initCallback(&output->events.frame, &Events::listener_monitorFrame, this);
|
||||||
|
hyprListener_monitorDestroy.initCallback(&output->events.destroy, &Events::listener_monitorDestroy, this);
|
||||||
|
|
||||||
|
// if it's disabled, disable and ignore
|
||||||
|
if (monitorRule.disabled) {
|
||||||
|
wlr_output_enable(output, 0);
|
||||||
|
wlr_output_commit(output);
|
||||||
|
|
||||||
|
hyprListener_monitorFrame.removeCallback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_vMonitors.end()){
|
||||||
|
g_pCompositor->m_vMonitors.push_back(*m_pThisWrap);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bEnabled = true;
|
||||||
|
|
||||||
|
ID = g_pCompositor->getNextAvailableMonitorID();
|
||||||
|
szName = output->name;
|
||||||
|
|
||||||
|
wlr_output_set_scale(output, monitorRule.scale);
|
||||||
|
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, monitorRule.scale);
|
||||||
|
wlr_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: support other transforms
|
||||||
|
|
||||||
|
wlr_output_enable_adaptive_sync(output, 1);
|
||||||
|
|
||||||
|
// create it in the arr
|
||||||
|
vecPosition = monitorRule.offset;
|
||||||
|
vecSize = monitorRule.resolution;
|
||||||
|
refreshRate = monitorRule.refreshRate;
|
||||||
|
|
||||||
|
wlr_output_enable(output, 1);
|
||||||
|
|
||||||
|
// TODO: this doesn't seem to set the X and Y correctly,
|
||||||
|
// wlr_output_layout_output_coords returns invalid values, I think...
|
||||||
|
wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, output, monitorRule.offset.x, monitorRule.offset.y);
|
||||||
|
|
||||||
|
// set mode, also applies
|
||||||
|
if (!noRule)
|
||||||
|
g_pHyprRenderer->applyMonitorRule(this, &monitorRule, true);
|
||||||
|
|
||||||
|
Debug::log(LOG, "Added new monitor with name %s at %i,%i with size %ix%i, pointer %x", output->name, (int)monitorRule.offset.x, (int)monitorRule.offset.y, (int)monitorRule.resolution.x, (int)monitorRule.resolution.y, output);
|
||||||
|
|
||||||
|
damage = wlr_output_damage_create(output);
|
||||||
|
|
||||||
|
// add a WLR workspace group
|
||||||
|
if (!pWLRWorkspaceGroupHandle) {
|
||||||
|
pWLRWorkspaceGroupHandle = wlr_ext_workspace_group_handle_v1_create(g_pCompositor->m_sWLREXTWorkspaceMgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_ext_workspace_group_handle_v1_output_enter(pWLRWorkspaceGroupHandle, output);
|
||||||
|
|
||||||
|
// Workspace
|
||||||
|
std::string newDefaultWorkspaceName = "";
|
||||||
|
auto WORKSPACEID = monitorRule.defaultWorkspace == "" ? g_pCompositor->m_vWorkspaces.size() + 1 : getWorkspaceIDFromString(monitorRule.defaultWorkspace, newDefaultWorkspaceName);
|
||||||
|
|
||||||
|
if (WORKSPACEID == INT_MAX || WORKSPACEID == (long unsigned int)SPECIAL_WORKSPACE_ID) {
|
||||||
|
WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1;
|
||||||
|
newDefaultWorkspaceName = std::to_string(WORKSPACEID);
|
||||||
|
|
||||||
|
Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"%s\" is invalid.", monitorRule.defaultWorkspace.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID);
|
||||||
|
|
||||||
|
Debug::log(LOG, "New monitor: WORKSPACEID %d, exists: %d", WORKSPACEID, (int)(PNEWWORKSPACE != nullptr));
|
||||||
|
|
||||||
|
if (PNEWWORKSPACE) {
|
||||||
|
// workspace exists, move it to the newly connected monitor
|
||||||
|
g_pCompositor->moveWorkspaceToMonitor(PNEWWORKSPACE, this);
|
||||||
|
activeWorkspace = PNEWWORKSPACE->m_iID;
|
||||||
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
|
||||||
|
PNEWWORKSPACE->startAnim(true, true, true);
|
||||||
|
} else {
|
||||||
|
PNEWWORKSPACE = g_pCompositor->m_vWorkspaces.emplace_back(std::make_unique<CWorkspace>(ID, newDefaultWorkspaceName)).get();
|
||||||
|
|
||||||
|
// We are required to set the name here immediately
|
||||||
|
wlr_ext_workspace_handle_v1_set_name(PNEWWORKSPACE->m_pWlrHandle, newDefaultWorkspaceName.c_str());
|
||||||
|
|
||||||
|
PNEWWORKSPACE->m_iID = WORKSPACEID;
|
||||||
|
}
|
||||||
|
|
||||||
|
activeWorkspace = PNEWWORKSPACE->m_iID;
|
||||||
|
scale = monitorRule.scale;
|
||||||
|
|
||||||
|
forceFullFrames = 3; // force 3 full frames to make sure there is no blinking due to double-buffering.
|
||||||
|
|
||||||
|
g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle);
|
||||||
|
PNEWWORKSPACE->setActive(true);
|
||||||
|
//
|
||||||
|
|
||||||
|
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
|
||||||
|
g_pCompositor->m_pLastMonitor = this;
|
||||||
|
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName});
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMonitor::onDisconnect() {
|
||||||
|
// Cleanup everything. Move windows back, snap cursor, shit.
|
||||||
|
CMonitor* BACKUPMON = nullptr;
|
||||||
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
|
if (m.get() != this) {
|
||||||
|
BACKUPMON = m.get();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BACKUPMON) {
|
||||||
|
Debug::log(CRIT, "No monitors! Unplugged last! Exiting.");
|
||||||
|
g_pCompositor->cleanup();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bEnabled = false;
|
||||||
|
|
||||||
|
hyprListener_monitorFrame.removeCallback();
|
||||||
|
|
||||||
|
const auto BACKUPWORKSPACE = BACKUPMON->activeWorkspace > 0 ? std::to_string(BACKUPMON->activeWorkspace) : "name:" + g_pCompositor->getWorkspaceByID(BACKUPMON->activeWorkspace)->m_szName;
|
||||||
|
|
||||||
|
// snap cursor
|
||||||
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, BACKUPMON->vecPosition.x + BACKUPMON->vecTransformedSize.x / 2.f, BACKUPMON->vecPosition.y + BACKUPMON->vecTransformedSize.y / 2.f);
|
||||||
|
|
||||||
|
// move workspaces
|
||||||
|
std::deque<CWorkspace*> wspToMove;
|
||||||
|
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
||||||
|
if (w->m_iMonitorID == ID) {
|
||||||
|
wspToMove.push_back(w.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& w : wspToMove) {
|
||||||
|
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
|
||||||
|
w->startAnim(true, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
activeWorkspace = -1;
|
||||||
|
|
||||||
|
wlr_output_damage_destroy(damage);
|
||||||
|
|
||||||
|
wlr_output_layout_remove(g_pCompositor->m_sWLROutputLayout, output);
|
||||||
|
|
||||||
|
wlr_output_enable(output, false);
|
||||||
|
|
||||||
|
wlr_output_commit(output);
|
||||||
|
|
||||||
|
g_pCompositor->m_vWorkspaces.erase(std::remove_if(g_pCompositor->m_vWorkspaces.begin(), g_pCompositor->m_vWorkspaces.end(), [&](std::unique_ptr<CWorkspace>& el) { return el->m_iMonitorID == ID; }));
|
||||||
|
|
||||||
|
Debug::log(LOG, "Removed monitor %s!", szName.c_str());
|
||||||
|
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName});
|
||||||
|
|
||||||
|
g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](std::shared_ptr<CMonitor>& el) { return el.get() == this; }));
|
||||||
|
}
|
|
@ -7,7 +7,8 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
struct SMonitor {
|
class CMonitor {
|
||||||
|
public:
|
||||||
Vector2D vecPosition = Vector2D(0,0);
|
Vector2D vecPosition = Vector2D(0,0);
|
||||||
Vector2D vecSize = Vector2D(0,0);
|
Vector2D vecSize = Vector2D(0,0);
|
||||||
Vector2D vecPixelSize = Vector2D(0,0);
|
Vector2D vecPixelSize = Vector2D(0,0);
|
||||||
|
@ -51,9 +52,16 @@ struct SMonitor {
|
||||||
wlr_ext_workspace_group_handle_v1* pWLRWorkspaceGroupHandle = nullptr;
|
wlr_ext_workspace_group_handle_v1* pWLRWorkspaceGroupHandle = nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
// methods
|
||||||
|
void onConnect(bool noRule);
|
||||||
|
void onDisconnect();
|
||||||
|
|
||||||
|
std::shared_ptr<CMonitor>* m_pThisWrap = nullptr;
|
||||||
|
bool m_bEnabled = false;
|
||||||
|
|
||||||
// For the list lookup
|
// For the list lookup
|
||||||
|
|
||||||
bool operator==(const SMonitor& rhs) {
|
bool operator==(const CMonitor& rhs) {
|
||||||
return vecPosition == rhs.vecPosition && vecSize == rhs.vecSize && szName == rhs.szName;
|
return vecPosition == rhs.vecPosition && vecSize == rhs.vecSize && szName == rhs.szName;
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -143,13 +143,13 @@ struct SConstraint {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SMonitor;
|
struct CMonitor;
|
||||||
|
|
||||||
struct SXDGPopup {
|
struct SXDGPopup {
|
||||||
CWindow* parentWindow = nullptr;
|
CWindow* parentWindow = nullptr;
|
||||||
SXDGPopup* parentPopup = nullptr;
|
SXDGPopup* parentPopup = nullptr;
|
||||||
wlr_xdg_popup* popup = nullptr;
|
wlr_xdg_popup* popup = nullptr;
|
||||||
SMonitor* monitor = nullptr;
|
CMonitor* monitor = nullptr;
|
||||||
|
|
||||||
DYNLISTENER(newPopupFromPopupXDG);
|
DYNLISTENER(newPopupFromPopupXDG);
|
||||||
DYNLISTENER(destroyPopupXDG);
|
DYNLISTENER(destroyPopupXDG);
|
||||||
|
@ -270,5 +270,5 @@ struct SSwipeGesture {
|
||||||
float avgSpeed = 0;
|
float avgSpeed = 0;
|
||||||
int speedPoints = 0;
|
int speedPoints = 0;
|
||||||
|
|
||||||
SMonitor* pMonitor = nullptr;
|
CMonitor* pMonitor = nullptr;
|
||||||
};
|
};
|
|
@ -99,7 +99,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode) {
|
||||||
if (pNode->isNode)
|
if (pNode->isNode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SMonitor* PMONITOR = nullptr;
|
CMonitor* PMONITOR = nullptr;
|
||||||
|
|
||||||
if (pNode->workspaceID == SPECIAL_WORKSPACE_ID) {
|
if (pNode->workspaceID == SPECIAL_WORKSPACE_ID) {
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
|
|
|
@ -171,7 +171,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
||||||
SMonitor* PMONITOR = nullptr;
|
CMonitor* PMONITOR = nullptr;
|
||||||
|
|
||||||
if (pNode->workspaceID == SPECIAL_WORKSPACE_ID) {
|
if (pNode->workspaceID == SPECIAL_WORKSPACE_ID) {
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ void CAnimationManager::tick() {
|
||||||
const auto PWINDOW = (CWindow*)av->m_pWindow;
|
const auto PWINDOW = (CWindow*)av->m_pWindow;
|
||||||
const auto PWORKSPACE = (CWorkspace*)av->m_pWorkspace;
|
const auto PWORKSPACE = (CWorkspace*)av->m_pWorkspace;
|
||||||
const auto PLAYER = (SLayerSurface*)av->m_pLayer;
|
const auto PLAYER = (SLayerSurface*)av->m_pLayer;
|
||||||
SMonitor* PMONITOR = nullptr;
|
CMonitor* PMONITOR = nullptr;
|
||||||
|
|
||||||
wlr_box WLRBOXPREV = {0,0,0,0};
|
wlr_box WLRBOXPREV = {0,0,0,0};
|
||||||
if (PWINDOW) {
|
if (PWINDOW) {
|
||||||
|
|
|
@ -996,7 +996,7 @@ void CKeybindManager::exitHyprland(std::string argz) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) {
|
void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) {
|
||||||
SMonitor* PMONITOR = nullptr;
|
CMonitor* PMONITOR = nullptr;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!isNumber(args) && !isDirection(args)) {
|
if (!isNumber(args) && !isDirection(args)) {
|
||||||
|
@ -1025,7 +1025,7 @@ void CKeybindManager::moveWorkspaceToMonitor(std::string args) {
|
||||||
std::string workspace = args.substr(0, args.find_first_of(' '));
|
std::string workspace = args.substr(0, args.find_first_of(' '));
|
||||||
std::string monitor = args.substr(args.find_first_of(' ') + 1);
|
std::string monitor = args.substr(args.find_first_of(' ') + 1);
|
||||||
|
|
||||||
SMonitor* PMONITOR = nullptr;
|
CMonitor* PMONITOR = nullptr;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!isNumber(monitor) && !isDirection(monitor)) {
|
if (!isNumber(monitor) && !isDirection(monitor)) {
|
||||||
|
|
|
@ -139,7 +139,7 @@ GLuint CHyprOpenGLImpl::compileShader(const GLuint& type, std::string src) {
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::begin(SMonitor* pMonitor, pixman_region32_t* pDamage, bool fake) {
|
void CHyprOpenGLImpl::begin(CMonitor* pMonitor, pixman_region32_t* pDamage, bool fake) {
|
||||||
m_RenderData.pMonitor = pMonitor;
|
m_RenderData.pMonitor = pMonitor;
|
||||||
|
|
||||||
glViewport(0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y);
|
glViewport(0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y);
|
||||||
|
@ -941,7 +941,7 @@ void CHyprOpenGLImpl::renderSplash(cairo_t *const CAIRO, cairo_surface_t *const
|
||||||
cairo_surface_flush(CAIROSURFACE);
|
cairo_surface_flush(CAIROSURFACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::createBGTextureForMonitor(SMonitor* pMonitor) {
|
void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to createBGTex without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to createBGTex without begin()!");
|
||||||
|
|
||||||
static auto *const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue;
|
static auto *const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue;
|
||||||
|
@ -1011,7 +1011,7 @@ void CHyprOpenGLImpl::clearWithTex() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::destroyMonitorResources(SMonitor* pMonitor) {
|
void CHyprOpenGLImpl::destroyMonitorResources(CMonitor* pMonitor) {
|
||||||
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].mirrorFB.release();
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].mirrorFB.release();
|
||||||
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].primaryFB.release();
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].primaryFB.release();
|
||||||
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].stencilTex.destroyTexture();
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].stencilTex.destroyTexture();
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct SMonitorRenderData {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SCurrentRenderData {
|
struct SCurrentRenderData {
|
||||||
SMonitor* pMonitor = nullptr;
|
CMonitor* pMonitor = nullptr;
|
||||||
float projection[9];
|
float projection[9];
|
||||||
|
|
||||||
SMonitorRenderData* pCurrentMonData = nullptr;
|
SMonitorRenderData* pCurrentMonData = nullptr;
|
||||||
|
@ -56,7 +56,7 @@ public:
|
||||||
|
|
||||||
CHyprOpenGLImpl();
|
CHyprOpenGLImpl();
|
||||||
|
|
||||||
void begin(SMonitor*, pixman_region32_t*, bool fake = false);
|
void begin(CMonitor*, pixman_region32_t*, bool fake = false);
|
||||||
void end();
|
void end();
|
||||||
|
|
||||||
void renderRect(wlr_box*, const CColor&, int round = 0);
|
void renderRect(wlr_box*, const CColor&, int round = 0);
|
||||||
|
@ -78,7 +78,7 @@ public:
|
||||||
void scissor(const pixman_box32*);
|
void scissor(const pixman_box32*);
|
||||||
void scissor(const int x, const int y, const int w, const int h);
|
void scissor(const int x, const int y, const int w, const int h);
|
||||||
|
|
||||||
void destroyMonitorResources(SMonitor*);
|
void destroyMonitorResources(CMonitor*);
|
||||||
|
|
||||||
SCurrentRenderData m_RenderData;
|
SCurrentRenderData m_RenderData;
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ public:
|
||||||
|
|
||||||
std::unordered_map<CWindow*, CFramebuffer> m_mWindowFramebuffers;
|
std::unordered_map<CWindow*, CFramebuffer> m_mWindowFramebuffers;
|
||||||
std::unordered_map<SLayerSurface*, CFramebuffer> m_mLayerFramebuffers;
|
std::unordered_map<SLayerSurface*, CFramebuffer> m_mLayerFramebuffers;
|
||||||
std::unordered_map<SMonitor*, SMonitorRenderData> m_mMonitorRenderResources;
|
std::unordered_map<CMonitor*, SMonitorRenderData> m_mMonitorRenderResources;
|
||||||
std::unordered_map<SMonitor*, CTexture> m_mMonitorBGTextures;
|
std::unordered_map<CMonitor*, CTexture> m_mMonitorBGTextures;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<GLuint> m_lBuffers;
|
std::list<GLuint> m_lBuffers;
|
||||||
|
@ -117,7 +117,7 @@ private:
|
||||||
|
|
||||||
GLuint createProgram(const std::string&, const std::string&);
|
GLuint createProgram(const std::string&, const std::string&);
|
||||||
GLuint compileShader(const GLuint&, std::string);
|
GLuint compileShader(const GLuint&, std::string);
|
||||||
void createBGTextureForMonitor(SMonitor*);
|
void createBGTextureForMonitor(CMonitor*);
|
||||||
|
|
||||||
// returns the out FB, can be either Mirror or MirrorSwap
|
// returns the out FB, can be either Mirror or MirrorSwap
|
||||||
CFramebuffer* blurMainFramebufferWithDamage(float a, wlr_box* pBox, pixman_region32_t* damage);
|
CFramebuffer* blurMainFramebufferWithDamage(float a, wlr_box* pBox, pixman_region32_t* damage);
|
||||||
|
|
|
@ -65,7 +65,7 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
|
||||||
wlr_presentation_surface_sampled_on_output(g_pCompositor->m_sWLRPresentation, surface, RDATA->output);
|
wlr_presentation_surface_sampled_on_output(g_pCompositor->m_sWLRPresentation, surface, RDATA->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, SMonitor* pMonitor) {
|
bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, CMonitor* pMonitor) {
|
||||||
wlr_box geometry = pWindow->getFullWindowBoundingBox();
|
wlr_box geometry = pWindow->getFullWindowBoundingBox();
|
||||||
|
|
||||||
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry))
|
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry))
|
||||||
|
@ -107,7 +107,7 @@ bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderWorkspaceWithFullscreenWindow(SMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) {
|
void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) {
|
||||||
CWindow* pWorkspaceWindow = nullptr;
|
CWindow* pWorkspaceWindow = nullptr;
|
||||||
|
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
@ -162,7 +162,7 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(SMonitor* pMonitor, CWor
|
||||||
g_pHyprError->draw();
|
g_pHyprError->draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec* time, bool decorate, eRenderPassMode mode) {
|
void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* time, bool decorate, eRenderPassMode mode) {
|
||||||
if (pWindow->m_bHidden)
|
if (pWindow->m_bHidden)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
|
||||||
g_pHyprOpenGL->m_pCurrentWindow = nullptr;
|
g_pHyprOpenGL->m_pCurrentWindow = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderLayer(SLayerSurface* pLayer, SMonitor* pMonitor, timespec* time) {
|
void CHyprRenderer::renderLayer(SLayerSurface* pLayer, CMonitor* pMonitor, timespec* time) {
|
||||||
if (pLayer->fadingOut) {
|
if (pLayer->fadingOut) {
|
||||||
g_pHyprOpenGL->renderSnapshot(&pLayer);
|
g_pHyprOpenGL->renderSnapshot(&pLayer);
|
||||||
return;
|
return;
|
||||||
|
@ -504,7 +504,7 @@ void apply_exclusive(struct wlr_box* usable_area, uint32_t anchor, int32_t exclu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::arrangeLayerArray(SMonitor* pMonitor, const std::vector<std::unique_ptr<SLayerSurface>>& layerSurfaces, bool exclusiveZone, wlr_box* usableArea) {
|
void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std::unique_ptr<SLayerSurface>>& layerSurfaces, bool exclusiveZone, wlr_box* usableArea) {
|
||||||
wlr_box full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y};
|
wlr_box full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y};
|
||||||
|
|
||||||
for (auto& ls : layerSurfaces) {
|
for (auto& ls : layerSurfaces) {
|
||||||
|
@ -674,7 +674,7 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) {
|
||||||
Debug::log(LOG, "Damage: Window (%s): xy: %d, %d wh: %d, %d", pWindow->m_szTitle.c_str(), damageBox.x, damageBox.y, damageBox.width, damageBox.height);
|
Debug::log(LOG, "Damage: Window (%s): xy: %d, %d wh: %d, %d", pWindow->m_szTitle.c_str(), damageBox.x, damageBox.y, damageBox.width, damageBox.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::damageMonitor(SMonitor* pMonitor) {
|
void CHyprRenderer::damageMonitor(CMonitor* pMonitor) {
|
||||||
wlr_box damageBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
|
wlr_box damageBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
|
||||||
wlr_output_damage_add_box(pMonitor->damage, &damageBox);
|
wlr_output_damage_add_box(pMonitor->damage, &damageBox);
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ void CHyprRenderer::damageRegion(pixman_region32_t* rg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderDragIcon(SMonitor* pMonitor, timespec* time) {
|
void CHyprRenderer::renderDragIcon(CMonitor* pMonitor, timespec* time) {
|
||||||
if (!(g_pInputManager->m_sDrag.dragIcon && g_pInputManager->m_sDrag.iconMapped && g_pInputManager->m_sDrag.dragIcon->surface))
|
if (!(g_pInputManager->m_sDrag.dragIcon && g_pInputManager->m_sDrag.iconMapped && g_pInputManager->m_sDrag.dragIcon->surface))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -735,19 +735,24 @@ DAMAGETRACKINGMODES CHyprRenderer::damageTrackingModeFromStr(const std::string&
|
||||||
return DAMAGE_TRACKING_INVALID;
|
return DAMAGE_TRACKING_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorRule, bool force) {
|
bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorRule, bool force) {
|
||||||
|
|
||||||
Debug::log(LOG, "Applying monitor rule for %s", pMonitor->szName.c_str());
|
Debug::log(LOG, "Applying monitor rule for %s", pMonitor->szName.c_str());
|
||||||
|
|
||||||
// if it's disabled, disable and ignore
|
// if it's disabled, disable and ignore
|
||||||
if (pMonitorRule->disabled) {
|
if (pMonitorRule->disabled) {
|
||||||
wlr_output_enable(pMonitor->output, 0);
|
|
||||||
wlr_output_commit(pMonitor->output);
|
|
||||||
|
|
||||||
Events::listener_monitorDestroy(nullptr, pMonitor->output);
|
if (pMonitor->m_bEnabled)
|
||||||
|
pMonitor->onDisconnect();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pMonitor->m_bEnabled) {
|
||||||
|
pMonitor->onConnect(true); // enable it.
|
||||||
|
force = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the rule isn't already applied
|
// Check if the rule isn't already applied
|
||||||
if (!force && DELTALESSTHAN(pMonitor->vecPixelSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecPixelSize.y, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->scale == pMonitorRule->scale && DELTALESSTHAN(pMonitor->vecPosition.x, pMonitorRule->offset.x, 1) && DELTALESSTHAN(pMonitor->vecPosition.y, pMonitorRule->offset.y, 1) && pMonitor->transform == pMonitorRule->transform) {
|
if (!force && DELTALESSTHAN(pMonitor->vecPixelSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecPixelSize.y, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->scale == pMonitorRule->scale && DELTALESSTHAN(pMonitor->vecPosition.x, pMonitorRule->offset.x, 1) && DELTALESSTHAN(pMonitor->vecPosition.y, pMonitorRule->offset.y, 1) && pMonitor->transform == pMonitorRule->transform) {
|
||||||
Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str());
|
Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str());
|
||||||
|
|
|
@ -34,9 +34,9 @@ public:
|
||||||
void damageBox(wlr_box*);
|
void damageBox(wlr_box*);
|
||||||
void damageBox(const int& x, const int& y, const int& w, const int& h);
|
void damageBox(const int& x, const int& y, const int& w, const int& h);
|
||||||
void damageRegion(pixman_region32_t*);
|
void damageRegion(pixman_region32_t*);
|
||||||
void damageMonitor(SMonitor*);
|
void damageMonitor(CMonitor*);
|
||||||
bool applyMonitorRule(SMonitor*, SMonitorRule*, bool force = false);
|
bool applyMonitorRule(CMonitor*, SMonitorRule*, bool force = false);
|
||||||
bool shouldRenderWindow(CWindow*, SMonitor*);
|
bool shouldRenderWindow(CWindow*, CMonitor*);
|
||||||
bool shouldRenderWindow(CWindow*);
|
bool shouldRenderWindow(CWindow*);
|
||||||
void ensureCursorRenderingMode();
|
void ensureCursorRenderingMode();
|
||||||
bool shouldRenderCursor();
|
bool shouldRenderCursor();
|
||||||
|
@ -46,11 +46,11 @@ public:
|
||||||
DAMAGETRACKINGMODES damageTrackingModeFromStr(const std::string&);
|
DAMAGETRACKINGMODES damageTrackingModeFromStr(const std::string&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void arrangeLayerArray(SMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, wlr_box*);
|
void arrangeLayerArray(CMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, wlr_box*);
|
||||||
void renderWorkspaceWithFullscreenWindow(SMonitor*, CWorkspace*, timespec*);
|
void renderWorkspaceWithFullscreenWindow(CMonitor*, CWorkspace*, timespec*);
|
||||||
void renderWindow(CWindow*, SMonitor*, timespec*, bool, eRenderPassMode);
|
void renderWindow(CWindow*, CMonitor*, timespec*, bool, eRenderPassMode);
|
||||||
void renderLayer(SLayerSurface*, SMonitor*, timespec*);
|
void renderLayer(SLayerSurface*, CMonitor*, timespec*);
|
||||||
void renderDragIcon(SMonitor*, timespec*);
|
void renderDragIcon(CMonitor*, timespec*);
|
||||||
|
|
||||||
bool m_bHasARenderedCursor = true;
|
bool m_bHasARenderedCursor = true;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ void CHyprDropShadowDecoration::updateWindow(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDropShadowDecoration::draw(SMonitor* pMonitor, float a) {
|
void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(m_pWindow))
|
if (!g_pCompositor->windowValidMapped(m_pWindow))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,7 +9,7 @@ public:
|
||||||
|
|
||||||
virtual SWindowDecorationExtents getWindowDecorationExtents();
|
virtual SWindowDecorationExtents getWindowDecorationExtents();
|
||||||
|
|
||||||
virtual void draw(SMonitor*, float a);
|
virtual void draw(CMonitor*, float a);
|
||||||
|
|
||||||
virtual eDecorationType getDecorationType();
|
virtual eDecorationType getDecorationType();
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ void CHyprGroupBarDecoration::damageEntire() {
|
||||||
g_pHyprRenderer->damageBox(&dm);
|
g_pHyprRenderer->damageBox(&dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprGroupBarDecoration::draw(SMonitor* pMonitor, float a) {
|
void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
// get how many bars we will draw
|
// get how many bars we will draw
|
||||||
int barsToDraw = m_dwGroupMembers.size();
|
int barsToDraw = m_dwGroupMembers.size();
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ public:
|
||||||
|
|
||||||
virtual SWindowDecorationExtents getWindowDecorationExtents();
|
virtual SWindowDecorationExtents getWindowDecorationExtents();
|
||||||
|
|
||||||
virtual void draw(SMonitor*, float a);
|
virtual void draw(CMonitor*, float a);
|
||||||
|
|
||||||
virtual eDecorationType getDecorationType();
|
virtual eDecorationType getDecorationType();
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct SWindowDecorationExtents {
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWindow;
|
class CWindow;
|
||||||
struct SMonitor;
|
struct CMonitor;
|
||||||
|
|
||||||
interface IHyprWindowDecoration {
|
interface IHyprWindowDecoration {
|
||||||
public:
|
public:
|
||||||
|
@ -22,7 +22,7 @@ public:
|
||||||
|
|
||||||
virtual SWindowDecorationExtents getWindowDecorationExtents() = 0;
|
virtual SWindowDecorationExtents getWindowDecorationExtents() = 0;
|
||||||
|
|
||||||
virtual void draw(SMonitor*, float a) = 0;
|
virtual void draw(CMonitor*, float a) = 0;
|
||||||
|
|
||||||
virtual eDecorationType getDecorationType() = 0;
|
virtual eDecorationType getDecorationType() = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue