summaryrefslogtreecommitdiffstats
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
parent2f3e71bfb99194163418662d6324a2a2f4545e70 (diff)
downloadtdebase-387117c2.tar.gz
tdebase-387117c2.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
-rw-r--r--kdesktop/lock/lockprocess.cc52
-rw-r--r--kdesktop/lock/lockprocess.h1
-rw-r--r--kicker/applets/minipager/pagerapplet.cpp6
3 files changed, 59 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:
diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h
index eed5f92b9..ee1621bc8 100644
--- a/kdesktop/lock/lockprocess.h
+++ b/kdesktop/lock/lockprocess.h
@@ -64,6 +64,7 @@ public slots:
void preparePopup();
void cleanupPopup();
void checkPipe();
+ void desktopResized();
protected:
virtual bool x11Event(XEvent *);
diff --git a/kicker/applets/minipager/pagerapplet.cpp b/kicker/applets/minipager/pagerapplet.cpp
index 5c761c03f..0998957cc 100644
--- a/kicker/applets/minipager/pagerapplet.cpp
+++ b/kicker/applets/minipager/pagerapplet.cpp
@@ -493,6 +493,9 @@ void KMiniPager::drawButtons()
void KMiniPager::slotSetDesktopCount( int )
{
+ QSize s(m_kwin->numberOfViewports(m_kwin->currentDesktop()));
+ m_useViewports = s.width() * s.height() > 1;
+
QValueList<KMiniPagerButton*>::ConstIterator it;
QValueList<KMiniPagerButton*>::ConstIterator itEnd = m_desktops.end();
for( it = m_desktops.begin(); it != itEnd; ++it )
@@ -515,6 +518,9 @@ void KMiniPager::slotSetDesktopCount( int )
void KMiniPager::slotRefreshViewportCount( int )
{
+ QSize s(m_kwin->numberOfViewports(m_kwin->currentDesktop()));
+ m_useViewports = s.width() * s.height() > 1;
+
QValueList<KMiniPagerButton*>::ConstIterator it;
QValueList<KMiniPagerButton*>::ConstIterator itEnd = m_desktops.end();
for( it = m_desktops.begin(); it != itEnd; ++it )