obey more controlcenter options (mouse actions for frame and titlebar)
svn path=/trunk/kdebase/kwin/; revision=62090
This commit is contained in:
parent
cca94688ee
commit
6a54a209af
3 changed files with 34 additions and 42 deletions
46
client.cpp
46
client.cpp
|
@ -1134,43 +1134,36 @@ bool Client::isMaximizable() const
|
|||
*/
|
||||
void Client::mousePressEvent( QMouseEvent * e)
|
||||
{
|
||||
if (buttonDown) return;
|
||||
if (e->state() & AltButton)
|
||||
{
|
||||
Options::MouseCommand com = Options::MouseNothing;
|
||||
if (buttonDown)
|
||||
return;
|
||||
|
||||
Options::MouseCommand com = Options::MouseNothing;
|
||||
|
||||
if (e->state() & AltButton) {
|
||||
if ( e->button() == LeftButton ) {
|
||||
com = options->commandAll1();
|
||||
}
|
||||
else if (e->button() == MidButton) {
|
||||
} else if (e->button() == MidButton) {
|
||||
com = options->commandAll2();
|
||||
}
|
||||
else if (e->button() == RightButton) {
|
||||
} else if (e->button() == RightButton) {
|
||||
com = options->commandAll3();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
performMouseCommand( com, e->globalPos());
|
||||
}
|
||||
else {
|
||||
if ( e->button() == LeftButton ) {
|
||||
if ( options->focusPolicyIsReasonable() )
|
||||
workspace()->requestFocus( this );
|
||||
workspace()->raiseClient( this );
|
||||
mouseMoveEvent( e );
|
||||
buttonDown = TRUE;
|
||||
moveOffset = e->pos();
|
||||
invertedMoveOffset = rect().bottomRight() - e->pos();
|
||||
com = isActive() ? options->commandActiveTitlebar1() : options->commandInactiveTitlebar1();
|
||||
}
|
||||
else if ( e->button() == MidButton ) {
|
||||
workspace()->lowerClient( this );
|
||||
com = isActive() ? options->commandActiveTitlebar2() : options->commandInactiveTitlebar2();
|
||||
}
|
||||
else if ( e->button() == RightButton ) {
|
||||
if ( isActive() & ( options->focusPolicy != Options::ClickToFocus && options->clickRaise ) )
|
||||
autoRaise();
|
||||
workspace()->clientPopup( this )->popup( e->globalPos() );
|
||||
com = isActive() ? options->commandActiveTitlebar3() : options->commandInactiveTitlebar3();
|
||||
}
|
||||
}
|
||||
performMouseCommand( com, e->globalPos());
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1220,14 +1213,13 @@ void Client::mouseMoveEvent( QMouseEvent * e)
|
|||
if ( !buttonDown ) {
|
||||
mode = mousePosition( e->pos() );
|
||||
setMouseCursor( mode );
|
||||
geom = geometry();
|
||||
geom = geometry();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !isMovable()) return;
|
||||
|
||||
if ( !moveResizeMode )
|
||||
{
|
||||
if ( !moveResizeMode ) {
|
||||
QPoint p( e->pos() - moveOffset );
|
||||
if (p.manhattanLength() >= 6) {
|
||||
moveResizeMode = TRUE;
|
||||
|
@ -1242,9 +1234,9 @@ void Client::mouseMoveEvent( QMouseEvent * e)
|
|||
if ( ( isMove() && options->moveMode != Options::Opaque )
|
||||
|| ( isResize() && options->resizeMode != Options::Opaque ) )
|
||||
XGrabServer( qt_xdisplay() );
|
||||
}
|
||||
else
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( mode != Center && shaded )
|
||||
|
@ -1845,9 +1837,6 @@ bool Client::isShade() const
|
|||
|
||||
void Client::setShade( bool s )
|
||||
{
|
||||
if (!isMovable())
|
||||
return;
|
||||
|
||||
if ( shaded == s )
|
||||
return;
|
||||
|
||||
|
@ -2098,6 +2087,9 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
|
|||
workspace()->lowerClient( this );
|
||||
break;
|
||||
case Options::MouseOperationsMenu:
|
||||
if ( isActive() & ( options->focusPolicy != Options::ClickToFocus && options->clickRaise ) )
|
||||
autoRaise();
|
||||
workspace()->clientPopup( this )->popup( globalPos );
|
||||
break;
|
||||
case Options::MouseToggleRaiseAndLower:
|
||||
if ( workspace()->topClientOnDesktop() == this )
|
||||
|
|
|
@ -164,7 +164,7 @@ static void create_pixmaps()
|
|||
iMenuPix->setMask(menuMask);
|
||||
aMenuPixDown->setMask(menuMask);
|
||||
iMenuPixDown->setMask(menuMask);
|
||||
|
||||
|
||||
QBitmap helpMask(16, 16, help_mask_bits, true);
|
||||
aHelpPix->setMask(helpMask);
|
||||
iHelpPix->setMask(helpMask);
|
||||
|
@ -308,7 +308,7 @@ void B2Titlebar::recalcBuffer()
|
|||
t.setRight(client->button[B2Client::BtnIconify]->x()-1);
|
||||
p.drawText(t, AlignLeft | AlignVCenter, client->caption());
|
||||
p.end();
|
||||
|
||||
|
||||
oldTitle = caption();
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ void B2Titlebar::resizeEvent(QResizeEvent *)
|
|||
recalcBuffer();
|
||||
repaint(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void B2Titlebar::paintEvent(QPaintEvent * /*e*/)
|
||||
{
|
||||
|
@ -354,7 +354,7 @@ void B2Titlebar::paintEvent(QPaintEvent * /*e*/)
|
|||
|
||||
void B2Titlebar::mouseDoubleClickEvent( QMouseEvent * )
|
||||
{
|
||||
client->setShade( !client->isShade() );
|
||||
client->workspace()->performWindowOperation( client, options->operationTitlebarDblClick() );
|
||||
client->workspace()->requestFocus( client );
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ B2Client::B2Client( Workspace *ws, WId w, QWidget *parent,
|
|||
button[BtnSticky]->setToggle();
|
||||
button[BtnSticky]->setDown(isSticky());
|
||||
button[BtnMenu]->setUseMiniIcon();
|
||||
|
||||
|
||||
if(!providesContextHelp())
|
||||
button[5]->hide();
|
||||
|
||||
|
@ -568,7 +568,7 @@ void B2Client::doShape()
|
|||
mask -= QRect(0, t.height()-4, 1, 1); //top left point
|
||||
}
|
||||
if (t.right() < width()-1) {
|
||||
mask -= QRect(width()-1, t.height()-4, 1, 1); // top right point
|
||||
mask -= QRect(width()-1, t.height()-4, 1, 1); // top right point
|
||||
mask -= QRect(t.right()+1, 0, width()-t.right()-1, t.height()-4);
|
||||
}
|
||||
mask -= QRect(width()-1, height()-1, 1, 1); // bottom right point
|
||||
|
@ -576,7 +576,7 @@ void B2Client::doShape()
|
|||
mask -= QRect(width()-1, height()-1, 1, 1); // bottom right point
|
||||
mask -= QRect(width()-40, height()-1, 1, 1); // handle left point
|
||||
mask -= QRect(0, height()-4, width()-40, 4); // bottom left
|
||||
|
||||
|
||||
setMask(mask);
|
||||
}
|
||||
|
||||
|
@ -591,7 +591,7 @@ void B2Client::showEvent(QShowEvent *ev)
|
|||
void B2Client::windowWrapperShowEvent( QShowEvent* )
|
||||
{
|
||||
doShape();
|
||||
}
|
||||
}
|
||||
|
||||
Client::MousePosition B2Client::mousePosition( const QPoint& p ) const
|
||||
{
|
||||
|
@ -601,7 +601,7 @@ Client::MousePosition B2Client::mousePosition( const QPoint& p ) const
|
|||
t.setRight(button[BtnClose]->x()+17);
|
||||
*/
|
||||
QRect t = titlebar->geometry();
|
||||
t.setHeight(20-border);
|
||||
t.setHeight(20-border);
|
||||
int ly = t.bottom();
|
||||
int lx = t.right();
|
||||
|
||||
|
@ -630,14 +630,14 @@ Client::MousePosition B2Client::mousePosition( const QPoint& p ) const
|
|||
else return Right;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (p.y() >= height() - 8) {
|
||||
/* the normal Client:: only wants border of 4 pixels */
|
||||
if (p.x() <= range) return BottomLeft;
|
||||
if (p.x() >= width()-range) return BottomRight;
|
||||
return Bottom;
|
||||
}
|
||||
|
||||
|
||||
return Client::mousePosition( p );
|
||||
}
|
||||
|
||||
|
@ -794,7 +794,7 @@ static void redraw_pixmaps()
|
|||
bitBlt(aNormalizePix, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true);
|
||||
|
||||
bitBlt(aIconifyPix, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true);
|
||||
|
||||
|
||||
drawB2Rect(&smallBox, aGrp.button(), true);
|
||||
drawB2Rect(&largeBox, aGrp.button(), true);
|
||||
aNormalizePixDown->fill(options->color(Options::TitleBar, true));
|
||||
|
@ -810,7 +810,7 @@ static void redraw_pixmaps()
|
|||
bitBlt(iNormalizePix, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true);
|
||||
|
||||
bitBlt(iIconifyPix, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true);
|
||||
|
||||
|
||||
drawB2Rect(&smallBox, iGrp.button(), true);
|
||||
drawB2Rect(&largeBox, iGrp.button(), true);
|
||||
iNormalizePixDown->fill(options->color(Options::TitleBar, false));
|
||||
|
@ -896,7 +896,7 @@ static void redraw_pixmaps()
|
|||
void B2Client::positionButtons()
|
||||
{
|
||||
QFontMetrics fm(options->font(isActive()));
|
||||
|
||||
|
||||
int textLen = fm.width(caption());
|
||||
//int xpos = bar_x_ofs+4;
|
||||
int xpos = 4;
|
||||
|
|
|
@ -510,7 +510,7 @@ void KDEClient::windowWrapperShowEvent( QShowEvent* )
|
|||
void KDEClient::mouseDoubleClickEvent( QMouseEvent * e )
|
||||
{
|
||||
if (titlebar->geometry().contains( e->pos() ) )
|
||||
setShade( !isShade() );
|
||||
workspace()->performWindowOperation( this, options->operationTitlebarDblClick() );
|
||||
workspace()->requestFocus( this );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue