From 7db006210bee765e4c21cc195e5795499a09c080 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 22 Mar 2013 01:51:54 -0500 Subject: Enable ARGB support in kdesktop_lock --- kdesktop/lock/lockprocess.cc | 66 +++++++++++++++++++++++++++----------------- kdesktop/lock/lockprocess.h | 2 ++ kdesktop/lock/main.cc | 13 ++++----- 3 files changed, 48 insertions(+), 33 deletions(-) (limited to 'kdesktop') diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc index d96b64ca9..ac70def46 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cc @@ -220,6 +220,7 @@ LockProcess::LockProcess() mHackDelayStartupTimer(NULL), mHackDelayStartupTimeout(0), mHackStartupEnabled(true), + mOverrideHackStartupEnabled(false), mResizingDesktopLock(false), m_rootPixmap(NULL), mBackingStartupDelayTimer(0), @@ -683,6 +684,7 @@ void LockProcess::slotDeadTimePassed() bool LockProcess::defaultSave() { mLocked = false; + mOverrideHackStartupEnabled = true; if (startSaver()) { if (mLockGrace >= 0) TQTimer::singleShot(mLockGrace, this, TQT_SLOT(startLock())); @@ -859,16 +861,19 @@ void LockProcess::configure() if (mSaver.isEmpty() || mUseBlankOnly) { mSaver = "KBlankscreen.desktop"; } - if (KDesktopSettings::screenSaverEnabled() == false) { - mSaver = ""; - mSaverExec = ""; + if (!trinity_desktop_lock_use_system_modal_dialogs) { + if (KDesktopSettings::screenSaverEnabled() == false) { + mSaver = ""; + mSaverExec = ""; + } } readSaver(); mPlugins = KDesktopSettings::pluginsUnlock(); - if (mPlugins.isEmpty()) + if (mPlugins.isEmpty()) { mPlugins = TQStringList("classic"); + } mPluginOptions = KDesktopSettings::pluginOptions(); } @@ -1110,7 +1115,7 @@ void LockProcess::desktopResized() // Black out the background widget to hide ugly resize tiling artifacts if (argb_visual) { - setErasePixmap(TQPixmap()); + setTransparentBackgroundARGB(); } else { setBackgroundColor(black); @@ -1362,17 +1367,10 @@ void LockProcess::ungrabInput() //--------------------------------------------------------------------------- // -// Start the screen saver. +// Set a fully transparent ARGB background image. // -bool LockProcess::startSaver() +void LockProcess::setTransparentBackgroundARGB() { - if (!child_saver && !grabInput()) - { - kdWarning(1204) << "LockProcess::startSaver() grabInput() failed!!!!" << endl; - return false; - } - mBusy = false; - // eliminate nasty flicker on first show TQImage m_grayImage = TQImage( TQApplication::desktop()->width(), TQApplication::desktop()->height(), 32 ); m_grayImage = m_grayImage.convertDepth(32); @@ -1387,6 +1385,23 @@ bool LockProcess::startSaver() p.drawImage( 0, 0, m_grayImage ); p.end(); setBackgroundPixmap( m_root ); +} + +//--------------------------------------------------------------------------- +// +// Start the screen saver. +// +bool LockProcess::startSaver() +{ + if (!child_saver && !grabInput()) + { + kdWarning(1204) << "LockProcess::startSaver() grabInput() failed!!!!" << endl; + return false; + } + mBusy = false; + + // eliminate nasty flicker on first show + setTransparentBackgroundARGB(); saveVRoot(); @@ -1408,9 +1423,9 @@ bool LockProcess::startSaver() slotPaintBackground(rootWinSnapShot); } - if (((!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced)) && (!trinity_desktop_lock_in_sec_dlg)) && mHackStartupEnabled) { + if (((!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced)) && (!trinity_desktop_lock_in_sec_dlg)) && (mHackStartupEnabled || mOverrideHackStartupEnabled)) { if (argb_visual) { - setErasePixmap(TQPixmap()); + setTransparentBackgroundARGB(); } else { if (backingPixmap.isNull()) { @@ -1430,7 +1445,8 @@ bool LockProcess::startSaver() if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); } else { - if (mHackStartupEnabled == true) { + if (mHackStartupEnabled || mOverrideHackStartupEnabled) { + mOverrideHackStartupEnabled = false; startHack(); } else { @@ -1558,7 +1574,7 @@ void LockProcess::repaintRootWindowIfNeeded() if (trinity_desktop_lock_use_system_modal_dialogs) { if (!mHackProc.isRunning()) { if (argb_visual) { - setErasePixmap(TQPixmap()); + setTransparentBackgroundARGB(); erase(); } else { @@ -1591,7 +1607,7 @@ bool LockProcess::startHack() { // no resuming with dialog visible or when not visible if (argb_visual) { - setErasePixmap(TQPixmap()); + setTransparentBackgroundARGB(); } else { if (backingPixmap.isNull()) { @@ -1644,7 +1660,7 @@ bool LockProcess::startHack() if (trinity_desktop_lock_use_system_modal_dialogs) { // Make sure we have a nice clean display to start with! if (argb_visual) { - setErasePixmap(TQPixmap()); + setTransparentBackgroundARGB(); } else { if (backingPixmap.isNull()) { @@ -1684,7 +1700,7 @@ bool LockProcess::startHack() TQApplication::syncX(); if (!trinity_desktop_lock_use_system_modal_dialogs) { if (argb_visual) { - setErasePixmap(TQPixmap()); + setTransparentBackgroundARGB(); } else { if (backingPixmap.isNull()) { @@ -1696,7 +1712,7 @@ bool LockProcess::startHack() } } if (argb_visual) { - setErasePixmap(TQPixmap()); + setTransparentBackgroundARGB(); erase(); } else { @@ -1746,7 +1762,7 @@ void LockProcess::hackExited(TDEProcess *) TQApplication::syncX(); if (!trinity_desktop_lock_use_system_modal_dialogs) { if (argb_visual) { - setErasePixmap(TQPixmap()); + setTransparentBackgroundARGB(); } else { if (backingPixmap.isNull()) { @@ -1758,7 +1774,7 @@ void LockProcess::hackExited(TDEProcess *) } } if (argb_visual) { - setErasePixmap(TQPixmap()); + setTransparentBackgroundARGB(); } else { if (backingPixmap.isNull()) { @@ -1846,7 +1862,7 @@ void LockProcess::resume( bool force ) // no resuming with dialog visible or when not visible if (trinity_desktop_lock_use_system_modal_dialogs) { if (argb_visual) { - setErasePixmap(TQPixmap()); + setTransparentBackgroundARGB(); } else { if (backingPixmap.isNull()) { diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h index 57caede60..e1b8fcf52 100644 --- a/kdesktop/lock/lockprocess.h +++ b/kdesktop/lock/lockprocess.h @@ -110,6 +110,7 @@ private: void saveVRoot(); void setVRoot(Window win, Window rw); void removeVRoot(Window win); + void setTransparentBackgroundARGB(); bool grabKeyboard(); bool grabMouse(); bool grabInput(); @@ -196,6 +197,7 @@ private: int mHackDelayStartupTimeout; bool mHackStartupEnabled; + bool mOverrideHackStartupEnabled; bool mResizingDesktopLock; TQPixmap backingPixmap; diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cc index 017250a35..c2a6c753a 100644 --- a/kdesktop/lock/main.cc +++ b/kdesktop/lock/main.cc @@ -307,15 +307,12 @@ int main( int argc, char **argv ) } } -// FIXME -// Composite should be enabled where possible, however using ARGB visuals seems to cause problems -// with XScreenSaver hacks (they do not display). -// #ifdef COMPOSITE -// MyApp app(TDEApplication::openX11RGBADisplay()); -// argb_visual = app.isX11CompositionAvailable(); -// #else +#ifdef COMPOSITE + MyApp app(TDEApplication::openX11RGBADisplay()); + argb_visual = app.isX11CompositionAvailable(); +#else MyApp app; -// #endif +#endif kdDebug() << "app " << kdesktop_screen_number << " " << starting_screen << " " << child << " " << child_sockets.count() << " " << parent_connection << endl; app.disableSessionManagement(); -- cgit v1.2.1