--Boundary-00=_p6ZP9PQAfqomHa1 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hey everyone, I fixed some problems with this patch and unless someones says "screw=20 you hippie" I'm going to commit the "transparent panel" patch. I fixed=20 the problem with the panel buttons not being transparent. So, what's=20 transparent: =2D the panel itself, =2D all panel buttons, what's not transparent =2D tasklist, =2D clock, =2D applets. Neither of the last three (maybe with the exception of the tasklist, on=20 which I'm going to hack a little) is going to become transparent=20 (unless _real_ transparency gets into XFree86 ). If you feel like=20 testing it, patch your kdebase with the attached patch, or look at the=20 screenshots below and drool/flame on/read another post. http://vortex.bd.psu.edu/~mus11/img/kicker2.png http://vortex.bd.psu.edu/~mus11/img/kicker3.png http://vortex.bd.psu.edu/~mus11/img/kicker1.png Zack Rusin =2D-=20 "I get to go to lots of overseas places, like Canada." - Britney Spears=20 --Boundary-00=_p6ZP9PQAfqomHa1 Content-Type: text/x-diff; charset="iso-8859-1"; name="transparent.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="transparent.diff" ? transparent.diff ? kate/app/dummy_kate.cpp ? kate/app/dummy_kate_la.cpp ? kate/app/dummy_kwrite.cpp ? kcontrol/kded/Makefile ? kcontrol/kicker/lookandfeeltab.ui.h ? kcontrol/kicker/semantic.cache ? kcontrol/konqhtml/nsconfigwidget.cpp ? kcontrol/konqhtml/nsconfigwidget.h ? kdm/kfrontend/krootimage ? kicker/dummy_la.cpp ? kicker/buttons/semantic.cache ? kicker/core/semantic.cache ? nsplugins/control/Makefile ? nsplugins/control/Makefile.in ? nsplugins/control/configwidget.cpp ? nsplugins/control/configwidget.h Index: kcontrol/kicker/lookandfeeltab.ui =================================================================== RCS file: /home/kde/kdebase/kcontrol/kicker/lookandfeeltab.ui,v retrieving revision 1.16 diff -u -3 -p -r1.16 lookandfeeltab.ui --- kcontrol/kicker/lookandfeeltab.ui 2002/05/12 23:30:31 1.16 +++ kcontrol/kicker/lookandfeeltab.ui 2002/07/23 22:06:45 @@ -8,8 +8,8 @@ 0 0 - 441 - 360 + 547 + 528 @@ -344,7 +344,18 @@ 6 - + + + m_backgroundImage + + + Enable &background image + + + If this option is selected, you can choose a background image that will be displayed on the panel. If it is not selected, the default colors will be used, see the 'Colors' control module. + + + m_backgroundLabel @@ -390,19 +401,8 @@ This is a preview for the selected background image. - - - - m_backgroundImage - - - Enable &background image - - - If this option is selected, you can choose a background image that will be displayed on the panel. If it is not selected, the default colors will be used, see the 'Colors' control module. - - + m_backgroundInput @@ -421,6 +421,17 @@ Here you can choose a theme to be displayed by the panel. Press the 'Browse' button to choose a theme using the file dialog.<p> This option is only active if 'Enable background image' is selected. + + + m_transparent + + + false + + + Make the panel transparent + + @@ -455,6 +466,24 @@ m_backgroundInput setEnabled(bool) + + m_backgroundImage + toggled(bool) + m_transparent + setEnabled(bool) + + + m_transparent + toggled(bool) + m_backgroundInput + setDisabled(bool) + + + m_transparent + toggled(bool) + m_backgroundLabel + setDisabled(bool) + m_zoom_cb @@ -470,6 +499,7 @@ kurlrequester.h + lookandfeeltab.ui.h Index: kcontrol/kicker/lookandfeeltab_impl.cpp =================================================================== RCS file: /home/kde/kdebase/kcontrol/kicker/lookandfeeltab_impl.cpp,v retrieving revision 1.28 diff -u -3 -p -r1.28 lookandfeeltab_impl.cpp --- kcontrol/kicker/lookandfeeltab_impl.cpp 2002/07/20 16:17:53 1.28 +++ kcontrol/kicker/lookandfeeltab_impl.cpp 2002/07/23 22:06:45 @@ -56,7 +56,7 @@ LookAndFeelTab::LookAndFeelTab( QWidget { connect(m_zoom_cb, SIGNAL(clicked()), SIGNAL(changed())); connect(m_showToolTips, SIGNAL(clicked()), SIGNAL(changed())); - + connect(m_kmenuTile, SIGNAL(activated(int)), SIGNAL(changed())); connect(m_desktopTile, SIGNAL(activated(int)), SIGNAL(changed())); connect(m_browserTile, SIGNAL(activated(int)), SIGNAL(changed())); @@ -65,6 +65,7 @@ LookAndFeelTab::LookAndFeelTab( QWidget connect(m_wlTile, SIGNAL(activated(int)), SIGNAL(changed())); connect(m_backgroundImage, SIGNAL(clicked()), SIGNAL(changed())); + connect(m_transparent, SIGNAL(clicked()), SIGNAL(changed())); m_backgroundInput->fileDialog()->setFilter(KImageIO::pattern(KImageIO::Reading)); m_backgroundInput->fileDialog()->setCaption(i18n("Select an Image File")); @@ -102,7 +103,7 @@ int LookAndFeelTab::findComboEntry(QComb { int index = 0; - for (int i = 0; i < combo->count(); i++) + for (int i = 0; i < combo->count(); i++) { if (searchFor == combo->text(i)) { @@ -128,9 +129,12 @@ void LookAndFeelTab::load() bool use_theme = c.readBoolEntry("UseBackgroundTheme", false); theme = c.readEntry("BackgroundTheme", QString::null).stripWhiteSpace(); + bool transparent = c.readBoolEntry("Transparent", false); + m_backgroundImage->setChecked(use_theme); - m_backgroundInput->setEnabled(use_theme); - m_backgroundLabel->setEnabled(use_theme); + m_transparent->setChecked(transparent); + m_backgroundInput->setEnabled((transparent)?false:use_theme); + m_backgroundLabel->setEnabled((transparent)?false:use_theme); if (theme.length() > 0) { @@ -259,6 +263,7 @@ void LookAndFeelTab::save() c.setGroup("General"); c.writeEntry("UseBackgroundTheme", m_backgroundImage->isChecked()); + c.writeEntry("Transparent", m_transparent->isChecked()); c.writeEntry("BackgroundTheme", theme); c.writeEntry( "ShowToolTips", m_showToolTips->isChecked() ); c.writeEntry( "FadeOutAppletHandles", m_fadeOutAppletHandles ); @@ -274,7 +279,7 @@ void LookAndFeelTab::save() } else { - c.writeEntry("EnableKMenuTiles", false); + c.writeEntry("EnableKMenuTiles", false); } tile = m_desktopTile->currentItem(); @@ -286,9 +291,9 @@ void LookAndFeelTab::save() } else { - c.writeEntry("EnableDesktopButtonTiles", false); + c.writeEntry("EnableDesktopButtonTiles", false); } - + tile = m_urlTile->currentItem(); if (tile > 0) { @@ -298,7 +303,7 @@ void LookAndFeelTab::save() } else { - c.writeEntry("EnableURLTiles", false); + c.writeEntry("EnableURLTiles", false); } tile = m_browserTile->currentItem(); @@ -322,7 +327,7 @@ void LookAndFeelTab::save() } else { - c.writeEntry("EnableExeTiles", false); + c.writeEntry("EnableExeTiles", false); } tile = m_wlTile->currentItem(); @@ -334,13 +339,13 @@ void LookAndFeelTab::save() } else { - c.writeEntry("EnableWindowListTiles", false); + c.writeEntry("EnableWindowListTiles", false); } c.setGroup("buttons"); c.writeEntry("EnableTileBackground", enableTiles); c.writeEntry("EnableIconZoom", m_zoom_cb->isChecked()); - + c.sync(); } @@ -359,6 +364,7 @@ void LookAndFeelTab::defaults() theme = QString::null; m_backgroundImage->setChecked(false); + m_transparent->setChecked(false); m_backgroundInput->lineEdit()->setText(theme); m_backgroundLabel->clear(); @@ -398,13 +404,13 @@ void LookAndFeelTab::fillTileCombos() m_browserTile->insertItem(pix, tile); m_exeTile->insertItem(pix, tile); m_wlTile->insertItem(pix, tile); - - if (pix.height() > minHeight) + + if (pix.height() > minHeight) { minHeight = pix.height(); } } - + minHeight += 6; m_kmenuTile->setMinimumHeight(minHeight); m_desktopTile->setMinimumHeight(minHeight); Index: kicker/buttons/panelbuttonbase.cpp =================================================================== RCS file: /home/kde/kdebase/kicker/buttons/panelbuttonbase.cpp,v retrieving revision 1.17 diff -u -3 -p -r1.17 panelbuttonbase.cpp --- kicker/buttons/panelbuttonbase.cpp 2002/05/25 02:15:57 1.17 +++ kicker/buttons/panelbuttonbase.cpp 2002/07/23 22:06:48 @@ -40,6 +40,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include #include "kicker.h" +#include "containerarea.h" #include "panel.h" #include "panelbuttonbase.h" @@ -76,11 +77,11 @@ void ZoomButton::reconfigure() void ZoomButton::updateIcon() { - if ( watch ) + if ( watch ) { _icon = watch->zoomIcon(); update(); - } + } } bool ZoomButton::isWatching( PanelButtonBase* btn ) @@ -93,7 +94,7 @@ void ZoomButton::watchMe( PanelButtonBas PanelButtonBase* watch_old = watch; watch = btn; _icon = watch->zoomIcon(); - if ( watch_old ) + if ( watch_old ) { watch_old->repaint(); disconnect(watch_old,0, this,0); @@ -240,14 +241,14 @@ bool ZoomButton::eventFilter( QObject *o return FALSE; } -void ZoomButton::unFocus() +void ZoomButton::unFocus() { hide(); if (watch) { PanelButtonBase* tmp = watch; watch = 0; tmp->update(); - } + } lower(); setEnabled(false); } @@ -382,6 +383,7 @@ void PanelButtonBase::setBackground() { KConfig* config = KGlobal::config(); config->setGroup("General"); + if (config->readBoolEntry("UseBackgroundTheme", false)) { // Get the pixmap from the container area object @@ -424,7 +426,6 @@ void PanelButtonBase::setBackground() else { // Need to do 2 seperate bitBlts to take care of the overlap - // Copy the left/top of the image first up to the wrap- // around point int x = 0; @@ -479,9 +480,9 @@ void PanelButtonBase::resizeEvent(QResiz void PanelButtonBase::setZoomEnabled(bool b) { - if (!zoomButton) + if (!zoomButton) zoomButton = new ZoomButton(); - + if (!b) zoomDisabled++; else @@ -490,7 +491,7 @@ void PanelButtonBase::setZoomEnabled(boo if (zoomDisabled) { zoomButton->unFocus(); - } + } } void PanelButtonBase::enterEvent(QEvent* e) @@ -604,13 +605,27 @@ void PanelButtonBase::drawButton(QPainte QPixmap bg(size()); QPainter pbg; pbg.begin(&bg); - // Draw the background. This is always needed, even when using tiles, // because they don't have to cover the entire button. - if ( !_bg.isNull() ) + if ( !_bg.isNull() ) { pbg.drawPixmap( 0, 0, _bg ); - else - pbg.fillRect(rect(), colorGroup().brush(QColorGroup::Background)); + } + else { + QPixmap *pm = colorGroup().brush( QColorGroup::Background).pixmap(); + if ( pm ) { + QPixmap mbg( width(), height() ); + + QWidget *wid = static_cast(Panel::the()->containerArea()); + if ( !wid ) + kdDebug()< #include #include +#include #include "kicker.h" #include "pluginmanager.h" @@ -70,6 +71,7 @@ ContainerArea::ContainerArea( KConfig* _ , _dragIndicator(0) , _dragMoveAC(0) , _dragMoveOffset(QPoint(0,0)) + , _rootPixmap(0) { setAcceptDrops( !Kicker::kicker()->isImmutable() ); connect(&_autoScrollTimer, SIGNAL(timeout()), SLOT(autoScroll())); @@ -233,7 +235,7 @@ void ContainerArea::saveContainerConfig( // build the applet list QStringList alist; - for( ContainerIterator it(_containers); it.current(); ++it ) + for( ContainerIterator it(_containers); it.current(); ++it ) { BaseContainer* a = it.current(); @@ -258,7 +260,7 @@ void ContainerArea::loadContainerConfig( QStringList alist = group.readListEntry("Applets"); // now restore the applets - for( QStringList::Iterator it = alist.begin(); it != alist.end(); ++it ) + for( QStringList::Iterator it = alist.begin(); it != alist.end(); ++it ) { QString appletId(*it); @@ -272,7 +274,7 @@ void ContainerArea::loadContainerConfig( int sep = appletId.findRev('_'); Q_ASSERT(sep != -1); QString appletType = appletId.left(sep); - + // create a matching applet container if (appletType == "KMenuButton") a = new KMenuButtonContainer(viewport()); @@ -1377,52 +1379,63 @@ void ContainerArea::setBackgroundTheme() KConfigGroupSaver saver(_config, "General"); if (_config->readBoolEntry("UseBackgroundTheme", false)) { - QString bgStr = _config->readEntry("BackgroundTheme", ""); - bgStr = locate("appdata", bgStr); - if(!bgStr.isEmpty()){ - QPixmap bgPix(bgStr); - if(!bgPix.isNull()){ - // Do we need to rotate the image - QPixmap bgPixNew; - - if ( _config->readBoolEntry("RotateBackground", false) && - orientation() == Vertical ) - { - // Rotate the pixmap before scaling - QWMatrix m; - m.rotate( -90.0 ); - bgPixNew = bgPix.xForm( m ); - } - else - { - // Don't rotate the image - just copy it - bgPixNew = bgPix; - } - - // Scale the image but keep the same aspect ratio - QImage bgImage = bgPixNew.convertToImage(); - double dAspect = (double)bgPixNew.width() / (double)bgPixNew.height(); - - int nNewWidth = width(); - int nNewHeight = height(); - if (orientation() == Vertical ) - nNewHeight = (int)( (double)nNewWidth / dAspect ); - else - nNewWidth = (int)( (double)nNewHeight * dAspect); - QImage bgImageNew = bgImage.smoothScale( nNewWidth, nNewHeight ); - - // Convert back to a QPixmap - bgPixNew.convertFromImage( bgImageNew ); - - QBrush bgBrush(colorGroup().background(), bgPixNew); - QPalette pal = kapp->palette(); - pal.setBrush(QColorGroup::Background, bgBrush); - setPalette(pal); - } - else { - unsetPalette(); - kdWarning() << "Kicker: Error loading background theme pixmap\n"; - } + if (_config->readBoolEntry("Transparent", false) ) { + if ( !_rootPixmap ) { + _rootPixmap = new KRootPixmap(this); + _rootPixmap->setCustomPainting(true); + connect(_rootPixmap, SIGNAL(backgroundUpdated(const QPixmap&)), + SLOT(updateBackground(const QPixmap&))); + _rootPixmap->start(); + } else + _rootPixmap->repaint(true); + } else { + QString bgStr = _config->readEntry("BackgroundTheme", ""); + bgStr = locate("appdata", bgStr); + if(!bgStr.isEmpty()){ + QPixmap bgPix(bgStr); + if(!bgPix.isNull()){ + // Do we need to rotate the image + QPixmap bgPixNew; + + if ( _config->readBoolEntry("RotateBackground", false) && + orientation() == Vertical ) + { + // Rotate the pixmap before scaling + QWMatrix m; + m.rotate( -90.0 ); + bgPixNew = bgPix.xForm( m ); + } + else + { + // Don't rotate the image - just copy it + bgPixNew = bgPix; + } + + // Scale the image but keep the same aspect ratio + QImage bgImage = bgPixNew.convertToImage(); + double dAspect = (double)bgPixNew.width() / (double)bgPixNew.height(); + + int nNewWidth = width(); + int nNewHeight = height(); + if (orientation() == Vertical ) + nNewHeight = (int)( (double)nNewWidth / dAspect ); + else + nNewWidth = (int)( (double)nNewHeight * dAspect); + QImage bgImageNew = bgImage.smoothScale( nNewWidth, nNewHeight ); + + // Convert back to a QPixmap + bgPixNew.convertFromImage( bgImageNew ); + + QBrush bgBrush(colorGroup().background(), bgPixNew); + QPalette pal = kapp->palette(); + pal.setBrush(QColorGroup::Background, bgBrush); + setPalette(pal); + } + else { + unsetPalette(); + kdWarning() << "Kicker: Error loading background theme pixmap\n"; + } + } } } else { @@ -1794,6 +1807,15 @@ void ContainerArea::autoScroll() else if(_moveAC->pos().y() >= height() - _moveAC->height() - 80) scrollBy(0, 10); } +} + +void ContainerArea::updateBackground( const QPixmap& pm ) +{ + QBrush bgBrush(colorGroup().background(), pm); + QPalette pal = kapp->palette(); + pal.setBrush(QColorGroup::Background, bgBrush); + setPalette(pal); + kdDebug()< ContainerList; typedef QPtrListIterator ContainerIterator; @@ -92,7 +93,7 @@ protected slots: void stopContainerMove(BaseContainer *a); protected: - + QString createUniqueId(const QString& appletType) const; void layoutChildren(); @@ -138,6 +139,7 @@ protected slots: void embeddedWindowDestroyed(); void slotRemoveContainer(BaseContainer*); void autoScroll(); + void updateBackground( const QPixmap &pm ); private: ContainerList _containers; @@ -151,6 +153,7 @@ private: BaseContainer* _dragMoveAC; QPoint _dragMoveOffset; QTimer _autoScrollTimer; + KRootPixmap* _rootPixmap; }; class DragIndicator : public QWidget --Boundary-00=_p6ZP9PQAfqomHa1--