Making titlebar double click follow kcontrol window conveentions.

Added missing mousePosition() function.

svn path=/trunk/kdebase/kwin/; revision=101314
icc-effect-5.14.5
Karol Szwed 2001-06-10 12:27:26 +00:00
parent 096025d7ed
commit 572cfb125f
2 changed files with 44 additions and 4 deletions

View File

@ -388,6 +388,14 @@ void MwmClient::paintEvent( QPaintEvent* )
s_frameWidth,
mrect.height() - s_frameWidth - s_buttonSize - 1 );
// Draw something behind wrapped window when shaded
p.drawLine(
wrect.x(),
wrect.y(),
wrect.x() + wrect.width() - 1,
wrect.y() );
p.setPen( Qt::NoPen );
// draw titlebar:
@ -406,13 +414,44 @@ void MwmClient::paintEvent( QPaintEvent* )
AlignHCenter | AlignVCenter, caption() );
}
Client::MousePosition MwmClient::mousePosition( const QPoint& p ) const
{
const int range = s_frameWidth + s_buttonSize;
const int border = s_frameWidth;
MousePosition m = Nowhere;
if ( ( p.x() > border && p.x() < width() - border )
&& ( p.y() > border && p.y() < height() - border ) )
return Center;
if ( p.y() <= range && p.x() <= range)
m = TopLeft;
else if ( p.y() >= height()-range && p.x() >= width()-range)
m = BottomRight;
else if ( p.y() >= height()-range && p.x() <= range)
m = BottomLeft;
else if ( p.y() <= range && p.x() >= width()-range)
m = TopRight;
else if ( p.y() <= border )
m = Top;
else if ( p.y() >= height()-border )
m = Bottom;
else if ( p.x() <= border )
m = Left;
else if ( p.x() >= width()-border )
m = Right;
else
m = Center;
return m;
}
void MwmClient::mouseDoubleClickEvent( QMouseEvent * e )
{
if ( titlebar->geometry().contains( e->pos() ) )
{
workspace()->lowerClient( this );
workspace()->requestFocus( workspace()->topClientOnDesktop() );
}
workspace()->performWindowOperation( this, options->operationTitlebarDblClick() );
workspace()->requestFocus(this);
}
void MwmClient::init()

View File

@ -44,6 +44,7 @@ protected:
void init();
void captionChange( const QString& );
void activeChange( bool );
MousePosition mousePosition( const QPoint& p ) const;
protected slots:
void slotReset();