-
Notifications
You must be signed in to change notification settings - Fork 23
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
Detect OS X and use appropriate keyboard shortcuts #25
Comments
@rm-code any thoughts on this? What about shortcut attribute, if someone creates a widget with a shortcut like 'ctrl-s' should that be command-s on a Mac? Is the control key not something an application usually cares about as a modifier on Mac, like the Windows logo key on Windows (something that belongs more to the window manager than to individual apps)? |
@airstruck The ctrl key is used on OSX in some cases and shouldn't be replaced by default. How about making the keys interchangeable? They could be loaded like a theme then: local Keymap = {
['OSX'] = { -- Backend returns same identifier regardless of SDL or LÖVE.
text_moveCaretRight = { 'lgui', 'rgui' },
-- ...
},
['Windows'] = {
text_moveCaretRight = { 'lctrl', 'rctrl' },
-- ...
}
} moveCaretLeft(self, Backend.isKeyDown( Keymap[Backend.getOS()].text_moveCaretLeft )) Just a quick and dirty idea. If not then I'd simply suggest adding special cases like I did in #24. Shouldn't be too many anyway. |
Here's the thing I'm mostly worried about, actually. When a Windows user creates a UI with something like:
What does this mean on a Mac? Should they press ctrl-s to save, or cmd-s? Maybe UI author could write something like |
Well
The problem with forcing ctrl to be cmd on OSX automatically is that you'd essentially take away one key from Mac users 😁 |
Doesn't #24 also leave Mac users with one less key? ctrl-a still selects all on Mac, so you can't use it for something else. I just pushed a commit that has shortcuts treat ctrl and lgui/rgui as both being a ctrl key, so a Multiple shortcuts per widget is a good idea in general though, should probably support that anyway. |
That's true if we don't have different key maps for osx and windows. No idea how to implement that nicely though. I think the current approach is okay for now 👍 |
In general, shortcuts on OS X should use command key instead of control key.
Use
love.system.getOS() == 'OS X'
in Love andSDL_GetPlatform() == 'Mac OS X'
in SDL to figure out if user is on a Mac.Add a special function like
Backend.isControlPressed
that detects command key on Mac and control key everywhere else. Is there a better name for this, some word that refers to either a command or control key?The text was updated successfully, but these errors were encountered: