author | sandman <sandman> | 2002-07-08 00:42:56 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-07-08 00:42:56 (UTC) |
commit | 923a6290c8cc93914d54e583f1d79a6bae638fab (patch) (side-by-side diff) | |
tree | b2562e4dbf6d71631b358021f8c4ec29f36a6d12 | |
parent | 895f43bd1850b3e0c43edaaad18a7d7f2613033b (diff) | |
download | opie-923a6290c8cc93914d54e583f1d79a6bae638fab.zip opie-923a6290c8cc93914d54e583f1d79a6bae638fab.tar.gz opie-923a6290c8cc93914d54e583f1d79a6bae638fab.tar.bz2 |
- Fix a memory leak (bg pixmaps for taskbar applets were never freed)
- Try to be more intelligent about stipple alignment in child widgets
(in every app I tested the stipple is now always aligned right)
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 16 | ||||
-rw-r--r-- | noncore/styles/liquid/plugin.cpp | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 67e53e9..fc925b8 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -104,73 +104,72 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) if(p->testWFlags(Qt::WType_Popup)){ QRect r(p->x(), p->y(), p->width(), p->height()); QRect deskR = QApplication::desktop()->rect(); if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ r.setBottom(deskR.bottom()); r.setRight(deskR.right()); } *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), r.width(), r.height()); } else{ // tear off menu pix->resize(p->width(), p->height()); pix->fill(Qt::black.rgb()); } if(type == TransStippleBg){ stripePixmap(*pix, p->colorGroup().background()); } else if(type == TransStippleBtn){ stripePixmap(*pix, p->colorGroup().button()); } else{ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); } - if (p->inherits("QPopupMenu")) - pixDict.insert(p->winId(), pix); - else { + pixDict.insert(p->winId(), pix); + + if (!p->inherits("QPopupMenu")) { p->setBackgroundPixmap(*pix); QObjectList *ol = p-> queryList("QWidget"); for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { QWidget *wid = (QWidget *) it.current ( ); wid-> setBackgroundPixmap(*pix); wid-> setBackgroundOrigin(QWidget::ParentOrigin); } delete ol; } } } else if(ev->type() == QEvent::Hide){ if(type == TransStippleBg || type == TransStippleBtn || type == Custom){ // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); - if (p->inherits("QPopupMenu")) - pixDict.remove(p->winId()); - else { - p->setBackgroundMode(QWidget::PaletteBackground); + pixDict.remove(p->winId()); + if (!p->inherits("QPopupMenu")) { + p->setBackgroundMode(QWidget::PaletteBackground); QObjectList *ol = p-> queryList("QWidget"); for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { QWidget *wid = (QWidget *) it.current ( ); wid-> setBackgroundMode( QWidget::PaletteBackground ); } delete ol; } } } return(false); } LiquidStyle::LiquidStyle() :QWindowsStyle() { setName ( "LiquidStyle" ); btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); btnMaskBmp.setMask(btnMaskBmp); htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); @@ -824,49 +823,50 @@ void LiquidStyle::polish(QPalette &appPal) applyCustomAttributes((QPushButton *)w); } } } void LiquidStyle::polish(QWidget *w) { if(w->inherits("QMenuBar")){ //((QFrame*)w)->setLineWidth(0); w->setBackgroundMode(QWidget::PaletteBackground); return; } if(w->inherits("QPopupMenu")) w->setBackgroundMode(QWidget::NoBackground); else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { w->installEventFilter(menuHandler); } if(w->isTopLevel()){ return; } - w-> setBackgroundOrigin ( QWidget::ParentOrigin ); + if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); if(w->inherits("QComboBox") || w->inherits("QLineEdit") || w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QScrollBar")) { w->installEventFilter(this); } if(w->inherits("QLineEdit")){ QPalette pal = w->palette(); pal.setBrush(QColorGroup::Base, baseBrush); w->setPalette(pal); } if(w->inherits("QPushButton")){ applyCustomAttributes((QPushButton *)w); w->installEventFilter(this); } if(w->inherits("QButton") || w-> inherits("QComboBox")){ w-> setBackgroundMode ( QWidget::PaletteBackground ); } bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || qstrcmp(w->name(), "qt_clipped_viewport") == 0; bool isViewportChild = w->parent() && ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); diff --git a/noncore/styles/liquid/plugin.cpp b/noncore/styles/liquid/plugin.cpp index f149c29..5f4c8e5 100644 --- a/noncore/styles/liquid/plugin.cpp +++ b/noncore/styles/liquid/plugin.cpp @@ -88,24 +88,26 @@ bool LiquidSettingsInterface::accept ( ) return m_widget-> writeConfig ( ); } void LiquidSettingsInterface::reject ( ) { } QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_StyleSettings ) *iface = this; if ( *iface ) (*iface)-> addRef ( ); return QS_OK; } +// Hack for Retail Z experiments +extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } |