Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added FocusedWindow event and raw winit WindowEvents #956

Merged
merged 1 commit into from
Dec 7, 2020
Merged

Added FocusedWindow event and raw winit WindowEvents #956

merged 1 commit into from
Dec 7, 2020

Conversation

thebluefish
Copy link
Contributor

Also adds a new example demonstrating how to use both.

@memoryruins memoryruins added C-Feature A new feature, making something new possible A-Windowing Platform-agnostic interface layer to run your app in labels Nov 29, 2020

/// An event that indicates a window has received or lost focus.
#[derive(Debug, Clone)]
pub struct FocusedWindow {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since it can be focused or unfocused, maybe a different name may be valuable. Something like WindowFocus or FocusChanged?

Copy link
Member

Choose a reason for hiding this comment

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

I personally like WindowFocus

Copy link
Member

@cart cart left a comment

Choose a reason for hiding this comment

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

I'm starting to think that we shouldn't expose winit events directly. The whole point of bevy_window / bevy_input is to make user-facing code backend-agnostic. If we add console support in the future, it likely won't go through winit, which means user-facing code directly referencing winit events will break. Or in the future if we decide to replace winit with something else, that would be a breaking change.

Edit: the rationale for exposing winit events was that it "filled in the gaps" while bevy_window is fleshed out. But if we use winit events to fill in the gaps, that allows people to do what they want "the hackey way" and reduces the desire/need to expose things "the right way".


/// An event that indicates a window has received or lost focus.
#[derive(Debug, Clone)]
pub struct FocusedWindow {
Copy link
Member

Choose a reason for hiding this comment

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

I personally like WindowFocus

@cart
Copy link
Member

cart commented Dec 7, 2020

I removed the winit events, renamed to WindowFocused (for parity with the winit event), and rebased on master

@cart cart merged commit 08b6aa5 into bevyengine:master Dec 7, 2020
@fopsdev fopsdev mentioned this pull request Jan 24, 2021
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 C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants