opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
key_modifier.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <cstdint>
6
7namespace osc
8{
9 // Represents a single keyboard key modifier.
10 //
11 // `KeyModifier`s are virtual, which means that don't necessarily
12 // represent what's physically written on the keyboard. For
13 // example, MacOS tends to use the Command key in place of the
14 // Ctrl key for many application keybinds. With this in mind, the
15 // backend maps (virtualizes) the Command key to `KeyModifier::Ctrl`
16 // so that application code can just write keybinds "as if" only
17 // writing for Windows/Linux. See `PhysicalKeyModifier` (and related
18 // `Converter`s) if you need to know the underlying physical key.
19 enum class KeyModifier : uint16_t {
20 // No modifier key is pressed.
21 None = 0,
22
23 // A shift key on the keyboard is pressed.
24 Shift = 1<<0,
25
26 // If on MacOS, a command key on the keyboard is pressed.
27 // Otherwise, a ctrl key on the keyboard is pressed.
28 //
29 // The difference between MacOS and the others is to normalize
30 // how the modifier key is actually used on those OSes. E.g.
31 // `Ctrl+V` on Windows usually has the same intent as `Command+V`
32 // on MacOS. With this in mind, you should write your keybinds
33 // as-if designing for Windows.
34 Ctrl = 1<<1,
35
36 // If on MacOS, a ctrl key on the keyboard is pressed.
37 // Otherwise, a meta (e.g. Windows) key on the keyboard is pressed.
38 //
39 // The difference between MacOS and the others is to normalize
40 // how a key is actually used between OSes. E.g. `Ctrl+V` on
41 // Windows usually has the same intent as `Command+V` on MacOS.
42 // With this in mind, you should write your keybinds as-if
43 // designing for Windows.
44 Meta = 1<<2,
45
46 // An alt key on the keyboard is pressed.
47 Alt = 1<<3,
48
49 NUM_FLAGS = 4,
50 };
52
57}
Definition custom_decoration_generator.h:5
constexpr KeyCombination operator|(KeyModifiers modifiers, Key key)
Definition key_combination.h:27
constexpr U to(T &&value)
Definition conversion.h:56
KeyModifier
Definition key_modifier.h:19