~kdub/mir/real-nested-platform

« back to all changes in this revision

Viewing changes to src/common/events/keyboard_event.cpp

  • Committer: Kevin DuBois
  • Date: 2016-11-23 12:59:00 UTC
  • mfrom: (3665.5.163 development-branch)
  • Revision ID: kevin.dubois@canonical.com-20161123125900-4gzspvl0y7q47rsj
merge in base, fix many conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "mir/events/input_event.h"
20
20
#include "mir/events/keyboard_event.h"
21
21
 
22
 
MirKeyboardEvent::MirKeyboardEvent() :
23
 
    MirInputEvent(mir_event_type_key)
24
 
{
25
 
}
26
 
 
27
 
int32_t MirKeyboardEvent::device_id() const
28
 
{
29
 
    return device_id_;
30
 
}
31
 
 
32
 
void MirKeyboardEvent::set_device_id(int32_t id)
33
 
{
34
 
    device_id_ = id;
35
 
}
36
 
 
37
 
int32_t MirKeyboardEvent::source_id() const
38
 
{
39
 
    return source_id_;
40
 
}
41
 
 
42
 
void MirKeyboardEvent::set_source_id(int32_t id)
43
 
{
44
 
    source_id_ = id;
 
22
MirKeyboardEvent::MirKeyboardEvent()
 
23
{
 
24
    event.initInput();
 
25
    event.getInput().initKey();
45
26
}
46
27
 
47
28
MirKeyboardAction MirKeyboardEvent::action() const
48
29
{
49
 
    return action_;
 
30
    return static_cast<MirKeyboardAction>(event.asReader().getInput().getKey().getAction());
50
31
}
51
32
 
52
33
void MirKeyboardEvent::set_action(MirKeyboardAction action)
53
34
{
54
 
    action_ = action;
55
 
}
56
 
 
57
 
MirInputEventModifiers MirKeyboardEvent::modifiers() const
58
 
{
59
 
    return modifiers_;
60
 
}
61
 
 
62
 
void MirKeyboardEvent::set_modifiers(MirInputEventModifiers modifiers)
63
 
{
64
 
    modifiers_ = modifiers;
 
35
    event.getInput().getKey().setAction(static_cast<mir::capnp::KeyboardEvent::Action>(action));
65
36
}
66
37
 
67
38
int32_t MirKeyboardEvent::key_code() const
68
39
{
69
 
    return key_code_;
 
40
    return event.asReader().getInput().getKey().getKeyCode();
70
41
}
71
42
 
72
43
void MirKeyboardEvent::set_key_code(int32_t key_code)
73
44
{
74
 
    key_code_ = key_code;
 
45
    event.getInput().getKey().setKeyCode(key_code);
75
46
}
76
47
 
77
48
int32_t MirKeyboardEvent::scan_code() const
78
49
{
79
 
    return scan_code_;
 
50
    return event.asReader().getInput().getKey().getScanCode();
80
51
}
81
52
 
82
53
void MirKeyboardEvent::set_scan_code(int32_t scan_code)
83
54
{
84
 
    scan_code_ = scan_code;
85
 
}
86
 
 
87
 
std::chrono::nanoseconds MirKeyboardEvent::event_time() const
88
 
{
89
 
    return event_time_;
90
 
}
91
 
 
92
 
void MirKeyboardEvent::set_event_time(std::chrono::nanoseconds const& event_time)
93
 
{
94
 
    event_time_ = event_time;
95
 
}
96
 
 
97
 
mir::cookie::Blob MirKeyboardEvent::cookie() const
98
 
{
99
 
    return cookie_;
100
 
}
101
 
 
102
 
void MirKeyboardEvent::set_cookie(mir::cookie::Blob const& cookie)
103
 
{
104
 
    cookie_ = cookie;
105
 
}
 
55
    event.getInput().getKey().setScanCode(scan_code);
 
56
}
 
57
 
 
58