Trigger TrackMouseEffect using Ctrl+Meta rather than mouse buttons.

svn path=/branches/work/kwin_composite/; revision=656455
This commit is contained in:
Luboš Luňák 2007-04-21 12:50:02 +00:00
parent b849a760ef
commit f43b53ef7d
13 changed files with 26 additions and 17 deletions

View file

@ -233,10 +233,11 @@ bool EffectsHandlerImpl::borderActivated( ElectricBorder border )
return ret;
}
void EffectsHandlerImpl::cursorMoved( const QPoint& pos, Qt::MouseButtons buttons )
void EffectsHandlerImpl::mouseChanged( const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers )
{
foreach( EffectPair ep, loaded_effects )
ep.second->cursorMoved( pos, buttons );
ep.second->mouseChanged( pos, old, buttons, modifiers );
}
bool EffectsHandlerImpl::grabKeyboard( Effect* effect )

View file

@ -101,7 +101,8 @@ class EffectsHandlerImpl : public EffectsHandler
void tabBoxClosed();
void tabBoxUpdated();
bool borderActivated( ElectricBorder border );
void cursorMoved( const QPoint& pos, Qt::MouseButtons buttons );
void mouseChanged( const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
void grabbedKeyboardEvent( QKeyEvent* e );
bool hasKeyboardGrab() const;

View file

@ -101,7 +101,7 @@ QRect TaskbarThumbnailEffect::getThumbnailPosition( EffectWindow* c, int* space
return thumb;
}
void TaskbarThumbnailEffect::cursorMoved( const QPoint& pos, Qt::MouseButtons )
void TaskbarThumbnailEffect::mouseChanged( const QPoint& pos, const QPoint&, Qt::MouseButtons, Qt::KeyboardModifiers )
{
// this should check if the mouse position change actually means something
// (just like it should be done in prePaintScreen()), but since this effect

View file

@ -34,7 +34,8 @@ class TaskbarThumbnailEffect
virtual void prePaintScreen( int* mask, QRegion* region, int time );
virtual void prePaintWindow( EffectWindow* w, int* mask, QRegion* paint, QRegion* clip, int time );
virtual void postPaintScreen();
virtual void cursorMoved( const QPoint& pos, Qt::MouseButtons buttons );
virtual void mouseChanged( const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
protected:
QRect getThumbnailPosition( EffectWindow* c, int* space ) const;

View file

@ -138,9 +138,9 @@ void MagnifierEffect::toggle()
effects->addRepaint( magnifierArea());
}
void MagnifierEffect::cursorMoved( const QPoint&, Qt::MouseButtons )
void MagnifierEffect::mouseChanged( const QPoint& pos, const QPoint& old, Qt::MouseButtons, Qt::KeyboardModifiers )
{
if( zoom != 1 )
if( pos != old && zoom != 1 )
effects->addRepaint( magnifierArea());
}

View file

@ -25,7 +25,8 @@ class MagnifierEffect
virtual void prePaintScreen( int* mask, QRegion* region, int time );
virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
virtual void postPaintScreen();
void cursorMoved( const QPoint& pos, Qt::MouseButtons buttons );
virtual void mouseChanged( const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
private slots:
void zoomIn();
void zoomOut();

View file

@ -107,9 +107,10 @@ void TrackMouseEffect::postPaintScreen()
effects->postPaintScreen();
}
void TrackMouseEffect::cursorMoved( const QPoint&, Qt::MouseButtons buttons )
void TrackMouseEffect::mouseChanged( const QPoint&, const QPoint&, Qt::MouseButtons,
Qt::KeyboardModifiers modifiers )
{
if( buttons == ( Qt::LeftButton | Qt::RightButton ))
if( modifiers == ( Qt::CTRL | Qt::META ))
{
if( !active )
{

View file

@ -26,7 +26,8 @@ class TrackMouseEffect
virtual void prePaintScreen( int* mask, QRegion* region, int time );
virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
virtual void postPaintScreen();
virtual void cursorMoved( const QPoint& pos, Qt::MouseButtons buttons );
virtual void mouseChanged( const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
private:
QRect starRect( int num ) const;
void loadTexture();

View file

@ -89,9 +89,9 @@ void ZoomEffect::actualSize()
effects->addRepaintFull();
}
void ZoomEffect::cursorMoved( const QPoint&, Qt::MouseButtons )
void ZoomEffect::mouseChanged( const QPoint& pos, const QPoint& old, Qt::MouseButtons, Qt::KeyboardModifiers )
{
if( zoom != 1 )
if( pos != old && zoom != 1 )
effects->addRepaintFull();
}

View file

@ -25,7 +25,8 @@ class ZoomEffect
virtual void prePaintScreen( int* mask, QRegion* region, int time );
virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
virtual void postPaintScreen();
void cursorMoved( const QPoint& pos, Qt::MouseButtons buttons );
virtual void mouseChanged( const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
private slots:
void zoomIn();
void zoomOut();

View file

@ -118,7 +118,7 @@ bool Effect::borderActivated( ElectricBorder )
return false;
}
void Effect::cursorMoved( const QPoint&, Qt::MouseButtons )
void Effect::mouseChanged( const QPoint&, const QPoint&, Qt::MouseButtons, Qt::KeyboardModifiers )
{
}

View file

@ -100,7 +100,8 @@ class KWIN_EXPORT Effect
virtual void desktopChanged( int old );
virtual void windowDamaged( EffectWindow* w, const QRect& r );
virtual void windowGeometryShapeChanged( EffectWindow* w, const QRect& old );
virtual void cursorMoved( const QPoint& pos, Qt::MouseButtons buttons );
virtual void mouseChanged( const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
virtual void grabbedKeyboardEvent( QKeyEvent* e );
virtual void tabBoxAdded( int mode );

View file

@ -2613,7 +2613,8 @@ void Workspace::checkCursorPos()
int lastb = last_buttons;
cursorPos(); // update if needed
if( last != last_cursor_pos || lastb != last_buttons )
static_cast< EffectsHandlerImpl* >( effects )->cursorMoved( cursorPos(), x11ToQtMouseButtons( last_buttons ));
static_cast< EffectsHandlerImpl* >( effects )->mouseChanged( cursorPos(), last_cursor_pos,
x11ToQtMouseButtons( last_buttons ), x11ToQtKeyboardModifiers( last_buttons ));
}
} // namespace