Skip to content

Commit

Permalink
skip damage on mouse move
Browse files Browse the repository at this point in the history
  • Loading branch information
UjinT34 committed Jun 13, 2024
1 parent 03cefbc commit d5bcda4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/helpers/Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,17 +351,15 @@ void CMonitor::addDamage(const CRegion* rg) {
addDamage(const_cast<CRegion*>(rg)->pixman());
}

void CMonitor::addDamage(const CBox* box, bool skipFrameSchedule) {
void CMonitor::addDamage(const CBox* box) {
static auto PZOOMFACTOR = CConfigValue<Hyprlang::FLOAT>("cursor:zoom_factor");
if (*PZOOMFACTOR != 1.f && g_pCompositor->getMonitorFromCursor() == this) {
wlr_damage_ring_add_whole(&damage);
if (!skipFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(this);
g_pCompositor->scheduleFrameForMonitor(this);
}

if (wlr_damage_ring_add_box(&damage, const_cast<CBox*>(box)->pWlr()))
if (!skipFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(this);
g_pCompositor->scheduleFrameForMonitor(this);
}

bool CMonitor::shouldSkipScheduleFrameOnMouseEvent() {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/Monitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class CMonitor {
void onDisconnect(bool destroy = false);
void addDamage(const pixman_region32_t* rg);
void addDamage(const CRegion* rg);
void addDamage(const CBox* box, bool skipFrameSchedule = false);
void addDamage(const CBox* box);
bool shouldSkipScheduleFrameOnMouseEvent();
void setMirror(const std::string&);
bool isMirror();
Expand Down
3 changes: 2 additions & 1 deletion src/render/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,8 @@ void CHyprRenderer::damageBox(CBox* pBox, bool skipFrameSchedule) {

CBox damageBox = {pBox->x - m->vecPosition.x, pBox->y - m->vecPosition.y, pBox->width, pBox->height};
damageBox.scale(m->scale);
m->addDamage(&damageBox, skipFrameSchedule);
if (!skipFrameSchedule)
m->addDamage(&damageBox);
}

static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
Expand Down

0 comments on commit d5bcda4

Please sign in to comment.