From 2f3c383ecdd61de9886ab95c9d44811a690698cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 19 Aug 2011 21:53:30 +0200 Subject: [PATCH] Add shortcuts to lower/raise opacity REVIEW: 102374 --- kwinbindings.cpp | 4 ++++ useractions.cpp | 16 ++++++++++++++++ workspace.h | 3 +++ 3 files changed, 23 insertions(+) diff --git a/kwinbindings.cpp b/kwinbindings.cpp index d034390cf9..f75b2bac7d 100644 --- a/kwinbindings.cpp +++ b/kwinbindings.cpp @@ -137,6 +137,10 @@ DEF2("Switch Window Right", I18N_NOOP("Switch to Window to the Right"), Qt::META + Qt::ALT + Qt::Key_Right, slotSwitchWindowRight()); DEF2("Switch Window Left", I18N_NOOP("Switch to Window to the Left"), Qt::META + Qt::ALT + Qt::Key_Left, slotSwitchWindowLeft()); +DEF2("Increase Opacity", I18N_NOOP("Increase Opacity of Active Window by 5 %"), + 0, slotIncreaseWindowOpacity()); +DEF2("Decrease Opacity", I18N_NOOP("Decrease Opacity of Active Window by 5 %"), + 0, slotLowerWindowOpacity()); a = actionCollection->addAction("Group:Window Desktop"); a->setText(i18n("Window & Desktop")); diff --git a/useractions.cpp b/useractions.cpp index cb5e237ad6..5cc23e5860 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -254,6 +254,22 @@ void Workspace::setPopupClientOpacity(QAction* action) active_popup_client->setOpacity(level / 100.0); } +void Workspace::slotIncreaseWindowOpacity() +{ + if (!active_client) { + return; + } + active_client->setOpacity(qMin(active_client->opacity() + 0.05, 1.0)); +} + +void Workspace::slotLowerWindowOpacity() +{ + if (!active_client) { + return; + } + active_client->setOpacity(qMax(active_client->opacity() - 0.05, 0.05)); +} + /*! The client popup menu will become visible soon. diff --git a/workspace.h b/workspace.h index 68d78d57ca..72635d06ce 100644 --- a/workspace.h +++ b/workspace.h @@ -582,6 +582,9 @@ public slots: void slotSwitchWindowRight(); void slotSwitchWindowLeft(); + void slotIncreaseWindowOpacity(); + void slotLowerWindowOpacity(); + void slotWindowOperations(); void slotWindowClose(); void slotWindowMove();