Mir
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
src
include
common
mir
input
key_mapper.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2016 Canonical Ltd.
3
*
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
12
*
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* Authored by:
17
* Andreas Pokorny <andreas.pokorny@canonical.com>
18
*/
19
20
#ifndef MIR_INPUT_KEY_MAPPER_H_
21
#define MIR_INPUT_KEY_MAPPER_H_
22
23
#include "
mir_toolkit/client_types.h
"
24
#include "
mir_toolkit/event.h
"
25
26
#include <xkbcommon/xkbcommon.h>
27
#include <vector>
28
#include <memory>
29
30
struct
MirKeyEvent;
31
32
namespace
mir
33
{
34
namespace
input
35
{
36
class
Keymap;
37
45
class
KeyMapper
46
{
47
public
:
48
KeyMapper
() =
default
;
49
virtual
~KeyMapper
() =
default
;
50
52
virtual
void
set_key_state
(
MirInputDeviceId
id
, std::vector<uint32_t>
const
& key_state) = 0;
53
57
virtual
void
set_keymap_for_device
(
MirInputDeviceId
id
,
Keymap
const
& map) = 0;
61
virtual
void
set_keymap_for_device
(
MirInputDeviceId
id
,
char
const
* buffer,
size_t
len) = 0;
67
virtual
void
clear_keymap_for_device
(
MirInputDeviceId
id
) = 0;
68
72
virtual
void
set_keymap_for_all_devices
(
Keymap
const
& map) = 0;
76
virtual
void
set_keymap_for_all_devices
(
char
const
* buffer,
size_t
len) = 0;
77
/*
78
* Remove all keymap configurations
79
*
80
* After this call no key code will be evaluated.
81
*/
82
virtual
void
clear_all_keymaps
() = 0;
83
90
virtual
void
map_event
(
MirEvent
& event) = 0;
91
virtual
MirInputEventModifiers
modifiers
()
const
= 0;
92
93
protected
:
94
KeyMapper
(
KeyMapper
const
&) =
delete
;
95
KeyMapper
&
operator=
(
KeyMapper
const
&) =
delete
;
96
};
97
98
}
99
}
100
101
#endif
mir
All things Mir.
Definition:
atomic_callback.h:25
mir::input::KeyMapper::clear_keymap_for_device
virtual void clear_keymap_for_device(MirInputDeviceId id)=0
Remove the specific keymap defined for device identified via the id.
mir::input::KeyMapper::set_keymap_for_all_devices
virtual void set_keymap_for_all_devices(Keymap const &map)=0
Set a default keymap for all devices.
mir::input::KeyMapper::operator=
KeyMapper & operator=(KeyMapper const &)=delete
mir::input::KeyMapper::set_key_state
virtual void set_key_state(MirInputDeviceId id, std::vector< uint32_t > const &key_state)=0
Update the key state of device id, with the given sequence of pressed scan codes. ...
mir::input::KeyMapper::KeyMapper
KeyMapper()=default
mir::input::KeyMapper::~KeyMapper
virtual ~KeyMapper()=default
MirInputEventModifiers
unsigned int MirInputEventModifiers
Definition:
input_event.h:66
event.h
mir::input::KeyMapper
The key mapping interface KeyMapper allows configuring a key map for each device individually or a si...
Definition:
key_mapper.h:45
mir::input::Keymap
Definition:
keymap.h:30
MirInputDeviceId
int64_t MirInputDeviceId
Definition:
input_event.h:35
mir::input::KeyMapper::modifiers
virtual MirInputEventModifiers modifiers() const =0
mir::input::KeyMapper::map_event
virtual void map_event(MirEvent &event)=0
Map the given event based on the key maps configured.
client_types.h
mir::input::KeyMapper::set_keymap_for_device
virtual void set_keymap_for_device(MirInputDeviceId id, Keymap const &map)=0
Set a keymap for the device id.
mir::input::KeyMapper::clear_all_keymaps
virtual void clear_all_keymaps()=0
MirEvent
Definition:
event.h:30
Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016