diff options
author | Timothy Pearson <[email protected]> | 2013-08-25 16:01:27 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-08-25 16:01:27 -0500 |
commit | 67312e92f2ed5347f42bfa8e535102f9a930a801 (patch) | |
tree | cf8d4de5f6293b019934765bd4cf6182610f5296 /src | |
parent | 340d2058a454ca88f6e2ba9b8be54a91dcda0a91 (diff) | |
download | tdepowersave-67312e92f2ed5347f42bfa8e535102f9a930a801.tar.gz tdepowersave-67312e92f2ed5347f42bfa8e535102f9a930a801.zip |
Detect sleep and suspend key presses
Diffstat (limited to 'src')
-rw-r--r-- | src/hardware.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/hardware.cpp b/src/hardware.cpp index 3b7f214..48d7c64 100644 --- a/src/hardware.cpp +++ b/src/hardware.cpp @@ -184,18 +184,19 @@ void HardwareInfo::processKeyPressEvent(unsigned int keycode, TDEEventDevice* ed // FIXME // How can I get specific button press/release information (instead of just "something happened to the button") from the TDE hardware library? - // FIXME - // How are sleep buttons normally handled? On my Thinkpad pressing Fn+Sleep doesn't generate an event from the ACPI sleep button event device... // TODO: Check if we really need to monitor this events. We get maybe also // HAL_PROPERTY_CHANGED event for the key // if (message.startsWith("ButtonPressed")) { kdDebug() << "ButtonPressed event from TDE HW library " << endl; - if ((edevice->eventType() == TDEEventDeviceType::ACPIPowerButton) && (keycode == KEY_POWER)) { + if (((edevice->eventType() == TDEEventDeviceType::ACPIPowerButton) || (edevice->eventType() == TDEEventDeviceType::ACPIOtherInput)) + && (keycode == KEY_POWER)) { TQTimer::singleShot(50, this, TQT_SLOT(emitPowerButtonPressed())); - } else if ((edevice->eventType() == TDEEventDeviceType::ACPISleepButton) && (keycode == KEY_SLEEP)) { + } else if (((edevice->eventType() == TDEEventDeviceType::ACPISleepButton) || (edevice->eventType() == TDEEventDeviceType::ACPIOtherInput)) + && (keycode == KEY_SLEEP)) { TQTimer::singleShot(50, this, TQT_SLOT(emitSleepButtonPressed())); -// } else if (value.startsWith("hibernate")) { -// TQTimer::singleShot(50, this, TQT_SLOT(emitS2diskButtonPressed())); + } else if (((edevice->eventType() == TDEEventDeviceType::ACPISuspendButton) || (edevice->eventType() == TDEEventDeviceType::ACPIOtherInput)) + && (keycode == KEY_SUSPEND)) { + TQTimer::singleShot(50, this, TQT_SLOT(emitS2diskButtonPressed())); // } else if (value.startsWith("brightness-")) { // if (!brightness_in_hardware && value.endsWith("-up")) // TQTimer::singleShot(50, this, TQT_SLOT(brightnessUpPressed())); |