summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-08-25 16:01:27 -0500
committerTimothy Pearson <[email protected]>2013-08-25 16:01:27 -0500
commit67312e92f2ed5347f42bfa8e535102f9a930a801 (patch)
treecf8d4de5f6293b019934765bd4cf6182610f5296
parent340d2058a454ca88f6e2ba9b8be54a91dcda0a91 (diff)
downloadtdepowersave-67312e92f2ed5347f42bfa8e535102f9a930a801.tar.gz
tdepowersave-67312e92f2ed5347f42bfa8e535102f9a930a801.zip
Detect sleep and suspend key presses
-rw-r--r--src/hardware.cpp13
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()));