wheel scroll == desktop switch; no configuration, let's see how people react.

moment of philosophy: there are some features used almost exclusively by people who can't (or can't be bothered to) write code, but know where our bug tracker is, my blog is, what my email address is, etc... this is one such feature. amazing. or sad. i'm not sure which.

BUG:159876

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=842821
This commit is contained in:
Aaron J. Seigo 2008-08-06 01:22:05 +00:00
parent ad7a1256a9
commit 2c8f554ffd
2 changed files with 23 additions and 0 deletions

View File

@ -833,6 +833,28 @@ void Containment::keyPressEvent(QKeyEvent *event)
} }
} }
void Containment::wheelEvent(QGraphicsSceneWheelEvent *event)
{
if (containmentType() == DesktopContainment) {
QGraphicsItem* item = scene()->itemAt(event->scenePos());
if (item == this) {
int numDesktops = KWindowSystem::numberOfDesktops();
int currentDesktop = KWindowSystem::currentDesktop();
if (event->delta() > 0) {
KWindowSystem::setCurrentDesktop(currentDesktop % numDesktops + 1);
} else {
KWindowSystem::setCurrentDesktop((numDesktops + currentDesktop - 2) % numDesktops + 1);
}
event->accept();
return;
}
}
Applet::wheelEvent(event);
}
bool Containment::sceneEventFilter(QGraphicsItem *watched, QEvent *event) bool Containment::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
{ {
Applet *applet = qgraphicsitem_cast<Applet*>(watched); Applet *applet = qgraphicsitem_cast<Applet*>(watched);

View File

@ -414,6 +414,7 @@ class PLASMA_EXPORT Containment : public Applet
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
void wheelEvent(QGraphicsSceneWheelEvent *event);
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
QVariant itemChange(GraphicsItemChange change, const QVariant &value); QVariant itemChange(GraphicsItemChange change, const QVariant &value);