From 5b15d3b4f43e816b8ff9feefb2e331beebe7e0e1 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Wed, 18 May 2022 14:42:00 +0200 Subject: [PATCH] Revert "Merge pull request #88 from vaxerski/scaling" This reverts commit f68ddc382a2b009dc19491277f6328addcdb8336, reversing changes made to ba573a529afdbf368aa632cf70b41c9a0595578b. --- src/events/Monitors.cpp | 18 ++++------ src/helpers/Monitor.hpp | 1 - src/render/Framebuffer.cpp | 2 +- src/render/OpenGL.cpp | 73 +++++++++++++++++++------------------- src/render/OpenGL.hpp | 4 +-- src/render/Renderer.cpp | 13 ++----- 6 files changed, 48 insertions(+), 63 deletions(-) diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 8d0336d0..65049426 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -28,8 +28,8 @@ void Events::listener_change(wl_listener* listener, void* data) { wlr_box BOX; wlr_output_layout_get_box(g_pCompositor->m_sWLROutputLayout, m.output, &BOX); - //m.vecSize.x = BOX.width; - // m.vecSize.y = BOX.height; + m.vecSize.x = BOX.width; + m.vecSize.y = BOX.height; m.vecPosition.x = BOX.x; m.vecPosition.y = BOX.y; @@ -38,7 +38,7 @@ void Events::listener_change(wl_listener* listener, void* data) { CONFIGHEAD->state.x = m.vecPosition.x; CONFIGHEAD->state.y = m.vecPosition.y; - wlr_output_set_custom_mode(m.output, m.vecPixelSize.x, m.vecPixelSize.y, (int)(round(m.refreshRate * 1000))); + wlr_output_set_custom_mode(m.output, m.vecSize.x, m.vecSize.y, (int)(round(m.refreshRate * 1000))); } wlr_output_manager_v1_set_configuration(g_pCompositor->m_sWLROutputMgr, CONFIG); @@ -181,11 +181,10 @@ void Events::listener_monitorFrame(void* owner, void* data) { // if we have no tracking or full tracking, invalidate the entire monitor if (DTMODE == DAMAGE_TRACKING_NONE || DTMODE == DAMAGE_TRACKING_MONITOR) { - pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y); + pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y); pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage); } else { - // if we use blur we need to expand the damage for proper blurring if (g_pConfigManager->getInt("decoration:blur") == 1) { // TODO: can this be optimized? @@ -206,12 +205,12 @@ void Events::listener_monitorFrame(void* owner, void* data) { // potentially can save on resources. g_pHyprOpenGL->begin(PMONITOR, &damage); - g_pHyprOpenGL->clear(CColor(100, 11, 11, 255)); + g_pHyprOpenGL->clear(CColor(11, 11, 11, 255)); g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper" g_pHyprRenderer->renderAllClientsForMonitor(PMONITOR->ID, &now); - wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); + wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecSize.x, PMONITOR->vecSize.y); wlr_output_render_software_cursors(PMONITOR->output, NULL); @@ -224,10 +223,7 @@ void Events::listener_monitorFrame(void* owner, void* data) { pixman_region32_init(&frameDamage); const auto TRANSFORM = wlr_output_transform_invert(PMONITOR->output->transform); - wlr_region_transform(&frameDamage, &PMONITOR->damage->current, TRANSFORM, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y); - - if (DTMODE == DAMAGE_TRACKING_NONE || DTMODE == DAMAGE_TRACKING_MONITOR) - pixman_region32_union_rect(&frameDamage, &frameDamage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y); + wlr_region_transform(&frameDamage, &PMONITOR->damage->current, TRANSFORM, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y); wlr_output_set_damage(PMONITOR->output, &frameDamage); pixman_region32_fini(&frameDamage); diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index 0b57700a..81367850 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -9,7 +9,6 @@ struct SMonitor { Vector2D vecPosition = Vector2D(0,0); Vector2D vecSize = Vector2D(0,0); - Vector2D vecPixelSize = Vector2D(0,0); bool primary = false; diff --git a/src/render/Framebuffer.cpp b/src/render/Framebuffer.cpp index 4a5baf50..1cac19af 100644 --- a/src/render/Framebuffer.cpp +++ b/src/render/Framebuffer.cpp @@ -63,7 +63,7 @@ void CFramebuffer::bind() { #else glBindFramebuffer(GL_FRAMEBUFFER, m_iFb); #endif - glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y); + glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.y); } void CFramebuffer::release() { diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index d18afb6d..d07a6294 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -127,12 +127,12 @@ 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(SMonitor* pMonitor, pixman_region32_t* pDamage) { m_RenderData.pMonitor = pMonitor; - glViewport(0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); + glViewport(0, 0, pMonitor->vecSize.x, pMonitor->vecSize.y); - wlr_matrix_projection(m_RenderData.projection, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: this is deprecated + wlr_matrix_projection(m_RenderData.projection, pMonitor->vecSize.x, pMonitor->vecSize.y, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: this is deprecated glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); @@ -140,16 +140,16 @@ void CHyprOpenGLImpl::begin(SMonitor* pMonitor, pixman_region32_t* pDamage, bool m_iWLROutputFb = m_iCurrentOutputFb; // ensure a framebuffer for the monitor exists - if (m_mMonitorRenderResources.find(pMonitor) == m_mMonitorRenderResources.end() || m_mMonitorRenderResources[pMonitor].primaryFB.m_Size != pMonitor->vecPixelSize) { + if (m_mMonitorRenderResources.find(pMonitor) == m_mMonitorRenderResources.end() || m_mMonitorRenderResources[pMonitor].primaryFB.m_Size != pMonitor->vecSize) { m_mMonitorRenderResources[pMonitor].stencilTex.allocate(); m_mMonitorRenderResources[pMonitor].primaryFB.m_pStencilTex = &m_mMonitorRenderResources[pMonitor].stencilTex; m_mMonitorRenderResources[pMonitor].mirrorFB.m_pStencilTex = &m_mMonitorRenderResources[pMonitor].stencilTex; m_mMonitorRenderResources[pMonitor].mirrorSwapFB.m_pStencilTex = &m_mMonitorRenderResources[pMonitor].stencilTex; - m_mMonitorRenderResources[pMonitor].primaryFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); - m_mMonitorRenderResources[pMonitor].mirrorFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); - m_mMonitorRenderResources[pMonitor].mirrorSwapFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); + m_mMonitorRenderResources[pMonitor].primaryFB.alloc(pMonitor->vecSize.x * pMonitor->scale, pMonitor->vecSize.y * pMonitor->scale); + m_mMonitorRenderResources[pMonitor].mirrorFB.alloc(pMonitor->vecSize.x * pMonitor->scale, pMonitor->vecSize.y * pMonitor->scale); + m_mMonitorRenderResources[pMonitor].mirrorSwapFB.alloc(pMonitor->vecSize.x * pMonitor->scale, pMonitor->vecSize.y * pMonitor->scale); createBGTextureForMonitor(pMonitor); } @@ -158,22 +158,19 @@ void CHyprOpenGLImpl::begin(SMonitor* pMonitor, pixman_region32_t* pDamage, bool m_mMonitorRenderResources[pMonitor].primaryFB.bind(); m_RenderData.pDamage = pDamage; - - m_bFakeFrame = fake; } void CHyprOpenGLImpl::end() { // end the render, copy the data to the WLR framebuffer - if (!m_bFakeFrame) { - glBindFramebuffer(GL_FRAMEBUFFER, m_iWLROutputFb); - wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; + glBindFramebuffer(GL_FRAMEBUFFER, m_iWLROutputFb); + wlr_box windowBox = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y}; - pixman_region32_copy(m_RenderData.pDamage, &m_rOriginalDamageRegion); + pixman_region32_copy(m_RenderData.pDamage, &m_rOriginalDamageRegion); - clear(CColor(11, 11, 11, 255)); + clear(CColor(11, 11, 11, 255)); - renderTexture(m_mMonitorRenderResources[m_RenderData.pMonitor].primaryFB.m_cTex, &monbox, 255.f, 0); - } + scaleBox(&windowBox, m_RenderData.pMonitor->scale); + renderTexture(m_mMonitorRenderResources[m_RenderData.pMonitor].primaryFB.m_cTex, &windowBox, 255.f, 0); // reset our data m_RenderData.pMonitor = nullptr; @@ -200,7 +197,7 @@ void CHyprOpenGLImpl::clear(const CColor& color) { void CHyprOpenGLImpl::scissor(const wlr_box* pBox) { RASSERT(m_RenderData.pMonitor, "Tried to scissor without begin()!"); - if (!pBox || true) { + if (!pBox) { glDisable(GL_SCISSOR_TEST); return; } @@ -212,7 +209,7 @@ void CHyprOpenGLImpl::scissor(const wlr_box* pBox) { void CHyprOpenGLImpl::scissor(const pixman_box32* pBox) { RASSERT(m_RenderData.pMonitor, "Tried to scissor without begin()!"); - if (!pBox || true) { + if (!pBox) { glDisable(GL_SCISSOR_TEST); return; } @@ -382,7 +379,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p // get transforms for the full monitor const auto TRANSFORM = wlr_output_transform_invert(WL_OUTPUT_TRANSFORM_NORMAL); float matrix[9]; - wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; + wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y}; wlr_matrix_project_box(matrix, &MONITORBOX, TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix); float glMatrix[9]; @@ -425,9 +422,9 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p glUniformMatrix3fv(pShader->proj, 1, GL_FALSE, glMatrix); glUniform1f(glGetUniformLocation(pShader->program, "radius"), BLURSIZE * (a / 255.f)); // this makes the blursize change with a if (pShader == &m_shBLUR1) - glUniform2f(glGetUniformLocation(m_shBLUR1.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecPixelSize.x / 2.f), 0.5f / (m_RenderData.pMonitor->vecPixelSize.y / 2.f)); + glUniform2f(glGetUniformLocation(m_shBLUR1.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecSize.x / 2.f), 0.5f / (m_RenderData.pMonitor->vecSize.y / 2.f)); else - glUniform2f(glGetUniformLocation(m_shBLUR2.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecPixelSize.x * 2.f), 0.5f / (m_RenderData.pMonitor->vecPixelSize.y * 2.f)); + glUniform2f(glGetUniformLocation(m_shBLUR2.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecSize.x * 2.f), 0.5f / (m_RenderData.pMonitor->vecSize.y * 2.f)); glUniform1i(pShader->tex, 0); glVertexAttribPointer(pShader->posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts); @@ -506,7 +503,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox, pixman_region32_t inverseOpaque; pixman_region32_init(&inverseOpaque); if (a == 255.f) { - pixman_box32_t monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; + pixman_box32_t monbox = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y}; pixman_region32_copy(&inverseOpaque, &pSurface->current.opaque); pixman_region32_translate(&inverseOpaque, pBox->x, pBox->y); pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &monbox); @@ -544,7 +541,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox, glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); // stencil done. Render everything. - wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; + wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y}; if (pixman_region32_not_empty(&damage)) { // render our great blurred FB renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, a, &damage); @@ -615,17 +612,17 @@ void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) { // this is temporary, doesnt mess with the actual wlr damage pixman_region32_t fakeDamage; pixman_region32_init(&fakeDamage); - pixman_region32_union_rect(&fakeDamage, &fakeDamage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y); + pixman_region32_union_rect(&fakeDamage, &fakeDamage, 0, 0, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y); - begin(PMONITOR, &fakeDamage, true); + begin(PMONITOR, &fakeDamage); pixman_region32_fini(&fakeDamage); const auto PFRAMEBUFFER = &m_mWindowFramebuffers[pWindow]; - glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y); + PFRAMEBUFFER->m_tTransform = g_pXWaylandManager->getWindowSurface(pWindow)->current.transform; - PFRAMEBUFFER->alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); + PFRAMEBUFFER->alloc(PMONITOR->vecSize.x, PMONITOR->vecSize.y); PFRAMEBUFFER->bind(); @@ -652,6 +649,7 @@ void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) { #else glBindFramebuffer(GL_FRAMEBUFFER, m_iCurrentOutputFb); #endif + glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.y); end(); @@ -668,17 +666,17 @@ void CHyprOpenGLImpl::makeLayerSnapshot(SLayerSurface* pLayer) { // this is temporary, doesnt mess with the actual wlr damage pixman_region32_t fakeDamage; pixman_region32_init(&fakeDamage); - pixman_region32_union_rect(&fakeDamage, &fakeDamage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y); + pixman_region32_union_rect(&fakeDamage, &fakeDamage, 0, 0, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y); - begin(PMONITOR, &fakeDamage, true); + begin(PMONITOR, &fakeDamage); pixman_region32_fini(&fakeDamage); const auto PFRAMEBUFFER = &m_mLayerFramebuffers[pLayer]; - glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y); + PFRAMEBUFFER->m_tTransform = pLayer->layerSurface->surface->current.transform; - PFRAMEBUFFER->alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); + PFRAMEBUFFER->alloc(PMONITOR->vecSize.x, PMONITOR->vecSize.y); PFRAMEBUFFER->bind(); @@ -696,6 +694,7 @@ void CHyprOpenGLImpl::makeLayerSnapshot(SLayerSurface* pLayer) { #else glBindFramebuffer(GL_FRAMEBUFFER, m_iCurrentOutputFb); #endif + glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.y); end(); @@ -718,10 +717,10 @@ void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) { const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); - wlr_box windowBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y}; + wlr_box windowBox = {0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; pixman_region32_t fakeDamage; - pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); + pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y); renderTextureInternalWithDamage(it->second.m_cTex, &windowBox, PWINDOW->m_fAlpha.fl(), &fakeDamage, 0); @@ -744,10 +743,10 @@ void CHyprOpenGLImpl::renderSnapshot(SLayerSurface** pLayer) { const auto PMONITOR = g_pCompositor->getMonitorFromID(PLAYER->monitorID); - wlr_box windowBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y}; + wlr_box windowBox = {0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; pixman_region32_t fakeDamage; - pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); + pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y); renderTextureInternalWithDamage(it->second.m_cTex, &windowBox, PLAYER->alpha.fl(), &fakeDamage, 0); @@ -807,8 +806,8 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(SMonitor* pMonitor) { void CHyprOpenGLImpl::clearWithTex() { RASSERT(m_RenderData.pMonitor, "Tried to render BGtex without begin()!"); - - wlr_box box = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; + + wlr_box box = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y}; renderTexture(m_mMonitorBGTextures[m_RenderData.pMonitor], &box, 255, 0); } diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index b3aa5968..4209d9ac 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -50,7 +50,7 @@ public: CHyprOpenGLImpl(); - void begin(SMonitor*, pixman_region32_t*, bool fake = false); + void begin(SMonitor*, pixman_region32_t*); void end(); void renderRect(wlr_box*, const CColor&, int round = 0); @@ -92,8 +92,6 @@ private: int m_iDRMFD; std::string m_szExtensions; - bool m_bFakeFrame = false; - // Shaders SQuad m_shQUAD; CShader m_shRGBA; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 89aa4f7d..91c882ca 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -452,7 +452,6 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) { double lx = 0, ly = 0; wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, m.output, &lx, &ly); pixman_region32_translate(&damageBox, lx, ly); - wlr_region_scale(&damageBox, &damageBox, m.scale); wlr_output_damage_add(m.damage, &damageBox); pixman_region32_translate(&damageBox, -lx, -ly); } @@ -473,7 +472,6 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) { wlr_box fixedDamageBox = damageBox; fixedDamageBox.x -= m.vecPosition.x; fixedDamageBox.y -= m.vecPosition.y; - scaleBox(&fixedDamageBox, m.scale); wlr_output_damage_add_box(m.damage, &fixedDamageBox); } @@ -487,7 +485,6 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) { wlr_box fixedDamageBox = damageBox; fixedDamageBox.x -= m.vecPosition.x; fixedDamageBox.y -= m.vecPosition.y; - scaleBox(&fixedDamageBox, m.scale); wlr_output_damage_add_box(m.damage, &fixedDamageBox); } @@ -497,7 +494,8 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) { } void CHyprRenderer::damageMonitor(SMonitor* pMonitor) { - wlr_box damageBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y}; + wlr_box damageBox = {0, 0, pMonitor->vecSize.x, pMonitor->vecSize.y}; + scaleBox(&damageBox, pMonitor->scale); wlr_output_damage_add_box(pMonitor->damage, &damageBox); if (g_pConfigManager->getInt("debug:log_damage")) @@ -507,7 +505,6 @@ void CHyprRenderer::damageMonitor(SMonitor* pMonitor) { void CHyprRenderer::damageBox(wlr_box* pBox) { for (auto& m : g_pCompositor->m_lMonitors) { wlr_box damageBox = {pBox->x - m.vecPosition.x, pBox->y - m.vecPosition.y, pBox->width, pBox->height}; - scaleBox(&damageBox, m.scale); wlr_output_damage_add_box(m.damage, &damageBox); } @@ -548,7 +545,7 @@ void CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorR Debug::log(LOG, "Applying monitor rule for %s", pMonitor->szName.c_str()); // 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) { + if (!force && DELTALESSTHAN(pMonitor->vecSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecSize.y, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->scale == pMonitorRule->scale) { Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str()); return; } @@ -607,12 +604,8 @@ void CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorR } } else { wlr_output_set_custom_mode(pMonitor->output, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (int)pMonitorRule->refreshRate * 1000); - pMonitor->vecSize = pMonitorRule->resolution; } - pMonitor->vecPixelSize = pMonitor->vecSize; - pMonitor->vecSize = (pMonitor->vecSize / pMonitor->scale).floor(); - // update renderer g_pHyprOpenGL->destroyMonitorResources(pMonitor);