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. diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index 4767fd78..24e555f9 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -28,6 +28,7 @@ struct SMonitor { float refreshRate = 60; wlr_output_damage* damage = nullptr; int framesToSkip = 0; + int forceFullFrames = 0; bool noFrameSchedule = false; wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;