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

more consistent -confirm_quit support #7247

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ksherlock
Copy link
Contributor

-confirm_quit is only effective when quitting via the ui escape key.

  • SDL: support the SDL_QUIT message, generated by the OS X Quit menu item or ^C in the terminal (OS X, Linux, etc)
  • move request_quit method from mame_ui_manager to ui_manager (as virtual) for easier access.
  • when SDL driver receives the SDL_QUIT or SDL_WINDOWEVENT_CLOSE message, call ui_manager::request_quit() which will display a confirmation prompt, when -confirm_quit is active or quit immediately otherwise. (The SDL_QUIT and SDL_WINDOWEVENT_CLOSE messages are a suggestion that can be ignored.)
  • win32, same thing for the WM_CLOSE message.

- SDL: support the SQL_QUIT message, generated by the OS X Quit menu
or ^C in the terminal
- move request_quit method from mame_ui_manager to ui_manager (as virtual)
- when SDL receives the SDL_QUIT or SDL_WINDOWEVENT_CLOSE message, pass
it through the ui_manager::request_quit() which will display a confirmation prompt,
as necessary.  The SDL_QUIT and SDL_WINDOWEVENT_CLOSE messages are a request which can be denied.
- win32, same thing for the WM_CLOSE message.
@cuavas
Copy link
Member

cuavas commented Sep 18, 2020

I’m not sure this is really desirable. The “confirm quit” option is mostly to make it harder to accidentally quit by hitting UI cancel one too many times when backing out of the menus. I can see this being detrimental in a couple of ways:

  • If you’ve managed to get MAME into a state where you can’t use the UI controls, you can exit by closing the window, or on a Mac you should be able to hit Cmd-Tab to bring up the application switcher, move focus to MAME and then hit Q (without releasing Cmd). With this change, you’d then need to bring focus to MAME, and then use the UI controls to confirm.
  • This doesn’t allow MAME to request focus for confirmation when it receives a request to quit. If you try to get MAME to quit (e.g. from the Cmd-Tab switcher on macOS or by right-clicking a minimised taskbar item and choosing Close window on Windows), you may not realise that MAME is waiting for confirmation and think it’s unresponsive.
  • This won’t work well with automation, since the confirmation prompt isn’t a standard UI element. For example when automatically closing programs to log out or shut down.

@ksherlock
Copy link
Contributor Author

Currently command-Q or cmd-tab-Q doesn't quit because the SDL_QUIT event is ignored.

@cuavas
Copy link
Member

cuavas commented Sep 29, 2020

Well, the request quit event should schedule an exit, too in that case.

@cuavas
Copy link
Member

cuavas commented Sep 29, 2020

Actually, will that even work properly if you run the system from the internal system selection menu, or will it drop you back to the system selection menu? The quit event should actually quit.

@cuavas
Copy link
Member

cuavas commented Sep 29, 2020

OK, it’s nastier than that:

  • On closing the last window, you get the SDL_QUIT event in addition to the SDL_WINDOWEVENT/SDL_WINDOWEVENT_CLOSE event.
  • On Cmd-Q (macOS), SIGINT (Linux), or programmatic request to exit, you get only the SDL_QUIT event.

Closing the window should still drop you back to the system selection menu if the machine was launched that way, but the other cases should exit directly. Doing this properly would be a pain because it’s going to require detecting the absence of the accompanying window event to trigger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants