mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
key: add ModCtrl, ModShortcut
ModCtrl is the physical Ctrl key, ModShortcut is the virtual "shortcut" modifier, which is Ctrl on most platforms, Command on Apple platforms. Updates #59 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+9
-5
@@ -57,11 +57,12 @@ type EditEvent struct {
|
||||
type Modifiers uint32
|
||||
|
||||
const (
|
||||
// ModCommand is the command modifier. On macOS
|
||||
// it is the Cmd key, on other platforms the Ctrl
|
||||
// key.
|
||||
ModCommand Modifiers = 1 << iota
|
||||
// THe shift key.
|
||||
// ModCtrl is the ctrl modifier key.
|
||||
ModCtrl Modifiers = 1 << iota
|
||||
// ModCommand is the command modifier key
|
||||
// found on Apple keyboards.
|
||||
ModCommand
|
||||
// ModShift is the shift modifier key.
|
||||
ModShift
|
||||
)
|
||||
|
||||
@@ -111,6 +112,9 @@ func (e Event) String() string {
|
||||
|
||||
func (m Modifiers) String() string {
|
||||
var strs []string
|
||||
if m.Contain(ModCtrl) {
|
||||
strs = append(strs, "ModCtrl")
|
||||
}
|
||||
if m.Contain(ModCommand) {
|
||||
strs = append(strs, "ModCommand")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
// +build !darwin
|
||||
|
||||
package key
|
||||
|
||||
// ModShortcut is the platform's shortcut modifier, usually the Ctrl
|
||||
// key. On Apple platforms it is the Cmd key.
|
||||
const ModShortcut = ModCtrl
|
||||
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
package key
|
||||
|
||||
// ModShortcut is the platform's shortcut modifier, usually the Ctrl
|
||||
// key. On Apple platforms it is the Cmd key.
|
||||
const ModShortcut = ModCommand
|
||||
Reference in New Issue
Block a user