aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-05-18 13:16:32 +0200
committerGitHub <[email protected]>2022-05-18 13:16:32 +0200
commitf68ddc382a2b009dc19491277f6328addcdb8336 (patch)
tree81d0fd4a54d5891558b62969ba3b41853dd761ff
parentba573a529afdbf368aa632cf70b41c9a0595578b (diff)
parent6c437763f65489b7c720c56d2f2f69781a39e497 (diff)
downloadHyprland-f68ddc382a2b009dc19491277f6328addcdb8336.tar.gz
Hyprland-f68ddc382a2b009dc19491277f6328addcdb8336.zip
Merge pull request #88 from vaxerski/scaling
Fixed scaling
-rw-r--r--src/events/Monitors.cpp18
-rw-r--r--src/helpers/Monitor.hpp1
-rw-r--r--src/render/Framebuffer.cpp2
-rw-r--r--src/render/OpenGL.cpp73
-rw-r--r--src/render/OpenGL.hpp4
-rw-r--r--src/render/Renderer.cpp13
6 files changed, 63 insertions, 48 deletions
diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp
index 65049426..8d0336d0 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.vecSize.x, m.vecSize.y, (int)(round(m.refreshRate * 1000)));
+ wlr_output_set_custom_mode(m.output, m.vecPixelSize.x, m.vecPixelSize.y, (int)(round(m.refreshRate * 1000)));
}
wlr_output_manager_v1_set_configuration(g_pCompositor->m_sWLROutputMgr, CONFIG);
@@ -181,10 +181,11 @@ 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->vecSize.x, (int)PMONITOR->vecSize.y);
+ pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.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?
@@ -205,12 +206,12 @@ void Events::listener_monitorFrame(void* owner, void* data) {
// potentially can save on resources.
g_pHyprOpenGL->begin(PMONITOR, &damage);
- g_pHyprOpenGL->clear(CColor(11, 11, 11, 255));
+ g_pHyprOpenGL->clear(CColor(100, 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->vecSize.x, PMONITOR->vecSize.y);
+ wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
wlr_output_render_software_cursors(PMONITOR->output, NULL);
@@ -223,7 +224,10 @@ 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->vecSize.x, (int)PMONITOR->vecSize.y);
+ 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_output_set_damage(PMONITOR->output, &frameDamage);
pixman_region32_fini(&frameDamage);
diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp
index 81367850..0b57700a 100644
--- a/src/helpers/Monitor.hpp
+++ b/src/helpers/Monitor.hpp
@@ -9,6 +9,7 @@
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 1cac19af..4a5baf50 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->vecSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.y);
+ glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y);
}
void CFramebuffer::release() {
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index d07a6294..d18afb6d 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) {
+void CHyprOpenGLImpl::begin(SMonitor* pMonitor, pixman_region32_t* pDamage, bool fake) {
m_RenderData.pMonitor = pMonitor;
- glViewport(0, 0, pMonitor->vecSize.x, pMonitor->vecSize.y);
+ glViewport(0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y);
- wlr_matrix_projection(m_RenderData.projection, pMonitor->vecSize.x, pMonitor->vecSize.y, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: this is deprecated
+ wlr_matrix_projection(m_RenderData.projection, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.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) {
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->vecSize) {
+ if (m_mMonitorRenderResources.find(pMonitor) == m_mMonitorRenderResources.end() || m_mMonitorRenderResources[pMonitor].primaryFB.m_Size != pMonitor->vecPixelSize) {
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->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);
+ 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);
createBGTextureForMonitor(pMonitor);
}
@@ -158,19 +158,22 @@ void CHyprOpenGLImpl::begin(SMonitor* pMonitor, pixman_region32_t* pDamage) {
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
- glBindFramebuffer(GL_FRAMEBUFFER, m_iWLROutputFb);
- wlr_box windowBox = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y};
+ if (!m_bFakeFrame) {
+ glBindFramebuffer(GL_FRAMEBUFFER, m_iWLROutputFb);
+ wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.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));
- scaleBox(&windowBox, m_RenderData.pMonitor->scale);
- renderTexture(m_mMonitorRenderResources[m_RenderData.pMonitor].primaryFB.m_cTex, &windowBox, 255.f, 0);
+ renderTexture(m_mMonitorRenderResources[m_RenderData.pMonitor].primaryFB.m_cTex, &monbox, 255.f, 0);
+ }
// reset our data
m_RenderData.pMonitor = nullptr;
@@ -197,7 +200,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) {
+ if (!pBox || true) {
glDisable(GL_SCISSOR_TEST);
return;
}
@@ -209,7 +212,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) {
+ if (!pBox || true) {
glDisable(GL_SCISSOR_TEST);
return;
}
@@ -379,7 +382,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->vecSize.x, m_RenderData.pMonitor->vecSize.y};
+ wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
wlr_matrix_project_box(matrix, &MONITORBOX, TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix);
float glMatrix[9];
@@ -422,9 +425,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->vecSize.x / 2.f), 0.5f / (m_RenderData.pMonitor->vecSize.y / 2.f));
+ glUniform2f(glGetUniformLocation(m_shBLUR1.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecPixelSize.x / 2.f), 0.5f / (m_RenderData.pMonitor->vecPixelSize.y / 2.f));
else
- glUniform2f(glGetUniformLocation(m_shBLUR2.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecSize.x * 2.f), 0.5f / (m_RenderData.pMonitor->vecSize.y * 2.f));
+ glUniform2f(glGetUniformLocation(m_shBLUR2.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecPixelSize.x * 2.f), 0.5f / (m_RenderData.pMonitor->vecPixelSize.y * 2.f));
glUniform1i(pShader->tex, 0);
glVertexAttribPointer(pShader->posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
@@ -503,7 +506,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->vecSize.x, m_RenderData.pMonitor->vecSize.y};
+ pixman_box32_t monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
pixman_region32_copy(&inverseOpaque, &pSurface->current.opaque);
pixman_region32_translate(&inverseOpaque, pBox->x, pBox->y);
pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &monbox);
@@ -541,7 +544,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->vecSize.x, m_RenderData.pMonitor->vecSize.y};
+ wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
if (pixman_region32_not_empty(&damage)) {
// render our great blurred FB
renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, a, &damage);
@@ -612,17 +615,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->vecSize.x, (int)PMONITOR->vecSize.y);
+ pixman_region32_union_rect(&fakeDamage, &fakeDamage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y);
- begin(PMONITOR, &fakeDamage);
+ begin(PMONITOR, &fakeDamage, true);
pixman_region32_fini(&fakeDamage);
const auto PFRAMEBUFFER = &m_mWindowFramebuffers[pWindow];
- PFRAMEBUFFER->m_tTransform = g_pXWaylandManager->getWindowSurface(pWindow)->current.transform;
+ glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y);
- PFRAMEBUFFER->alloc(PMONITOR->vecSize.x, PMONITOR->vecSize.y);
+ PFRAMEBUFFER->alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
PFRAMEBUFFER->bind();
@@ -649,7 +652,6 @@ 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();
@@ -666,17 +668,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->vecSize.x, (int)PMONITOR->vecSize.y);
+ pixman_region32_union_rect(&fakeDamage, &fakeDamage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y);
- begin(PMONITOR, &fakeDamage);
+ begin(PMONITOR, &fakeDamage, true);
pixman_region32_fini(&fakeDamage);
const auto PFRAMEBUFFER = &m_mLayerFramebuffers[pLayer];
- PFRAMEBUFFER->m_tTransform = pLayer->layerSurface->surface->current.transform;
+ glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y);
- PFRAMEBUFFER->alloc(PMONITOR->vecSize.x, PMONITOR->vecSize.y);
+ PFRAMEBUFFER->alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
PFRAMEBUFFER->bind();
@@ -694,7 +696,6 @@ 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();
@@ -717,10 +718,10 @@ void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
- wlr_box windowBox = {0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
+ wlr_box windowBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
pixman_region32_t fakeDamage;
- pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
+ pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
renderTextureInternalWithDamage(it->second.m_cTex, &windowBox, PWINDOW->m_fAlpha.fl(), &fakeDamage, 0);
@@ -743,10 +744,10 @@ void CHyprOpenGLImpl::renderSnapshot(SLayerSurface** pLayer) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(PLAYER->monitorID);
- wlr_box windowBox = {0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
+ wlr_box windowBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
pixman_region32_t fakeDamage;
- pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
+ pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
renderTextureInternalWithDamage(it->second.m_cTex, &windowBox, PLAYER->alpha.fl(), &fakeDamage, 0);
@@ -806,8 +807,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->vecSize.x, m_RenderData.pMonitor->vecSize.y};
+
+ wlr_box box = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
renderTexture(m_mMonitorBGTextures[m_RenderData.pMonitor], &box, 255, 0);
}
diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp
index 4209d9ac..b3aa5968 100644
--- a/src/render/OpenGL.hpp
+++ b/src/render/OpenGL.hpp
@@ -50,7 +50,7 @@ public:
CHyprOpenGLImpl();
- void begin(SMonitor*, pixman_region32_t*);
+ void begin(SMonitor*, pixman_region32_t*, bool fake = false);
void end();
void renderRect(wlr_box*, const CColor&, int round = 0);
@@ -92,6 +92,8 @@ 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 91c882ca..89aa4f7d 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -452,6 +452,7 @@ 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);
}
@@ -472,6 +473,7 @@ 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);
}
@@ -485,6 +487,7 @@ 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);
}
@@ -494,8 +497,7 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) {
}
void CHyprRenderer::damageMonitor(SMonitor* pMonitor) {
- wlr_box damageBox = {0, 0, pMonitor->vecSize.x, pMonitor->vecSize.y};
- scaleBox(&damageBox, pMonitor->scale);
+ wlr_box damageBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
wlr_output_damage_add_box(pMonitor->damage, &damageBox);
if (g_pConfigManager->getInt("debug:log_damage"))
@@ -505,6 +507,7 @@ 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);
}
@@ -545,7 +548,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->vecSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecSize.y, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->scale == pMonitorRule->scale) {
+ 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) {
Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str());
return;
}
@@ -604,8 +607,12 @@ 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);