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

Command Q to quit on Mac OS X #468

Closed
neon64 opened this issue May 23, 2015 · 4 comments
Closed

Command Q to quit on Mac OS X #468

neon64 opened this issue May 23, 2015 · 4 comments
Assignees

Comments

@neon64
Copy link

neon64 commented May 23, 2015

Most native Cocoa apps will quit when you press Command-Q (or whatever keyboard shortcut you have set globally I think).

I'm not an expert in windowing systems for Mac OS X so I ask if it possible to implement this functionality with glutin as well. I understand I should be able to implement this myself in application code but I believe it would be better as part of glutin as it is a system-wide convention.

Also, when trying to implement this myself, I couldn't find a way to manually close the glutin window. I have a loop like so:

while !window.is_closed() {
    // stuff
}

And it will exit when I click the close button, but I can't find a function like window.close or window.set_closed anywhere where I can manually close the window. What is the recommended way of doing this?

@tomaka tomaka added the A-cocoa label May 23, 2015
@tomaka
Copy link
Contributor

tomaka commented May 23, 2015

And it will exit when I click the close button, but I can't find a function like window.close or window.set_closed anywhere where I can manually close the window. What is the recommended way of doing this?

For the moment the only way to destroy the window is to destroy the Window object associated to it. You can also call hide() instead, to hide it.

I don't know if it makes sense to add closed() in addition to hide().

@fkaa fkaa self-assigned this May 25, 2015
@fkaa
Copy link
Contributor

fkaa commented May 25, 2015

@tomaka The ⌘Q behavior is defined by the shortcut for Quit Application in the toolbar.

Quit application

Right now glutin doesn't have anything of the sort, and while it could be added programmatically, it would also be hardcoded. Alternatively it could use a .xib file to define the toolbar options. But that would mean glutin gets a local file dependency for a specific platform which is not ideal. How about checking if say, Menu.xib is in the bundle path (The normal place for it to be) and if it's not, fall back on programmatically defining the menu.

xib file

@fkaa
Copy link
Contributor

fkaa commented Jul 4, 2015

Added in this branch, but I'm not keen on merging since there's still the issue with how we process events on osx (currently it blocks ⌘Q and similar key combinations).

@tomaka
Copy link
Contributor

tomaka commented Nov 3, 2016

Closing for rust-windowing/winit#41

@tomaka tomaka closed this as completed Nov 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants