Merge branch 'Plasma/5.12'
This commit is contained in:
commit
dca8023207
2 changed files with 11 additions and 5 deletions
|
@ -67,7 +67,7 @@ Event *Event::create(libinput_event *event)
|
|||
Event::Event(libinput_event *event, libinput_event_type type)
|
||||
: m_event(event)
|
||||
, m_type(type)
|
||||
, m_device(Device::getDevice(libinput_event_get_device(m_event)))
|
||||
, m_device(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,14 @@ Event::~Event()
|
|||
libinput_event_destroy(m_event);
|
||||
}
|
||||
|
||||
Device *Event::device() const
|
||||
{
|
||||
if (!m_device) {
|
||||
m_device = Device::getDevice(libinput_event_get_device(m_event));
|
||||
}
|
||||
return m_device;
|
||||
}
|
||||
|
||||
libinput_device *Event::nativeDevice() const
|
||||
{
|
||||
if (m_device) {
|
||||
|
|
|
@ -37,9 +37,7 @@ public:
|
|||
virtual ~Event();
|
||||
|
||||
libinput_event_type type() const;
|
||||
Device *device() const {
|
||||
return m_device;
|
||||
}
|
||||
Device *device() const;
|
||||
libinput_device *nativeDevice() const;
|
||||
|
||||
operator libinput_event*() {
|
||||
|
@ -57,7 +55,7 @@ protected:
|
|||
private:
|
||||
libinput_event *m_event;
|
||||
libinput_event_type m_type;
|
||||
Device *m_device;
|
||||
mutable Device *m_device;
|
||||
};
|
||||
|
||||
class KeyEvent : public Event
|
||||
|
|
Loading…
Reference in a new issue