From 1eb5bc816598318458e3a6459663af103a46094b Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 18 Jul 2013 10:22:48 -0500 Subject: Beautify logout process --- ksmserver/server.cpp | 14 +++++++++++++- ksmserver/server.h | 2 ++ ksmserver/shutdown.cpp | 22 ++++++++++++++++++---- ksmserver/shutdowndlg.cpp | 36 +++++++++++++++++++++++++++++------- ksmserver/shutdowndlg.h | 3 +++ 5 files changed, 65 insertions(+), 12 deletions(-) (limited to 'ksmserver') diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp index 214108fb4..6e3ed44a3 100644 --- a/ksmserver/server.cpp +++ b/ksmserver/server.cpp @@ -514,8 +514,9 @@ static void sighandler(int sig) delete server; } - if (kapp) + if (kapp) { kapp->quit(); + } //::exit(0); } @@ -945,6 +946,17 @@ bool KSMServer::isCM( const TQString& program ) const return (program == "kompmgr"); } +bool KSMServer::isDesktop( const KSMClient* client ) const +{ + return isDesktop( client->program()); +} + +bool KSMServer::isDesktop( const TQString& program ) const +{ + // Returns true if the program in question is a desktop + return (program == "kdesktop"); +} + bool KSMServer::isNotifier( const KSMClient* client ) const { return isNotifier( client->program()); diff --git a/ksmserver/server.h b/ksmserver/server.h index 00e3b7388..f850c747c 100644 --- a/ksmserver/server.h +++ b/ksmserver/server.h @@ -149,6 +149,8 @@ private: bool isWM( const TQString& program ) const; bool isCM( const KSMClient* client ) const; bool isCM( const TQString& program ) const; + bool isDesktop( const KSMClient* client ) const; + bool isDesktop( const TQString& program ) const; bool isNotifier( const KSMClient* client ) const; bool isNotifier( const TQString& program ) const; bool defaultSession() const; // empty session diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index 4f064ece3..5809cd295 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -706,15 +706,17 @@ void KSMServer::killWM() shutdownNotifierIPDlg=0; } for ( KSMClient* c = clients.first(); c; c = clients.next() ) { - if( isWM( c )) { + if( isNotifier( c )) { iswm = true; - kdDebug( 1218 ) << "killWM: client " << c->program() << "(" << c->clientId() << ")" << endl; SmsDie( c->connection() ); } if( isCM( c )) { + iswm = true; SmsDie( c->connection() ); } - if( isNotifier( c )) { + if( isWM( c )) { + iswm = true; + kdDebug( 1218 ) << "killWM: client " << c->program() << "(" << c->clientId() << ")" << endl; SmsDie( c->connection() ); } } @@ -742,7 +744,19 @@ void KSMServer::completeKillingWM() void KSMServer::killingCompleted() { SHUTDOWN_MARKER("killingCompleted"); - kapp->quit(); + DM dmObject; + int dmType = dmObject.type(); + if ((dmType == DM::NewTDM) || (dmType == DM::OldTDM) || (dmType == DM::GDM)) { + // Hide any remaining windows until the X server is terminated by the display manager + pid_t child; + child = fork(); + if (child != 0) { + kapp->quit(); + } + } + else { + kapp->quit(); + } } // called when KNotify performs notification for logout (not when sound is finished though) diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp index ad2d9113f..b30e6ec2e 100644 --- a/ksmserver/shutdowndlg.cpp +++ b/ksmserver/shutdowndlg.cpp @@ -519,7 +519,7 @@ void KSMShutdownFeedback::slotPaintEffect() KSMShutdownIPFeedback * KSMShutdownIPFeedback::s_pSelf = 0L; KSMShutdownIPFeedback::KSMShutdownIPFeedback() -: TQWidget( 0L, "systemmodaldialogclass", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop ), m_timeout(0), m_isPainted(false), m_sharedRootPixmap(NULL), mPixmapTimeout(0) +: TQWidget( 0L, "systemmodaldialogclass", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop ), m_timeout(0), m_isPainted(false), m_paintedFromSharedRootPixmap(false), m_sharedRootPixmap(NULL), mPixmapTimeout(0) { setShown(false); @@ -559,7 +559,10 @@ void KSMShutdownIPFeedback::showNow() { setShown(true); - TQTimer::singleShot( 0, this, SLOT(slotPaintEffect()) ); + if (!m_isPainted) { + setGeometry( TQApplication::desktop()->geometry() ); + TQTimer::singleShot( 0, this, SLOT(slotPaintEffect()) ); + } } void KSMShutdownIPFeedback::enableExports() @@ -588,12 +591,19 @@ KSMShutdownIPFeedback::~KSMShutdownIPFeedback() if (m_sharedRootPixmap) { m_sharedRootPixmap->stop(); delete m_sharedRootPixmap; + m_sharedRootPixmap = NULL; } } -void KSMShutdownIPFeedback::fadeBack( void ) -{ +void KSMShutdownIPFeedback::fadeBack( void ) { + // +} +void KSMShutdownIPFeedback::resizeEvent(TQResizeEvent* re) { + if (m_isPainted) { + // Resist all attempts to change size + setGeometry( m_screenGeometry ); + } } void KSMShutdownIPFeedback::slotSetBackgroundPixmap(const TQPixmap &rpm) { @@ -602,6 +612,10 @@ void KSMShutdownIPFeedback::slotSetBackgroundPixmap(const TQPixmap &rpm) { void KSMShutdownIPFeedback::slotPaintEffect() { + if (m_isPainted && m_paintedFromSharedRootPixmap) { + return; + } + TQPixmap pm = m_rootPixmap; if (mPixmapTimeout == 0) { if (TQPaintDevice::x11AppDepth() != 32) { @@ -630,6 +644,15 @@ void KSMShutdownIPFeedback::slotPaintEffect() else { pm = TQPixmap(kapp->desktop()->width(), kapp->desktop()->height()); pm.fill(Qt::black); + m_paintedFromSharedRootPixmap = false; + } + } + else { + m_paintedFromSharedRootPixmap = true; + if (m_sharedRootPixmap) { + m_sharedRootPixmap->stop(); + delete m_sharedRootPixmap; + m_sharedRootPixmap = NULL; } } @@ -657,7 +680,8 @@ void KSMShutdownIPFeedback::slotPaintEffect() setBackgroundPixmap( pm ); move(0,0); setWindowState(WindowFullScreen); - setGeometry( TQApplication::desktop()->geometry() ); + m_screenGeometry = TQApplication::desktop()->geometry(); + setGeometry( m_screenGeometry ); repaint(true); tqApp->flushX(); @@ -1222,8 +1246,6 @@ void KSMDelayedPushButton::slotReleased() void KSMDelayedPushButton::slotTimeout() { TQPoint bl = mapToGlobal(rect().bottomLeft()); - TQWidget *par = (TQWidget*)parent(); - TQPoint br = par->mapToGlobal(par->rect().bottomRight()); pop->popup( bl ); popt->stop(); setDown(false); diff --git a/ksmserver/shutdowndlg.h b/ksmserver/shutdowndlg.h index e9f2271e3..3ce851244 100644 --- a/ksmserver/shutdowndlg.h +++ b/ksmserver/shutdowndlg.h @@ -97,6 +97,7 @@ public: protected: ~KSMShutdownIPFeedback(); + virtual void resizeEvent(TQResizeEvent* re); public slots: void slotPaintEffect(); @@ -118,9 +119,11 @@ private: void showNow( void ); int m_timeout; bool m_isPainted; + bool m_paintedFromSharedRootPixmap; KRootPixmap* m_sharedRootPixmap; TQPixmap m_rootPixmap; int mPixmapTimeout; + TQRect m_screenGeometry; }; // The confirmation dialog -- cgit v1.2.1