1 /* This file is part of the KDE project
2 Copyright (C) 2005-2007 Tom Albers <tomalbers@kde.nl>
3 Copyright (C) 2006 Bram Schoenmakers <bramschoenmakers@kde.nl>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "graywidget.h"
21 #include "grayouteffect.h"
22 #include "rsitimer_dpms.h"
23 #include "boxdialog.h"
25 #include <QApplication>
26 #include <QDesktopWidget>
31 #include <KWindowSystem>
34 GrayWidget::GrayWidget( QWidget
*parent
)
35 : QWidget( parent
, Qt::Popup
), m_currentY( 0 ), m_first( true )
38 setAttribute( Qt::WA_NoSystemBackground
);
39 setAttribute( Qt::WA_PaintOnScreen
);
40 QRect rect
= QApplication::desktop()->screenGeometry(
41 QApplication::desktop()->primaryScreen() );
46 m_dialog
= new BoxDialog( this, Qt::Popup
);
49 GrayWidget::~GrayWidget() {}
51 void GrayWidget::reset()
61 void GrayWidget::slotGrayEffect()
63 m_complete
= takeScreenshot( QX11Info::appScreen() );
65 repaint(); //before show
69 KWindowSystem::forceActiveWindow( winId() );
70 KWindowSystem::setOnAllDesktops( winId(), true );
71 KWindowSystem::setState( winId(), NET::KeepAbove
);
72 KWindowSystem::setState( winId(), NET::FullScreen
);
74 m_gray
= new GrayOutEffect( this, &m_complete
);
75 connect( m_gray
, SIGNAL( ready() ), m_dialog
, SLOT( showDialog() ) );
79 void GrayWidget::paintEvent( QPaintEvent
* )
81 QPainter
painter( this );
82 painter
.setCompositionMode( QPainter::CompositionMode_Source
);
83 painter
.drawPixmap( 0, 0, m_complete
);
86 #include "graywidget.moc"