Skip to content

macOS: create_window ignores inner_size and falls back to 800x600 #4

@Milky2018

Description

@Milky2018

Summary

On macOS, EventLoop::create_window currently ignores WindowAttributes::inner_size and only reads surface_size. If surface_size is None, it falls back to 800x600.

This causes unexpected clipping/cropping in apps that set logical size via inner_size (default path in many runtimes).

Reproduction

  1. Build/run an app that sets window size using WindowAttributes::with_inner_size(...) but does not set with_surface_size(...).
  2. On macOS, create window through EventLoop::create_window.
  3. Observe actual content area is 800x600 instead of the requested logical size.

Actual behavior

Window creation path falls back to 800x600 when surface_size is not set, even when inner_size is set.

Expected behavior

If surface_size is None but inner_size is set, create_window should respect inner_size (converted appropriately using scale factor), instead of falling back to 800x600.

Suspected root cause

In macos/window_delegate.mbt (EventLoop::create_window), size initialization currently does:

  • read attributes.surface_size()
  • convert it with to_physical(scale_factor)
  • otherwise fallback PhysicalSize::new(800, 600)

It does not check attributes.inner_size() in this branch.

Context

I hit this while running mgstudio examples. Layout was authored for a wider window, but actual macOS window ended up at 800x600, causing visible left/right clipping.

If useful, I can open a PR to add fallback order like:

  1. surface_size
  2. inner_size
  3. default 800x600

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions