Skip to content

Add ViewportInfo::monitor_refresh_rate - #8950

Merged
emilk merged 1 commit into
mainfrom
emilk/monitor-refresh-rate
Nov 25, 2026
Merged

emilk merged 1 commit into
mainfrom
emilk/monitor-refresh-rate

Conversation

@emilk

@emilk emilk commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Adds the refresh rate of the viewport's monitor, in Hz:

let hz: Option<f32> = ctx.input(|i| i.viewport().monitor_refresh_rate);

egui-winit fills it in each frame from MonitorHandle::refresh_rate_millihertz of the window's current monitor, so it follows the window to another monitor. It is None on the web, where the browser doesn't tell.

egui_webview wants it so that a page rendered off screen can paint at the same rate as egui, instead of a fixed 60 FPS.

Tested on macOS: a 144 Hz display reports Some(144.0).

🤖 Generated with Claude Code

egui-winit fills it in from the monitor that the window is on.
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Preview available at https://egui-pr-preview.github.io/pr/8950-emilkmonitor-refresh-rate
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

@emilk emilk added egui egui-winit porblems related to winit feature New feature or request labels Nov 25, 2026
@emilk
emilk marked this pull request as ready for review November 25, 2026 17:42
@emilk emilk added the eframe Relates to epi and eframe label Nov 25, 2026
@emilk
emilk enabled auto-merge (squash) November 25, 2026 17:42
@emilk
emilk merged commit d279ed7 into main Nov 25, 2026
30 of 31 checks passed
@emilk
emilk deleted the emilk/monitor-refresh-rate branch November 25, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eframe Relates to epi and eframe egui egui-winit porblems related to winit feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant