dpmsinputfilter: don't wake up the screen on media or volume key events

It's pretty unexpected that the key press would be ignored and instead the screen
wakes up
This commit is contained in:
Xaver Hugl 2024-03-12 16:11:33 +01:00
parent 09049954b9
commit b2babac3d0

View file

@ -51,6 +51,26 @@ bool DpmsInputEventFilter::wheelEvent(WheelEvent *event)
bool DpmsInputEventFilter::keyEvent(KeyEvent *event)
{
static constexpr std::array s_mediaKeys = {
Qt::Key::Key_MediaLast,
Qt::Key::Key_MediaNext,
Qt::Key::Key_MediaPause,
Qt::Key::Key_MediaPlay,
Qt::Key::Key_MediaPrevious,
Qt::Key::Key_MediaRecord,
Qt::Key::Key_MediaStop,
Qt::Key::Key_MediaTogglePlayPause,
Qt::Key::Key_VolumeUp,
Qt::Key::Key_VolumeDown,
Qt::Key::Key_VolumeMute,
Qt::Key::Key_MicVolumeUp,
Qt::Key::Key_MicVolumeDown,
Qt::Key::Key_MicMute,
};
if (std::ranges::find(s_mediaKeys, event->key()) != s_mediaKeys.end()) {
// don't wake up the screens for media or volume keys
return false;
}
if (event->type() == QKeyEvent::KeyPress) {
notify();
} else if (event->type() == QKeyEvent::KeyRelease) {