author | zecke <zecke> | 2002-09-10 13:54:23 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-10 13:54:23 (UTC) |
commit | 4aad041a733e2478ff29330e1544e5fefcfb5cde (patch) (side-by-side diff) | |
tree | d45f21fa4570037b516ebfc1dd95aac56b3e6660 | |
parent | 9ae3234e770008c4fac9dc69ffc9bb0cb0f1b2ae (diff) | |
download | opie-4aad041a733e2478ff29330e1544e5fefcfb5cde.zip opie-4aad041a733e2478ff29330e1544e5fefcfb5cde.tar.gz opie-4aad041a733e2478ff29330e1544e5fefcfb5cde.tar.bz2 |
Fix floating point exception divide by 0 in qpedecoration
-rw-r--r-- | library/qpedecoration_qws.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp index 222d906..c2eb751 100644 --- a/library/qpedecoration_qws.cpp +++ b/library/qpedecoration_qws.cpp @@ -46,129 +46,130 @@ extern QRect qt_maxWindowRect; #ifndef QT_NO_QWS_QPE_WM_STYLE #ifndef QT_NO_IMAGEIO_XPM /* XPM */ static const char * const qpe_close_xpm[] = { "16 16 3 1", " c None", ". c #FFFFFF", "+ c #000000", " ", " ", " ..... ", " ..+++++.. ", " .+++++++++. ", " .+..+++..+. ", " .++...+...++. ", " .+++.....+++. ", " .++++...++++. ", " .+++.....+++. ", " .++...+...++. ", " .+..+++..+. ", " .+++++++++. ", " ..+++++.. ", " ..... ", " "}; /* XPM */ static const char * const qpe_accept_xpm[] = { "16 16 3 1", " c None", ". c #FFFFFF", "+ c #000000", " ", " ", " ..... ", " ..+++++.. ", " .+++++++++. ", " .+++++++++. ", " .+++++++..++. ", " .++.+++...++. ", " .+...+...+++. ", " .+......++++. ", " .++....+++++. ", " .++..+++++. ", " .+++++++++. ", " ..+++++.. ", " ..... ", " "}; #endif // QT_NO_IMAGEIO_XPM class HackWidget : public QWidget { public: bool needsOk() { return (getWState() & WState_Reserved1 ) || (inherits( "QDialog" ) && !inherits( "QMessageBox" ) ); } }; static QImage scaleButton( const QImage &img, int height ) { - if ( img.height() != height ) { + qWarning("Height %d %d", height, img.height() ); + if ( img.height()!=0 && img.height() != height ) { return img.smoothScale( img.width()*height/img.height(), height ); } else { return img; } } class TLWidget : public QWidget { public: QWSManager *manager() { return topData()->qwsManager; } QTLWExtra *topExtra() { return topData(); } void setWState( uint s ) { QWidget::setWState( s ); } void clearWState( uint s ) { QWidget::clearWState( s ); } }; QPEManager::QPEManager( QPEDecoration *d, QObject *parent ) : QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE) { wtTimer = new QTimer( this ); connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) ); } void QPEManager::updateActive() { QWidget *newActive = qApp->activeWindow(); if ( newActive && (QWidget*)active == newActive ) return; if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) { ((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this ); } if ( newActive && ((TLWidget *)newActive)->manager() ) { active = newActive; ((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this ); } else if ( !newActive ) { active = 0; } } int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p ) { QRect rect(w->geometry()); if ( decoration->region( w, rect, (QWSDecoration::Region)QPEDecoration::Help ).contains(p) ) return QPEDecoration::Help; for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) { if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p)) return (QWSDecoration::Region)i; } return QWSDecoration::None; |