Skip to content

Commit 13060bd

Browse files
committed
Fix refresh rate not applied during profile change in some systems
1 parent b2eb5b4 commit 13060bd

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src-tauri/src/backend/windows/apply.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub fn apply_layout_against_snapshot(
5555

5656
if enabled {
5757
apply_desired_source_mode(path, &mut next_modes, desired_output);
58+
apply_desired_target_refresh(path, desired_output);
5859
}
5960
}
6061
reorder_paths_for_desired_priority(&mut next_paths, &desired_outputs);
@@ -360,6 +361,18 @@ fn apply_desired_source_mode(
360361
}
361362
}
362363

364+
fn apply_desired_target_refresh(
365+
path: &mut DISPLAYCONFIG_PATH_INFO,
366+
desired_output: Option<&&monarch::OutputConfig>,
367+
) {
368+
let Some(output) = desired_output.copied() else {
369+
return;
370+
};
371+
let desired_refresh_mhz = output.refresh_rate_mhz.max(1);
372+
path.targetInfo.refreshRate.Numerator = desired_refresh_mhz;
373+
path.targetInfo.refreshRate.Denominator = 1000;
374+
}
375+
363376
fn reorder_paths_for_desired_priority(
364377
paths: &mut [DISPLAYCONFIG_PATH_INFO],
365378
desired_outputs: &HashMap<(u64, u32), &monarch::OutputConfig>,

0 commit comments

Comments
 (0)