Fix maximized borders.

svn path=/trunk/kdebase/kwin/; revision=333562
This commit is contained in:
Luciano Montanaro 2004-07-28 16:55:38 +00:00
parent 06fa4c69bd
commit 1cba403dc1
2 changed files with 17 additions and 6 deletions

View file

@ -774,7 +774,7 @@ void KDEDefaultClient::init()
// Determine the size of the lower grab bar // Determine the size of the lower grab bar
spacer = new QSpacerItem(10, spacer = new QSpacerItem(10,
showGrabBar && isResizable() ? grabBorderWidth : borderWidth, mustDrawHandle() ? grabBorderWidth : borderWidth,
QSizePolicy::Expanding, QSizePolicy::Minimum); QSizePolicy::Expanding, QSizePolicy::Minimum);
g->addItem(spacer, 4, 1); g->addItem(spacer, 4, 1);
@ -936,6 +936,16 @@ void KDEDefaultClient::reset( unsigned long )
widget()->repaint(); widget()->repaint();
} }
bool KDEDefaultClient::mustDrawHandle() const
{
bool drawSmallBorders = !options()->moveResizeMaximizedWindows();
if (drawSmallBorders && (maximizeMode() & MaximizeVertical)) {
return false;
} else {
return showGrabBar && isResizable();
}
}
void KDEDefaultClient::iconChange() void KDEDefaultClient::iconChange()
{ {
if (button[BtnMenu] && button[BtnMenu]->isVisible()) if (button[BtnMenu] && button[BtnMenu]->isVisible())
@ -1118,7 +1128,7 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
options()->color(ColorFrame, isActive() )); options()->color(ColorFrame, isActive() ));
// Draw the bottom handle if required // Draw the bottom handle if required
if (showGrabBar && isResizable()) if (mustDrawHandle())
{ {
if(w > 50) if(w > 50)
{ {
@ -1238,7 +1248,7 @@ void KDEDefaultClient::maximizeChange()
QToolTip::remove( button[ BtnMax ] ); QToolTip::remove( button[ BtnMax ] );
QToolTip::add( button[BtnMax], m ? i18n("Restore") : i18n("Maximize")); QToolTip::add( button[BtnMax], m ? i18n("Restore") : i18n("Maximize"));
} }
spacer->changeSize(10, showGrabBar && isResizable() ? 8 : 4, spacer->changeSize(10, mustDrawHandle() ? 8 : 4,
QSizePolicy::Expanding, QSizePolicy::Minimum); QSizePolicy::Expanding, QSizePolicy::Minimum);
g->activate(); g->activate();
} }
@ -1278,7 +1288,7 @@ void KDEDefaultClient::borders( int& left, int& right, int& top, int& bottom ) c
left = right = borderWidth; left = right = borderWidth;
// , y+titleHeight+3, w-6, h-titleHeight-offset-6 ); // , y+titleHeight+3, w-6, h-titleHeight-offset-6 );
top = titleHeight + 4; top = titleHeight + 4;
bottom = (showGrabBar && isResizable()) ? grabBorderWidth : borderWidth; bottom = mustDrawHandle() ? grabBorderWidth : borderWidth;
} }
// The hiding button while shrinking, show button while expanding magic // The hiding button while shrinking, show button while expanding magic
@ -1328,7 +1338,7 @@ KDecoration::Position KDEDefaultClient::mousePosition( const QPoint& p ) const
{ {
Position m = PositionCenter; Position m = PositionCenter;
int bottomSize = (showGrabBar && isResizable()) ? grabBorderWidth : borderWidth; int bottomSize = mustDrawHandle() ? grabBorderWidth : borderWidth;
const int range = 14 + 3*borderWidth/2; const int range = 14 + 3*borderWidth/2;
@ -1355,7 +1365,7 @@ KDecoration::Position KDEDefaultClient::mousePosition( const QPoint& p ) const
m = PositionCenter; m = PositionCenter;
// Modify the mouse position if we are using a grab bar. // Modify the mouse position if we are using a grab bar.
if (showGrabBar && isResizable()) if (mustDrawHandle())
if (p.y() >= (height() - grabBorderWidth)) if (p.y() >= (height() - grabBorderWidth))
{ {
if (p.x() >= (width() - 2*borderWidth - 12)) if (p.x() >= (width() - 2*borderWidth - 12))

View file

@ -119,6 +119,7 @@ class KDEDefaultClient : public KDecoration
private: private:
void doShape(); void doShape();
void calcHiddenButtons(); void calcHiddenButtons();
bool mustDrawHandle() const;
void addClientButtons( const QString& s, bool isLeft=true ); void addClientButtons( const QString& s, bool isLeft=true );
bool isTool() const; bool isTool() const;