Skip to content

Add bevy_window::Window options for MacOS#15820

Merged
alice-i-cecile merged 2 commits intobevyengine:mainfrom
aecsocket:feat/macos-window-2
Oct 11, 2024
Merged

Add bevy_window::Window options for MacOS#15820
alice-i-cecile merged 2 commits intobevyengine:mainfrom
aecsocket:feat/macos-window-2

Conversation

@aecsocket
Copy link
Copy Markdown
Contributor

Objective

MacOS has some nice options for controlling the window and titlebar to make the content appear much more "immersively" in the window. This PR exposes options for controlling this.

Solution

Adds new fields to Window to control these, with doc comments to explain what they do and that they're MacOS only.

Testing

Tested on a MacOS machine (not my own, I don't have one). That's where the below screenshots were taken.


Showcase

On MacOS, you now have more options for configuring the window titlebar. You can, for example, make the title bar transparent and only show the window controls. This provides a more "immersive" experience for your rendered content.

Before, only this was possible:
image

Now, you can create windows like this:
image2

This uses the following bevy_window::Window settings:

fullsize_content_view: true,
titlebar_transparent: true,
titlebar_show_title: false,

Migration Guide

bevy_window::Window now has extra fields for configuring MacOS window settings:

    pub movable_by_window_background: bool,
    pub fullsize_content_view: bool,
    pub has_shadow: bool,
    pub titlebar_shown: bool,
    pub titlebar_transparent: bool,
    pub titlebar_show_title: bool,
    pub titlebar_show_buttons: bool,

Using Window::default keeps the same behaviour as before.

MacOS window titlebar settings

fixes

Remove borderless game option

Clean up and add docs
Copy link
Copy Markdown

@oxkitsune oxkitsune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very cool to see this exposed. i tried hacking around this and it wasn't pretty

@mnmaita mnmaita added A-Windowing Platform-agnostic interface layer to run your app in O-MacOS Specific to the MacOS (Apple) desktop operating system D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 10, 2024
Copy link
Copy Markdown
Contributor

@clarfonthey clarfonthey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable. Unfortunate some of these aren't better unified, since they could definitely apply to more than just MacOS, but that's more of a limitation of winit than bevy.

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 11, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 11, 2024
Merged via the queue into bevyengine:main with commit 992d17b Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Windowing Platform-agnostic interface layer to run your app in D-Straightforward Simple bug fixes and API improvements, docs, test and examples O-MacOS Specific to the MacOS (Apple) desktop operating system S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants