summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-08-25 19:22:53 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-08-25 19:22:53 -0500
commitd6504ec10ab9b6b816395032dd9cc668405d7106 (patch)
treec5e8eb3f9ed7bb51f34f1a8958dc035008e7f10e
parentaf4be97214150e31dc063f7dd6e006d93fc5a51e (diff)
downloadtdebase-d6504ec10ab9b6b816395032dd9cc668405d7106.tar.gz
tdebase-d6504ec10ab9b6b816395032dd9cc668405d7106.zip
Pass ACPI power key events through the lock dialog
-rw-r--r--kdesktop/lock/lockprocess.cc24
1 files changed, 20 insertions, 4 deletions
diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc
index f482dcd17..f5613f916 100644
--- a/kdesktop/lock/lockprocess.cc
+++ b/kdesktop/lock/lockprocess.cc
@@ -125,10 +125,16 @@ Status DPMSInfo ( Display *, CARD16 *, BOOL * );
// #define KEEP_MOUSE_UNGRABBED 1
// These lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special multimedia keys
-#define XF86XK_AudioMute 0x1008FF12
-#define XF86XK_AudioRaiseVolume 0x1008FF13
-#define XF86XK_AudioLowerVolume 0x1008FF11
-#define XF86XK_Display 0x1008FF59
+#define XF86XK_AudioMute 0x1008FF12
+#define XF86XK_AudioRaiseVolume 0x1008FF13
+#define XF86XK_AudioLowerVolume 0x1008FF11
+#define XF86XK_Display 0x1008FF59
+
+// These lines are taken on 08/2013 from X.org (X11/XF86keysym.h), defining some special ACPI power keys
+#define XF86XK_PowerOff 0x1008FF2A
+#define XF86XK_Sleep 0x1008FF2F
+#define XF86XK_Suspend 0x1008FFA7
+#define XF86XK_Hibernate 0x1008FFA8
#define DPMS_MONITOR_BLANKED(x) ((x == DPMSModeStandby) || (x == DPMSModeSuspend) || (x == DPMSModeOff))
@@ -2124,6 +2130,7 @@ bool LockProcess::x11Event(XEvent *event)
//if ((event->type == KeyPress) || (event->type == KeyRelease)) {
if (event->type == KeyPress) {
+ // Multimedia keys
if ((event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_Display)) || \
(event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_AudioMute)) || \
(event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_AudioRaiseVolume)) || \
@@ -2132,6 +2139,15 @@ bool LockProcess::x11Event(XEvent *event)
TQTimer::singleShot( 100, this, TQT_SLOT(doFunctionKeyBroadcast()) );
return true;
}
+ // ACPI power keys
+ if ((event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_PowerOff)) || \
+ (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_Sleep)) || \
+ (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_Suspend)) || \
+ (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_Hibernate))) {
+ mkeyCode = event->xkey.keycode;
+ TQTimer::singleShot( 100, this, TQT_SLOT(doFunctionKeyBroadcast()) );
+ return true;
+ }
}
switch (event->type)