summaryrefslogtreecommitdiffstats
path: root/kdesktop/lock/lockprocess.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-19 02:33:38 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-19 02:33:38 +0000
commit387117c2446a397a42698e9d8cfdf9ff1f371c96 (patch)
treeeaeb7b8c318f6618de3a47dffdcd3ffe347ab7b6 /kdesktop/lock/lockprocess.cc
parent2f3e71bfb99194163418662d6324a2a2f4545e70 (diff)
downloadtdebase-387117c2446a397a42698e9d8cfdf9ff1f371c96.tar.gz
tdebase-387117c2446a397a42698e9d8cfdf9ff1f371c96.zip
Enhanced Compiz support
Added preliminary ability for allowing specific hotkeys to execute global shortcut actions while the desktop lock is active. The primary use for this is to switch monitors while the screen is still locked (with the switch-monitor hotkey) so that the user can login. git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1116279 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdesktop/lock/lockprocess.cc')
-rw-r--r--kdesktop/lock/lockprocess.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc
index 2664c1c24..1e4e64940 100644
--- a/kdesktop/lock/lockprocess.cc
+++ b/kdesktop/lock/lockprocess.cc
@@ -25,6 +25,7 @@
#include "kdesktopsettings.h"
#include <dmctl.h>
+#include <dcopref.h>
#include <kstandarddirs.h>
#include <kapplication.h>
@@ -100,6 +101,12 @@ Status DPMSInfo ( Display *, CARD16 *, BOOL * );
#define LOCK_GRACE_DEFAULT 5000
#define AUTOLOGOUT_DEFAULT 600
+// 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 0x1008FF
+#define XF86XK_Display 0x1008FF59
+
static Window gVRoot = 0;
static Window gVRootData = 0;
static Atom gXA_VROOT;
@@ -194,6 +201,10 @@ LockProcess::LockProcess(bool child, bool useBlankOnly)
}
#endif
+#if (QT_VERSION-0 >= 0x030200) // XRANDR support
+ connect( kapp->desktop(), SIGNAL( resized( int )), SLOT( desktopResized()));
+#endif
+
greetPlugin.library = 0;
}
@@ -625,6 +636,27 @@ void LockProcess::createSaverWindow()
kdDebug(1204) << "Saver window Id: " << winId() << endl;
}
+void LockProcess::desktopResized()
+{
+ // Get root window size
+ XWindowAttributes rootAttr;
+ XGetWindowAttributes(qt_xdisplay(), RootWindow(qt_xdisplay(),
+ qt_xscreen()), &rootAttr);
+ mRootWidth = rootAttr.width;
+ mRootHeight = rootAttr.height;
+
+ setGeometry(0, 0, mRootWidth, mRootHeight);
+
+ // Restart the hack as the window size is now different
+ stopHack();
+ startHack();
+
+ if (currentDialog != NULL) {
+ mForceReject = true;
+ currentDialog->close();
+ }
+}
+
//---------------------------------------------------------------------------
//
// Hide the screensaver window
@@ -1134,6 +1166,26 @@ void LockProcess::cleanupPopup()
//
bool LockProcess::x11Event(XEvent *event)
{
+ // Allow certain very specific keypresses through
+ // Key: Reason:
+ // XF86Display You need to be able to see the screen when unlocking your computer
+ // XF86AudioMute Would be nice to be able to shut your computer up in an emergency while it is locked
+ // XF86AudioRaiseVolume Ditto
+ // XF86AudioLowerVolume Ditto
+ //
+ //if ((event->type == KeyPress) || (event->type == KeyRelease)) {
+ if (event->type == KeyPress) {
+ 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)) || \
+ (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_AudioLowerVolume))) {
+ XEvent ev2 = *event;
+ DCOPRef ref( "*", "MainApplication-Interface");
+ ref.send("sendFakeKey", DCOPArg( ev2.xkey.keycode, "unsigned int"));
+ return true;
+ }
+ }
+
switch (event->type)
{
case KeyPress: