include( effects/kscreen/CMakeLists.txt )
include( effects/presentwindows/CMakeLists.txt )
-include( effects/screenedge/CMakeLists.txt )
include( effects/slidingpopups/CMakeLists.txt )
include( effects/taskbarthumbnail/CMakeLists.txt )
include( effects/dashboard/CMakeLists.txt )
layers.cpp
main.cpp
options.cpp
- outline.cpp
decorations.cpp
events.cpp
killwindow.cpp
target_link_libraries(kwin
${KDE4_KDEUI_LIBS}
- ${KDE4_PLASMA_LIBS}
${KDE4_KDECLARATIVE_LIBS}
${X11_X11_LIB}
${X11_Xext_LIB}
#include "config-kwin.h"
#include <QApplication>
-#include <QtDeclarative/QDeclarativeComponent>
-#include <QtDeclarative/QDeclarativeContext>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QtDeclarative/QDeclarativeItem>
+#include <QDeclarativeComponent>
+#include <QDeclarativeContext>
+#include <QDeclarativeEngine>
+#include <QDeclarativeItem>
#include <QGraphicsView>
#include <QPaintEngine>
#include <KPluginInfo>
#include <KServiceTypeTrader>
#include <KStandardDirs>
-#include <Plasma/FrameSvg>
namespace Aurorae
{
#include <KService>
#include <KServiceTypeTrader>
#include <KPluginInfo>
-#include <Plasma/Theme>
#include <assert.h>
#include "composite.h"
#include "effects/mousemark/mousemark.h"
#include "effects/presentwindows/presentwindows.h"
#include "effects/resize/resize.h"
-#include "effects/screenedge/screenedgeeffect.h"
#include "effects/showfps/showfps.h"
#include "effects/showpaint/showpaint.h"
#include "effects/slide/slide.h"
effect = new KscreenEffect();
} else if (internalname == "kwin4_effect_presentwindows") {
effect = new PresentWindowsEffect();
- } else if (internalname == "kwin4_effect_screenedge") {
- effect = new ScreenEdgeEffect();
} else if (internalname == "kwin4_effect_slidingpopups") {
effect = new SlidingPopupsEffect();
} else if (internalname == "kwin4_effect_taskbarthumbnail") {
return ret;
}
-EffectFrame* EffectsHandlerImpl::effectFrame(EffectFrameStyle style, bool staticSize, const QPoint& position, Qt::Alignment alignment) const
+EffectFrame* EffectsHandlerImpl::effectFrame(bool staticSize, const QPoint& position, Qt::Alignment alignment) const
{
- return new EffectFrameImpl(style, staticSize, position, alignment);
+ return new EffectFrameImpl(staticSize, position, alignment);
}
// EffectFrameImpl
//****************************************
-EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint position, Qt::Alignment alignment)
+EffectFrameImpl::EffectFrameImpl(bool staticSize, QPoint position, Qt::Alignment alignment)
: QObject(0)
, EffectFrame()
- , m_style(style)
, m_static(staticSize)
, m_point(position)
, m_alignment(alignment)
{
- if (m_style == EffectFrameStyled) {
- m_frame.setImagePath("widgets/background");
- m_frame.setCacheAllRenderedFrames(true);
- connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
- }
- m_selection.setImagePath("widgets/viewitem");
- m_selection.setElementPrefix("hover");
- m_selection.setCacheAllRenderedFrames(true);
- m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders);
-
if (effects->compositingType() == XRenderCompositing) {
#ifdef KWIN_BUILD_COMPOSITE
m_sceneFrame = new SceneXrender::EffectFrame(this);
return;
}
- if (m_style == EffectFrameStyled) {
- qreal left, top, right, bottom;
- m_frame.getMargins(left, top, right, bottom); // m_geometry is the inner geometry
- m_frame.resizeFrame(m_geometry.adjusted(-left, -top, right, bottom).size());
- }
-
free();
}
m_sceneFrame->freeIconFrame();
}
-void EffectFrameImpl::plasmaThemeChanged()
-{
- free();
-}
-
void EffectFrameImpl::render(QRegion region, double opacity, double frameOpacity)
{
if (m_geometry.isEmpty()) {
}
}
-void EffectFrameImpl::setSelection(const QRect& selection)
-{
- if (selection == m_selectionGeometry) {
- return;
- }
- m_selectionGeometry = selection;
- if (m_selectionGeometry.size() != m_selection.frameSize().toSize()) {
- m_selection.resizeFrame(m_selectionGeometry.size());
- }
- // TODO; optimize to only recreate when resizing
- m_sceneFrame->freeSelection();
-}
-
void EffectFrameImpl::autoResize()
{
if (m_static)
setGeometry(geometry);
}
-QColor EffectFrameImpl::styledTextColor()
-{
- return Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
-}
-
} // namespace
#include <QStack>
#include <QHash>
-#include <Plasma/FrameSvg>
class QDBusPendingCallWatcher;
class QDBusServiceWatcher;
virtual bool decorationSupportsBlurBehind() const;
- virtual EffectFrame* effectFrame(EffectFrameStyle style, bool staticSize, const QPoint& position, Qt::Alignment alignment) const;
+ virtual EffectFrame* effectFrame(bool staticSize, const QPoint& position, Qt::Alignment alignment) const;
virtual QVariant kwinOption(KWinOption kwopt);
virtual bool isScreenLocked() const;
{
Q_OBJECT
public:
- explicit EffectFrameImpl(EffectFrameStyle style, bool staticSize = true, QPoint position = QPoint(-1, -1),
+ explicit EffectFrameImpl(bool staticSize = true, QPoint position = QPoint(-1, -1),
Qt::Alignment alignment = Qt::AlignCenter);
virtual ~EffectFrameImpl();
virtual void setPosition(const QPoint& point);
virtual const QString& text() const;
virtual void setText(const QString& text);
- virtual EffectFrameStyle style() const {
- return m_style;
- };
- Plasma::FrameSvg& frame() {
- return m_frame;
- }
bool isStatic() const {
return m_static;
};
void finalRender(QRegion region, double opacity, double frameOpacity) const;
- virtual void setSelection(const QRect& selection);
- const QRect& selection() const {
- return m_selectionGeometry;
- }
- Plasma::FrameSvg& selectionFrame() {
- return m_selection;
- }
- /**
- * The foreground text color as specified by the default Plasma theme.
- */
- static QColor styledTextColor();
-
-private Q_SLOTS:
- void plasmaThemeChanged();
-
private:
Q_DISABLE_COPY(EffectFrameImpl) // As we need to use Qt slots we cannot copy this class
void align(QRect &geometry); // positions geometry around m_point respecting m_alignment
void autoResize(); // Auto-resize if not a static size
- EffectFrameStyle m_style;
- Plasma::FrameSvg m_frame; // TODO: share between all EffectFrames
- Plasma::FrameSvg m_selection;
-
// Position
bool m_static;
QPoint m_point;
QFont m_font;
QPixmap m_icon;
QSize m_iconSize;
- QRect m_selectionGeometry;
Scene::EffectFrame* m_sceneFrame;
};
namespace KWin
{
-KWIN_EFFECT(dashboard, DashboardEffect)
DashboardEffect::DashboardEffect()
: transformWindow(false)
namespace KWin
{
-KWIN_EFFECT(diminactive, DimInactiveEffect)
-
DimInactiveEffect::DimInactiveEffect()
{
reconfigure(ReconfigureAll);
namespace KWin
{
-KWIN_EFFECT(dimscreen, DimScreenEffect)
-
DimScreenEffect::DimScreenEffect()
: mActivated(false)
, activateAnimation(false)
namespace KWin
{
-KWIN_EFFECT(highlightwindow, HighlightWindowEffect)
-
HighlightWindowEffect::HighlightWindowEffect()
: m_finishing(false)
, m_fadeDuration(float(animationTime(150)))
namespace KWin
{
-KWIN_EFFECT(kscreen, KscreenEffect)
-
KscreenEffect::KscreenEffect()
: Effect()
, m_state(StateNormal)
namespace KWin
{
-KWIN_EFFECT(logout, LogoutEffect)
-
-#warning this effect is probably bogus
-
LogoutEffect::LogoutEffect()
: progress(0.0)
, displayEffect(false)
namespace KWin
{
-KWIN_EFFECT(magnifier, MagnifierEffect)
-
const int FRAME_WIDTH = 5;
MagnifierEffect::MagnifierEffect()
namespace KWin
{
-KWIN_EFFECT(minimizeanimation, MinimizeAnimationEffect)
-
MinimizeAnimationEffect::MinimizeAnimationEffect()
{
mActiveAnimations = 0;
#define NULL_POINT (QPoint( -1, -1 )) // null point is (0,0), which is valid :-/
-KWIN_EFFECT(mousemark, MouseMarkEffect)
-
MouseMarkEffect::MouseMarkEffect()
{
KActionCollection* actionCollection = new KActionCollection(this);
namespace KWin
{
-KWIN_EFFECT(presentwindows, PresentWindowsEffect)
-
PresentWindowsEffect::PresentWindowsEffect()
: m_proxy(this)
, m_activated(false)
winData->visible = isVisibleWindow(w);
winData->opacity = 0.0;
winData->highlight = 0.0;
- winData->textFrame = effects->effectFrame(EffectFrameUnstyled, false);
+ winData->textFrame = effects->effectFrame(false);
QFont font;
font.setBold(true);
font.setPointSize(12);
winData->textFrame->setFont(font);
- winData->iconFrame = effects->effectFrame(EffectFrameUnstyled, false);
+ winData->iconFrame = effects->effectFrame(false);
winData->iconFrame->setAlignment(Qt::AlignRight | Qt::AlignBottom);
winData->iconFrame->setIcon(w->icon());
if (isSelectableWindow(w)) {
if (w->isOnCurrentDesktop() && !w->isMinimized())
winData->opacity = 1.0;
winData->highlight = 1.0;
- winData->textFrame = effects->effectFrame(EffectFrameUnstyled, false);
+ winData->textFrame = effects->effectFrame(false);
QFont font;
font.setBold(true);
font.setPointSize(12);
winData->textFrame->setFont(font);
- winData->iconFrame = effects->effectFrame(EffectFrameUnstyled, false);
+ winData->iconFrame = effects->effectFrame(false);
winData->iconFrame->setAlignment(Qt::AlignRight | Qt::AlignBottom);
winData->iconFrame->setIcon(w->icon());
}
{
QRect area = effects->clientArea(ScreenArea, effects->activeScreen(), effects->currentDesktop());
if (!m_filterFrame) {
- m_filterFrame = effects->effectFrame(EffectFrameStyled, false);
+ m_filterFrame = effects->effectFrame(false);
QFont font;
font.setPointSize(font.pointSize() * 2);
font.setBold(true);
m_gridSizes.append(GridSize());
if (m_dragToClose) {
const QRect screenRect = effects->clientArea(FullScreenArea, i, 1);
- EffectFrame *frame = effects->effectFrame(EffectFrameNone, false);
+ EffectFrame *frame = effects->effectFrame(false);
KIcon icon("user-trash");
frame->setIcon(icon.pixmap(QSize(128, 128)));
frame->setPosition(QPoint(screenRect.x() + screenRect.width(), screenRect.y()));
namespace KWin
{
-KWIN_EFFECT(resize, ResizeEffect)
-
ResizeEffect::ResizeEffect()
: AnimationEffect()
, m_active(false)
+++ /dev/null
-#######################################
-# Effect
-
-# Source files
-set(kwin4_effect_builtins_sources
- ${kwin4_effect_builtins_sources}
- effects/screenedge/screenedgeeffect.cpp
-)
-
-# .desktop files
-install(FILES effects/screenedge/screenedgeeffect.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin)
+++ /dev/null
-/********************************************************************
- KWin - the KDE window manager
- This file is part of the KDE project.
-
-Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*********************************************************************/
-#include "config-kwin.h"
-
-#include "screenedgeeffect.h"
-// KWin
-#include <kwinxrenderutils.h>
-// KDE
-#include <Plasma/Svg>
-// Qt
-#include <QTimer>
-#include <QPainter>
-#include <QVector4D>
-// xcb
-#ifdef KWIN_BUILD_COMPOSITE
-#include <xcb/render.h>
-#endif
-
-namespace KWin {
-
-KWIN_EFFECT(screenedge, ScreenEdgeEffect)
-
-ScreenEdgeEffect::ScreenEdgeEffect()
- : Effect()
- , m_glow(new Plasma::Svg(this))
- , m_cleanupTimer(new QTimer(this))
-{
- m_glow->setImagePath("widgets/glowbar");
- connect(effects, SIGNAL(screenEdgeApproaching(ElectricBorder,qreal,QRect)), SLOT(edgeApproaching(ElectricBorder,qreal,QRect)));
- m_cleanupTimer->setInterval(5000);
- m_cleanupTimer->setSingleShot(true);
- connect(m_cleanupTimer, SIGNAL(timeout()), SLOT(cleanup()));
-}
-
-ScreenEdgeEffect::~ScreenEdgeEffect()
-{
- cleanup();
-}
-
-void ScreenEdgeEffect::cleanup()
-{
- for (QHash<ElectricBorder, Glow*>::iterator it = m_borders.begin();
- it != m_borders.end();
- ++it) {
- effects->addRepaint((*it)->geometry);
- }
- qDeleteAll(m_borders);
- m_borders.clear();
-}
-
-void ScreenEdgeEffect::prePaintScreen(ScreenPrePaintData &data, int time)
-{
- effects->prePaintScreen(data, time);
- for (QHash<ElectricBorder, Glow*>::iterator it = m_borders.begin();
- it != m_borders.end();
- ++it) {
- if ((*it)->strength == 0.0) {
- continue;
- }
- data.paint += (*it)->geometry;
- }
-}
-
-void ScreenEdgeEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
-{
- effects->paintScreen(mask, region, data);
- for (QHash<ElectricBorder, Glow*>::iterator it = m_borders.begin();
- it != m_borders.end();
- ++it) {
- const qreal opacity = (*it)->strength;
- if (opacity == 0.0) {
- continue;
- }
- if (effects->compositingType() == XRenderCompositing) {
-#ifdef KWIN_BUILD_COMPOSITE
- const QRect &rect = (*it)->geometry;
- const QSize &size = (*it)->pictureSize;
- int x = rect.x();
- int y = rect.y();
- int width = rect.width();
- int height = rect.height();
- switch ((*it)->border) {
- case ElectricTopRight:
- x = rect.x() + rect.width() - size.width();
- break;
- case ElectricBottomRight:
- x = rect.x() + rect.width() - size.width();
- y = rect.y() + rect.height() - size.height();
- break;
- case ElectricBottomLeft:
- y = rect.y() + rect.height() - size.height();
- break;
- default:
- // nothing
- break;
- }
- xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *(*it)->picture.data(),
- xRenderBlendPicture(opacity), effects->xrenderBufferPicture(),
- 0, 0, 0, 0, x, y, width, height);
-#endif
- }
- }
-}
-
-void ScreenEdgeEffect::edgeApproaching(ElectricBorder border, qreal factor, const QRect &geometry)
-{
- QHash<ElectricBorder, Glow*>::iterator it = m_borders.find(border);
- if (it != m_borders.end()) {
- // need to update
- effects->addRepaint((*it)->geometry);
- (*it)->strength = factor;
- if ((*it)->geometry != geometry) {
- (*it)->geometry = geometry;
- effects->addRepaint((*it)->geometry);
- if (border == ElectricLeft || border == ElectricRight || border == ElectricTop || border == ElectricBottom) {
- if (effects->compositingType() == XRenderCompositing) {
-#ifdef KWIN_BUILD_COMPOSITE
- (*it)->picture.reset(createEdgeGlow<XRenderPicture>(border, geometry.size()));
-#endif
- }
- }
- }
- if (factor == 0.0) {
- m_cleanupTimer->start();
- } else {
- m_cleanupTimer->stop();
- }
- } else if (factor != 0.0) {
- // need to generate new Glow
- Glow *glow = createGlow(border, factor, geometry);
- if (glow) {
- m_borders.insert(border, glow);
- effects->addRepaint(glow->geometry);
- }
- }
-}
-
-Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QRect &geometry)
-{
- Glow *glow = new Glow();
- glow->border = border;
- glow->strength = factor;
- glow->geometry = geometry;
-
- // render the glow image
- if (effects->compositingType() == XRenderCompositing) {
-#ifdef KWIN_BUILD_COMPOSITE
- if (border == ElectricTopLeft || border == ElectricTopRight || border == ElectricBottomRight || border == ElectricBottomLeft) {
- glow->pictureSize = cornerGlowSize(border);
- glow->picture.reset(createCornerGlow<XRenderPicture>(border));
- } else {
- glow->pictureSize = geometry.size();
- glow->picture.reset(createEdgeGlow<XRenderPicture>(border, geometry.size()));
- }
- if (glow->picture.isNull()) {
- delete glow;
- return NULL;
- }
-#endif
- }
-
- return glow;
-}
-
-template <typename T>
-T *ScreenEdgeEffect::createCornerGlow(ElectricBorder border)
-{
- switch (border) {
- case ElectricTopLeft:
- return new T(m_glow->pixmap("bottomright"));
- case ElectricTopRight:
- return new T(m_glow->pixmap("bottomleft"));
- case ElectricBottomRight:
- return new T(m_glow->pixmap("topleft"));
- case ElectricBottomLeft:
- return new T(m_glow->pixmap("topright"));
- default:
- return NULL;
- }
-}
-
-QSize ScreenEdgeEffect::cornerGlowSize(ElectricBorder border) const
-{
- switch (border) {
- case ElectricTopLeft:
- return m_glow->elementSize("bottomright");
- case ElectricTopRight:
- return m_glow->elementSize("bottomleft");
- case ElectricBottomRight:
- return m_glow->elementSize("topleft");
- case ElectricBottomLeft:
- return m_glow->elementSize("topright");
- default:
- return QSize();
- }
-}
-
-template <typename T>
-T *ScreenEdgeEffect::createEdgeGlow(ElectricBorder border, const QSize &size)
-{
- QPoint pixmapPosition(0, 0);
- QPixmap l, r, c;
- switch (border) {
- case ElectricTop:
- l = m_glow->pixmap("bottomleft");
- r = m_glow->pixmap("bottomright");
- c = m_glow->pixmap("bottom");
- break;
- case ElectricBottom:
- l = m_glow->pixmap("topleft");
- r = m_glow->pixmap("topright");
- c = m_glow->pixmap("top");
- pixmapPosition = QPoint(0, size.height() - c.height());
- break;
- case ElectricLeft:
- l = m_glow->pixmap("topright");
- r = m_glow->pixmap("bottomright");
- c = m_glow->pixmap("right");
- break;
- case ElectricRight:
- l = m_glow->pixmap("topleft");
- r = m_glow->pixmap("bottomleft");
- c = m_glow->pixmap("left");
- pixmapPosition = QPoint(size.width() - c.width(), 0);
- break;
- default:
- return NULL;
- }
- QPixmap image(size);
- image.fill(Qt::transparent);
- QPainter p;
- p.begin(&image);
- if (border == ElectricBottom || border == ElectricTop) {
- p.drawPixmap(pixmapPosition, l);
- p.drawTiledPixmap(QRect(l.width(), pixmapPosition.y(), size.width() - l.width() - r.width(), c.height()), c);
- p.drawPixmap(QPoint(size.width() - r.width(), pixmapPosition.y()), r);
- } else {
- p.drawPixmap(pixmapPosition, l);
- p.drawTiledPixmap(QRect(pixmapPosition.x(), l.height(), c.width(), size.height() - l.height() - r.height()), c);
- p.drawPixmap(QPoint(pixmapPosition.x(), size.height() - r.height()), r);
- }
- p.end();
- return new T(image);
-}
-
-bool ScreenEdgeEffect::isActive() const
-{
- return !m_borders.isEmpty();
-}
-
-} // namespace
+++ /dev/null
-[Desktop Entry]
-Name=Screen Edge
-Name[bs]=Ivice ekrana
-Name[ca]=Vora de la pantalla
-Name[ca@valencia]=Vora de la pantalla
-Name[cs]=Hrana obrazovky
-Name[da]=Skærmkant
-Name[de]=Bildschirmkante
-Name[el]=Άκρο οθόνης
-Name[en_GB]=Screen Edge
-Name[es]=Borde de la pantalla
-Name[et]=Ekraani serv
-Name[eu]=Pantailaren ertza
-Name[fi]=Näytön reuna
-Name[gl]=Beira da pantalla
-Name[hu]=Képernyőszél
-Name[ia]=Margines de schermo
-Name[kk]=Экран жиегі
-Name[ko]=화면 경계
-Name[lt]=Ekrano kraštas
-Name[mr]=स्क्रीन किनारा
-Name[nb]=Skjermkant
-Name[nds]=Schirmkant
-Name[nl]=Schermrand
-Name[pa]=ਸਕਰੀਨ ਕੋਨਾ
-Name[pl]=Krawędź ekranu
-Name[pt]=Extremo do Ecrã
-Name[pt_BR]=Borda da tela
-Name[ro]=Muchia ecranului
-Name[ru]=Край экрана
-Name[sk]=Hrana obrazovky
-Name[sl]=Rob zaslona
-Name[sr]=Ивица екрана
-Name[sr@ijekavian]=Ивица екрана
-Name[sr@ijekavianlatin]=Ivica ekrana
-Name[sr@latin]=Ivica ekrana
-Name[sv]=Skärmkant
-Name[tr]=Ekran Kenarı
-Name[uk]=Край екрана
-Name[x-test]=xxScreen Edgexx
-Name[zh_CN]=屏幕边缘
-Name[zh_TW]=螢幕邊緣
-Icon=preferences-system-windows-effect-screenedge
-Comment=Highlights a screen edge when approaching
-Comment[bs]=Označava ivicu ekrana pri približavanju
-Comment[ca]=Ressalta la vora de la pantalla en aproximar-se
-Comment[ca@valencia]=Ressalta la vora de la pantalla en aproximar-se
-Comment[cs]=Zvýrazní hranu obrazovky při přiblížení k ní
-Comment[da]=Fremhæver en skærmkant når den nærmer sig
-Comment[de]=Bildschirmkante bei Annäherung hervorheben
-Comment[el]=Εμφανίζει τονισμένο το άκρο της οθόνης όταν το πλησιάζετε
-Comment[en_GB]=Highlights a screen edge when approaching
-Comment[es]=Resalta el borde de la pantalla al aproximarse a él
-Comment[et]=Ekraani serva esiletõstmine sellele lähenemisel
-Comment[eu]=Pantailaren ertz bat nabarmentzen du hurbiltzerakoan
-Comment[fi]=Korostaa näytön reunan sitä lähestyttäessä
-Comment[gl]=Realza unha beira da pantalla cando se aproxima
-Comment[hu]=Kiemeli a képernyő szélét megközelítéskor
-Comment[ia]=Evidentia un margine de schermo quando on approxima se
-Comment[kk]=Экран жиегіне жақындағанда оны бояп белгілеу
-Comment[ko]=화면 경계에 도달할 때 강조하기
-Comment[lt]=Paryškina ekrano kraštą kai priartėjama
-Comment[mr]=पोहोचताना स्क्रीन किनारे ठळक करतो
-Comment[nb]=Fremhever en skjermkant når den kommer nær
-Comment[nds]=Markeert en Schirmkant, wenn een ehr neger kummt
-Comment[nl]=Accentueert een schermrand bij nadering
-Comment[pl]=Podświetlenie krawędzi ekranu przy zbliżaniu się do niej
-Comment[pt]=Realça um extremo do ecrã ao aproximar-se
-Comment[pt_BR]=Destaca a borda da tela quando se aproxima
-Comment[ro]=Evidențiază o muchie a ecranului la apropiere
-Comment[ru]=Выделяет край экрана при приближении к нему
-Comment[sk]=Zvýrazní okraj obrazovky pri priblížení
-Comment[sl]=Poudari rob zaslona, ko se mu približate
-Comment[sr]=Истиче ивицу екрана при приближавању
-Comment[sr@ijekavian]=Истиче ивицу екрана при приближавању
-Comment[sr@ijekavianlatin]=Ističe ivicu ekrana pri približavanju
-Comment[sr@latin]=Ističe ivicu ekrana pri približavanju
-Comment[sv]=Markerar en skärmkant när man närmar sig den
-Comment[tr]=Yaklaşıldığında bir ekran kenarını vurgular
-Comment[uk]=Підсвічує край екрана у разі наближення вказівника
-Comment[x-test]=xxHighlights a screen edge when approachingxx
-Comment[zh_CN]=接近屏幕边缘时高亮显示
-Comment[zh_TW]=接近時突顯螢幕邊緣
-
-Type=Service
-X-KDE-ServiceTypes=KWin/Effect
-X-KDE-PluginInfo-Author=Martin Gräßlin
-X-KDE-PluginInfo-Email=mgraesslin@kde.org
-X-KDE-PluginInfo-Name=kwin4_effect_screenedge
-X-KDE-PluginInfo-Version=0.1.0
-X-KDE-PluginInfo-Category=Appearance
-X-KDE-PluginInfo-Depends=
-X-KDE-PluginInfo-License=GPL
-X-KDE-PluginInfo-EnabledByDefault=true
-X-KDE-Ordering=90
+++ /dev/null
-/********************************************************************
- KWin - the KDE window manager
- This file is part of the KDE project.
-
-Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*********************************************************************/
-#ifndef KWIN_SCREEN_EDGE_EFFECT_H
-#define KWIN_SCREEN_EDGE_EFFECT_H
-
-#include "config-kwin.h"
-
-#include <kwineffects.h>
-
-class QTimer;
-namespace Plasma {
- class Svg;
-}
-
-namespace KWin {
-class Glow;
-
-class ScreenEdgeEffect : public Effect
-{
- Q_OBJECT
-public:
- ScreenEdgeEffect();
- virtual ~ScreenEdgeEffect();
- virtual void prePaintScreen(ScreenPrePaintData &data, int time);
- virtual void paintScreen(int mask, QRegion region, ScreenPaintData &data);
- virtual bool isActive() const;
-private Q_SLOTS:
- void edgeApproaching(ElectricBorder border, qreal factor, const QRect &geometry);
- void cleanup();
-private:
- Glow *createGlow(ElectricBorder border, qreal factor, const QRect &geometry);
- template <typename T>
- T *createCornerGlow(ElectricBorder border);
- template <typename T>
- T *createEdgeGlow(ElectricBorder border, const QSize &size);
- QSize cornerGlowSize(ElectricBorder border) const;
- Plasma::Svg *m_glow;
- QHash<ElectricBorder, Glow*> m_borders;
- QTimer *m_cleanupTimer;
-};
-
-class Glow
-{
-public:
-#ifdef KWIN_BUILD_COMPOSITE
- QScopedPointer<XRenderPicture> picture;
- QSize pictureSize;
-#endif
- qreal strength;
- QRect geometry;
- ElectricBorder border;
-};
-
-}
-
-#endif
namespace KWin
{
-KWIN_EFFECT(showfps, ShowFpsEffect)
-
const int FPS_WIDTH = 10;
const int MAX_TIME = 100;
ShowFpsEffect::ShowFpsEffect()
: paints_pos(0)
, frames_pos(0)
- , m_noBenchmark(effects->effectFrame(EffectFrameUnstyled, false))
+ , m_noBenchmark(effects->effectFrame(false))
{
for (int i = 0;
i < NUM_PAINTS;
namespace KWin
{
-KWIN_EFFECT(showpaint, ShowPaintEffect)
-
static QColor colors[] = { Qt::red, Qt::green, Qt::blue, Qt::cyan, Qt::magenta,
Qt::yellow, Qt::gray
};
namespace KWin
{
-KWIN_EFFECT(slide, SlideEffect)
-
SlideEffect::SlideEffect()
: slide(false)
{
namespace KWin
{
-KWIN_EFFECT(slideback, SlideBackEffect)
-
SlideBackEffect::SlideBackEffect()
{
m_tabboxActive = 0;
namespace KWin
{
-KWIN_EFFECT(slidingpopups, SlidingPopupsEffect)
-
SlidingPopupsEffect::SlidingPopupsEffect()
{
mAtom = effects->announceSupportProperty("_KDE_SLIDE", this);
namespace KWin
{
-KWIN_EFFECT(snaphelper, SnapHelperEffect)
-
SnapHelperEffect::SnapHelperEffect()
: m_active(false)
, m_window(NULL)
namespace KWin
{
-KWIN_EFFECT(taskbarthumbnail, TaskbarThumbnailEffect)
-
TaskbarThumbnailEffect::TaskbarThumbnailEffect()
{
atom = effects->announceSupportProperty("_KDE_WINDOW_PREVIEW", this);
namespace KWin
{
-KWIN_EFFECT(thumbnailaside, ThumbnailAsideEffect)
-
ThumbnailAsideEffect::ThumbnailAsideEffect()
{
KActionCollection* actionCollection = new KActionCollection(this);
namespace KWin
{
-KWIN_EFFECT(trackmouse, TrackMouseEffect)
-
TrackMouseEffect::TrackMouseEffect()
: m_active(false)
, m_angle(0)
using namespace KWin;
-KWIN_EFFECT(windowgeometry, WindowGeometryEffect)
-
WindowGeometryEffect::WindowGeometryEffect()
{
iAmActivated = true;
reconfigure(ReconfigureAll);
QFont fnt; fnt.setBold(true); fnt.setPointSize(12);
for (int i = 0; i < 3; ++i) {
- myMeasure[i] = effects->effectFrame(EffectFrameUnstyled, false);
+ myMeasure[i] = effects->effectFrame(false);
myMeasure[i]->setFont(fnt);
}
myMeasure[0]->setAlignment(Qt::AlignLeft | Qt::AlignTop);
namespace KWin
{
-KWIN_EFFECT(zoom, ZoomEffect)
-
ZoomEffect::ZoomEffect()
: Effect()
, zoom(1)
#include <QtGui/qx11info_x11.h>
#include <KGlobalSettings>
-#include "outline.h"
namespace KWin
{
if (isElectricBorderMaximizing()) {
setQuickTileMode(electricMode);
electricMaximizing = false;
- outline()->hide();
elevate(false);
} else if (!cancel) {
if (!(maximizeMode() & MaximizeHorizontal)) {
void Client::setElectricBorderMaximizing(bool maximizing)
{
electricMaximizing = maximizing;
- if (maximizing)
- outline()->show(electricBorderMaximizeGeometry(cursorPos(), desktop()));
- else
- outline()->hide();
elevate(maximizing);
}
-include_directories( ${CMAKE_SOURCE_DIR}/kwin )
+include_directories(${CMAKE_SOURCE_DIR}/kwin)
-set(
- kcm_kwinscreenedges_PART_SRCS
+set(kcm_kwinscreenedges_SRCS
main.cpp
monitor.cpp
- main.ui
)
-kde4_add_plugin( kcm_kwinscreenedges ${kcm_kwinscreenedges_PART_SRCS} )
-target_link_libraries( kcm_kwinscreenedges ${X11_LIBRARIES} kworkspace ${KDE4_PLASMA_LIBS})
-install( TARGETS kcm_kwinscreenedges DESTINATION ${PLUGIN_INSTALL_DIR} )
+kde4_add_plugin(kcm_kwinscreenedges ${kcm_kwinscreenedges_SRCS})
+target_link_libraries(kcm_kwinscreenedges ${X11_LIBRARIES} kworkspace ${KDE4_PLASMA_LIBS})
+install(TARGETS kcm_kwinscreenedges DESTINATION ${PLUGIN_INSTALL_DIR})
-install( FILES kwinscreenedges.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+install(FILES kwinscreenedges.desktop DESTINATION ${SERVICES_INSTALL_DIR})
};
/**
- * Style types used by @ref EffectFrame.
- * @since 4.6
- */
-enum EffectFrameStyle {
- EffectFrameNone, ///< Displays no frame around the contents.
- EffectFrameUnstyled, ///< Displays a basic box around the contents.
- EffectFrameStyled ///< Displays a Plasma-styled frame around the contents.
-};
-
-/**
* Infinite region (i.e. a special region type saying that everything needs to be painted).
*/
KWIN_EXPORT inline
* EffectFrame.
* @since 4.6
*/
- virtual EffectFrame* effectFrame(EffectFrameStyle style, bool staticSize = true,
- const QPoint& position = QPoint(-1, -1), Qt::Alignment alignment = Qt::AlignCenter) const = 0;
+ virtual EffectFrame* effectFrame(bool staticSize = true,
+ const QPoint& position = QPoint(-1, -1),
+ Qt::Alignment alignment = Qt::AlignCenter) const = 0;
/**
* Allows an effect to trigger a reload of itself.
virtual const QSize& iconSize() const = 0;
/**
- * Sets the geometry of a selection.
- * To remove the selection set a null rect.
- * @param selection The geometry of the selection in screen coordinates.
- **/
- virtual void setSelection(const QRect& selection) = 0;
-
- /**
- * @returns The style of this EffectFrame.
- **/
- virtual EffectFrameStyle style() const = 0;
-
- /**
* If @p enable is @c true cross fading between icons and text is enabled
* By default disabled. Use setCrossFadeProgress to cross fade.
* Cross Fading is currently only available if OpenGL is used.
+++ /dev/null
-/********************************************************************
- KWin - the KDE window manager
- This file is part of the KDE project.
-
-Copyright (C) 2011 Arthur Arlt <a.arlt@stud.uni-heidelberg.de>
-Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*********************************************************************/
-// own
-#include "outline.h"
-// KWin
-#include "composite.h"
-// KWin libs
-#include <kwinxrenderutils.h>
-#include "workspace.h"
-// Plasma
-#include <Plasma/FrameSvg>
-// Qt
-#include <QPainter>
-// xcb
-#include <xcb/render.h>
-
-namespace KWin {
-
-KWIN_SINGLETON_FACTORY(Outline)
-
-Outline::Outline(QObject *parent)
- : QObject(parent)
- , m_active(false)
-{
- connect(Compositor::self(), SIGNAL(compositingToggled(bool)), SLOT(compositingChanged()));
-}
-
-Outline::~Outline()
-{
-}
-
-void Outline::show()
-{
- m_active = true;
- if (m_visual.isNull()) {
- createHelper();
- }
- if (m_visual.isNull()) {
- // something went wrong
- return;
- }
- m_visual->show();
-}
-
-void Outline::hide()
-{
- if (!m_active) {
- return;
- }
- m_active = false;
- if (m_visual.isNull()) {
- return;
- }
- m_visual->hide();
-}
-
-void Outline::show(const QRect& outlineGeometry)
-{
- setGeometry(outlineGeometry);
- show();
-}
-
-void Outline::setGeometry(const QRect& outlineGeometry)
-{
- m_outlineGeometry = outlineGeometry;
-}
-
-void Outline::createHelper()
-{
- if (!m_visual.isNull()) {
- return;
- }
- if (Compositor::compositing()) {
- m_visual.reset(new CompositedOutlineVisual(this));
- } else {
- m_visual.reset(new NonCompositedOutlineVisual(this));
- }
-}
-
-void Outline::compositingChanged()
-{
- m_visual.reset();
- if (m_active) {
- show();
- }
-}
-
-OutlineVisual::OutlineVisual(Outline *outline)
- : m_outline(outline)
-{
-}
-
-OutlineVisual::~OutlineVisual()
-{
-}
-
-CompositedOutlineVisual::CompositedOutlineVisual(Outline *outline)
- : QWidget(NULL, Qt::X11BypassWindowManagerHint)
- , OutlineVisual(outline)
- , m_background(new Plasma::FrameSvg(this))
-{
- setAttribute(Qt::WA_TranslucentBackground);
- QPalette pal = palette();
- pal.setColor(backgroundRole(), Qt::transparent);
- setPalette(pal);
- m_background->setImagePath("widgets/translucentbackground");
- m_background->setCacheAllRenderedFrames(true);
- m_background->setEnabledBorders(Plasma::FrameSvg::AllBorders);
-}
-
-CompositedOutlineVisual::~CompositedOutlineVisual()
-{
-}
-
-void CompositedOutlineVisual::hide()
-{
- QWidget::hide();
-}
-
-void CompositedOutlineVisual::show()
-{
- const QRect &outlineGeometry = outline()->geometry();
- m_background->resizeFrame(outlineGeometry.size());
- setGeometry(outlineGeometry);
-
- // check which borders to enable
- bool left, right, top, bottom;
- left = right = top = bottom = false;
- const QRect maximizedArea = Workspace::self()->clientArea(MaximizeArea, outlineGeometry.center(), 1);
- if (outlineGeometry.x() == maximizedArea.x()) {
- left = true;
- }
- if (outlineGeometry.y() == maximizedArea.y()) {
- top = true;
- }
- if (outlineGeometry.right() == maximizedArea.right()) {
- right = true;
- }
- if (outlineGeometry.bottom() == maximizedArea.bottom()) {
- bottom = true;
- }
- Plasma::FrameSvg::EnabledBorders borders = Plasma::FrameSvg::AllBorders;
- if (left) {
- borders = borders & ~Plasma::FrameSvg::LeftBorder;
- }
- if (right) {
- borders = borders & ~Plasma::FrameSvg::RightBorder;
- }
- if (top) {
- borders = borders & ~Plasma::FrameSvg::TopBorder;
- }
- if (bottom) {
- borders = borders & ~Plasma::FrameSvg::BottomBorder;
- }
- if (left && right && bottom && top) {
- borders = Plasma::FrameSvg::AllBorders;
- }
- m_background->setEnabledBorders(borders);
- QWidget::show();
-}
-
-void CompositedOutlineVisual::paintEvent(QPaintEvent *)
-{
- QPainter painter(this);
- painter.setRenderHint(QPainter::Antialiasing);
- m_background->paintFrame(&painter);
-}
-
-NonCompositedOutlineVisual::NonCompositedOutlineVisual(Outline *outline)
- : OutlineVisual(outline)
- , m_initialized(false)
-{
-}
-
-NonCompositedOutlineVisual::~NonCompositedOutlineVisual()
-{
-}
-
-void NonCompositedOutlineVisual::show()
-{
- if (!m_initialized) {
- const QRect geo(0, 0, 1, 1);
- const uint32_t values[] = {true};
- // TODO: use template variant
- m_leftOutline.create(geo, XCB_CW_OVERRIDE_REDIRECT, values);
- m_rightOutline.create(geo, XCB_CW_OVERRIDE_REDIRECT, values);
- m_topOutline.create(geo, XCB_CW_OVERRIDE_REDIRECT, values);
- m_bottomOutline.create(geo, XCB_CW_OVERRIDE_REDIRECT, values);
- m_initialized = true;
- }
-
- const int defaultDepth = Xcb::defaultDepth();
-
- const QRect &outlineGeometry = outline()->geometry();
- // left/right parts are between top/bottom, they don't reach as far as the corners
- const uint16_t verticalWidth = 5;
- const uint16_t verticalHeight = outlineGeometry.height() - 10;
- const uint16_t horizontalWidth = outlineGeometry.width();
- const uint horizontalHeight = 5;
- m_leftOutline.setGeometry(outlineGeometry.x(), outlineGeometry.y() + 5, verticalWidth, verticalHeight);
- m_rightOutline.setGeometry(outlineGeometry.x() + outlineGeometry.width() - 5, outlineGeometry.y() + 5, verticalWidth, verticalHeight);
- m_topOutline.setGeometry(outlineGeometry.x(), outlineGeometry.y(), horizontalWidth, horizontalHeight);
- m_bottomOutline.setGeometry(outlineGeometry.x(), outlineGeometry.y() + outlineGeometry.height() - 5, horizontalWidth, horizontalHeight);
-
- const xcb_render_color_t white = {0xffff, 0xffff, 0xffff, 0xffff};
- QColor qGray(Qt::gray);
- const xcb_render_color_t gray = {
- uint16_t(0xffff * qGray.redF()),
- uint16_t(0xffff * qGray.greenF()),
- uint16_t(0xffff * qGray.blueF()),
- 0xffff
- };
- const xcb_render_color_t black = {0, 0, 0, 0xffff};
- {
- xcb_pixmap_t xpix = xcb_generate_id(connection());
- xcb_create_pixmap(connection(), defaultDepth, xpix, rootWindow(), verticalWidth, verticalHeight);
- XRenderPicture pic(xpix, defaultDepth);
-
- xcb_rectangle_t rect = {0, 0, 5, verticalHeight};
- xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, pic, white, 1, &rect);
- rect.x = 1;
- rect.width = 3;
- xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, pic, gray, 1, &rect);
- rect.x = 2;
- rect.width = 1;
- xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, pic, black, 1, &rect);
-
- m_leftOutline.setBackgroundPixmap(xpix);
- m_rightOutline.setBackgroundPixmap(xpix);
- // According to the XSetWindowBackgroundPixmap documentation the pixmap can be freed.
- xcb_free_pixmap(connection(), xpix);
- }
- {
- xcb_pixmap_t xpix = xcb_generate_id(connection());
- xcb_create_pixmap(connection(), defaultDepth, xpix, rootWindow(), horizontalWidth, horizontalHeight);
- XRenderPicture pic(xpix, defaultDepth);
-
- xcb_rectangle_t rect = {0, 0, horizontalWidth, horizontalHeight};
- xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, pic, white, 1, &rect);
- xcb_rectangle_t grayRects[] = {
- {1, 1, uint16_t(horizontalWidth -2), 3},
- {1, 4, 3, 1},
- {int16_t(horizontalWidth - 4), 4, 3, 1}
- };
- xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, pic, gray, 3, grayRects);
- xcb_rectangle_t blackRects[] = {
- {2, 2, uint16_t(horizontalWidth -4), 1},
- {2, 3, 1, 2},
- {int16_t(horizontalWidth - 3), 3, 1, 2}
- };
- xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, pic, black, 3, blackRects);
- m_topOutline.setBackgroundPixmap(xpix);
- // According to the XSetWindowBackgroundPixmap documentation the pixmap can be freed.
- xcb_free_pixmap(connection(), xpix);
- }
- {
- xcb_pixmap_t xpix = xcb_generate_id(connection());
- xcb_create_pixmap(connection(), defaultDepth, xpix, rootWindow(), outlineGeometry.width(), 5);
- XRenderPicture pic(xpix, defaultDepth);
-
- xcb_rectangle_t rect = {0, 0, horizontalWidth, horizontalHeight};
- xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, pic, white, 1, &rect);
- xcb_rectangle_t grayRects[] = {
- {1, 1, uint16_t(horizontalWidth -2), 3},
- {1, 0, 3, 1},
- {int16_t(horizontalWidth - 4), 0, 3, 1}
- };
- xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, pic, gray, 3, grayRects);
- xcb_rectangle_t blackRects[] = {
- {2, 2, uint16_t(horizontalWidth -4), 1},
- {2, 0, 1, 2},
- {int16_t(horizontalWidth - 3), 0, 1, 2}
- };
- xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, pic, black, 3, blackRects);
- m_bottomOutline.setBackgroundPixmap(xpix);
- // According to the XSetWindowBackgroundPixmap documentation the pixmap can be freed.
- xcb_free_pixmap(connection(), xpix);
- }
- forEachWindow(&Xcb::Window::clear);
- forEachWindow(&Xcb::Window::map);
-}
-
-void NonCompositedOutlineVisual::hide()
-{
- forEachWindow(&Xcb::Window::unmap);
-}
-
-} // namespace
+++ /dev/null
-/********************************************************************
- KWin - the KDE window manager
- This file is part of the KDE project.
-
-Copyright (C) 2011 Arthur Arlt <a.arlt@stud.uni-heidelberg.de>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*********************************************************************/
-
-#ifndef KWIN_OUTLINE_H
-#define KWIN_OUTLINE_H
-#include "xcbutils.h"
-#include <kwinglobals.h>
-#include <QRect>
-#include <QWidget>
-
-namespace Plasma {
-class FrameSvg;
-}
-
-namespace KWin {
-class OutlineVisual;
-
-/**
- * @short This class is used to show the outline of a given geometry.
- *
- * The class renders an outline by using four windows. One for each border of
- * the geometry. It is possible to replace the outline with an effect. If an
- * effect is available the effect will be used, otherwise the outline will be
- * rendered by using the X implementation.
- *
- * @author Arthur Arlt
- * @since 4.7
- */
-class Outline : public QObject {
- Q_OBJECT
-public:
- ~Outline();
-
- /**
- * Set the outline geometry.
- * To show the outline use @link showOutline.
- * @param outlineGeometry The geometry of the outline to be shown
- * @see showOutline
- */
- void setGeometry(const QRect &outlineGeometry);
-
- /**
- * Shows the outline of a window using either an effect or the X implementation.
- * To stop the outline process use @link hideOutline.
- * @see hideOutline
- */
- void show();
-
- /**
- * Shows the outline for the given @p outlineGeometry.
- * This is the same as setOutlineGeometry followed by showOutline directly.
- * To stop the outline process use @link hideOutline.
- * @param outlineGeometry The geometry of the outline to be shown
- * @see hideOutline
- */
- void show(const QRect &outlineGeometry);
-
- /**
- * Hides shown outline.
- * @see showOutline
- */
- void hide();
-
- const QRect &geometry() const;
-
-private Q_SLOTS:
- void compositingChanged();
-
-private:
- void createHelper();
- QScopedPointer<OutlineVisual> m_visual;
- QRect m_outlineGeometry;
- bool m_active;
- KWIN_SINGLETON(Outline)
-};
-
-class OutlineVisual
-{
-public:
- OutlineVisual(Outline *outline);
- virtual ~OutlineVisual();
- virtual void show() = 0;
- virtual void hide() = 0;
-protected:
- Outline *outline();
- const Outline *outline() const;
-private:
- Outline *m_outline;
-};
-
-class CompositedOutlineVisual : public QWidget, public OutlineVisual
-{
-public:
- CompositedOutlineVisual(Outline *outline);
- virtual ~CompositedOutlineVisual();
- virtual void show();
- virtual void hide();
-protected:
- virtual void paintEvent(QPaintEvent *);
-private:
- Plasma::FrameSvg *m_background;
-};
-
-class NonCompositedOutlineVisual : public OutlineVisual
-{
-public:
- NonCompositedOutlineVisual(Outline *outline);
- virtual ~NonCompositedOutlineVisual();
- virtual void show();
- virtual void hide();
-
-private:
- // TODO: variadic template arguments for adding method arguments
- template <typename T>
- void forEachWindow(T method);
- bool m_initialized;
- Xcb::Window m_topOutline;
- Xcb::Window m_rightOutline;
- Xcb::Window m_bottomOutline;
- Xcb::Window m_leftOutline;
-};
-
-inline
-const QRect &Outline::geometry() const
-{
- return m_outlineGeometry;
-}
-
-inline
-Outline *OutlineVisual::outline()
-{
- return m_outline;
-}
-
-inline
-const Outline *OutlineVisual::outline() const
-{
- return m_outline;
-}
-
-template <typename T>
-inline
-void NonCompositedOutlineVisual::forEachWindow(T method)
-{
- (m_topOutline.*method)();
- (m_rightOutline.*method)();
- (m_bottomOutline.*method)();
- (m_leftOutline.*method)();
-}
-
-inline
-Outline *outline()
-{
- return Outline::self();
-}
-
-}
-
-#endif
virtual void free() = 0;
virtual void freeIconFrame() = 0;
virtual void freeTextFrame() = 0;
- virtual void freeSelection() = 0;
virtual void crossFadeIcon() = 0;
virtual void crossFadeText() = 0;
m_picture = NULL;
m_textPicture = NULL;
m_iconPicture = NULL;
- m_selectionPicture = NULL;
}
SceneXrender::EffectFrame::~EffectFrame()
delete m_picture;
delete m_textPicture;
delete m_iconPicture;
- delete m_selectionPicture;
}
void SceneXrender::EffectFrame::cleanup()
m_textPicture = NULL;
delete m_iconPicture;
m_iconPicture = NULL;
- delete m_selectionPicture;
- m_selectionPicture = NULL;
}
void SceneXrender::EffectFrame::freeIconFrame()
m_textPicture = NULL;
}
-void SceneXrender::EffectFrame::freeSelection()
-{
- delete m_selectionPicture;
- m_selectionPicture = NULL;
-}
-
void SceneXrender::EffectFrame::crossFadeIcon()
{
// TODO: implement me
}
// Render the actual frame
- if (m_effectFrame->style() == EffectFrameUnstyled) {
- renderUnstyled(effects->xrenderBufferPicture(), m_effectFrame->geometry(), opacity * frameOpacity);
- } else if (m_effectFrame->style() == EffectFrameStyled) {
- if (!m_picture) { // Lazy creation
- updatePicture();
- }
- if (m_picture) {
- qreal left, top, right, bottom;
- m_effectFrame->frame().getMargins(left, top, right, bottom); // m_geometry is the inner geometry
- QRect geom = m_effectFrame->geometry().adjusted(-left, -top, right, bottom);
- xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *m_picture,
- XCB_RENDER_PICTURE_NONE, effects->xrenderBufferPicture(),
- 0, 0, 0, 0, geom.x(), geom.y(), geom.width(), geom.height());
- }
- }
- if (!m_effectFrame->selection().isNull()) {
- if (!m_selectionPicture) { // Lazy creation
- const QPixmap pix = m_effectFrame->selectionFrame().framePixmap();
- if (!pix.isNull()) // don't try if there's no content
- m_selectionPicture = new XRenderPicture(m_effectFrame->selectionFrame().framePixmap());
- }
- if (m_selectionPicture) {
- const QRect geom = m_effectFrame->selection();
- xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *m_selectionPicture,
- XCB_RENDER_PICTURE_NONE, effects->xrenderBufferPicture(),
- 0, 0, 0, 0, geom.x(), geom.y(), geom.width(), geom.height());
- }
- }
+ renderUnstyled(effects->xrenderBufferPicture(), m_effectFrame->geometry(), opacity * frameOpacity);
XRenderPicture fill = xRenderBlendPicture(opacity);
{
delete m_picture;
m_picture = 0L;
- if (m_effectFrame->style() == EffectFrameStyled) {
- const QPixmap pix = m_effectFrame->frame().framePixmap();
- if (!pix.isNull())
- m_picture = new XRenderPicture(pix);
- }
}
void SceneXrender::EffectFrame::updateTextPicture()
pixmap.fill(Qt::transparent);
QPainter p(&pixmap);
p.setFont(m_effectFrame->font());
- if (m_effectFrame->style() == EffectFrameStyled) {
- p.setPen(m_effectFrame->styledTextColor());
- } else {
- // TODO: What about no frame? Custom color setting required
- p.setPen(Qt::white);
- }
+ // TODO: What about no frame? Custom color setting required
+ p.setPen(Qt::white);
p.drawText(rect, m_effectFrame->alignment(), text);
p.end();
m_textPicture = new XRenderPicture(pixmap);
virtual void free();
virtual void freeIconFrame();
virtual void freeTextFrame();
- virtual void freeSelection();
virtual void crossFadeIcon();
virtual void crossFadeText();
virtual void render(QRegion region, double opacity, double frameOpacity);
XRenderPicture* m_picture;
XRenderPicture* m_textPicture;
XRenderPicture* m_iconPicture;
- XRenderPicture* m_selectionPicture;
static XRenderPicture* s_effectFrameCircle;
};
, m_model(model)
, m_mode(mode)
, m_currentScreenGeometry()
- , m_frame(new Plasma::FrameSvg(this))
, m_currentLayout()
, m_cachedWidth(0)
, m_cachedHeight(0)
}
setSource(QUrl(KStandardDirs::locate("data", QLatin1String("kwin/tabbox/tabbox.qml"))));
- // FrameSvg
- m_frame->setImagePath("dialogs/background");
- m_frame->setCacheAllRenderedFrames(true);
- m_frame->setEnabledBorders(Plasma::FrameSvg::AllBorders);
-
connect(tabBox, SIGNAL(configChanged()), SLOT(updateQmlSource()));
if (m_mode == TabBoxConfig::ClientTabBox) {
connect(tabBox, SIGNAL(embeddedChanged(bool)), SLOT(slotEmbeddedChanged(bool)));
QGraphicsView::showEvent(event);
}
-void DeclarativeView::resizeEvent(QResizeEvent *event)
-{
- if (tabBox->embedded()) {
- Plasma::WindowEffects::enableBlurBehind(winId(), false);
- } else {
- const QString maskImagePath = rootObject()->property("maskImagePath").toString();
- if (maskImagePath.isEmpty()) {
- clearMask();
- Plasma::WindowEffects::enableBlurBehind(winId(), false);
- } else {
- const double maskWidth = rootObject()->property("maskWidth").toDouble();
- const double maskHeight = rootObject()->property("maskHeight").toDouble();
- const int maskTopMargin = rootObject()->property("maskTopMargin").toInt();
- const int maskLeftMargin = rootObject()->property("maskLeftMargin").toInt();
- m_frame->setImagePath(maskImagePath);
- m_frame->resizeFrame(QSizeF(maskWidth, maskHeight));
- QRegion mask = m_frame->mask().translated(maskLeftMargin, maskTopMargin);
-#ifndef TABBOX_KCM
- // notice: this covers an issue with plasma detecting the compositing state. see plasmaThemeVariant()
- if (Workspace::self()->compositing() && effects) {
- // blur background?!
- Plasma::WindowEffects::enableBlurBehind(winId(), static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::Blur), mask);
- clearMask();
- } else
-#endif
- {
- // do not trim to mask with compositing enabled, otherwise shadows are cropped
- setMask(mask);
- }
- }
- }
- QDeclarativeView::resizeEvent(event);
-}
-
void DeclarativeView::hideEvent(QHideEvent *event)
{
QWidget::hideEvent(event);
public:
DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBoxMode mode, QWidget *parent = NULL);
virtual void showEvent(QShowEvent *event);
- virtual void resizeEvent(QResizeEvent *event);
void setCurrentIndex(const QModelIndex &index, bool disableAnimation = false);
bool sendKeyEvent(QKeyEvent *event);
QAbstractItemModel *m_model;
TabBoxConfig::TabBoxMode m_mode;
QRect m_currentScreenGeometry;
- /**
- * Background Frame required for setting the blur mask
- */
- Plasma::FrameSvg* m_frame;
QString m_currentLayout;
int m_cachedWidth;
int m_cachedHeight;
#include "group.h"
#include "killwindow.h"
#include "netinfo.h"
-#include "outline.h"
#include "placement.h"
#include "rules.h"
#ifdef KWIN_BUILD_SCREENEDGES
client_keys = new KActionCollection(this);
- Outline::create(this);
-
initShortcuts();
init();