summaryrefslogtreecommitdiff
path: root/src/events/Monitors.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-21 22:13:13 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-21 22:13:13 +0200
commitff49f2244069124d366e2eba5e5474398a14281a (patch)
tree695cafc482e5ec3cf5ae16198c3c6140bdb43932 /src/events/Monitors.cpp
parenta2fa1bc80db40302fd3c2be24b1f063a0db19d44 (diff)
fix rapid blinking on launch
Diffstat (limited to 'src/events/Monitors.cpp')
-rw-r--r--src/events/Monitors.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp
index e5fa7c55..25756548 100644
--- a/src/events/Monitors.cpp
+++ b/src/events/Monitors.cpp
@@ -140,6 +140,8 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
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);
@@ -216,7 +218,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
return;
}
- if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE) {
+ if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && PMONITOR->forceFullFrames == 0) {
pixman_region32_fini(&damage);
wlr_output_rollback(PMONITOR->output);
wlr_output_schedule_frame(PMONITOR->output); // we update shit at the monitor's Hz so we need to schedule frames because rollback wont
@@ -224,7 +226,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
}
// if we have no tracking or full tracking, invalidate the entire monitor
- if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR) {
+ if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || PMONITOR->forceFullFrames > 0) {
pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
@@ -247,6 +249,9 @@ void Events::listener_monitorFrame(void* owner, void* data) {
}
}
+ if (PMONITOR->forceFullFrames > 0)
+ PMONITOR->forceFullFrames -= 1;
+
// TODO: this is getting called with extents being 0,0,0,0 should it be?
// potentially can save on resources.