Skip to content

Cocoa: set Window::scaleFactor from the backing scale factor - #120

Open
mkrus wants to merge 1 commit into
mainfrom
cocoa-scale-factor
Open

mkrus wants to merge 1 commit into
mainfrom
cocoa-scale-factor

Conversation

@mkrus

@mkrus mkrus commented Oct 28, 2026

Copy link
Copy Markdown
Member

On macOS, Window::scaleFactor stayed at its default of 1.0, so applications could not size their swapchains for retina displays.

The Cocoa platform window now sets scaleFactor to the backing scale factor:

  • at creation, from the main screen (the window has no screen yet);
  • when the window is shown, from the window itself;
  • in windowDidChangeBackingProperties:, when the window moves to a screen with a different pixel density.

Window sizes stay in points, which matches the Wayland backend's convention of logical sizes plus a scale factor.

Tested with KDGpu's examples on a MacBook Pro with the built-in retina display and an external 1x display.

🤖 Generated with Claude Code

The window size stays in points. scaleFactor reports the pixels per
point, as the Wayland backend does, and follows the window when it
moves to a screen with a different density.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Change-Id: Ic8bfc6e2ae393d0cdb1541bff2882e60981b1971
@mkrus mkrus self-assigned this Oct 28, 2026
@0x6e

0x6e commented Oct 28, 2026

Copy link
Copy Markdown
Member

Nit: do we want to keep the Claude explanation comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants