diff options
Diffstat (limited to 'kdesktop')
-rw-r--r-- | kdesktop/lock/autologout.cc | 19 | ||||
-rw-r--r-- | kdesktop/lock/infodlg.cc | 18 | ||||
-rw-r--r-- | kdesktop/lock/lockdlg.cc | 66 | ||||
-rw-r--r-- | kdesktop/lock/lockdlg.h | 3 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.cc | 205 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.h | 16 | ||||
-rw-r--r-- | kdesktop/lock/main.cc | 4 | ||||
-rw-r--r-- | kdesktop/lock/querydlg.cc | 18 |
8 files changed, 320 insertions, 29 deletions
diff --git a/kdesktop/lock/autologout.cc b/kdesktop/lock/autologout.cc index 3dbb3ac6b..7a9cc9e66 100644 --- a/kdesktop/lock/autologout.cc +++ b/kdesktop/lock/autologout.cc @@ -25,12 +25,27 @@ #include <tqdialog.h> #include <tqprogressbar.h> +#include <X11/Xatom.h> + #define COUNTDOWN 30 -AutoLogout::AutoLogout(LockProcess *parent) : TQDialog(parent, "password dialog", true, (WFlags)WX11BypassWM) +extern bool trinity_desktop_lock_use_system_modal_dialogs; + +AutoLogout::AutoLogout(LockProcess *parent) : TQDialog(parent, "password dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))) { + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(qt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + setCaption(i18n("Automatic Logout Notification")); + frame = new TQFrame(this); - frame->setFrameStyle(TQFrame::Panel | TQFrame::Raised); + if (trinity_desktop_lock_use_system_modal_dialogs) + frame->setFrameStyle( TQFrame::NoFrame ); + else + frame->setFrameStyle(TQFrame::Panel | TQFrame::Raised); frame->setLineWidth(2); TQLabel *pixLabel = new TQLabel( frame, "pixlabel" ); diff --git a/kdesktop/lock/infodlg.cc b/kdesktop/lock/infodlg.cc index 60c500925..da83535c8 100644 --- a/kdesktop/lock/infodlg.cc +++ b/kdesktop/lock/infodlg.cc @@ -48,22 +48,36 @@ #include <X11/Xutil.h> #include <X11/keysym.h> +#include <X11/Xatom.h> #include <fixx11h.h> #ifndef AF_LOCAL # define AF_LOCAL AF_UNIX #endif +extern bool trinity_desktop_lock_use_system_modal_dialogs; + //=========================================================================== // // Simple dialog for displaying an unlock status or recurring error message // InfoDlg::InfoDlg(LockProcess *parent) - : TQDialog(parent, "information dialog", true, (WFlags)WX11BypassWM), + : TQDialog(parent, "information dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), mUnlockingFailed(false) { + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(qt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + setCaption(i18n("Information")); + frame = new TQFrame( this ); - frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); + if (trinity_desktop_lock_use_system_modal_dialogs) + frame->setFrameStyle( TQFrame::NoFrame ); + else + frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); frame->setLineWidth( 2 ); mpixLabel = new TQLabel( frame, "pixlabel" ); diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index ef07679b3..812933e08 100644 --- a/kdesktop/lock/lockdlg.cc +++ b/kdesktop/lock/lockdlg.cc @@ -52,26 +52,42 @@ #include <X11/Xutil.h> #include <X11/keysym.h> +#include <X11/Xatom.h> #include <fixx11h.h> #ifndef AF_LOCAL # define AF_LOCAL AF_UNIX #endif +// [FIXME] This interval should be taken from the screensaver start delay of kdesktop #define PASSDLG_HIDE_TIMEOUT 10000 +extern bool trinity_desktop_lock_autohide_lockdlg; +extern bool trinity_desktop_lock_use_system_modal_dialogs; + //=========================================================================== // // Simple dialog for entering a password. // PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin) - : TQDialog(parent, "password dialog", true, (WFlags)WX11BypassWM), + : TQDialog(parent, "password dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), mPlugin( plugin ), mCapsLocked(-1), mUnlockingFailed(false) { + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(qt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + setCaption(i18n("Authentication Required")); + frame = new TQFrame( this ); - frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); + if (trinity_desktop_lock_use_system_modal_dialogs) + frame->setFrameStyle( TQFrame::NoFrame ); + else + frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); frame->setLineWidth( 2 ); TQLabel *pixLabel = new TQLabel( frame, "pixlabel" ); @@ -93,6 +109,7 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin) mNewSessButton = new KPushButton( KGuiItem(i18n("Sw&itch User..."), "fork"), frame ); ok = new KPushButton( i18n("Unl&ock"), frame ); cancel = new KPushButton( KStdGuiItem::cancel(), frame ); + if (!trinity_desktop_lock_autohide_lockdlg) cancel->setEnabled(false); greet = plugin->info->create( this, 0, this, mLayoutButton, TQString::null, KGreeterPlugin::Authenticate, KGreeterPlugin::ExUnlock ); @@ -164,6 +181,12 @@ PasswordDlg::~PasswordDlg() delete greet; } +void PasswordDlg::reject() +{ + if (trinity_desktop_lock_autohide_lockdlg) + TQDialog::reject(); +} + void PasswordDlg::layoutClicked() { @@ -210,7 +233,12 @@ void PasswordDlg::timerEvent(TQTimerEvent *ev) { if (ev->timerId() == mTimeoutTimerId) { - reject(); + if (trinity_desktop_lock_autohide_lockdlg) { + reject(); + } + else { + slotActivity(); + } } else if (ev->timerId() == mFailedTimerId) { @@ -513,9 +541,21 @@ void PasswordDlg::slotStartNewSession() killTimer(mTimeoutTimerId); mTimeoutTimerId = 0; - TQDialog *dialog = new TQDialog( this, "warnbox", true, (WFlags)WX11BypassWM ); + TQDialog *dialog = new TQDialog( this, "warnbox", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))); + + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(qt_xdisplay(), dialog->winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + dialog->setCaption(i18n("New Session")); + TQFrame *winFrame = new TQFrame( dialog ); - winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); + if (trinity_desktop_lock_use_system_modal_dialogs) + winFrame->setFrameStyle( TQFrame::NoFrame ); + else + winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); winFrame->setLineWidth( 2 ); TQVBoxLayout *vbox = new TQVBoxLayout( dialog ); vbox->addWidget( winFrame ); @@ -627,9 +667,21 @@ void PasswordDlg::slotSwitchUser() int p = 0; DM dm; - TQDialog dialog( this, "sessbox", true, (WFlags)WX11BypassWM ); + TQDialog dialog( this, "sessbox", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM)) ); + + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(qt_xdisplay(), dialog.winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + dialog.setCaption(i18n("Switch User")); + TQFrame *winFrame = new TQFrame( &dialog ); - winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); + if (trinity_desktop_lock_use_system_modal_dialogs) + winFrame->setFrameStyle( TQFrame::NoFrame ); + else + winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); winFrame->setLineWidth( 2 ); TQBoxLayout *vbox = new TQVBoxLayout( &dialog ); vbox->addWidget( winFrame ); diff --git a/kdesktop/lock/lockdlg.h b/kdesktop/lock/lockdlg.h index 258339314..f65e93c23 100644 --- a/kdesktop/lock/lockdlg.h +++ b/kdesktop/lock/lockdlg.h @@ -58,6 +58,9 @@ private slots: void layoutClicked(); void slotActivity(); +protected slots: + virtual void reject(); + private: void setLayoutText( const TQString &txt ); void capsLocked(); diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc index c11314bb8..519646f1e 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cc @@ -51,6 +51,7 @@ #include <tqsocketnotifier.h> #include <tqvaluevector.h> #include <tqtooltip.h> +#include <tqimage.h> #include <tqdatetime.h> @@ -122,6 +123,18 @@ static void segv_handler(int) } extern Atom qt_wm_state; +extern bool trinity_desktop_lock_use_system_modal_dialogs; +extern bool trinity_desktop_lock_delay_screensaver_start; + +bool trinity_desktop_lock_autohide_lockdlg = TRUE; + +#define ENABLE_CONTINUOUS_LOCKDLG_DISPLAY \ +mForceContinualLockDisplayTimer->start(100, FALSE); \ +trinity_desktop_lock_autohide_lockdlg = FALSE; + +#define DISABLE_CONTINUOUS_LOCKDLG_DISPLAY \ +mForceContinualLockDisplayTimer->stop(); \ +trinity_desktop_lock_autohide_lockdlg = TRUE; //=========================================================================== // @@ -129,7 +142,7 @@ extern Atom qt_wm_state; // starting screensaver hacks, and password entry.f // LockProcess::LockProcess(bool child, bool useBlankOnly) - : TQWidget(0L, "saver window", WX11BypassWM), + : TQWidget(0L, "saver window", (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)(WStyle_StaysOnTop|WStyle_Customize | WStyle_NoBorder)):((WFlags)WX11BypassWM))), mOpenGLVisual(0), child_saver(child), mParent(0), @@ -147,13 +160,26 @@ LockProcess::LockProcess(bool child, bool useBlankOnly) mForceReject(false), mDialogControlLock(false), currentDialog(NULL), - resizeTimer(NULL) + resizeTimer(NULL), + hackResumeTimer(NULL), + mForceContinualLockDisplayTimer(NULL), + mHackDelayStartupTimer(NULL), + mHackDelayStartupTimeout(0) { setupSignals(); setupPipe(); kapp->installX11EventFilter(this); + mForceContinualLockDisplayTimer = new TQTimer( this ); + connect( mForceContinualLockDisplayTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(displayLockDialogIfNeeded()) ); + + mHackDelayStartupTimer = new TQTimer( this ); + connect( mHackDelayStartupTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(startHack()) ); + + // [FIXME] This interval should be taken from the screensaver start delay of kdesktop + mHackDelayStartupTimeout = 10*1000; + // Get root window size XWindowAttributes rootAttr; XGetWindowAttributes(qt_xdisplay(), RootWindow(qt_xdisplay(), @@ -232,6 +258,23 @@ LockProcess::LockProcess(bool child, bool useBlankOnly) // LockProcess::~LockProcess() { + if (resizeTimer != NULL) { + resizeTimer->stop(); + delete resizeTimer; + } + if (hackResumeTimer != NULL) { + hackResumeTimer->stop(); + delete hackResumeTimer; + } + if (mForceContinualLockDisplayTimer != NULL) { + mForceContinualLockDisplayTimer->stop(); + delete mForceContinualLockDisplayTimer; + } + if (mHackDelayStartupTimer != NULL) { + mHackDelayStartupTimer->stop(); + delete mHackDelayStartupTimer; + } + if (greetPlugin.library) { if (greetPlugin.info->done) greetPlugin.info->done(); @@ -575,10 +618,19 @@ void LockProcess::readSaver() kdDebug(1204) << "mForbidden: " << (mForbidden ? "true" : "false") << endl; - if (config.hasActionGroup("Root")) - { - config.setActionGroup("Root"); - mSaverExec = config.readPathEntry("Exec"); + if (trinity_desktop_lock_use_system_modal_dialogs) { + if (config.hasActionGroup("InWindow")) + { + config.setActionGroup("InWindow"); + mSaverExec = config.readPathEntry("Exec"); + } + } + else { + if (config.hasActionGroup("Root")) + { + config.setActionGroup("Root"); + mSaverExec = config.readPathEntry("Exec"); + } } } } @@ -591,7 +643,7 @@ void LockProcess::createSaverWindow() { Visual* visual = CopyFromParent; XSetWindowAttributes attrs; - int flags = CWOverrideRedirect; + int flags = trinity_desktop_lock_use_system_modal_dialogs?0:CWOverrideRedirect; #ifdef HAVE_GLXCHOOSEVISUAL if( mOpenGLVisual ) { @@ -658,7 +710,8 @@ void LockProcess::createSaverWindow() // set NoBackground so that the saver can capture the current // screen state if necessary - setBackgroundMode(TQWidget::NoBackground); + // this is a security risk and has been deactivated--welcome to the 21st century folks! + // setBackgroundMode(TQWidget::NoBackground); setCursor( tqblankCursor ); setGeometry(0, 0, mRootWidth, mRootHeight); @@ -915,7 +968,27 @@ bool LockProcess::startSaver() raise(); XSync(qt_xdisplay(), False); setVRoot( winId(), winId() ); - startHack(); + if (!trinity_desktop_lock_delay_screensaver_start) { + setBackgroundColor(black); + erase(); + } + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Try to get the root pixmap + TQString filename = getenv("USER"); + filename.prepend("/tmp/kde-"); + filename.append("/krootbacking.png"); + remove(filename.ascii()); + system("krootbacking &"); + TQTimer::singleShot( 0, this, SLOT(slotPaintBackground()) ); + } + + if (trinity_desktop_lock_delay_screensaver_start) { + ENABLE_CONTINUOUS_LOCKDLG_DISPLAY + mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + } + else { + startHack(); + } return true; } @@ -926,8 +999,9 @@ bool LockProcess::startSaver() void LockProcess::stopSaver() { kdDebug(1204) << "LockProcess: stopping saver" << endl; - resume( true ); + mHackProc.kill(SIGCONT); stopHack(); + mSuspended = false; hideSaverWindow(); mVisibility = false; if (!child_saver) { @@ -1048,12 +1122,27 @@ bool LockProcess::startHack() if (!mForbidden) { + if (trinity_desktop_lock_delay_screensaver_start) { + // Make sure we have a nice clean display to start with! + setBackgroundColor(black); + erase(); + mSuspended = false; + } + if (mHackProc.start() == true) { #ifdef HAVE_SETPRIORITY setpriority(PRIO_PROCESS, mHackProc.pid(), mPriority); #endif //bitBlt(this, 0, 0, &mOriginal); + DISABLE_CONTINUOUS_LOCKDLG_DISPLAY + if (trinity_desktop_lock_delay_screensaver_start) { + // Close any active dialogs + if (currentDialog != NULL) { + mForceReject = true; + currentDialog->close(); + } + } return true; } } @@ -1061,7 +1150,12 @@ bool LockProcess::startHack() // 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 { - setBackgroundColor(black); + usleep(100); + TQApplication::syncX(); + if (!trinity_desktop_lock_use_system_modal_dialogs) setBackgroundColor(black); + if (backingPixmap.isNull()) erase(); + else bitBlt(this, 0, 0, &backingPixmap); + ENABLE_CONTINUOUS_LOCKDLG_DISPLAY } } return false; @@ -1087,7 +1181,28 @@ void LockProcess::hackExited(KProcess *) { // Hack exited while we're supposed to be saving the screen. // Make sure the saver window is black. - setBackgroundColor(black); + usleep(100); + TQApplication::syncX(); + if (!trinity_desktop_lock_use_system_modal_dialogs) setBackgroundColor(black); + if (backingPixmap.isNull()) erase(); + else bitBlt(this, 0, 0, &backingPixmap); + ENABLE_CONTINUOUS_LOCKDLG_DISPLAY +} + +void LockProcess::displayLockDialogIfNeeded() +{ + if (trinity_desktop_lock_use_system_modal_dialogs) { + if (!mBusy) { + mBusy = true; + if (mLocked) { + if (checkPass()) { + stopSaver(); + kapp->quit(); + } + } + mBusy = false; + } + } } void LockProcess::suspend() @@ -1096,6 +1211,8 @@ void LockProcess::suspend() { mHackProc.kill(SIGSTOP); TQApplication::syncX(); + usleep(100); // Let the stop signal get through + TQApplication::syncX(); mSavedScreen = TQPixmap::grabWindow( winId()); } mSuspended = true; @@ -1105,7 +1222,7 @@ void LockProcess::resume( bool force ) { if( !force && (!mDialogs.isEmpty() || !mVisibility )) return; // no resuming with dialog visible or when not visible - if(mSuspended) + if ((mSuspended) && (mHackProc.isRunning())) { XForceScreenSaver(qt_xdisplay(), ScreenSaverReset ); bitBlt( this, 0, 0, &mSavedScreen ); @@ -1169,6 +1286,11 @@ static void fakeFocusIn( WId window ) XSendEvent( qt_xdisplay(), window, False, NoEventMask, &ev ); } +void LockProcess::resumeUnforced() +{ + resume( false ); +} + int LockProcess::execDialog( TQDialog *dlg ) { currentDialog=dlg; @@ -1186,6 +1308,8 @@ int LockProcess::execDialog( TQDialog *dlg ) } mDialogs.prepend( dlg ); fakeFocusIn( dlg->winId()); + if (backingPixmap.isNull() && trinity_desktop_lock_use_system_modal_dialogs) erase(); + else bitBlt(this, 0, 0, &backingPixmap); int rt = dlg->exec(); while (mDialogControlLock == true) sleep(1); currentDialog = NULL; @@ -1193,12 +1317,63 @@ int LockProcess::execDialog( TQDialog *dlg ) if( mDialogs.isEmpty() ) { XChangeActivePointerGrab( qt_xdisplay(), GRABEVENTS, TQCursor(tqblankCursor).handle(), CurrentTime); - resume( false ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Slight delay before screensaver resume to allow the dialog window to fully disappear + if (hackResumeTimer == NULL) { + hackResumeTimer = new TQTimer( this ); + connect( hackResumeTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(resumeUnforced()) ); + } + hackResumeTimer->start( 10, TRUE ); + } + else { + resume( false ); + } } else fakeFocusIn( mDialogs.first()->winId()); return rt; } +void LockProcess::slotPaintBackground() +{ + TQPixmap pm; + TQString filename = getenv("USER"); + filename.prepend("/tmp/kde-"); + filename.append("/krootbacking.png"); + bool success = pm.load(filename, "PNG"); + if (!success) { + sleep(1); + success = pm.load(filename, "PNG"); + if (!success) { + pm = TQPixmap(kapp->desktop()->width(), kapp->desktop()->height()); + pm.fill(Qt::black); + } + } + + if (TQPaintDevice::x11AppDepth() == 32) { + // Remove the alpha components from the image + TQImage correctedImage = pm.convertToImage(); + correctedImage = correctedImage.convertDepth(32); + correctedImage.setAlphaBuffer(true); + int w = correctedImage.width(); + int h = correctedImage.height(); + for (int y = 0; y < h; ++y) { + TQRgb *ls = (TQRgb *)correctedImage.scanLine( y ); + for (int x = 0; x < w; ++x) { + TQRgb l = ls[x]; + int r = int( tqRed( l ) ); + int g = int( tqGreen( l ) ); + int b = int( tqBlue( l ) ); + int a = int( 255 ); + ls[x] = tqRgba( r, g, b, a ); + } + } + pm.convertFromImage(correctedImage); + } + + backingPixmap = pm; + if (trinity_desktop_lock_delay_screensaver_start) erase(); +} + void LockProcess::preparePopup() { TQWidget *dlg = (TQWidget *)sender(); @@ -1266,6 +1441,8 @@ bool LockProcess::x11Event(XEvent *event) return true; // filter out // fall through case KeyPress: + if ((mHackDelayStartupTimer) && ((trinity_desktop_lock_autohide_lockdlg == FALSE) && (mHackDelayStartupTimer->isActive()))) + mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); if (mBusy || !mDialogs.isEmpty()) break; mBusy = true; diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h index 9f9c2c0bf..2c209cc8f 100644 --- a/kdesktop/lock/lockprocess.h +++ b/kdesktop/lock/lockprocess.h @@ -68,6 +68,7 @@ public slots: void desktopResized(); void doDesktopResizeFinish(); void doFunctionKeyBroadcast(); + void slotPaintBackground(); protected: virtual bool x11Event(XEvent *); @@ -81,6 +82,9 @@ private slots: void checkDPMSActive(); void slotDeadTimePassed(); void windowAdded( WId ); + void resumeUnforced(); + void displayLockDialogIfNeeded(); + bool startHack(); private: void configure(); @@ -97,7 +101,6 @@ private: void cantLock(const TQString &reason); bool startSaver(); void stopSaver(); - bool startHack(); void stopHack(); void setupSignals(); void setupPipe(); @@ -146,6 +149,8 @@ private: TQTimer *resizeTimer; unsigned int mkeyCode; + TQTimer *hackResumeTimer; + KProcess* mVkbdProcess; KWinModule* mKWinModule; struct VkbdWindow @@ -162,9 +167,16 @@ private: int mPipe_fd_out; bool mInfoMessageDisplayed; - TQDialog *currentDialog; bool mDialogControlLock; bool mForceReject; + TQDialog *currentDialog; + + TQTimer* mForceContinualLockDisplayTimer; + TQTimer* mHackDelayStartupTimer; + + int mHackDelayStartupTimeout; + + TQPixmap backingPixmap; }; #endif diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cc index 6e032bebb..667becaa0 100644 --- a/kdesktop/lock/main.cc +++ b/kdesktop/lock/main.cc @@ -34,6 +34,10 @@ #include <X11/Xlib.h> #include <fixx11h.h> +// [FIXME] These settings should be user configurable! +bool trinity_desktop_lock_use_system_modal_dialogs = FALSE; +bool trinity_desktop_lock_delay_screensaver_start = FALSE; + bool MyApp::x11EventFilter( XEvent *ev ) { if (ev->type == XKeyPress || ev->type == ButtonPress) diff --git a/kdesktop/lock/querydlg.cc b/kdesktop/lock/querydlg.cc index b05d77076..639772ace 100644 --- a/kdesktop/lock/querydlg.cc +++ b/kdesktop/lock/querydlg.cc @@ -48,22 +48,36 @@ #include <X11/Xutil.h> #include <X11/keysym.h> +#include <X11/Xatom.h> #include <fixx11h.h> #ifndef AF_LOCAL # define AF_LOCAL AF_UNIX #endif +extern bool trinity_desktop_lock_use_system_modal_dialogs; + //=========================================================================== // // Simple dialog for displaying a password/PIN entry dialog // QueryDlg::QueryDlg(LockProcess *parent) - : TQDialog(parent, "query dialog", true, (WFlags)WX11BypassWM), + : TQDialog(parent, "query dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))), mUnlockingFailed(false) { + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(qt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + setCaption(i18n("Information Needed")); + frame = new TQFrame( this ); - frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); + if (trinity_desktop_lock_use_system_modal_dialogs) + frame->setFrameStyle( TQFrame::NoFrame ); + else + frame->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); frame->setLineWidth( 2 ); mpixLabel = new TQLabel( frame, "pixlabel" ); |