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

Add a method for fetching the main window when it might not exist #874

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Jul 9, 2022

  1. Add App::try_main_window and App:try_window_id

    Previously, if the main window had been closed, there was no way of
    trying to access the main window without panicing. There was also no
    safe way to check if the main window had been closed since that would
    require fetching the focused window id which might not exist, thus
    panicing.
    
    With these new methods it's possible to easily handle the case when
    there is no main window or the main window has been closed, using the
    App::try_main_window method. App::try_window_id is added for
    completeness, but is not strictly necessary since if there has been at
    least one window the focused window should be set.
    Frojdholm committed Jul 9, 2022
    Configuration menu
    Copy the full SHA
    b776d85 View commit details
    Browse the repository at this point in the history
  2. Handle a missing main window

    If the main window was closed using the X, the window might not exist in
    the exit function, causing a panic. Use the new method which returns an
    Option to handle that case.
    Frojdholm committed Jul 9, 2022
    Configuration menu
    Copy the full SHA
    3aaa2d8 View commit details
    Browse the repository at this point in the history