mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
ksmserver: drop custom logout effect
the effect is very much bound to the window manager (KWin) because if applications require attention (such as confirmation to cancel any pending changes) their window or any dialog they pop may have to be raised, will have to be focused and not be grayed out Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
1ed14fe2f7
commit
36d3e65630
8 changed files with 5 additions and 343 deletions
|
@ -25,8 +25,6 @@ set(ksmserver_SRCS
|
|||
startup.cpp
|
||||
shutdown.cpp
|
||||
client.cpp
|
||||
logouteffect.cpp
|
||||
curtaineffect.cpp
|
||||
)
|
||||
|
||||
set(kcminit_adaptor ${CMAKE_SOURCE_DIR}/kcminit/main.h)
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2008 Fredrik Höglund <fredrik@kde.org>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "curtaineffect.h"
|
||||
#include "moc_curtaineffect.cpp"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QWidget>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
|
||||
CurtainEffect::CurtainEffect(QWidget *parent, QPixmap *pixmap)
|
||||
: LogoutEffect(parent, pixmap)
|
||||
{
|
||||
}
|
||||
|
||||
void CurtainEffect::start()
|
||||
{
|
||||
currentY = 0;
|
||||
nextFrame();
|
||||
emit initialized();
|
||||
}
|
||||
|
||||
void CurtainEffect::nextFrame()
|
||||
{
|
||||
QImage image = QPixmap::grabWindow(QApplication::desktop()->winId(), 0, currentY,
|
||||
parent->width(), 10 ).toImage();
|
||||
|
||||
// gray scale
|
||||
QColor oldColor;
|
||||
for(int x = 0; x < image.width(); x++){
|
||||
for(int y = 0; y < image.height(); y++){
|
||||
oldColor = QColor(image.pixel(x, y));
|
||||
int average = (oldColor.red() + oldColor.green() + oldColor.blue()) / 3;
|
||||
image.setPixel(x, y, qRgb(average,average,average));
|
||||
}
|
||||
}
|
||||
|
||||
QPainter painter(pixmap);
|
||||
painter.drawImage(0, currentY, image);
|
||||
painter.end();
|
||||
|
||||
currentY += 10;
|
||||
parent->update(0, 0, parent->width(), currentY);
|
||||
|
||||
QTimer::singleShot(5, this, SLOT(nextFrame()));
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2008 Fredrik Höglund <fredrik@kde.org>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CURTAINEFFECT_H
|
||||
#define CURTAINEFFECT_H
|
||||
|
||||
#include "logouteffect.h"
|
||||
|
||||
/**
|
||||
* This class implements the classic KDE curtain effect.
|
||||
*/
|
||||
class CurtainEffect : public LogoutEffect
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CurtainEffect(QWidget *parent, QPixmap *pixmap);
|
||||
virtual void start();
|
||||
|
||||
private slots:
|
||||
void nextFrame();
|
||||
|
||||
private:
|
||||
int currentY;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2008 Fredrik Höglund <fredrik@kde.org>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "logouteffect.h"
|
||||
#include "curtaineffect.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
LogoutEffect::LogoutEffect(QWidget *parent, QPixmap *pixmap)
|
||||
: QObject(parent), parent(parent), pixmap(pixmap)
|
||||
{
|
||||
}
|
||||
|
||||
LogoutEffect::~LogoutEffect()
|
||||
{
|
||||
}
|
||||
|
||||
LogoutEffect *LogoutEffect::create(QWidget *parent, QPixmap *pixmap)
|
||||
{
|
||||
return new CurtainEffect(parent, pixmap);
|
||||
}
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2008 Fredrik Höglund <fredrik@kde.org>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef LOGOUTEFFECT_H
|
||||
#define LOGOUTEFFECT_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPixmap>
|
||||
|
||||
class LogoutEffect : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
virtual ~LogoutEffect();
|
||||
static LogoutEffect *create(QWidget *parent, QPixmap *pixmap);
|
||||
virtual void start() = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void initialized();
|
||||
|
||||
protected:
|
||||
LogoutEffect(QWidget *parent, QPixmap *pixmap);
|
||||
|
||||
protected:
|
||||
QWidget *parent;
|
||||
QPixmap *pixmap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -53,10 +53,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
static const char version[] = "0.4";
|
||||
static const char description[] = I18N_NOOP( "The reliable KDE session manager that talks the standard X11R6 \nsession management protocol (XSMP)." );
|
||||
|
||||
Display* dpy = 0;
|
||||
Colormap colormap = 0;
|
||||
Visual *visual = 0;
|
||||
|
||||
extern KSMServer* the_server;
|
||||
|
||||
void IoErrorHandler ( IceConn iceConn)
|
||||
|
@ -83,55 +79,6 @@ bool writeTest(QByteArray path)
|
|||
return true;
|
||||
}
|
||||
|
||||
void checkComposite()
|
||||
{
|
||||
if( qgetenv( "KDE_SKIP_ARGB_VISUALS" ) == "1" )
|
||||
return;
|
||||
// thanks to zack rusin and frederik for pointing me in the right direction
|
||||
// for the following bits of X11 code
|
||||
dpy = XOpenDisplay(0); // open default display
|
||||
if (!dpy)
|
||||
{
|
||||
kError() << "Cannot connect to the X server";
|
||||
return;
|
||||
}
|
||||
|
||||
int screen = DefaultScreen(dpy);
|
||||
int eventBase, errorBase;
|
||||
|
||||
if (XRenderQueryExtension(dpy, &eventBase, &errorBase))
|
||||
{
|
||||
int nvi;
|
||||
XVisualInfo templ;
|
||||
templ.screen = screen;
|
||||
templ.depth = 32;
|
||||
templ.c_class = TrueColor;
|
||||
XVisualInfo *xvi = XGetVisualInfo(dpy, VisualScreenMask |
|
||||
VisualDepthMask |
|
||||
VisualClassMask,
|
||||
&templ, &nvi);
|
||||
for (int i = 0; i < nvi; ++i)
|
||||
{
|
||||
XRenderPictFormat *format = XRenderFindVisualFormat(dpy,
|
||||
xvi[i].visual);
|
||||
if (format->type == PictTypeDirect && format->direct.alphaMask)
|
||||
{
|
||||
visual = xvi[i].visual;
|
||||
colormap = XCreateColormap(dpy, RootWindow(dpy, screen),
|
||||
visual, AllocNone);
|
||||
|
||||
XFree(xvi);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(xvi);
|
||||
|
||||
}
|
||||
XCloseDisplay( dpy );
|
||||
dpy = NULL;
|
||||
}
|
||||
|
||||
void sanity_check( int argc, char* argv[], KAboutData* aboutDataPtr )
|
||||
{
|
||||
QString msg;
|
||||
|
@ -252,13 +199,7 @@ int main( int argc, char* argv[] )
|
|||
KCmdLineArgs::addCmdLineOptions( options );
|
||||
|
||||
::unsetenv("SESSION_MANAGER");
|
||||
checkComposite();
|
||||
KApplication *a;
|
||||
|
||||
if( dpy != NULL && DefaultDepth(dpy, DefaultScreen(dpy)) >= 24) // 16bpp breaks the software logout effect for some reason???
|
||||
a = new KApplication(dpy, visual ? Qt::HANDLE(visual) : 0, colormap ? Qt::HANDLE(colormap) : 0);
|
||||
else
|
||||
a = new KApplication();
|
||||
KApplication *a = new KApplication();
|
||||
fcntl(ConnectionNumber(QX11Info::display()), F_SETFD, 1);
|
||||
|
||||
a->setQuitOnLastWindowClosed(false); // #169486
|
||||
|
|
|
@ -56,50 +56,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <kworkspace/kdisplaymanager.h>
|
||||
|
||||
#include "logouteffect.h"
|
||||
#include "moc_shutdowndlg.cpp"
|
||||
|
||||
#define FONTCOLOR "#bfbfbf"
|
||||
|
||||
KSMShutdownFeedback * KSMShutdownFeedback::s_pSelf = 0L;
|
||||
|
||||
KSMShutdownFeedback::KSMShutdownFeedback()
|
||||
: QWidget( 0L, Qt::Popup ),
|
||||
initialized( false )
|
||||
{
|
||||
setObjectName( "feedbackwidget" );
|
||||
setAttribute( Qt::WA_NoSystemBackground );
|
||||
setAttribute( Qt::WA_PaintOnScreen );
|
||||
setGeometry( QApplication::desktop()->geometry() );
|
||||
m_pixmap = QPixmap( size() );
|
||||
QTimer::singleShot( 10, this, SLOT(slotPaintEffect()) );
|
||||
}
|
||||
|
||||
|
||||
void KSMShutdownFeedback::paintEvent( QPaintEvent* )
|
||||
{
|
||||
if ( !initialized )
|
||||
return;
|
||||
|
||||
QPainter painter( this );
|
||||
painter.setCompositionMode( QPainter::CompositionMode_Source );
|
||||
painter.drawPixmap( 0, 0, m_pixmap );
|
||||
}
|
||||
|
||||
void KSMShutdownFeedback::slotPaintEffect()
|
||||
{
|
||||
effect = LogoutEffect::create(this, &m_pixmap);
|
||||
connect(effect, SIGNAL(initialized()),
|
||||
this, SLOT (slotPaintEffectInitialized()));
|
||||
|
||||
effect->start();
|
||||
}
|
||||
|
||||
void KSMShutdownFeedback::slotPaintEffectInitialized()
|
||||
{
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void KSMShutdownFeedback::start()
|
||||
{
|
||||
if( KWindowSystem::compositingActive()) {
|
||||
|
@ -131,14 +89,10 @@ void KSMShutdownFeedback::start()
|
|||
return;
|
||||
}
|
||||
}
|
||||
s_pSelf = new KSMShutdownFeedback();
|
||||
s_pSelf->show();
|
||||
}
|
||||
|
||||
void KSMShutdownFeedback::stop()
|
||||
{
|
||||
delete s_pSelf;
|
||||
s_pSelf = NULL;
|
||||
}
|
||||
|
||||
void KSMShutdownFeedback::logoutCanceled()
|
||||
|
|
|
@ -27,13 +27,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <QDialog>
|
||||
#include <QPushButton>
|
||||
#include <kworkspace/kworkspace.h>
|
||||
|
||||
#include <QMenu>
|
||||
#include <QTimer>
|
||||
#include <QTimeLine>
|
||||
#include <QLabel>
|
||||
class LogoutEffect;
|
||||
#include <QDeclarativeView>
|
||||
#include <kworkspace/kworkspace.h>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
@ -41,35 +40,15 @@ namespace Plasma
|
|||
class FrameSvg;
|
||||
}
|
||||
|
||||
// The (singleton) widget that makes the desktop gray.
|
||||
class KSMShutdownFeedback : public QWidget
|
||||
// The methods that make the desktop gray if compositor is active.
|
||||
class KSMShutdownFeedback
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void start();
|
||||
static void stop();
|
||||
static void logoutCanceled();
|
||||
|
||||
protected:
|
||||
~KSMShutdownFeedback() {}
|
||||
|
||||
virtual void paintEvent( QPaintEvent* );
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotPaintEffect();
|
||||
void slotPaintEffectInitialized();
|
||||
|
||||
private:
|
||||
static KSMShutdownFeedback * s_pSelf;
|
||||
KSMShutdownFeedback();
|
||||
QPixmap m_pixmap;
|
||||
LogoutEffect *effect;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
#include <QDeclarativeView>
|
||||
|
||||
// The confirmation dialog
|
||||
class KSMShutdownDlg : public QDialog
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue