author | zecke <zecke> | 2002-09-10 13:54:23 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-10 13:54:23 (UTC) |
commit | 4aad041a733e2478ff29330e1544e5fefcfb5cde (patch) (unidiff) | |
tree | d45f21fa4570037b516ebfc1dd95aac56b3e6660 /library | |
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 | 23 |
1 files changed, 12 insertions, 11 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 | |||
@@ -37,13 +37,13 @@ | |||
37 | #include "windowdecorationinterface.h" | 37 | #include "windowdecorationinterface.h" |
38 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qsignal.h> | 39 | #include <qsignal.h> |
40 | 40 | ||
41 | #include <stdlib.h> | 41 | #include <stdlib.h> |
42 | 42 | ||
43 | extern QRect qt_maxWindowRect; | 43 | extern QRect qt_maxWindowRect; |
44 | 44 | ||
45 | #define WHATSTHIS_MODE | 45 | #define WHATSTHIS_MODE |
46 | 46 | ||
47 | #ifndef QT_NO_QWS_QPE_WM_STYLE | 47 | #ifndef QT_NO_QWS_QPE_WM_STYLE |
48 | 48 | ||
49 | #ifndef QT_NO_IMAGEIO_XPM | 49 | #ifndef QT_NO_IMAGEIO_XPM |
@@ -104,13 +104,14 @@ public: | |||
104 | (inherits( "QDialog" ) && !inherits( "QMessageBox" ) ); | 104 | (inherits( "QDialog" ) && !inherits( "QMessageBox" ) ); |
105 | } | 105 | } |
106 | }; | 106 | }; |
107 | 107 | ||
108 | static QImage scaleButton( const QImage &img, int height ) | 108 | static QImage scaleButton( const QImage &img, int height ) |
109 | { | 109 | { |
110 | if ( img.height() != height ) { | 110 | qWarning("Height %d %d", height, img.height() ); |
111 | if ( img.height()!=0 && img.height() != height ) { | ||
111 | return img.smoothScale( img.width()*height/img.height(), height ); | 112 | return img.smoothScale( img.width()*height/img.height(), height ); |
112 | } else { | 113 | } else { |
113 | return img; | 114 | return img; |
114 | } | 115 | } |
115 | } | 116 | } |
116 | 117 | ||
@@ -644,31 +645,31 @@ QRegion QPEDecoration::region(const QWidget *widget, const QRect &rect, QWSDecor | |||
644 | QRegion m = wdiface->mask(&wd); | 645 | QRegion m = wdiface->mask(&wd); |
645 | QRect br = m.boundingRect(); | 646 | QRect br = m.boundingRect(); |
646 | int b = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); | 647 | int b = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); |
647 | region = m & QRect( br.left()+grab, br.top(), | 648 | region = m & QRect( br.left()+grab, br.top(), |
648 | br.width()-2*grab, b ); | 649 | br.width()-2*grab, b ); |
649 | } | 650 | } |
650 | break; | 651 | break; |
651 | case Left: | 652 | case Left: |
652 | if ( !widget->isMaximized() ) { | 653 | if ( !widget->isMaximized() ) { |
653 | QRegion m = wdiface->mask(&wd); | 654 | QRegion m = wdiface->mask(&wd); |
654 | QRect br = m.boundingRect(); | 655 | QRect br = m.boundingRect(); |
655 | int b = wdiface->metric(WindowDecorationInterface::LeftBorder,&wd); | 656 | int b = wdiface->metric(WindowDecorationInterface::LeftBorder,&wd); |
656 | region = m & QRect( br.left(), br.top()+grab, | 657 | region = m & QRect( br.left(), br.top()+grab, |
657 | b, br.height()-2*grab ); | 658 | b, br.height()-2*grab ); |
658 | } | 659 | } |
659 | break; | 660 | break; |
660 | case Right: | 661 | case Right: |
661 | if ( !widget->isMaximized() ) { | 662 | if ( !widget->isMaximized() ) { |
662 | QRegion m = wdiface->mask(&wd); | 663 | QRegion m = wdiface->mask(&wd); |
663 | QRect br = m.boundingRect(); | 664 | QRect br = m.boundingRect(); |
664 | int b = wdiface->metric(WindowDecorationInterface::RightBorder,&wd); | 665 | int b = wdiface->metric(WindowDecorationInterface::RightBorder,&wd); |
665 | region = m & QRect( rect.right(), br.top()+grab, | 666 | region = m & QRect( rect.right(), br.top()+grab, |
666 | b, br.height()-2*grab ); | 667 | b, br.height()-2*grab ); |
667 | } | 668 | } |
668 | break; | 669 | break; |
669 | case Bottom: | 670 | case Bottom: |
670 | if ( !widget->isMaximized() ) { | 671 | if ( !widget->isMaximized() ) { |
671 | QRegion m = wdiface->mask(&wd); | 672 | QRegion m = wdiface->mask(&wd); |
672 | QRect br = m.boundingRect(); | 673 | QRect br = m.boundingRect(); |
673 | int b = wdiface->metric(WindowDecorationInterface::BottomBorder,&wd); | 674 | int b = wdiface->metric(WindowDecorationInterface::BottomBorder,&wd); |
674 | region = m & QRect( br.left()+grab, rect.bottom(), | 675 | region = m & QRect( br.left()+grab, rect.bottom(), |
@@ -682,13 +683,13 @@ QRegion QPEDecoration::region(const QWidget *widget, const QRect &rect, QWSDecor | |||
682 | int tb = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); | 683 | int tb = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); |
683 | int lb = wdiface->metric(WindowDecorationInterface::LeftBorder,&wd); | 684 | int lb = wdiface->metric(WindowDecorationInterface::LeftBorder,&wd); |
684 | QRegion crgn( br.left(), br.top(), grab, tb ); | 685 | QRegion crgn( br.left(), br.top(), grab, tb ); |
685 | crgn |= QRect( br.left(), br.top(), lb, grab ); | 686 | crgn |= QRect( br.left(), br.top(), lb, grab ); |
686 | region = m & crgn; | 687 | region = m & crgn; |
687 | } | 688 | } |
688 | break; | 689 | break; |
689 | case TopRight: | 690 | case TopRight: |
690 | if ( !widget->isMaximized() ) { | 691 | if ( !widget->isMaximized() ) { |
691 | QRegion m = wdiface->mask(&wd); | 692 | QRegion m = wdiface->mask(&wd); |
692 | QRect br = m.boundingRect(); | 693 | QRect br = m.boundingRect(); |
693 | int tb = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); | 694 | int tb = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); |
694 | int rb = wdiface->metric(WindowDecorationInterface::RightBorder,&wd); | 695 | int rb = wdiface->metric(WindowDecorationInterface::RightBorder,&wd); |
@@ -700,13 +701,13 @@ QRegion QPEDecoration::region(const QWidget *widget, const QRect &rect, QWSDecor | |||
700 | case BottomLeft: | 701 | case BottomLeft: |
701 | if ( !widget->isMaximized() ) { | 702 | if ( !widget->isMaximized() ) { |
702 | QRegion m = wdiface->mask(&wd); | 703 | QRegion m = wdiface->mask(&wd); |
703 | QRect br = m.boundingRect(); | 704 | QRect br = m.boundingRect(); |
704 | region = m & QRect( br.left(), br.bottom()-grab, grab, grab ); | 705 | region = m & QRect( br.left(), br.bottom()-grab, grab, grab ); |
705 | } | 706 | } |
706 | break; | 707 | break; |
707 | case BottomRight: | 708 | case BottomRight: |
708 | if ( !widget->isMaximized() ) { | 709 | if ( !widget->isMaximized() ) { |
709 | QRegion m = wdiface->mask(&wd); | 710 | QRegion m = wdiface->mask(&wd); |
710 | QRect br = m.boundingRect(); | 711 | QRect br = m.boundingRect(); |
711 | region = m & QRect( br.right()-grab, br.bottom()-grab, grab, grab ); | 712 | region = m & QRect( br.right()-grab, br.bottom()-grab, grab, grab ); |
712 | } | 713 | } |
@@ -819,17 +820,17 @@ void QPEDecoration::paintButton(QPainter *painter, const QWidget *w, | |||
819 | } | 820 | } |
820 | 821 | ||
821 | //#define QPE_DONT_SHOW_TITLEBAR | 822 | //#define QPE_DONT_SHOW_TITLEBAR |
822 | 823 | ||
823 | void QPEDecoration::maximize( QWidget *widget ) | 824 | void QPEDecoration::maximize( QWidget *widget ) |
824 | { | 825 | { |
825 | #ifdef QPE_DONT_SHOW_TITLEBAR | 826 | #ifdef QPE_DONT_SHOW_TITLEBAR |
826 | if ( !widget->inherits( "QDialog" ) ) { | 827 | if ( !widget->inherits( "QDialog" ) ) { |
827 | widget->setGeometry( qt_maxWindowRect ); | 828 | widget->setGeometry( qt_maxWindowRect ); |
828 | } else | 829 | } else |
829 | #endif | 830 | #endif |
830 | { | 831 | { |
831 | QWSDecoration::maximize( widget ); | 832 | QWSDecoration::maximize( widget ); |
832 | } | 833 | } |
833 | } | 834 | } |
834 | 835 | ||
835 | #ifndef QT_NO_DIALOG | 836 | #ifndef QT_NO_DIALOG |
@@ -850,13 +851,13 @@ void QPEDecoration::minimize( QWidget *widget ) | |||
850 | { | 851 | { |
851 | #ifndef QT_NO_DIALOG | 852 | #ifndef QT_NO_DIALOG |
852 | // We use the minimize button as an "accept" button. | 853 | // We use the minimize button as an "accept" button. |
853 | if ( widget->inherits( "QDialog" ) ) { | 854 | if ( widget->inherits( "QDialog" ) ) { |
854 | HackDialog *d = (HackDialog *)widget; | 855 | HackDialog *d = (HackDialog *)widget; |
855 | d->acceptIt(); | 856 | d->acceptIt(); |
856 | } | 857 | } |
857 | #endif | 858 | #endif |
858 | else if ( ((HackWidget *)widget)->needsOk() ) { | 859 | else if ( ((HackWidget *)widget)->needsOk() ) { |
859 | QSignal s; | 860 | QSignal s; |
860 | s.connect( widget, SLOT( accept() ) ); | 861 | s.connect( widget, SLOT( accept() ) ); |
861 | s.activate(); | 862 | s.activate(); |
862 | } else { | 863 | } else { |