Open furiousgreencloud opened 2 years ago
Prior art for this: GTK 3 has GdkModifierIntent
, which includes GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR
(the key that is used within an app for copy, paste, search, etc. - Command on Mac, Control otherwise). GdkModifierIntent
doesn't have a representation for the key that is usually reserved for use by the operating system/desktop environment (Control on Mac, Windows/Super otherwise), but that's probably because this key is reserved for use by the OS/DE and so applications usually shouldn't be using it.
Other prior art: Qt uses Qt::ControlModifier
for the key that is used for copy, paste, search, etc. (even though on Mac that's labelled Command), and Qt::MetaModifier
for the key that is reserved by the OS (usually the Windows key, and even though on Mac it's labelled Control). However, SDL's current API prevents use of Qt's strategy.
CONOTATES
is not a commonly-used English word, and the meaning of CMD
and GUI
isn't obvious to me: both of these keys send commands to some sort of GUI. Perhaps a clearer naming would be something like KMOD_IN_APP_SHORTCUT
or KMOD_PRIMARY_ACCELERATOR
or something along those lines for the one that is used by the application for copy/paste/etc. (Control or Command), and KMOD_OS_SHORTCUT
for the one that is reserved by the OS (Windows or Control)?
Or perhaps the equivalent of GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR
should have an alias like KMOD_IN_APP_SHORTCUT
, but the other one should not have an alias at all, to encourage games to use the one that isn't reserved by the OS?
conotate
is (from what I can find online) a misspelling of the word connotate
.
As for my two cents, I'd be perfectly happy with that name, as I think it clearly expresses the intent.
Simpler ways of phrasing it might be "A_means_B", "A_implies_B", or "A_used_for_B".
From my Windows background, I've never heard of an accelerator
key before, so that would be even less clear to me.
My first association with acceleration would be changing mouse speed/dpi.
I'm not sure if we can find a self-explanatory name for the expected behaviour those keys.
The easiest compromise would be to have one set of values for developers with Apple's perspective,
KMOD/SDLK_USED_FOR_APPLE_CMD
and KMOD/SDLK_USED_FOR_APPLE_GUI
,
and one set for the other perspective,
SDLK/KMOD_USED_FOR_GENERAL_CTRL
and SDLK/KMOD_USED_FOR_GENERAL_GUI
,
so a developer may choose whichever they are more familiar with.
I assume scancodes of the key positions are unchanged? Otherwise those constants would also be useful.
Sorry for the spelling error, Accelerator is pretty unclear to me too, Short Cut is pretty good. The idea with the word 'connotates' is the classic distinction between connotation and denotation. I.e. Between what is written and what it implies.
I'm not too fussed with what it's called just that it exists and is documented. It's the kind thing that a cross platform layer should do, but can't ways do perfectly.
Honestly was expecting people to just say, listen this is a LOW level layer we don't get involved in that stuff.
Happy to cobble together a PR once the all the 2cents add up.
Thanks for your attention.
I'm not sure that generalizing this concept is going to be useful. There are a number of shortcuts that are common to one platform and not another. Instead maybe it makes sense to surface those directly, or at least document them so application developers know the common key combinations across the different platforms?
Feature Request
Create Symbols:
KMOD_Conotates_L/RGUI : mapped to KMOD_L/RCTRL when
_APPLE_
is defined and KMOD_L/RGUI otherwiseKMOD_Conotates_L/RCMD : mapped to KMOD_L/RGUI when
_APPLE_
is defined and KMOD_L/RCTRL otherwiseAnd
SDLK_Conotates_L/RGUI : mapped to SDLK_L/RCTRL when
_APPLE_
is defined and SDLK_L/RGUI otherwiseSDLK_Conotates_L/RCMD : mapped to SDLK_L/RGUI when
_APPLE_
is defined and SDLK_L/RCTRL otherwiseRationalle
While SDL is a low level abstraction layer and defines Key and Key Mod symbols across its supported platforms. It does not take into account that the semantic connotation of these keys is reversed on Apple operating systems.
For example Control (^) + Left Arrow (a "CTRL" mod in SDL) by default switches windows into different "spaces" on Apple systems, is a Graphical User Interface (GUI) operation while Cmd-C (a "GUI" mod in SDL ) invokes a copy command on Apple systems.
Downstream developers wanting to write platform agnostic code do not have a semantically consistent way to refer to the users native platforms expectations of these keys forcing each to them to implement their own remapping macros, or encounter unexpected bug reports, when users try to accommodate the developers key mapping, for example Control+Left Arrow is a reasonable application combination until it is built on MacOS with SDL, which will move windows around.
Background
SDL provides a cross platform way to reference the named hardware keys as follows:
Detailed Request
Maintain the current constants for backward compatibility and to reference the keys directly for example when the name on the key is relevant or the position of the key:
And
Add SDL native symbols that switch to the above based on the build platform for the expected user function accommodating users' muscle memory and simplifying down stream development.
On Non-Apple Systems:
KMOD_CONOTATES_CMD would refer to KMOD_CTRL KMOD_CONOTATES_GUI would refer to KMOD_GUI
While on Apple Systems:
KMOD_CONOTATES_CMD would refer to KMOD_GUI refers to KMOD_CONOTATES_GUI would refer KMOD_CTRL
and similarly for SDLK_ keys names