Skip to content

Allow some events to perform cancellation. #3349

Open

Description

@cyan-river

For example, in the WindowEvent::Resized method, if the calculation result does not meet my requirements or settings. I can cancel the execution of this event by returning false or other methods.

Activity

  1. added
    S - enhancement
    on Jan 2, 2024
  2. daxpedda commented on Jan 2, 2024

    @daxpedda
    Member

    I don't know if this is possible in other backends, but it's not possible in Web.

  3. madsmtm commented on Jan 2, 2024

    @madsmtm
    Member

    I think maybe -[NSWindowDelegate windowwillresize] would be able to provide what you need on macOS, can you confirm that's what you need?

    (Using that is problematic though, because it works with the outer size of the window, not the inner size).

    (And winit generally does not support callbacks (the ScaleFactorChanged event is terrible), so even then, implementing this would be difficult).

  4. cyan-river commented on Jan 3, 2024

    @cyan-river
    Author

    I don't know if this is possible in other backends, but it's not possible in Web.

    I don't know about the web platform. What I am currently working with is the window platform. For example, WindowEvent::Resized I mentioned above. EventLoop only provides a notification callback. The reason why the window actually changes is not other than after winit executes the EventLoop callback. Changes to the window are made from winit's code. So the current phenomenon is that no matter what is done in the callback, it is the same as not doing anything. The code in the callback only has the right to know the callback message and has no decision-making power (for example, let winit ignore the message and give up adjusting the window) .

  5. daxpedda commented on Jan 3, 2024

    @daxpedda
    Member

    (And winit generally does not support callbacks (the ScaleFactorChanged event is terrible), so even then, implementing this would be difficult).

    It would be good to figure out an API for that first indeed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    S - enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions