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
v3.5.13-sru
tpearson 14 years ago
parent 2f3e71bfb9
commit 387117c244

@ -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:

@ -64,6 +64,7 @@ public slots:
void preparePopup();
void cleanupPopup();
void checkPipe();
void desktopResized();
protected:
virtual bool x11Event(XEvent *);

@ -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 )

Loading…
Cancel
Save