From: <hep...@us...> - 2011-03-03 04:25:51
|
Revision: 1271 http://qterm.svn.sourceforge.net/qterm/?rev=1271&view=rev Author: hephooey Date: 2011-03-03 04:25:45 +0000 (Thu, 03 Mar 2011) Log Message: ----------- Support background blur in the KDE Modified Paths: -------------- trunk/qterm-qt4/src/CMakeLists.txt trunk/qterm-qt4/src/qtermscreen.cpp trunk/qterm-qt4/src/qtermscreen.h Added Paths: ----------- trunk/qterm-qt4/src/blur.cpp trunk/qterm-qt4/src/blur.h Modified: trunk/qterm-qt4/src/CMakeLists.txt =================================================================== --- trunk/qterm-qt4/src/CMakeLists.txt 2011-03-03 04:25:38 UTC (rev 1270) +++ trunk/qterm-qt4/src/CMakeLists.txt 2011-03-03 04:25:45 UTC (rev 1271) @@ -166,6 +166,7 @@ dommodel.cpp pallete.cpp chartable.cpp + blur.cpp ${optionalSources}) set(qterm_UIS ui/aboutdialog.ui Added: trunk/qterm-qt4/src/blur.cpp =================================================================== --- trunk/qterm-qt4/src/blur.cpp (rev 0) +++ trunk/qterm-qt4/src/blur.cpp 2011-03-03 04:25:45 UTC (rev 1271) @@ -0,0 +1,55 @@ +/* + Shamelessly copied from the patch for konsole at: + https://bugs.kde.org/show_bug.cgi?id=198175 + with some obvious modifications for QTerm + + This file is part of Konsole, a terminal emulator for KDE. + + Copyright 2010 Hugo Pereira Da Costa <hu...@ox...> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. +*/ + +#include "blur.h" + +#ifdef Q_WS_X11 +#include <QtGui/QX11Info> +#include <X11/Xlib.h> +#include <X11/Xatom.h> +#endif + +namespace QTerm +{ + + //_________________________________________________________________________ + void BlurHelper::updateBlurRegion( const QWidget* widget, const QRegion& region ) const + { +#ifdef Q_WS_X11 + // Atom + static Atom atom = XInternAtom( QX11Info::display(), "_KDE_NET_WM_BLUR_BEHIND_REGION", False); + + QVector<unsigned long> data; + foreach( const QRect& rect, region.rects() ) + { data << rect.x() << rect.y() << rect.width() << rect.height(); } + + XChangeProperty( + QX11Info::display(), widget->window()->winId(), atom, XA_CARDINAL, 32, PropModeReplace, + reinterpret_cast<const unsigned char *>(data.constData()), data.size() ); +#endif + } + +} + Added: trunk/qterm-qt4/src/blur.h =================================================================== --- trunk/qterm-qt4/src/blur.h (rev 0) +++ trunk/qterm-qt4/src/blur.h 2011-03-03 04:25:45 UTC (rev 1271) @@ -0,0 +1,47 @@ +#ifndef BlurHelper_h +#define BlurHelper_h +/* + Shamelessly copied from the patch for konsole at: + https://bugs.kde.org/show_bug.cgi?id=198175 + with some obvious modifications for QTerm + + This file is part of Konsole, a terminal emulator for KDE. + + Copyright 2010 Hugo Pereira Da Costa <hu...@ox...> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. +*/ + +#include <QtGui/QWidget> + +namespace QTerm +{ + class BlurHelper + { + + public: + + //! constructor + explicit BlurHelper( void ) + {} + + //! update blur region + void updateBlurRegion( const QWidget*, const QRegion& ) const; + + }; + +} +#endif Modified: trunk/qterm-qt4/src/qtermscreen.cpp =================================================================== --- trunk/qterm-qt4/src/qtermscreen.cpp 2011-03-03 04:25:38 UTC (rev 1270) +++ trunk/qterm-qt4/src/qtermscreen.cpp 2011-03-03 04:25:45 UTC (rev 1271) @@ -23,6 +23,7 @@ #include "qtermglobal.h" #include "schemedialog.h" #include "osdmessage.h" +#include "blur.h" #include <QApplication> #include <QPainter> @@ -254,6 +255,7 @@ } m_ePaintState = Show; update(); + QTimer::singleShot(50,this,SLOT(blurBackground())); } /* ------------------------------------------------------------------------ */ @@ -772,6 +774,10 @@ if (m_hasBlink) m_blinkTimer->start(1000); } +void Screen::blurBackground() +{ + BlurHelper().updateBlurRegion(Frame::instance(), Frame::instance()->rect()); +} void Screen::paintEvent(QPaintEvent * pe) { Modified: trunk/qterm-qt4/src/qtermscreen.h =================================================================== --- trunk/qterm-qt4/src/qtermscreen.h 2011-03-03 04:25:38 UTC (rev 1270) +++ trunk/qterm-qt4/src/qtermscreen.h 2011-03-03 04:25:45 UTC (rev 1271) @@ -149,6 +149,7 @@ void prevLine(); void nextLine(); void scrollLine(int); + void blurBackground(); protected: QRect m_rcClient; // the display area This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |