KWin
Loading...
Searching...
No Matches
Public Types | Public Slots | Public Member Functions | Static Public Member Functions | List of all members
KWin::Effect Class Reference

Base class for all KWin effects. More...

#include <effect.h>

Inheritance diagram for KWin::Effect:
KWin::BlurEffect KWin::ColorPickerEffect KWin::ContrastEffect KWin::CrossFadeEffect KWin::DimInactiveEffect KWin::GlideEffect KWin::HelperEffect KWin::HelperEffect KWin::KscreenEffect KWin::MagnifierEffect KWin::MouseClickEffect KWin::MouseMarkEffect KWin::OffscreenEffect KWin::OutputLocatorEffect KWin::QuickSceneEffect KWin::ScreenEdgeEffect KWin::ScreenShotEffect KWin::ScreenTransformEffect KWin::ShakeCursorEffect KWin::SheetEffect KWin::ShowFpsEffect KWin::ShowPaintEffect KWin::SlideBackEffect KWin::SlideEffect KWin::SlidingPopupsEffect KWin::SnapHelperEffect KWin::StartupFeedbackEffect KWin::ThumbnailAsideEffect KWin::TouchPointsEffect KWin::TrackMouseEffect KWin::ZoomEffect

Public Types

enum  {
  PAINT_WINDOW_OPAQUE = 1 << 0 , PAINT_WINDOW_TRANSLUCENT = 1 << 1 , PAINT_WINDOW_TRANSFORMED = 1 << 2 , PAINT_SCREEN_REGION = 1 << 3 ,
  PAINT_SCREEN_TRANSFORMED = 1 << 4 , PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS = 1 << 5 , PAINT_SCREEN_BACKGROUND_FIRST = 1 << 6
}
 
enum  Feature {
  Nothing = 0 , ScreenInversion , Blur , Contrast ,
  HighlightWindows
}
 
enum  ReconfigureFlag { ReconfigureAll = 1 << 0 }
 

Public Slots

virtual bool borderActivated (ElectricBorder border)
 

Public Member Functions

 Effect (QObject *parent=nullptr)
 
 ~Effect () override
 
virtual void reconfigure (ReconfigureFlags flags)
 
virtual void prePaintScreen (ScreenPrePaintData &data, std::chrono::milliseconds presentTime)
 
virtual void paintScreen (const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
 
virtual void postPaintScreen ()
 
virtual void prePaintWindow (EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime)
 
virtual void paintWindow (const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
 
virtual void postPaintWindow (EffectWindow *w)
 
virtual bool provides (Feature)
 
virtual bool perform (Feature feature, const QVariantList &arguments)
 
virtual void drawWindow (const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data)
 
virtual void windowInputMouseEvent (QEvent *e)
 
virtual void grabbedKeyboardEvent (QKeyEvent *e)
 
virtual bool isActive () const
 
virtual QString debug (const QString &parameter) const
 
virtual int requestedEffectChainPosition () const
 
virtual bool touchDown (qint32 id, const QPointF &pos, std::chrono::microseconds time)
 
virtual bool touchMotion (qint32 id, const QPointF &pos, std::chrono::microseconds time)
 
virtual bool touchUp (qint32 id, std::chrono::microseconds time)
 
virtual bool tabletToolEvent (QTabletEvent *event)
 
virtual bool tabletToolButtonEvent (uint button, bool pressed, quint64 tabletToolId)
 
virtual bool tabletPadButtonEvent (uint button, bool pressed, void *tabletPadId)
 
virtual bool tabletPadStripEvent (int number, int position, bool isFinger, void *tabletPadId)
 
virtual bool tabletPadRingEvent (int number, int position, bool isFinger, void *tabletPadId)
 
template<typename T >
int animationTime (int defaultDuration)
 
virtual bool blocksDirectScanout () const
 

Static Public Member Functions

static QPointF cursorPos ()
 
static double animationTime (const KConfigGroup &cfg, const QString &key, int defaultTime)
 
static double animationTime (int defaultTime)
 
static double interpolate (double x, double y, double a)
 
static void setPositionTransformations (WindowPaintData &data, QRect &region, EffectWindow *w, const QRect &r, Qt::AspectRatioMode aspect)
 

Detailed Description

Base class for all KWin effects.

This is the base class for all effects. By reimplementing virtual methods of this class, you can customize how the windows are painted.

The virtual methods are used for painting and need to be implemented for custom painting.

In order to react to state changes (e.g. a window gets closed) the effect should provide slots for the signals emitted by the EffectsHandler.

Chaining

Most methods of this class are called in chain style. This means that when effects A and B area active then first e.g. A::paintWindow() is called and then from within that method B::paintWindow() is called (although indirectly). To achieve this, you need to make sure to call corresponding method in EffectsHandler class from each such method (using effects pointer):

void MyEffect::postPaintScreen()
{
// Do your own processing here
...
// Call corresponding EffectsHandler method
}
EffectsHandler * effects

Effects pointer

effects pointer points to the global EffectsHandler object that you can use to interact with the windows.

Painting stages

Painting of windows is done in three stages:

For each stage there are *Screen() and *Window() methods. The window method is called for every window while the screen method is usually called just once.

OpenGL

Effects can use OpenGL if EffectsHandler::isOpenGLCompositing() returns true. The OpenGL context may not always be current when code inside the effect is executed. The framework ensures that the OpenGL context is current when the Effect gets created, destroyed or reconfigured and during the painting stages. All virtual methods which have the OpenGL context current are documented.

If OpenGL code is going to be executed outside the painting stages, e.g. in reaction to a global shortcut, it is the task of the Effect to make the OpenGL context current:

bool makeOpenGLContextCurrent()
Makes the OpenGL compositing context current.

There is in general no need to call the matching doneCurrent method.

Definition at line 534 of file effect.h.


The documentation for this class was generated from the following files: