|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
//===========================================================================
|
|
|
|
|
//
|
|
|
|
|
// This file is part of the KDE project
|
|
|
|
|
// This file is part of the TDE project
|
|
|
|
|
//
|
|
|
|
|
// Copyright (c) 1999 Martin R. Jones <mjones@kde.org>
|
|
|
|
|
// Copyright (c) 2003 Oswald Buddenhagen <ossi@kde.org>
|
|
|
|
|
// Copyright (c) 2010-2013 Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
|
|
|
|
// Copyright (c) 2010 - 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
//kdesktop keeps running and checks user inactivity
|
|
|
|
@ -270,8 +270,7 @@ LockProcess::LockProcess()
|
|
|
|
|
// Add KDE specific screensaver path
|
|
|
|
|
TQString relPath="System/ScreenSavers/";
|
|
|
|
|
KServiceGroup::Ptr servGroup = KServiceGroup::baseGroup( "screensavers");
|
|
|
|
|
if (servGroup)
|
|
|
|
|
{
|
|
|
|
|
if (servGroup) {
|
|
|
|
|
relPath=servGroup->relPath();
|
|
|
|
|
kdDebug(1204) << "relPath=" << relPath << endl;
|
|
|
|
|
}
|
|
|
|
@ -283,12 +282,13 @@ LockProcess::LockProcess()
|
|
|
|
|
gXA_VROOT = XInternAtom (tqt_xdisplay(), "__SWM_VROOT", False);
|
|
|
|
|
gXA_SCREENSAVER_VERSION = XInternAtom (tqt_xdisplay(), "_SCREENSAVER_VERSION", False);
|
|
|
|
|
|
|
|
|
|
TQStringList dmopt =
|
|
|
|
|
TQStringList::split(TQChar(','),
|
|
|
|
|
TQStringList dmopt = TQStringList::split(TQChar(','),
|
|
|
|
|
TQString::fromLatin1( ::getenv( "XDM_MANAGED" )));
|
|
|
|
|
for (TQStringList::ConstIterator it = dmopt.begin(); it != dmopt.end(); ++it)
|
|
|
|
|
if ((*it).startsWith("method="))
|
|
|
|
|
for (TQStringList::ConstIterator it = dmopt.begin(); it != dmopt.end(); ++it) {
|
|
|
|
|
if ((*it).startsWith("method=")) {
|
|
|
|
|
mMethod = (*it).mid(7);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef KEEP_MOUSE_UNGRABBED
|
|
|
|
|
setEnabled(false);
|
|
|
|
@ -467,8 +467,7 @@ bool LockProcess::closeCurrentWindow()
|
|
|
|
|
|
|
|
|
|
void LockProcess::timerEvent(TQTimerEvent *ev)
|
|
|
|
|
{
|
|
|
|
|
if (mAutoLogout && ev->timerId() == mAutoLogoutTimerId)
|
|
|
|
|
{
|
|
|
|
|
if (mAutoLogout && ev->timerId() == mAutoLogoutTimerId) {
|
|
|
|
|
killTimer(mAutoLogoutTimerId);
|
|
|
|
|
AutoLogout autologout(this);
|
|
|
|
|
execDialog(&autologout);
|
|
|
|
@ -554,8 +553,7 @@ bool LockProcess::lock()
|
|
|
|
|
// the screensaver kicks in because the user moved the mouse after
|
|
|
|
|
// selecting "lock screen", that looks really untidy.
|
|
|
|
|
mBusy = true;
|
|
|
|
|
if (startLock())
|
|
|
|
|
{
|
|
|
|
|
if (startLock()) {
|
|
|
|
|
TQTimer::singleShot(1000, this, TQT_SLOT(slotDeadTimePassed()));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -576,8 +574,9 @@ bool LockProcess::defaultSave()
|
|
|
|
|
mLocked = false;
|
|
|
|
|
mOverrideHackStartupEnabled = true;
|
|
|
|
|
if (startSaver()) {
|
|
|
|
|
if (mLockGrace >= 0)
|
|
|
|
|
if (mLockGrace >= 0) {
|
|
|
|
|
TQTimer::singleShot(mLockGrace, this, TQT_SLOT(startLock()));
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
@ -725,8 +724,7 @@ bool LockProcess::inSecureDialog()
|
|
|
|
|
void LockProcess::configure()
|
|
|
|
|
{
|
|
|
|
|
// the configuration is stored in kdesktop's config file
|
|
|
|
|
if( KDesktopSettings::lock() )
|
|
|
|
|
{
|
|
|
|
|
if( KDesktopSettings::lock() ) {
|
|
|
|
|
mLockGrace = KDesktopSettings::lockGrace();
|
|
|
|
|
if (mLockGrace < 0)
|
|
|
|
|
mLockGrace = 0;
|
|
|
|
@ -736,8 +734,7 @@ void LockProcess::configure()
|
|
|
|
|
else
|
|
|
|
|
mLockGrace = -1;
|
|
|
|
|
|
|
|
|
|
if ( KDesktopSettings::autoLogout() )
|
|
|
|
|
{
|
|
|
|
|
if ( KDesktopSettings::autoLogout() ) {
|
|
|
|
|
mAutoLogout = true;
|
|
|
|
|
mAutoLogoutTimeout = KDesktopSettings::autoLogoutTimeout();
|
|
|
|
|
mAutoLogoutTimerId = startTimer(mAutoLogoutTimeout * 1000); // in milliseconds
|
|
|
|
@ -773,31 +770,25 @@ void LockProcess::configure()
|
|
|
|
|
//
|
|
|
|
|
void LockProcess::readSaver()
|
|
|
|
|
{
|
|
|
|
|
if (!mSaver.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
if (!mSaver.isEmpty()) {
|
|
|
|
|
TQString file = locate("scrsav", mSaver);
|
|
|
|
|
|
|
|
|
|
bool opengl = kapp->authorize("opengl_screensavers");
|
|
|
|
|
bool manipulatescreen = kapp->authorize("manipulatescreen_screensavers");
|
|
|
|
|
KDesktopFile config(file, true);
|
|
|
|
|
if (config.readEntry("X-TDE-Type").utf8() != 0)
|
|
|
|
|
{
|
|
|
|
|
if (config.readEntry("X-TDE-Type").utf8() != 0) {
|
|
|
|
|
TQString saverType = config.readEntry("X-TDE-Type").utf8();
|
|
|
|
|
TQStringList saverTypes = TQStringList::split(";", saverType);
|
|
|
|
|
for (uint i = 0; i < saverTypes.count(); i++)
|
|
|
|
|
{
|
|
|
|
|
if ((saverTypes[i] == "ManipulateScreen") && !manipulatescreen)
|
|
|
|
|
{
|
|
|
|
|
for (uint i = 0; i < saverTypes.count(); i++) {
|
|
|
|
|
if ((saverTypes[i] == "ManipulateScreen") && !manipulatescreen) {
|
|
|
|
|
kdDebug(1204) << "Screensaver is type ManipulateScreen and ManipulateScreen is forbidden" << endl;
|
|
|
|
|
mForbidden = true;
|
|
|
|
|
}
|
|
|
|
|
if ((saverTypes[i] == "OpenGL") && !opengl)
|
|
|
|
|
{
|
|
|
|
|
if ((saverTypes[i] == "OpenGL") && !opengl) {
|
|
|
|
|
kdDebug(1204) << "Screensaver is type OpenGL and OpenGL is forbidden" << endl;
|
|
|
|
|
mForbidden = true;
|
|
|
|
|
}
|
|
|
|
|
if (saverTypes[i] == "OpenGL")
|
|
|
|
|
{
|
|
|
|
|
if (saverTypes[i] == "OpenGL") {
|
|
|
|
|
mOpenGLVisual = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -806,15 +797,13 @@ void LockProcess::readSaver()
|
|
|
|
|
kdDebug(1204) << "mForbidden: " << (mForbidden ? "true" : "false") << endl;
|
|
|
|
|
|
|
|
|
|
if (trinity_desktop_lock_use_system_modal_dialogs) {
|
|
|
|
|
if (config.hasActionGroup("InWindow"))
|
|
|
|
|
{
|
|
|
|
|
if (config.hasActionGroup("InWindow")) {
|
|
|
|
|
config.setActionGroup("InWindow");
|
|
|
|
|
mSaverExec = config.readPathEntry("Exec");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (config.hasActionGroup("Root"))
|
|
|
|
|
{
|
|
|
|
|
if (config.hasActionGroup("Root")) {
|
|
|
|
|
config.setActionGroup("Root");
|
|
|
|
|
mSaverExec = config.readPathEntry("Exec");
|
|
|
|
|
}
|
|
|
|
@ -833,10 +822,8 @@ void LockProcess::createSaverWindow()
|
|
|
|
|
XVisualInfo* info = NULL;
|
|
|
|
|
int flags = trinity_desktop_lock_use_system_modal_dialogs?0:CWOverrideRedirect;
|
|
|
|
|
#ifdef HAVE_GLXCHOOSEVISUAL
|
|
|
|
|
if( mOpenGLVisual )
|
|
|
|
|
{
|
|
|
|
|
static int attribs[][ 15 ] =
|
|
|
|
|
{
|
|
|
|
|
if( mOpenGLVisual ) {
|
|
|
|
|
static int attribs[][ 15 ] = {
|
|
|
|
|
#define R GLX_RED_SIZE
|
|
|
|
|
#define G GLX_GREEN_SIZE
|
|
|
|
|
#define B GLX_BLUE_SIZE
|
|
|
|
@ -887,8 +874,7 @@ void LockProcess::createSaverWindow()
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( !info )
|
|
|
|
|
{
|
|
|
|
|
if ( !info ) {
|
|
|
|
|
printf("[WARNING] Unable to locate matching X11 GLX Visual; this OpenGL application may not function correctly!\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1131,11 +1117,8 @@ void LockProcess::saveVRoot()
|
|
|
|
|
int (*oldHandler)(Display *, XErrorEvent *);
|
|
|
|
|
oldHandler = XSetErrorHandler(ignoreXError);
|
|
|
|
|
|
|
|
|
|
if (XQueryTree(tqt_xdisplay(), root, &rootReturn, &parentReturn,
|
|
|
|
|
&children, &numChildren))
|
|
|
|
|
{
|
|
|
|
|
for (unsigned int i = 0; i < numChildren; i++)
|
|
|
|
|
{
|
|
|
|
|
if (XQueryTree(tqt_xdisplay(), root, &rootReturn, &parentReturn, &children, &numChildren)) {
|
|
|
|
|
for (unsigned int i = 0; i < numChildren; i++) {
|
|
|
|
|
Atom actual_type;
|
|
|
|
|
int actual_format;
|
|
|
|
|
unsigned long nitems, bytesafter;
|
|
|
|
@ -1143,8 +1126,7 @@ void LockProcess::saveVRoot()
|
|
|
|
|
|
|
|
|
|
if ((XGetWindowProperty(tqt_xdisplay(), children[i], gXA_VROOT, 0, 1,
|
|
|
|
|
False, XA_WINDOW, &actual_type, &actual_format, &nitems, &bytesafter,
|
|
|
|
|
&newRoot) == Success) && newRoot)
|
|
|
|
|
{
|
|
|
|
|
&newRoot) == Success) && newRoot) {
|
|
|
|
|
gVRoot = children[i];
|
|
|
|
|
Window *dummy = (Window*)newRoot;
|
|
|
|
|
gVRootData = *dummy;
|
|
|
|
@ -1152,8 +1134,7 @@ void LockProcess::saveVRoot()
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (children)
|
|
|
|
|
{
|
|
|
|
|
if (children) {
|
|
|
|
|
XFree((char *)children);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1250,21 +1231,17 @@ bool LockProcess::grabInput()
|
|
|
|
|
{
|
|
|
|
|
XSync(tqt_xdisplay(), False);
|
|
|
|
|
|
|
|
|
|
if (!grabKeyboard())
|
|
|
|
|
{
|
|
|
|
|
if (!grabKeyboard()) {
|
|
|
|
|
usleep(100000);
|
|
|
|
|
if (!grabKeyboard())
|
|
|
|
|
{
|
|
|
|
|
if (!grabKeyboard()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef KEEP_MOUSE_UNGRABBED
|
|
|
|
|
if (!grabMouse())
|
|
|
|
|
{
|
|
|
|
|
if (!grabMouse()) {
|
|
|
|
|
usleep(100000);
|
|
|
|
|
if (!grabMouse())
|
|
|
|
|
{
|
|
|
|
|
if (!grabMouse()) {
|
|
|
|
|
XUngrabKeyboard(tqt_xdisplay(), CurrentTime);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -1423,15 +1400,17 @@ void LockProcess::stopSaver()
|
|
|
|
|
hideSaverWindow();
|
|
|
|
|
mVisibility = false;
|
|
|
|
|
if (!child_saver) {
|
|
|
|
|
if (mLocked)
|
|
|
|
|
if (mLocked) {
|
|
|
|
|
DM().setLock( false );
|
|
|
|
|
}
|
|
|
|
|
ungrabInput();
|
|
|
|
|
const char *out = "GOAWAY!";
|
|
|
|
|
for (TQValueList<int>::ConstIterator it = child_sockets.begin(); it != child_sockets.end(); ++it)
|
|
|
|
|
for (TQValueList<int>::ConstIterator it = child_sockets.begin(); it != child_sockets.end(); ++it) {
|
|
|
|
|
if (write(*it, out, sizeof(out)) == -1) {
|
|
|
|
|
// Error handler to shut up gcc warnings
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// private static
|
|
|
|
@ -1439,10 +1418,11 @@ TQVariant LockProcess::getConf(void *ctx, const char *key, const TQVariant &dflt
|
|
|
|
|
{
|
|
|
|
|
LockProcess *that = (LockProcess *)ctx;
|
|
|
|
|
TQString fkey = TQString::fromLatin1( key ) + '=';
|
|
|
|
|
for (TQStringList::ConstIterator it = that->mPluginOptions.begin();
|
|
|
|
|
it != that->mPluginOptions.end(); ++it)
|
|
|
|
|
if ((*it).startsWith( fkey ))
|
|
|
|
|
for (TQStringList::ConstIterator it = that->mPluginOptions.begin(); it != that->mPluginOptions.end(); ++it) {
|
|
|
|
|
if ((*it).startsWith( fkey )) {
|
|
|
|
|
return (*it).mid( fkey.length() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return dflt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1464,8 +1444,7 @@ bool LockProcess::startLock()
|
|
|
|
|
{
|
|
|
|
|
for (TQStringList::ConstIterator it = mPlugins.begin(); it != mPlugins.end(); ++it) {
|
|
|
|
|
GreeterPluginHandle plugin;
|
|
|
|
|
TQString path = KLibLoader::self()->findLibrary(
|
|
|
|
|
((*it)[0] == '/' ? *it : "kgreet_" + *it ).latin1() );
|
|
|
|
|
TQString path = KLibLoader::self()->findLibrary( ((*it)[0] == '/' ? *it : "kgreet_" + *it ).latin1() );
|
|
|
|
|
if (path.isEmpty()) {
|
|
|
|
|
kdWarning(1204) << "GreeterPlugin " << *it << " does not exist" << endl;
|
|
|
|
|
continue;
|
|
|
|
@ -1565,10 +1544,11 @@ bool LockProcess::startHack()
|
|
|
|
|
{
|
|
|
|
|
mHackActive = TRUE;
|
|
|
|
|
|
|
|
|
|
if ((mEnsureVRootWindowSecurityTimer) && (!mEnsureVRootWindowSecurityTimer->isActive())) mEnsureVRootWindowSecurityTimer->start(250, FALSE);
|
|
|
|
|
if ((mEnsureVRootWindowSecurityTimer) && (!mEnsureVRootWindowSecurityTimer->isActive())) {
|
|
|
|
|
mEnsureVRootWindowSecurityTimer->start(250, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currentDialog || (!mDialogs.isEmpty()))
|
|
|
|
|
{
|
|
|
|
|
if (currentDialog || (!mDialogs.isEmpty())) {
|
|
|
|
|
// no resuming with dialog visible or when not visible
|
|
|
|
|
if (argb_visual) {
|
|
|
|
|
setTransparentBackgroundARGB();
|
|
|
|
@ -1590,13 +1570,11 @@ bool LockProcess::startHack()
|
|
|
|
|
setCursor( tqblankCursor );
|
|
|
|
|
XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(tqblankCursor).handle(), CurrentTime);
|
|
|
|
|
|
|
|
|
|
if (mSaverExec.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
if (mSaverExec.isEmpty()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mHackProc.isRunning())
|
|
|
|
|
{
|
|
|
|
|
if (mHackProc.isRunning()) {
|
|
|
|
|
stopHack();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1607,14 +1585,12 @@ bool LockProcess::startHack()
|
|
|
|
|
ts >> word;
|
|
|
|
|
TQString path = TDEStandardDirs::findExe(word);
|
|
|
|
|
|
|
|
|
|
if (!path.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
if (!path.isEmpty()) {
|
|
|
|
|
mHackProc << path;
|
|
|
|
|
|
|
|
|
|
kdDebug(1204) << "Starting hack: " << path << endl;
|
|
|
|
|
|
|
|
|
|
while (!ts.atEnd())
|
|
|
|
|
{
|
|
|
|
|
while (!ts.atEnd()) {
|
|
|
|
|
ts >> word;
|
|
|
|
|
if (word == "%w")
|
|
|
|
|
{
|
|
|
|
@ -1623,8 +1599,7 @@ bool LockProcess::startHack()
|
|
|
|
|
mHackProc << word;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!mForbidden)
|
|
|
|
|
{
|
|
|
|
|
if (!mForbidden) {
|
|
|
|
|
if (trinity_desktop_lock_use_system_modal_dialogs) {
|
|
|
|
|
// Make sure we have a nice clean display to start with!
|
|
|
|
|
if (argb_visual) {
|
|
|
|
@ -1650,8 +1625,7 @@ bool LockProcess::startHack()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(tqblankCursor).handle(), CurrentTime);
|
|
|
|
|
if (mHackProc.start() == true)
|
|
|
|
|
{
|
|
|
|
|
if (mHackProc.start() == true) {
|
|
|
|
|
#ifdef HAVE_SETPRIORITY
|
|
|
|
|
setpriority(PRIO_PROCESS, mHackProc.pid(), mPriority);
|
|
|
|
|
#endif
|
|
|
|
@ -1667,10 +1641,9 @@ bool LockProcess::startHack()
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
else {
|
|
|
|
|
// we aren't allowed to start the specified screensaver either because it didn't run for some reason
|
|
|
|
|
// according to the kiosk restrictions forbid it
|
|
|
|
|
{
|
|
|
|
|
usleep(100);
|
|
|
|
|
TQApplication::syncX();
|
|
|
|
|
if (!trinity_desktop_lock_use_system_modal_dialogs) {
|
|
|
|
@ -1706,7 +1679,12 @@ bool LockProcess::startHack()
|
|
|
|
|
saverReadyIfNeeded();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (m_startupStatusDialog) { m_startupStatusDialog->closeSMDialog(); m_startupStatusDialog=NULL; }
|
|
|
|
|
|
|
|
|
|
if (m_startupStatusDialog) {
|
|
|
|
|
m_startupStatusDialog->closeSMDialog();
|
|
|
|
|
m_startupStatusDialog=NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1714,11 +1692,9 @@ bool LockProcess::startHack()
|
|
|
|
|
//
|
|
|
|
|
void LockProcess::stopHack()
|
|
|
|
|
{
|
|
|
|
|
if (mHackProc.isRunning())
|
|
|
|
|
{
|
|
|
|
|
if (mHackProc.isRunning()) {
|
|
|
|
|
mHackProc.kill();
|
|
|
|
|
if (!mHackProc.wait(10))
|
|
|
|
|
{
|
|
|
|
|
if (!mHackProc.wait(10)) {
|
|
|
|
|
mHackProc.kill(SIGKILL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1799,13 +1775,14 @@ void LockProcess::displayLockDialogIfNeeded()
|
|
|
|
|
|
|
|
|
|
void LockProcess::suspend()
|
|
|
|
|
{
|
|
|
|
|
if(!mSuspended)
|
|
|
|
|
{
|
|
|
|
|
if (!mSuspended) {
|
|
|
|
|
if (trinity_desktop_lock_use_system_modal_dialogs) {
|
|
|
|
|
mSuspended = true;
|
|
|
|
|
stopHack();
|
|
|
|
|
ENABLE_CONTINUOUS_LOCKDLG_DISPLAY
|
|
|
|
|
if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE);
|
|
|
|
|
if (mHackStartupEnabled) {
|
|
|
|
|
mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
TQString hackStatus;
|
|
|
|
@ -1863,8 +1840,7 @@ void LockProcess::resume( bool force )
|
|
|
|
|
saverReadyIfNeeded();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ((mSuspended) && (mHackProc.isRunning()))
|
|
|
|
|
{
|
|
|
|
|
if ((mSuspended) && (mHackProc.isRunning())) {
|
|
|
|
|
XForceScreenSaver(tqt_xdisplay(), ScreenSaverReset );
|
|
|
|
|
bitBlt( this, 0, 0, &mSavedScreen );
|
|
|
|
|
TQApplication::syncX();
|
|
|
|
@ -1933,8 +1909,7 @@ bool LockProcess::checkPass()
|
|
|
|
|
XWindowAttributes rootAttr;
|
|
|
|
|
XGetWindowAttributes(tqt_xdisplay(), RootWindow(tqt_xdisplay(),
|
|
|
|
|
tqt_xscreen()), &rootAttr);
|
|
|
|
|
if(( rootAttr.your_event_mask & SubstructureNotifyMask ) == 0 )
|
|
|
|
|
{
|
|
|
|
|
if(( rootAttr.your_event_mask & SubstructureNotifyMask ) == 0 ) {
|
|
|
|
|
kdWarning() << "ERROR: Something removed SubstructureNotifyMask from the root window!!!" << endl;
|
|
|
|
|
XSelectInput( tqt_xdisplay(), tqt_xrootwin(),
|
|
|
|
|
SubstructureNotifyMask | rootAttr.your_event_mask );
|
|
|
|
@ -1977,8 +1952,7 @@ int LockProcess::execDialog( TQDialog *dlg )
|
|
|
|
|
rect.moveCenter(TDEGlobalSettings::desktopGeometry(TQCursor::pos()).center());
|
|
|
|
|
dlg->move( rect.topLeft() );
|
|
|
|
|
|
|
|
|
|
if (mDialogs.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
if (mDialogs.isEmpty()) {
|
|
|
|
|
suspend();
|
|
|
|
|
XChangeActivePointerGrab( tqt_xdisplay(), GRABEVENTS, TQCursor(tqarrowCursor).handle(), CurrentTime);
|
|
|
|
|
}
|
|
|
|
@ -1999,7 +1973,9 @@ int LockProcess::execDialog( TQDialog *dlg )
|
|
|
|
|
oldHandler = XSetErrorHandler(ignoreXError);
|
|
|
|
|
int rt = dlg->exec();
|
|
|
|
|
XSetErrorHandler(oldHandler);
|
|
|
|
|
while (mDialogControlLock == true) usleep(100000);
|
|
|
|
|
while (mDialogControlLock == true) {
|
|
|
|
|
usleep(100000);
|
|
|
|
|
}
|
|
|
|
|
currentDialog = NULL;
|
|
|
|
|
mDialogs.remove( dlg );
|
|
|
|
|
if( mDialogs.isEmpty() ) {
|
|
|
|
@ -2024,7 +2000,8 @@ int LockProcess::execDialog( TQDialog *dlg )
|
|
|
|
|
else {
|
|
|
|
|
resume( false );
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
fakeFocusIn( mDialogs.first()->winId());
|
|
|
|
|
currentDialog = dynamic_cast<TQDialog*>(mDialogs.first());
|
|
|
|
|
}
|
|
|
|
@ -2117,7 +2094,9 @@ void LockProcess::doFunctionKeyBroadcast() {
|
|
|
|
|
mBusy=true;
|
|
|
|
|
TQTimer::singleShot(1000, this, TQT_SLOT(slotDeadTimePassed()));
|
|
|
|
|
if (mkeyCode == XKeysymToKeycode(tqt_xdisplay(), XF86XK_Display)) {
|
|
|
|
|
while (mDialogControlLock == true) usleep(100000);
|
|
|
|
|
while (mDialogControlLock == true) {
|
|
|
|
|
usleep(100000);
|
|
|
|
|
}
|
|
|
|
|
mDialogControlLock = true;
|
|
|
|
|
currentDialog->close(); // DO NOT use closeCurrentWindow() here!
|
|
|
|
|
mDialogControlLock = false;
|
|
|
|
@ -2172,41 +2151,43 @@ bool LockProcess::x11Event(XEvent *event)
|
|
|
|
|
case ButtonPress:
|
|
|
|
|
case MotionNotify:
|
|
|
|
|
case ButtonRelease:
|
|
|
|
|
if( forwardVkbdEvent( event ))
|
|
|
|
|
if( forwardVkbdEvent( event )) {
|
|
|
|
|
return true; // filter out
|
|
|
|
|
}
|
|
|
|
|
// fall through
|
|
|
|
|
case KeyPress:
|
|
|
|
|
if ((mHackDelayStartupTimer) && (mHackDelayStartupTimer->isActive())) {
|
|
|
|
|
if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE);
|
|
|
|
|
}
|
|
|
|
|
if (mBusy || !mDialogs.isEmpty())
|
|
|
|
|
if (mBusy || !mDialogs.isEmpty()) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
mBusy = true;
|
|
|
|
|
if (trinity_desktop_lock_delay_screensaver_start) {
|
|
|
|
|
if (mLocked) {
|
|
|
|
|
ENABLE_CONTINUOUS_LOCKDLG_DISPLAY
|
|
|
|
|
if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE);
|
|
|
|
|
if (mHackStartupEnabled) {
|
|
|
|
|
mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE);
|
|
|
|
|
}
|
|
|
|
|
if ((!mLocked) && (!mInSecureDialog))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
if ((!mLocked) && (!mInSecureDialog)) {
|
|
|
|
|
stopSaver();
|
|
|
|
|
kapp->quit();
|
|
|
|
|
}
|
|
|
|
|
if (mAutoLogout) // we need to restart the auto logout countdown
|
|
|
|
|
{
|
|
|
|
|
if (mAutoLogout) {
|
|
|
|
|
// we need to restart the auto logout countdown
|
|
|
|
|
killTimer(mAutoLogoutTimerId);
|
|
|
|
|
mAutoLogoutTimerId = startTimer(mAutoLogoutTimeout);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (!mLocked || checkPass())
|
|
|
|
|
{
|
|
|
|
|
if (!mLocked || checkPass()) {
|
|
|
|
|
mClosingWindows = true;
|
|
|
|
|
stopSaver();
|
|
|
|
|
kapp->quit();
|
|
|
|
|
}
|
|
|
|
|
else if (mAutoLogout) // we need to restart the auto logout countdown
|
|
|
|
|
{
|
|
|
|
|
else if (mAutoLogout) {
|
|
|
|
|
// we need to restart the auto logout countdown
|
|
|
|
|
killTimer(mAutoLogoutTimerId);
|
|
|
|
|
mAutoLogoutTimerId = startTimer(mAutoLogoutTimeout);
|
|
|
|
|
}
|
|
|
|
@ -2215,15 +2196,14 @@ bool LockProcess::x11Event(XEvent *event)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case VisibilityNotify:
|
|
|
|
|
if( event->xvisibility.window == winId())
|
|
|
|
|
{ // mVisibility == false means the screensaver is not visible at all
|
|
|
|
|
if( event->xvisibility.window == winId()) {
|
|
|
|
|
// mVisibility == false means the screensaver is not visible at all
|
|
|
|
|
// e.g. when switched to text console
|
|
|
|
|
mVisibility = !(event->xvisibility.state == VisibilityFullyObscured);
|
|
|
|
|
if(!mVisibility) {
|
|
|
|
|
mSuspendTimer.start(2000, true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
else {
|
|
|
|
|
mSuspendTimer.stop();
|
|
|
|
|
if (mResizingDesktopLock == false) {
|
|
|
|
|
if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced && trinity_desktop_lock_use_system_modal_dialogs) {
|
|
|
|
@ -2267,17 +2247,17 @@ bool LockProcess::x11Event(XEvent *event)
|
|
|
|
|
break;
|
|
|
|
|
case MapNotify: // from SubstructureNotifyMask on the root window
|
|
|
|
|
windowAdded( event->xmap.window, false );
|
|
|
|
|
if( event->xmap.event == tqt_xrootwin())
|
|
|
|
|
if( event->xmap.event == tqt_xrootwin()) {
|
|
|
|
|
stayOnTop();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case DestroyNotify:
|
|
|
|
|
for( TQValueList< VkbdWindow >::Iterator it = mVkbdWindows.begin();
|
|
|
|
|
it != mVkbdWindows.end();
|
|
|
|
|
++it )
|
|
|
|
|
for( TQValueList< VkbdWindow >::Iterator it = mVkbdWindows.begin(); it != mVkbdWindows.end(); ++it ) {
|
|
|
|
|
if( (*it).id == event->xdestroywindow.window ) {
|
|
|
|
|
mVkbdWindows.remove( it );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2290,8 +2270,7 @@ bool LockProcess::x11Event(XEvent *event)
|
|
|
|
|
// so let's simply dupe it with correct destination window,
|
|
|
|
|
// and ignore the original one.
|
|
|
|
|
if(!mDialogs.isEmpty() && ( event->type == KeyPress || event->type == KeyRelease)
|
|
|
|
|
&& event->xkey.window != mDialogs.first()->winId())
|
|
|
|
|
{
|
|
|
|
|
&& event->xkey.window != mDialogs.first()->winId()) {
|
|
|
|
|
XEvent ev2 = *event;
|
|
|
|
|
ev2.xkey.window = ev2.xkey.subwindow = mDialogs.first()->winId();
|
|
|
|
|
tqApp->x11ProcessEvent( &ev2 );
|
|
|
|
@ -2303,34 +2282,34 @@ bool LockProcess::x11Event(XEvent *event)
|
|
|
|
|
|
|
|
|
|
void LockProcess::stayOnTop()
|
|
|
|
|
{
|
|
|
|
|
if(!mDialogs.isEmpty() || !mVkbdWindows.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
if(!mDialogs.isEmpty() || !mVkbdWindows.isEmpty()) {
|
|
|
|
|
// this restacking is written in a way so that
|
|
|
|
|
// if the stacking positions actually don't change,
|
|
|
|
|
// all restacking operations will be no-op,
|
|
|
|
|
// and no ConfigureNotify will be generated,
|
|
|
|
|
// thus avoiding possible infinite loops
|
|
|
|
|
if( !mVkbdWindows.isEmpty())
|
|
|
|
|
if( !mVkbdWindows.isEmpty()) {
|
|
|
|
|
XRaiseWindow( tqt_xdisplay(), mVkbdWindows.first().id );
|
|
|
|
|
else
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
XRaiseWindow( tqt_xdisplay(), mDialogs.first()->winId()); // raise topmost
|
|
|
|
|
}
|
|
|
|
|
// and stack others below it
|
|
|
|
|
Window* stack = new Window[ mDialogs.count() + mVkbdWindows.count() + 1 ];
|
|
|
|
|
int count = 0;
|
|
|
|
|
for( TQValueList< VkbdWindow >::ConstIterator it = mVkbdWindows.begin();
|
|
|
|
|
it != mVkbdWindows.end();
|
|
|
|
|
++it )
|
|
|
|
|
for( TQValueList< VkbdWindow >::ConstIterator it = mVkbdWindows.begin(); it != mVkbdWindows.end(); ++it )
|
|
|
|
|
stack[ count++ ] = (*it).id;
|
|
|
|
|
for( TQValueList< TQWidget* >::ConstIterator it = mDialogs.begin();
|
|
|
|
|
it != mDialogs.end();
|
|
|
|
|
++it )
|
|
|
|
|
}
|
|
|
|
|
for( TQValueList< TQWidget* >::ConstIterator it = mDialogs.begin(); it != mDialogs.end(); ++it )
|
|
|
|
|
stack[ count++ ] = (*it)->winId();
|
|
|
|
|
}
|
|
|
|
|
stack[ count++ ] = winId();
|
|
|
|
|
XRestackWindows( x11Display(), stack, count );
|
|
|
|
|
delete[] stack;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
else {
|
|
|
|
|
XRaiseWindow(tqt_xdisplay(), winId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LockProcess::checkDPMSActive()
|
|
|
|
@ -2361,41 +2340,48 @@ void LockProcess::checkDPMSActive()
|
|
|
|
|
static enum { Unknown, Yes, No } can_do_xf86_lock = Unknown;
|
|
|
|
|
void LockProcess::lockXF86()
|
|
|
|
|
{
|
|
|
|
|
if( can_do_xf86_lock == Unknown )
|
|
|
|
|
{
|
|
|
|
|
if( can_do_xf86_lock == Unknown ) {
|
|
|
|
|
int major, minor;
|
|
|
|
|
if( XF86MiscQueryVersion( tqt_xdisplay(), &major, &minor )
|
|
|
|
|
&& major >= 0 && minor >= 5 )
|
|
|
|
|
if( XF86MiscQueryVersion( tqt_xdisplay(), &major, &minor ) && major >= 0 && minor >= 5 ) {
|
|
|
|
|
can_do_xf86_lock = Yes;
|
|
|
|
|
else
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
can_do_xf86_lock = No;
|
|
|
|
|
}
|
|
|
|
|
if( can_do_xf86_lock != Yes )
|
|
|
|
|
}
|
|
|
|
|
if( can_do_xf86_lock != Yes ) {
|
|
|
|
|
return;
|
|
|
|
|
if( mRestoreXF86Lock )
|
|
|
|
|
}
|
|
|
|
|
if( mRestoreXF86Lock ) {
|
|
|
|
|
return;
|
|
|
|
|
if( XF86MiscSetGrabKeysState( tqt_xdisplay(), False ) != MiscExtGrabStateSuccess )
|
|
|
|
|
}
|
|
|
|
|
if( XF86MiscSetGrabKeysState( tqt_xdisplay(), False ) != MiscExtGrabStateSuccess ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// success
|
|
|
|
|
mRestoreXF86Lock = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LockProcess::unlockXF86()
|
|
|
|
|
{
|
|
|
|
|
if( can_do_xf86_lock != Yes )
|
|
|
|
|
if( can_do_xf86_lock != Yes ) {
|
|
|
|
|
return;
|
|
|
|
|
if( !mRestoreXF86Lock )
|
|
|
|
|
}
|
|
|
|
|
if( !mRestoreXF86Lock ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
XF86MiscSetGrabKeysState( tqt_xdisplay(), True );
|
|
|
|
|
mRestoreXF86Lock = false;
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
void LockProcess::lockXF86()
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LockProcess::unlockXF86()
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -2408,10 +2394,12 @@ void LockProcess::msgBox( TQMessageBox::Icon type, const TQString &txt )
|
|
|
|
|
}
|
|
|
|
|
box.setCaption(i18n("Authentication Subsystem Notice"));
|
|
|
|
|
TQFrame *winFrame = new TQFrame( &box );
|
|
|
|
|
if (trinity_desktop_lock_use_system_modal_dialogs)
|
|
|
|
|
if (trinity_desktop_lock_use_system_modal_dialogs) {
|
|
|
|
|
winFrame->setFrameStyle( TQFrame::NoFrame );
|
|
|
|
|
else
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised );
|
|
|
|
|
}
|
|
|
|
|
winFrame->setLineWidth( 2 );
|
|
|
|
|
TQLabel *label1 = new TQLabel( winFrame );
|
|
|
|
|
label1->setPixmap( TQMessageBox::standardIcon( type ) );
|
|
|
|
@ -2438,8 +2426,7 @@ void LockProcess::showVkbd()
|
|
|
|
|
#ifdef WITH_HAL
|
|
|
|
|
int status = system( "hal-find-by-property --key system.formfactor.subtype --string tabletpc" );
|
|
|
|
|
// status = 0; // enable for testing
|
|
|
|
|
run_vkbd = ( WIFEXITED( status ) && WEXITSTATUS( status ) == 0
|
|
|
|
|
&& !TDEStandardDirs::findExe( "xvkbd" ).isEmpty()) ? 1 : 0;
|
|
|
|
|
run_vkbd = ( WIFEXITED( status ) && WEXITSTATUS( status ) == 0 && !TDEStandardDirs::findExe( "xvkbd" ).isEmpty()) ? 1 : 0;
|
|
|
|
|
#else // WITH_HAL
|
|
|
|
|
run_vkbd = (!TDEStandardDirs::findExe( "xvkbd" ).isEmpty());
|
|
|
|
|
#endif // WITH_HAL
|
|
|
|
@ -2480,8 +2467,9 @@ void LockProcess::windowAdded( WId w, bool managed )
|
|
|
|
|
KWin::WindowInfo info = KWin::windowInfo( w, 0, NET::WM2WindowClass );
|
|
|
|
|
XSetErrorHandler(oldHandler);
|
|
|
|
|
|
|
|
|
|
if( info.windowClassClass().lower() != "xvkbd" )
|
|
|
|
|
if( info.windowClassClass().lower() != "xvkbd" ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// Unmanaged windows (i.e. popups) don't currently work anyway, since they
|
|
|
|
|
// don't have WM_CLASS set anyway. I could perhaps try tricks with X id
|
|
|
|
|
// ranges if really needed.
|
|
|
|
@ -2503,14 +2491,16 @@ void LockProcess::windowAdded( WId w, bool managed )
|
|
|
|
|
withdrawn = (*wstate == WithdrawnState );
|
|
|
|
|
XFree( (char *)data );
|
|
|
|
|
}
|
|
|
|
|
if( withdrawn )
|
|
|
|
|
if( withdrawn ) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
XSelectInput( tqt_xdisplay(), w, StructureNotifyMask );
|
|
|
|
|
XWindowAttributes attr_geom;
|
|
|
|
|
if( !XGetWindowAttributes( tqt_xdisplay(), w, &attr_geom ))
|
|
|
|
|
if( !XGetWindowAttributes( tqt_xdisplay(), w, &attr_geom )) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
int x = XDisplayWidth( tqt_xdisplay(), tqt_xscreen()) - attr_geom.width;
|
|
|
|
|
int y = XDisplayHeight( tqt_xdisplay(), tqt_xscreen()) - attr_geom.height;
|
|
|
|
|
if( managed ) {
|
|
|
|
@ -2530,8 +2520,9 @@ void LockProcess::windowAdded( WId w, bool managed )
|
|
|
|
|
|
|
|
|
|
bool LockProcess::forwardVkbdEvent( XEvent* event )
|
|
|
|
|
{
|
|
|
|
|
if( mVkbdProcess == NULL )
|
|
|
|
|
if( mVkbdProcess == NULL ) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
TQPoint pos;
|
|
|
|
|
Time time;
|
|
|
|
|
switch( event->type )
|
|
|
|
@ -2549,9 +2540,7 @@ bool LockProcess::forwardVkbdEvent( XEvent* event )
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// vkbd windows are kept topmost, so just find the first one in the position
|
|
|
|
|
for( TQValueList< VkbdWindow >::ConstIterator it = mVkbdWindows.begin();
|
|
|
|
|
it != mVkbdWindows.end();
|
|
|
|
|
++it ) {
|
|
|
|
|
for( TQValueList< VkbdWindow >::ConstIterator it = mVkbdWindows.begin(); it != mVkbdWindows.end(); ++it ) {
|
|
|
|
|
if( TQT_TQRECT_OBJECT((*it).rect).contains( pos )) {
|
|
|
|
|
// Find the subwindow where the event should actually go.
|
|
|
|
|
// Not exactly cheap in the number of X roundtrips but oh well.
|
|
|
|
@ -2560,10 +2549,12 @@ bool LockProcess::forwardVkbdEvent( XEvent* event )
|
|
|
|
|
int root_x, root_y, x, y;
|
|
|
|
|
unsigned int mask;
|
|
|
|
|
for(;;) {
|
|
|
|
|
if( !XQueryPointer( tqt_xdisplay(), window, &root, &child, &root_x, &root_y, &x, &y, &mask ))
|
|
|
|
|
if( !XQueryPointer( tqt_xdisplay(), window, &root, &child, &root_x, &root_y, &x, &y, &mask )) {
|
|
|
|
|
return false;
|
|
|
|
|
if( child == None )
|
|
|
|
|
}
|
|
|
|
|
if( child == None ) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
window = child;
|
|
|
|
|
}
|
|
|
|
|
switch( event->type )
|
|
|
|
@ -2595,8 +2586,9 @@ bool LockProcess::forwardVkbdEvent( XEvent* event )
|
|
|
|
|
// not needed otherwise it seems).
|
|
|
|
|
void LockProcess::sendVkbdFocusInOut( WId window, Time t )
|
|
|
|
|
{
|
|
|
|
|
if( mVkbdLastEventWindow == window )
|
|
|
|
|
if( mVkbdLastEventWindow == window ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if( mVkbdLastEventWindow != None ) {
|
|
|
|
|
XEvent e;
|
|
|
|
|
e.xcrossing.type = LeaveNotify;
|
|
|
|
|