added DPMS
This commit is contained in:
parent
50b991674b
commit
31a079b347
24 changed files with 287 additions and 211 deletions
|
|
@ -139,7 +139,7 @@ GLuint CHyprOpenGLImpl::compileShader(const GLuint& type, std::string src) {
|
|||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::createBGTextureForMonitor(SMonitor* pMonitor) {
|
||||
void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
|
||||
RASSERT(m_RenderData.pMonitor, "Tried to createBGTex without begin()!");
|
||||
|
||||
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].primaryFB.release();
|
||||
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].stencilTex.destroyTexture();
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct SMonitorRenderData {
|
|||
};
|
||||
|
||||
struct SCurrentRenderData {
|
||||
SMonitor* pMonitor = nullptr;
|
||||
CMonitor* pMonitor = nullptr;
|
||||
float projection[9];
|
||||
|
||||
SMonitorRenderData* pCurrentMonData = nullptr;
|
||||
|
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
CHyprOpenGLImpl();
|
||||
|
||||
void begin(SMonitor*, pixman_region32_t*, bool fake = false);
|
||||
void begin(CMonitor*, pixman_region32_t*, bool fake = false);
|
||||
void end();
|
||||
|
||||
void renderRect(wlr_box*, const CColor&, int round = 0);
|
||||
|
|
@ -78,7 +78,7 @@ public:
|
|||
void scissor(const pixman_box32*);
|
||||
void scissor(const int x, const int y, const int w, const int h);
|
||||
|
||||
void destroyMonitorResources(SMonitor*);
|
||||
void destroyMonitorResources(CMonitor*);
|
||||
|
||||
SCurrentRenderData m_RenderData;
|
||||
|
||||
|
|
@ -91,8 +91,8 @@ public:
|
|||
|
||||
std::unordered_map<CWindow*, CFramebuffer> m_mWindowFramebuffers;
|
||||
std::unordered_map<SLayerSurface*, CFramebuffer> m_mLayerFramebuffers;
|
||||
std::unordered_map<SMonitor*, SMonitorRenderData> m_mMonitorRenderResources;
|
||||
std::unordered_map<SMonitor*, CTexture> m_mMonitorBGTextures;
|
||||
std::unordered_map<CMonitor*, SMonitorRenderData> m_mMonitorRenderResources;
|
||||
std::unordered_map<CMonitor*, CTexture> m_mMonitorBGTextures;
|
||||
|
||||
private:
|
||||
std::list<GLuint> m_lBuffers;
|
||||
|
|
@ -117,7 +117,7 @@ private:
|
|||
|
||||
GLuint createProgram(const std::string&, const std::string&);
|
||||
GLuint compileShader(const GLuint&, std::string);
|
||||
void createBGTextureForMonitor(SMonitor*);
|
||||
void createBGTextureForMonitor(CMonitor*);
|
||||
|
||||
// returns the out FB, can be either Mirror or MirrorSwap
|
||||
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);
|
||||
}
|
||||
|
||||
bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, SMonitor* pMonitor) {
|
||||
bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, CMonitor* pMonitor) {
|
||||
wlr_box geometry = pWindow->getFullWindowBoundingBox();
|
||||
|
||||
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry))
|
||||
|
|
@ -107,7 +107,7 @@ bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void CHyprRenderer::renderWorkspaceWithFullscreenWindow(SMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) {
|
||||
void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) {
|
||||
CWindow* pWorkspaceWindow = nullptr;
|
||||
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
|
|
@ -162,7 +162,7 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(SMonitor* pMonitor, CWor
|
|||
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)
|
||||
return;
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
|
|||
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) {
|
||||
g_pHyprOpenGL->renderSnapshot(&pLayer);
|
||||
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};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void CHyprRenderer::damageMonitor(SMonitor* pMonitor) {
|
||||
void CHyprRenderer::damageMonitor(CMonitor* pMonitor) {
|
||||
wlr_box damageBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
|
||||
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))
|
||||
return;
|
||||
|
||||
|
|
@ -735,19 +735,24 @@ DAMAGETRACKINGMODES CHyprRenderer::damageTrackingModeFromStr(const std::string&
|
|||
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());
|
||||
|
||||
// if it's disabled, disable and ignore
|
||||
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;
|
||||
}
|
||||
|
||||
if (!pMonitor->m_bEnabled) {
|
||||
pMonitor->onConnect(true); // enable it.
|
||||
force = true;
|
||||
}
|
||||
|
||||
// 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) {
|
||||
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(const int& x, const int& y, const int& w, const int& h);
|
||||
void damageRegion(pixman_region32_t*);
|
||||
void damageMonitor(SMonitor*);
|
||||
bool applyMonitorRule(SMonitor*, SMonitorRule*, bool force = false);
|
||||
bool shouldRenderWindow(CWindow*, SMonitor*);
|
||||
void damageMonitor(CMonitor*);
|
||||
bool applyMonitorRule(CMonitor*, SMonitorRule*, bool force = false);
|
||||
bool shouldRenderWindow(CWindow*, CMonitor*);
|
||||
bool shouldRenderWindow(CWindow*);
|
||||
void ensureCursorRenderingMode();
|
||||
bool shouldRenderCursor();
|
||||
|
|
@ -46,11 +46,11 @@ public:
|
|||
DAMAGETRACKINGMODES damageTrackingModeFromStr(const std::string&);
|
||||
|
||||
private:
|
||||
void arrangeLayerArray(SMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, wlr_box*);
|
||||
void renderWorkspaceWithFullscreenWindow(SMonitor*, CWorkspace*, timespec*);
|
||||
void renderWindow(CWindow*, SMonitor*, timespec*, bool, eRenderPassMode);
|
||||
void renderLayer(SLayerSurface*, SMonitor*, timespec*);
|
||||
void renderDragIcon(SMonitor*, timespec*);
|
||||
void arrangeLayerArray(CMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, wlr_box*);
|
||||
void renderWorkspaceWithFullscreenWindow(CMonitor*, CWorkspace*, timespec*);
|
||||
void renderWindow(CWindow*, CMonitor*, timespec*, bool, eRenderPassMode);
|
||||
void renderLayer(SLayerSurface*, CMonitor*, timespec*);
|
||||
void renderDragIcon(CMonitor*, timespec*);
|
||||
|
||||
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))
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public:
|
|||
|
||||
virtual SWindowDecorationExtents getWindowDecorationExtents();
|
||||
|
||||
virtual void draw(SMonitor*, float a);
|
||||
virtual void draw(CMonitor*, float a);
|
||||
|
||||
virtual eDecorationType getDecorationType();
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ void CHyprGroupBarDecoration::damageEntire() {
|
|||
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
|
||||
int barsToDraw = m_dwGroupMembers.size();
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public:
|
|||
|
||||
virtual SWindowDecorationExtents getWindowDecorationExtents();
|
||||
|
||||
virtual void draw(SMonitor*, float a);
|
||||
virtual void draw(CMonitor*, float a);
|
||||
|
||||
virtual eDecorationType getDecorationType();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ struct SWindowDecorationExtents {
|
|||
};
|
||||
|
||||
class CWindow;
|
||||
struct SMonitor;
|
||||
struct CMonitor;
|
||||
|
||||
interface IHyprWindowDecoration {
|
||||
public:
|
||||
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
virtual SWindowDecorationExtents getWindowDecorationExtents() = 0;
|
||||
|
||||
virtual void draw(SMonitor*, float a) = 0;
|
||||
virtual void draw(CMonitor*, float a) = 0;
|
||||
|
||||
virtual eDecorationType getDecorationType() = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue