summaryrefslogtreecommitdiff
authorsandman <sandman>2002-07-08 00:42:56 (UTC)
committer sandman <sandman>2002-07-08 00:42:56 (UTC)
commit923a6290c8cc93914d54e583f1d79a6bae638fab (patch) (unidiff)
treeb2562e4dbf6d71631b358021f8c4ec29f36a6d12
parent895f43bd1850b3e0c43edaaad18a7d7f2613033b (diff)
downloadopie-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)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp16
-rw-r--r--noncore/styles/liquid/plugin.cpp2
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)
104 if(p->testWFlags(Qt::WType_Popup)){ 104 if(p->testWFlags(Qt::WType_Popup)){
105 QRect r(p->x(), p->y(), p->width(), p->height()); 105 QRect r(p->x(), p->y(), p->width(), p->height());
106 QRect deskR = QApplication::desktop()->rect(); 106 QRect deskR = QApplication::desktop()->rect();
107 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ 107 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){
108 r.setBottom(deskR.bottom()); 108 r.setBottom(deskR.bottom());
109 r.setRight(deskR.right()); 109 r.setRight(deskR.right());
110 } 110 }
111 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 111 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
112 r.width(), r.height()); 112 r.width(), r.height());
113 } 113 }
114 else{ // tear off menu 114 else{ // tear off menu
115 pix->resize(p->width(), p->height()); 115 pix->resize(p->width(), p->height());
116 pix->fill(Qt::black.rgb()); 116 pix->fill(Qt::black.rgb());
117 } 117 }
118 if(type == TransStippleBg){ 118 if(type == TransStippleBg){
119 stripePixmap(*pix, p->colorGroup().background()); 119 stripePixmap(*pix, p->colorGroup().background());
120 } 120 }
121 else if(type == TransStippleBtn){ 121 else if(type == TransStippleBtn){
122 stripePixmap(*pix, p->colorGroup().button()); 122 stripePixmap(*pix, p->colorGroup().button());
123 } 123 }
124 else{ 124 else{
125 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 125 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
126 } 126 }
127 127
128 if (p->inherits("QPopupMenu")) 128 pixDict.insert(p->winId(), pix);
129 pixDict.insert(p->winId(), pix); 129
130 else { 130 if (!p->inherits("QPopupMenu")) {
131 p->setBackgroundPixmap(*pix); 131 p->setBackgroundPixmap(*pix);
132 132
133 QObjectList *ol = p-> queryList("QWidget"); 133 QObjectList *ol = p-> queryList("QWidget");
134 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 134 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
135 QWidget *wid = (QWidget *) it.current ( ); 135 QWidget *wid = (QWidget *) it.current ( );
136 136
137 wid-> setBackgroundPixmap(*pix); 137 wid-> setBackgroundPixmap(*pix);
138 wid-> setBackgroundOrigin(QWidget::ParentOrigin); 138 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
139 } 139 }
140 delete ol; 140 delete ol;
141 } 141 }
142 } 142 }
143 } 143 }
144 else if(ev->type() == QEvent::Hide){ 144 else if(ev->type() == QEvent::Hide){
145 if(type == TransStippleBg || type == TransStippleBtn || 145 if(type == TransStippleBg || type == TransStippleBtn ||
146 type == Custom){ 146 type == Custom){
147// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 147// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
148 148
149 if (p->inherits("QPopupMenu")) 149 pixDict.remove(p->winId());
150 pixDict.remove(p->winId()); 150 if (!p->inherits("QPopupMenu")) {
151 else { 151 p->setBackgroundMode(QWidget::PaletteBackground);
152 p->setBackgroundMode(QWidget::PaletteBackground);
153 152
154 QObjectList *ol = p-> queryList("QWidget"); 153 QObjectList *ol = p-> queryList("QWidget");
155 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 154 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
156 QWidget *wid = (QWidget *) it.current ( ); 155 QWidget *wid = (QWidget *) it.current ( );
157 156
158 wid-> setBackgroundMode( QWidget::PaletteBackground ); 157 wid-> setBackgroundMode( QWidget::PaletteBackground );
159 } 158 }
160 delete ol; 159 delete ol;
161 } 160 }
162 } 161 }
163 } 162 }
164 return(false); 163 return(false);
165} 164}
166 165
167 166
168LiquidStyle::LiquidStyle() 167LiquidStyle::LiquidStyle()
169 :QWindowsStyle() 168 :QWindowsStyle()
170{ 169{
171 setName ( "LiquidStyle" ); 170 setName ( "LiquidStyle" );
172 171
173 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 172 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
174 btnMaskBmp.setMask(btnMaskBmp); 173 btnMaskBmp.setMask(btnMaskBmp);
175 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 174 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
176 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 175 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
@@ -824,49 +823,50 @@ void LiquidStyle::polish(QPalette &appPal)
824 applyCustomAttributes((QPushButton *)w); 823 applyCustomAttributes((QPushButton *)w);
825 } 824 }
826 } 825 }
827 826
828} 827}
829 828
830void LiquidStyle::polish(QWidget *w) 829void LiquidStyle::polish(QWidget *w)
831{ 830{
832 if(w->inherits("QMenuBar")){ 831 if(w->inherits("QMenuBar")){
833 //((QFrame*)w)->setLineWidth(0); 832 //((QFrame*)w)->setLineWidth(0);
834 w->setBackgroundMode(QWidget::PaletteBackground); 833 w->setBackgroundMode(QWidget::PaletteBackground);
835 return; 834 return;
836 } 835 }
837 if(w->inherits("QPopupMenu")) 836 if(w->inherits("QPopupMenu"))
838 w->setBackgroundMode(QWidget::NoBackground); 837 w->setBackgroundMode(QWidget::NoBackground);
839 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 838 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
840 w->installEventFilter(menuHandler); 839 w->installEventFilter(menuHandler);
841 } 840 }
842 841
843 if(w->isTopLevel()){ 842 if(w->isTopLevel()){
844 return; 843 return;
845 } 844 }
846 845
847 846
848 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 847 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
848 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
849 849
850 if(w->inherits("QComboBox") || 850 if(w->inherits("QComboBox") ||
851 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 851 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
852 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 852 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
853 w->installEventFilter(this); 853 w->installEventFilter(this);
854 } 854 }
855 if(w->inherits("QLineEdit")){ 855 if(w->inherits("QLineEdit")){
856 QPalette pal = w->palette(); 856 QPalette pal = w->palette();
857 pal.setBrush(QColorGroup::Base, baseBrush); 857 pal.setBrush(QColorGroup::Base, baseBrush);
858 w->setPalette(pal); 858 w->setPalette(pal);
859 } 859 }
860 if(w->inherits("QPushButton")){ 860 if(w->inherits("QPushButton")){
861 applyCustomAttributes((QPushButton *)w); 861 applyCustomAttributes((QPushButton *)w);
862 w->installEventFilter(this); 862 w->installEventFilter(this);
863 } 863 }
864 if(w->inherits("QButton") || w-> inherits("QComboBox")){ 864 if(w->inherits("QButton") || w-> inherits("QComboBox")){
865 w-> setBackgroundMode ( QWidget::PaletteBackground ); 865 w-> setBackgroundMode ( QWidget::PaletteBackground );
866 } 866 }
867 867
868 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 868 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
869 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 869 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
870 bool isViewportChild = w->parent() && 870 bool isViewportChild = w->parent() &&
871 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 871 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
872 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 872 (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 ( )
88 88
89 return m_widget-> writeConfig ( ); 89 return m_widget-> writeConfig ( );
90} 90}
91 91
92void LiquidSettingsInterface::reject ( ) 92void LiquidSettingsInterface::reject ( )
93{ 93{
94} 94}
95 95
96QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 96QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
97{ 97{
98 *iface = 0; 98 *iface = 0;
99 99
100 100
101 if ( uuid == IID_QUnknown ) 101 if ( uuid == IID_QUnknown )
102 *iface = this; 102 *iface = this;
103 else if ( uuid == IID_StyleSettings ) 103 else if ( uuid == IID_StyleSettings )
104 *iface = this; 104 *iface = this;
105 105
106 if ( *iface ) 106 if ( *iface )
107 (*iface)-> addRef ( ); 107 (*iface)-> addRef ( );
108 108
109 return QS_OK; 109 return QS_OK;
110} 110}
111 111
112// Hack for Retail Z experiments
113extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } }