From 67312e92f2ed5347f42bfa8e535102f9a930a801 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 25 Aug 2013 16:01:27 -0500 Subject: Detect sleep and suspend key presses --- src/hardware.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/hardware.cpp') 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())); -- cgit v1.2.3