Don't crash on divisions by zero.

svn path=/trunk/kdebase/kwin/; revision=98171
icc-effect-5.14.5
Waldo Bastian 2001-05-21 23:02:38 +00:00
parent ade32a5124
commit ac5556a78d
1 changed files with 8 additions and 0 deletions

View File

@ -431,6 +431,7 @@ void KWMThemeClient::paintEvent( QPaintEvent *)
//top //top
pm = *framePixmaps[FrameTop]; pm = *framePixmaps[FrameTop];
if (pm.width() > 0){
s = width()-w2-w1; s = width()-w2-w1;
n = s/pm.width(); n = s/pm.width();
w = n>0?s/n:s; w = n>0?s/n:s;
@ -452,10 +453,12 @@ void KWMThemeClient::paintEvent( QPaintEvent *)
break; break;
} }
} }
}
//bottom //bottom
pm = *framePixmaps[FrameBottom]; pm = *framePixmaps[FrameBottom];
if (pm.width() > 0){
s = width()-w4-w3; s = width()-w4-w3;
n = s/pm.width(); n = s/pm.width();
w = n>0?s/n:s; w = n>0?s/n:s;
@ -475,10 +478,12 @@ void KWMThemeClient::paintEvent( QPaintEvent *)
break; break;
} }
} }
}
//left //left
pm = *framePixmaps[FrameLeft]; pm = *framePixmaps[FrameLeft];
if (pm.height() > 0){
s = height()-h3-h1; s = height()-h3-h1;
n = s/pm.height(); n = s/pm.height();
w = n>0?s/n:s; w = n>0?s/n:s;
@ -501,10 +506,12 @@ void KWMThemeClient::paintEvent( QPaintEvent *)
break; break;
} }
} }
}
//right //right
pm = *framePixmaps[FrameRight]; pm = *framePixmaps[FrameRight];
if (pm.height() > 0){
s = height()-h4-h2; s = height()-h4-h2;
n = s/pm.height(); n = s/pm.height();
w = n>0?s/n:s; w = n>0?s/n:s;
@ -527,6 +534,7 @@ void KWMThemeClient::paintEvent( QPaintEvent *)
break; break;
} }
} }
}
drawTitle(p); drawTitle(p);
// KWM evidently had a 1 pixel border around the client window. We // KWM evidently had a 1 pixel border around the client window. We
// emulate it here, but should be removed at some point in order to // emulate it here, but should be removed at some point in order to