KWin
Loading...
Searching...
No Matches
src
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
13
namespace
KWin
14
{
15
16
LidSwitchTracker::LidSwitchTracker
()
17
{
18
input
()->
installInputEventSpy
(
this
);
19
}
20
21
bool
LidSwitchTracker::isLidClosed
()
const
22
{
23
return
m_isLidClosed;
24
}
25
26
void
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"
KWin::InputDevice::isLidSwitch
virtual bool isLidSwitch() const =0
KWin::InputRedirection::installInputEventSpy
void installInputEventSpy(InputEventSpy *spy)
Definition
onscreennotificationtest.cpp:25
KWin::LidSwitchTracker::LidSwitchTracker
LidSwitchTracker()
Definition
lidswitchtracker.cpp:16
KWin::LidSwitchTracker::lidStateChanged
void lidStateChanged()
KWin::LidSwitchTracker::isLidClosed
bool isLidClosed() const
Definition
lidswitchtracker.cpp:21
KWin::SwitchEvent
Definition
input_event.h:162
KWin::SwitchEvent::device
InputDevice * device() const
Definition
input_event.h:180
KWin::SwitchEvent::State::On
@ On
input_event.h
inputdevice.h
lidswitchtracker.h
KWin
Definition
activation_test.cpp:20
KWin::input
InputRedirection * input()
Definition
input.h:549
Generated on Sat Feb 17 2024 01:42:09 for KWin by
1.10.0