[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/utils/rsibreak/src
From: Tom Albers <tomalbers () kde ! nl>
Date: 2007-07-31 21:14:25
Message-ID: 1185916465.513588.3719.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 694832 by toma:
disadvantage of fast laptop is that it takes the screenshot after the widget is \
shown, resulting in a black screenie in this case. Fix that and use the new \
screenshot routine, so it actually works on this laptop.
M +22 -13 graywidget.cpp
M +2 -0 graywidget.h
M +0 -5 rsiwidget.cpp
--- trunk/extragear/utils/rsibreak/src/graywidget.cpp #694831:694832
@@ -18,6 +18,7 @@
*/
#include "graywidget.h"
+#include "rsitimer_dpms.h"
#include <QApplication>
#include <QDesktopWidget>
@@ -27,13 +28,14 @@
#include <QLabel>
#include <kpixmapeffect.h>
+#include <kwindowsystem.h>
#include <KDialog>
#include <KLocale>
#include <KAction>
GrayWidget::GrayWidget( QWidget *parent )
: QWidget( parent, Qt::Popup), m_currentY( 0 ), m_showMinimize( true ),
- m_disableShort( false )
+ m_disableShort( false ), m_first( true )
{
// full screen
setAttribute( Qt::WA_NoSystemBackground );
@@ -58,6 +60,7 @@
void GrayWidget::reset()
{
m_currentY = 0;
+ m_first = true;
m_dialog->hide();
}
@@ -91,35 +94,41 @@
showDialog();
return;
}
+ if (m_first)
+ {
+ m_first = false;
+ m_complete = takeScreenshot( QX11Info::appScreen() );
+
+ show();
+
+ KWindowSystem::forceActiveWindow(winId());
+ KWindowSystem::setOnAllDesktops(winId(),true);
+ KWindowSystem::setState(winId(), NET::KeepAbove);
+ KWindowSystem::setState(winId(), NET::FullScreen);
+
+ }
repaint();
m_currentY += 15;
}
void GrayWidget::paintEvent( QPaintEvent* )
{
+ kDebug() << k_funcinfo << m_currentY << m_first << endl;
+
if ( m_currentY >= height() )
return;
- static QPixmap complete( width(), height() );
- QPixmap below(width(),(height()-15));
-
- if ( m_currentY == 0 )
- {
- complete = QPixmap::grabWindow( QX11Info::appRootWindow(), 0, 0, width(), \
height() );
- below = complete.copy(0, 15, width(), height()-15);
- }
-
// this part we want to process...
QPixmap change(width(),15);
- change = complete.copy(0, m_currentY, width(),15);
+ change = m_complete.copy(0, m_currentY, width(),15);
change = KPixmapEffect::fade( change, 0.4, Qt::black );
change = KPixmapEffect::toGray( change, true );
QPainter painter( this );
painter.drawPixmap( 0, m_currentY, change );
- if ( m_currentY == 0 )
- painter.drawPixmap( 0, 15, below );
+ if ( m_currentY == 15 )
+ painter.drawPixmap( 0, 15, m_complete.copy(0, 15, width(), height()-15) );
QTimer::singleShot(10,this,SLOT(slotGrayEffect()));
}
--- trunk/extragear/utils/rsibreak/src/graywidget.h #694831:694832
@@ -72,8 +72,10 @@
int m_currentY;
KDialog* m_dialog;
QLabel* m_label;
+ QPixmap m_complete;
bool m_showMinimize;
bool m_disableShort;
+ bool m_first;
void showDialog();
void loadDialog();
};
--- trunk/extragear/utils/rsibreak/src/rsiwidget.cpp #694831:694832
@@ -221,11 +221,6 @@
// If there are no images found, we gray the screen and wait....
if (!m_slideShow->hasImages() || !m_useImages)
{
- m_grayWidget->show(); // Keep it above the KWindowSystem calls.
- KWindowSystem::forceActiveWindow(m_grayWidget->winId());
- KWindowSystem::setOnAllDesktops(m_grayWidget->winId(),true);
- KWindowSystem::setState(m_grayWidget->winId(), NET::KeepAbove);
- KWindowSystem::setState(m_grayWidget->winId(), NET::FullScreen);
QTimer::singleShot( 10, m_grayWidget, SLOT( slotGrayEffect() ) );
}
else
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic