KWin
Loading...
Searching...
No Matches
lidswitchtracker.cpp
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2023 Xaver Hugl <xaver.hugl@gmail.com>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#include "lidswitchtracker.h"
10#include "core/inputdevice.h"
11#include "input_event.h"
12
13namespace KWin
14{
15
20
22{
23 return m_isLidClosed;
24}
25
26void LidSwitchTracker::switchEvent(KWin::SwitchEvent *event)
27{
28 if (event->device()->isLidSwitch()) {
29 const bool state = event->state() == SwitchEvent::State::On;
30 if (state != m_isLidClosed) {
31 m_isLidClosed = state;
32 Q_EMIT lidStateChanged();
33 }
34 }
35}
36
37}
38
39#include "moc_lidswitchtracker.cpp"
virtual bool isLidSwitch() const =0
void installInputEventSpy(InputEventSpy *spy)
InputDevice * device() const
InputRedirection * input()
Definition input.h:549