summaryrefslogtreecommitdiffstats
path: root/ksmserver
diff options
context:
space:
mode:
Diffstat (limited to 'ksmserver')
-rw-r--r--ksmserver/shutdown.cpp12
-rw-r--r--ksmserver/shutdowndlg.cpp144
-rw-r--r--ksmserver/shutdowndlg.h7
3 files changed, 114 insertions, 49 deletions
diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp
index d298b2cf3..549fd2cc3 100644
--- a/ksmserver/shutdown.cpp
+++ b/ksmserver/shutdown.cpp
@@ -158,6 +158,13 @@ void KSMServer::shutdownInternal( KApplication::ShutdownConfirm confirm,
if (sdmode == KApplication::ShutdownModeDefault)
sdmode = KApplication::ShutdownModeInteractive;
+ // shall we show a nice fancy logout screen?
+ bool showFancyLogout = KConfigGroup(KGlobal::config(), "Logout").readBoolEntry("showFancyLogout", true);
+
+ if (showFancyLogout) {
+ KSMShutdownIPFeedback::start();
+ }
+
dialogActive = true;
if ( !logoutConfirmed ) {
KSMShutdownFeedback::start(); // make the screen gray
@@ -179,11 +186,8 @@ void KSMServer::shutdownInternal( KApplication::ShutdownConfirm confirm,
// shall we save the session on logout?
saveSession = ( config->readEntry( "loginMode", "restorePreviousLogout" ) == "restorePreviousLogout" );
- // shall we show a nice fancy logout screen?
- bool showFancyLogout = KConfigGroup(KGlobal::config(), "Logout").readBoolEntry("showFancyLogout", true);
-
if (showFancyLogout) {
-// KSMShutdownIPFeedback::start(); // hide the UGLY logout process from the user
+ KSMShutdownIPFeedback::showit(); // hide the UGLY logout process from the user
KSMShutdownIPDlg::showShutdownIP();
}
diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp
index 52960ad6d..810260c2d 100644
--- a/ksmserver/shutdowndlg.cpp
+++ b/ksmserver/shutdowndlg.cpp
@@ -497,26 +497,24 @@ void KSMShutdownFeedback::slotPaintEffect()
KSMShutdownIPFeedback * KSMShutdownIPFeedback::s_pSelf = 0L;
KSMShutdownIPFeedback::KSMShutdownIPFeedback()
- : TQWidget( 0L, "feedbackipwidget", Qt::WType_Popup | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ), m_sharedpixmap(0), m_timeout(0)
+ : TQWidget( 0L, "feedbackipwidget", Qt::WType_Dialog | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ), m_timeout(0)
{
- m_sharedpixmap = new KSharedPixmap();
- resize(0, 0);
- setShown(true);
+ setShown(false);
- // At least show SOMETHING while waiting for the root pixmap...
- TQPixmap drawable = TQPixmap(TQPixmap::grabWindow(qt_xrootwin(), 0, 0, TQApplication::desktop()->width(), TQApplication::desktop()->height())).convertToImage();
- bitBlt( this, 0, 0, &drawable );
+ // Try to get the root pixmap
+ system("krootbacking &");
+}
- // Try to get and show the root pixmap
- enableExports();
- TQTimer::singleShot( 100, this, SLOT(slotPaintEffect()) );
+void KSMShutdownIPFeedback::showNow()
+{
+// slotPaintEffect();
+ TQTimer::singleShot( 0, this, SLOT(slotPaintEffect()) );
}
KSMShutdownIPFeedback::~KSMShutdownIPFeedback()
{
- if (m_sharedpixmap)
- delete m_sharedpixmap;
+
}
void KSMShutdownIPFeedback::fadeBack( void )
@@ -535,29 +533,46 @@ TQString KSMShutdownIPFeedback::pixmapName(int desk) {
void KSMShutdownIPFeedback::slotPaintEffect()
{
- NETRootInfo rinfo( qt_xdisplay(), NET::CurrentDesktop );
- rinfo.activate();
- int current_desktop = rinfo.currentDesktop();
-
- m_sharedpixmap->loadFromShared(pixmapName(current_desktop), TQRect(0, 0, width(), height()));
-}
+ 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);
+ }
+ }
-void KSMShutdownIPFeedback::slotDone(bool success)
-{
- if (!success)
- {
- kdWarning(270) << k_lineinfo << "loading of desktop background failed.\n";
- if (m_timeout < 50) {
- TQTimer::singleShot( 100, this, SLOT(slotPaintEffect()) );
- m_timeout++;
- return;
+ 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);
}
- TQImage image = m_sharedpixmap->convertToImage();
- TQPixmap drawable;
- drawable.convertFromImage( image );
- bitBlt( this, 0, 0, &drawable );
+ resize(kapp->desktop()->width(), kapp->desktop()->height());
+ move(0,0);
+ setShown(true);
+
+ setBackgroundPixmap( pm );
}
void KSMShutdownIPFeedback::enableExports()
@@ -1071,7 +1086,8 @@ void KSMShutdownIPDlg::showShutdownIP()
}
KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent)
- : TQDialog( 0, "", TRUE, Qt::WType_Popup | Qt::WDestructiveClose )
+// : TQDialog( 0, "", TRUE, Qt::WStyle_Customize | Qt::WType_Dialog | Qt::WStyle_NoBorder | Qt::WStyle_Title | Qt::WStyle_StaysOnTop | Qt::WDestructiveClose )
+ : TQDialog( 0, "", TRUE, Qt::WStyle_Customize | Qt::WType_Popup | Qt::WStyle_NoBorder | Qt::WStyle_Title | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM | Qt::WDestructiveClose )
{
TQVBoxLayout* vbox = new TQVBoxLayout( this );
@@ -1083,30 +1099,64 @@ KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent)
frame->setMinimumWidth(400);
vbox->addWidget( frame );
TQGridLayout* gbox = new TQGridLayout( frame, 1, 1, 2 * KDialog::marginHint(), 2 * KDialog::spacingHint() );
+ TQHBoxLayout* centerbox = new TQHBoxLayout( gbox, KDialog::spacingHint() );
+ TQHBoxLayout* seperatorbox = new TQHBoxLayout( gbox, 0 );
TQWidget* ticon = new TQWidget( frame );
KIconLoader * ldr = KGlobal::iconLoader();
TQPixmap trinityPixmap = ldr->loadIcon("kmenu", KIcon::Panel, KIcon::SizeLarge, KIcon::DefaultState, 0L, true);
+ if (TQPaintDevice::x11AppDepth() == 32) {
+ // Manually draw the alpha portions onto the widget background color...
+ TQRgb backgroundRgb = ticon->paletteBackgroundColor().rgb();
+ TQImage correctedImage = trinityPixmap.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];
+ float alpha_adjust = tqAlpha( l )/255.0;
+ int r = int( (tqRed( l ) * alpha_adjust) + (tqRed( backgroundRgb ) * (1.0-alpha_adjust)) );
+ int g = int( (tqGreen( l ) * alpha_adjust) + (tqGreen( backgroundRgb ) * (1.0-alpha_adjust)) );
+ int b = int( (tqBlue( l ) * alpha_adjust) + (tqBlue( backgroundRgb ) * (1.0-alpha_adjust)) );
+ int a = int( 255 );
+ ls[x] = tqRgba( r, g, b, a );
+ }
+ }
+ trinityPixmap.convertFromImage(correctedImage);
+ }
ticon->setBackgroundPixmap(trinityPixmap);
ticon->setMinimumSize(trinityPixmap.size());
ticon->setMaximumSize(trinityPixmap.size());
ticon->resize(trinityPixmap.size());
-// gbox->addMultiCellWidget( ticon, 0, 1, 0, 0, AlignCenter );
- gbox->addWidget( ticon, 0, 0, AlignHCenter );
+ centerbox->addWidget( ticon, AlignCenter );
+
+ TQWidget* swidget = new TQWidget( frame );
+ swidget->resize(2, frame->sizeHint().width());
+ swidget->setBackgroundColor(Qt::black);
+ seperatorbox->addWidget( swidget, AlignCenter );
- TQLabel* label = new TQLabel( i18n("Trinity is saving your settings, please wait..."), frame );
+ TQLabel* label = new TQLabel( i18n("Trinity Desktop Environment"), frame );
TQFont fnt = label->font();
fnt.setBold( true );
+ fnt.setPointSize( fnt.pointSize() * 3 / 2 );
+ label->setFont( fnt );
+ centerbox->addWidget( label, AlignCenter );
+
+ label = new TQLabel( i18n("Saving your settings..."), frame );
+ fnt = label->font();
+ fnt.setBold( false );
fnt.setPointSize( fnt.pointSize() * 1 );
label->setFont( fnt );
- gbox->addWidget( label, 0, 1, AlignHCenter );
-
-// label = new TQLabel( i18n("Logging off"), frame );
-// fnt = label->font();
-// fnt.setBold( true );
-// fnt.setPointSize( fnt.pointSize() * 3 / 2 );
-// label->setFont( fnt );
-// gbox->addWidget( label, 0, 1, AlignHCenter );
+ gbox->addMultiCellWidget( label, 2, 2, 0, 0, AlignLeft | AlignVCenter );
+
+ gbox->addLayout(centerbox, 0, 0);
+ gbox->addLayout(seperatorbox, 1, 0);
+
+ setFixedSize( sizeHint() );
+ setCaption( i18n("Please wait...") );
}
KSMShutdownIPDlg::~KSMShutdownIPDlg()
@@ -1114,6 +1164,14 @@ KSMShutdownIPDlg::~KSMShutdownIPDlg()
}
+void KSMShutdownIPDlg::closeEvent(TQCloseEvent *e)
+{
+ //---------------------------------------------
+ // Don't call the base function because
+ // we want to ignore the close event
+ //---------------------------------------------
+}
+
KSMDelayedPushButton::KSMDelayedPushButton( const KGuiItem &item,
TQWidget *parent,
const char *name)
diff --git a/ksmserver/shutdowndlg.h b/ksmserver/shutdowndlg.h
index 5beb32ca4..e6bcfdab2 100644
--- a/ksmserver/shutdowndlg.h
+++ b/ksmserver/shutdowndlg.h
@@ -81,6 +81,7 @@ class KSMShutdownIPFeedback : public TQWidget
public:
static void start() { s_pSelf = new KSMShutdownIPFeedback(); }
+ static void showit() { if ( s_pSelf != 0L ) s_pSelf->showNow(); }
static void stop() { if ( s_pSelf != 0L ) s_pSelf->fadeBack(); delete s_pSelf; s_pSelf = 0L; }
static KSMShutdownIPFeedback * self() { return s_pSelf; }
@@ -89,7 +90,6 @@ protected:
private slots:
void slotPaintEffect();
- void slotDone(bool success);
private:
static KSMShutdownIPFeedback * s_pSelf;
@@ -97,8 +97,8 @@ private:
int m_currentY;
TQPixmap m_root;
void fadeBack( void );
+ void showNow( void );
TQString pixmapName(int desk);
- KSharedPixmap* m_sharedpixmap;
void enableExports();
int m_timeout;
};
@@ -144,6 +144,9 @@ public:
protected:
~KSMShutdownIPDlg();
+protected slots:
+ void closeEvent(TQCloseEvent *e);
+
private:
KSMShutdownIPDlg( TQWidget* parent );
};