Commit Graph

151 Commits (b0e892e359c1b760cdf7f2e98bd525c6987d2c3d)

Author SHA1 Message Date
Martin Gräßlin b0e892e359 [kwin] Add a new EffectLoader
The EffectLoader is a subclass of AbstractEffectLoader delegating all
methods to instances of:
* BuiltInEffectLoader
* ScriptedEffectLoader
* PluginEffectLoader

It's used by the EffectsHandlerImpl and replaces the complete Effect
loading mechanism we so far found in it. This also means that KLibrary
is no longer needed to load the Effects as the PluginEffectLoader uses
the KPluginTrader, which removes lots of deprecated functionality.

REVIEW: 117054
2014-03-28 14:04:55 +01:00
Martin Gräßlin e68d5c6315 [kwin] Add a KPluginFactory subclass for loading binary Effects
A KWin::EffectPluginFactory is introduced which provides a specialized
create method and methods for the supported and enabledByDefault checks.

A set of KWIN_EFFECT_FACTORY macros are added which create a subclass
of this EffectPluginFactory following the approach from the
KPluginFactory macros. The macros only support json metadata thus the
QPluginTrader needs to be used.

The KWIN_EFFECT macros are removed as they are no longer needed.

KWin Core's loader is not yet adjusted to this change. This is a
preparation step for introducing a PluginEffectLoader.
2014-03-28 14:04:54 +01:00
Martin Gräßlin 3bbc9436db [kwin] Add a virtual Effect::requestedEffectChainPosition
This method replaces the X-KDE-ORDERING property in the Effect's desktop
files. This change is a preparation step for integrating the new Effect
Loader which doesn't read the ordering information. Thus it needs to be
provided by the Effect itself so that the EffectsHandler can properly
insert it into the chain.

Also for the built-in Effects on the long run it doesn't make much sense
to install the desktop files. And binary plugin effects will migrate to
json metadata which also doesn't have the KService::Ptr. Thus overall it
simplifies to read this information directly from the Effect.
2014-03-28 14:04:54 +01:00
Martin Gräßlin a2aab537d6 [kwin/effects] Use generated dbus interface to reconfigure effects
Instead of using EffectsHandler::sendReloadMessage we generate the dbus
interface in each plugin and call the reconfigure slot directly. That way
it's more type safe and we don't need to link kwineffects from the
configs.

REVIEW: 116875
2014-03-25 15:49:19 +01:00
Martin Gräßlin f9e0a8b597 [kwin] Create one plugin per effect configuration
There are no advantages for the effects KCM to have all the effect
config modules in one plugin.

By having a plugin per effect we can use the KPluginTrader to easily
find the configuration plugin for a given effect and load it.

To make this possible the following changes are done:
* config_builtins.cpp is deleted
* add_subdirectory is used for all effects which have a config module
* toplevel CMakeLists.txt contains the sources again for the effects
  which have a config module, but effects which don't have a config
  module are still included and thus the macro is still used
* plugin created for the config module, name pattern is:
   kwin_effectname_config
* plugin installed to ${PLUGIN_INSTALL_DIR}/kwin/effects/configs
* desktop file adjusted to new plugin name and keyword removed
* desktop file converted to json as meta data and no longer installed
* Uses K_PLUGIN_FACTORY_WITH_JSON
* Macros for config are dropped from kwineffects.h

REVIEW: 116854
2014-03-25 15:37:35 +01:00
Martin Gräßlin 2d4d14b1b7 Export Pointer Axis shortcuts to the effect system 2014-03-19 14:14:57 +01:00
Martin Gräßlin 5ea990a740 Export global pointer shortcuts to effect system and use it for cube
Used in cube effect as an example with hard coded ctrl+alt+left click.

BUG: 163121
2014-03-19 14:14:56 +01:00
Martin Gräßlin b57885a1bf Add registerGlobalShortcut method to kwineffects
Implemented in KWin core to forward to new global shortcut system. This
method should be extended/changed once we go to Qt5/KF5 to make the usage
easier (no more KAction).

Each global shortcut in the effects makes use of this new method.
2014-03-19 14:14:56 +01:00
Aleix Pol c72e519d9c Remove KDE/ prefix in include directories
It's unneeded and deprecated since KF5.
2014-03-17 16:24:10 +01:00
Martin Gräßlin 3f0ff9b8d5 Migrate effects from displayWidth()/displayHeight() to virtualScreenSize()/virtualScreenGeometry()
Rational behind this change is that displayWidth and displayHeight are
X specific API calls in kwinglobals. For the future it's easier to only
rely on functionality which goes through the EffectsHandler API which
allows easier adjustments in KWin core.

displayWidth() and displayHeight() are only used to get the size or the
complete rect of all screens. This is also provided by:

effects->virtualScreenGeometry() or
effects->virtualScreenSize()

REVIEW: 116021
2014-03-07 08:01:44 +01:00
Martin Gräßlin 6b1f0b1fca [kwin] Introduce Screens::size and Screens::geometry
Screens provides a size which is constructed from the size of
the bounding geometry of all screens and provides an overload taking
an int to return the size of a specified screen. For geometry() a new
ovload is added without an argument, which is just a convenient wrapper
for QRect(QPoint(0, 0), size()).

Both new methods are exported to effects and scripting as new
properties there called virtualScreenSize and virtualScreenGeometry.

The (virtual) size gets cached in screens and is updated whenever the
count or geometry changes.

Construction of Screens is slightly changed by moving the init code
from ctor into a virtual method init(). Reason is that we ended in
a loop with accessing the singleton pointer before it was set.

REVIEW: 116114
2014-03-05 13:03:33 +01:00
Martin Gräßlin 2fbc8414a7 Allow windows to specify that they should not get animated on window close
By setting the X property _KDE_NET_WM_SKIP_CLOSE_ANIMATION to 1 a window
can request to be excluded from any close animation. This property is
read in Toplevel, so that it is available to both Client and Unmanaged.

If the window has this property set the Scene suppresses the paintWindow
loop of the Deleted. Thus no effect needs to be adjusted. But an effect
using drawWindow directly would still be able to render the Deleted as
there is no suppression.

Furthermore the property is passed to the EffectWindow so that an
Effect can make use of this functionality and not start the animation
in the first place.

REVIEW: 115288
2014-01-28 07:43:35 +01:00
Marco Martin 4036f179fc one single pass, get rid of cached version
* this effect is way cheaper than blur, don't cache it
* use its own atom
* also pass the matrix in the x property
* remove remnants of the cache
* do just a single pass
* get rid of config ui remnants
2014-01-23 14:44:49 +01:00
Thomas Lübking 4bb88df714 Merge branch 'KDE/4.11' 2014-01-14 22:51:24 +01:00
Thomas Lübking c378bf4f7c emit desktopPresenceChanged from Client:setDesktop
and forward it to scripted effects

CCBUG: 326903
REVIEW: 114080
2014-01-14 22:23:49 +01:00
Martin Gräßlin dec41bbad8 Make Scene's QPainter available to effects
Effects can access the QPainter used by SceneQPainter to directly render
into the back buffer.

Obviously only available in Compositing Type QPainterCompositing.
2014-01-09 13:29:40 +01:00
Matteo De Carlo 59bb857c7b Replace NULL with nullptr in libkwineffects
Completing the task of replacing all NULL to nullptr in all the files in
libkwineffects folder.
(also substituting some "0" used as nullptr with nullptr)

REVIEW: 114823
2014-01-08 11:55:49 +01:00
Martin Gräßlin 73054577df [libkwineffects] Add a signal for screen count changed
Used in PresentWindows effect instead of QDesktopWidget.
2013-12-10 12:20:43 +01:00
Martin Gräßlin e4be8c34b8 [libkwineffects] Remove unused forward declaration 2013-12-10 11:03:08 +01:00
Martin Gräßlin 2372e02752 [kwin] Use a QIcon in Client for the icons instead of Pixmaps
Client used to have dedicated methods for different icon sizes instead
of combining all pixmaps into one QIcon. This resulted in various parts
of KWin having different access to the icons:
* effects only got one pixmap of size 32x32
* decorations only got the 16x16 and 32x32 pixmaps combined into a QIcon
* tabbox could request all icon sizes, but only as pixmap

Now all sizes are available in one QIcon allowing to easily access the
best fitting icon in a given UI.
2013-12-06 14:41:23 +01:00
Jacob Logan 0c4518cca9 added export header through cmake for kwineffects
REVIEW: 114233
2013-12-02 07:43:26 +01:00
Jacob Logan ac72e9fb73 Changed debug statements in kwin/effects from qDebug() to qCDebug(KWINEFFECTS)
A new .cpp file is added containing the declaration of the logging
category and compiled into the effects lib.

REVIEW: 114194
2013-11-29 08:47:56 +01:00
Martin Gräßlin b7be3cb621 Better handling for making the compositing OpenGL context current
With QtQuick2 it's possible that the scene graph rendering context either
lives in an own thread or uses the main GUI thread. In the latter case
it's the same thread as our compositing OpenGL context lives in. This
means our basic assumption that between two rendering passes the context
stays current does not hold.

The code already ensured that before we start a rendering pass the
context is made current, but there are many more possible cases. If we
use OpenGL in areas not triggered by the rendering loop but in response
to other events the context needs to be made current. This includes the
loading and unloading of effects (some effects use OpenGL in the static
effect check, in the ctor and dtor), background loading of texture data,
lazy loading after first usage invoked by shortcut, etc. etc.

To properly handle these cases new methods are added to EffectsHandler
to make the compositing OpenGL context current. These calls delegate down
into the scene. On non-OpenGL scenes they are noop, but on OpenGL they go
into the backend and make the context current. In addition they ensure
that Qt doesn't think that it's QOpenGLContext is current by calling
doneCurrent() on the QOpenGLContext::currentContext(). This unfortunately
causes an additional call to makeCurrent with a null context, but there
is no other way to tell Qt - it doesn't notice when a different context
is made current with low level API calls. In the multi-threaded
architecture this doesn't matter as ::currentContext() returns null.

A short evaluation showed that a transition to QOpenGLContext doesn't
seem feasible. Qt only supports either GLX or EGL while KWin supports
both and when entering the transition phase for Wayland, it would become
extremely tricky if our native platform is X11, but we want a Wayland
EGL context. A future solution might be to have a "KWin-QPA plugin" which
uses either xcb or Wayland and hides everything from Qt.

The API documentation is extended to describe when the effects-framework
ensures that an OpenGL context is current. The effects are changed to
make the context current in cases where it's not guaranteed. This has
been done by looking for creation or deletion of GLTextures and Shaders.
If there are other OpenGL usages outside the rendering loop, ctor/dtor
this needs to be changed, too.
2013-11-23 10:54:41 +01:00
Martin Gräßlin ff6cb5e75c Drop the GlobalShortcutsEditor from libkwineffects
As our need can be satisfied without sub-classing KShortcutsEditor
we can drop this class.
2013-09-09 07:10:08 +02:00
Sebastian Kügler 08a53e6a11 Remove K_EXPORT_PLUGIN macros
Include .moc file in configs_builtins.cpp, and reenable the build of the
configs.

REVIEW:111940
2013-08-08 13:47:25 +02:00
Martin Gräßlin 9291b18cee Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/effects.cpp
	kwin/effects/logout/logout.cpp
	kwin/effects/presentwindows/main.qml
	kwin/effects/presentwindows/presentwindows.cpp
	kwin/effects/presentwindows/presentwindows.h
	kwin/effects/zoom/zoom_config.cpp
	kwin/libkwineffects/kwinglutils_funcs.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/nvidiahack.cpp
	kwin/xcbutils.h
	plasma/desktop/containments/desktop/plasma-containment-desktop.desktop
	plasma/generic/wallpapers/image/image.cpp
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-08-07 10:10:06 +02:00
Martin Gräßlin 330d40f425 Fix no cast to/from ASCII intrduced issues
* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
2013-07-24 09:58:33 +02:00
Fredrik Höglund 7124f5190b Revert "kwin: Make WindowQuadList inherit from QVector"
This reverts commit 23dff966437bb664a2ffdb3f7957ef39978f5fad.

Using QVector is not a win when effects such as wobbly windows are
active, due to the realloc overhead. So revert this change for now.
2013-06-27 00:06:49 +02:00
Thomas Lübking e717c131bf Hook modalChanged signal for DialogParent script
Eg. gtk+ alters the modality after mapping and
before unmapping the window.
Therfore the former implementation ahd a wrong idea
about the modality until the window was activated and
again had a wrong idea when the dialog closed, keeping
the main client dimmed.

Modality changes at runtime are uncommon but legal and can
happen anytime.

BUG: 321340
FIXED-IN: 4.11
REVIEW: 111154
2013-06-26 12:42:09 +02:00
Martin Gräßlin 5660801192 Add DecorationOpacity to AnimationEffect
Just like Opacity for transforming only the decoration opacity.

It's an ABI break as the new enum value had to be included as anonther
non-float base value.
2013-06-05 08:27:09 +02:00
Martin Gräßlin 941c02a60f Introduce cross-fading with previous pixmap
Cross fading with previous pixmap is achieved by referencing the old
window pixmap. WindowPaintData has a cross-fade-factor which interpolates
between 0.0 (completely old pixmap) to 1.0 (completely new pixmap).

If a cross fading factor is set and a previous pixmap is valid this one
is rendered on top of the current pixmap with opacity adjusted. This
results in a smoother fading.

To simplify the setup the AnimationEffect is extended and also takes care
about correctly (un)referencing the previous window pixmap. The maximize
effect is adjusted to make use of this new capabilities.

Unfortunately this setup has a huge problem with the case that the window
decoration gets smaller (e.g. from normal to maximized state). In this
situation it can happen that the old window is rendered with parts outside
the content resulting in video garbage being shown. To prevent this a set
of new WindowQuads is generated with normalized texture coordinates in
the safe area which contains real content.

For OpenGL2Window a PreviousContentLeaf is added which is only set up in
case the crass fading factor is set.

REVIEW: 110578
2013-06-05 08:18:28 +02:00
Fredrik Höglund 40918e0193 kwin: Make WindowQuadList inherit from QVector
This avoids the overhead of allocating each WindowQuad on the heap
when appending items to the list, and also ensures that the quads
are continuous in memory.
2013-06-05 00:43:17 +02:00
Fredrik Höglund dbbda21129 kwin: Support quads in makeInterleavedArrays()
A new type parameter is added for specifying the primitive type.
2013-06-05 00:41:24 +02:00
Fredrik Höglund ac5f1317e9 kwin: Split WindowQuadDecoration into two types
Split WindowQuadDecoration into WindowQuadDecorationLeftRight
and WindowQuadDecorationTopBottom.

This simplifies the code in SceneOpenGL::Window::paintDecoration().
2013-06-05 00:41:22 +02:00
Martin Gräßlin 4b4646973b Use QList<KWin::EffectWindow*> as return type for mainWindows()
QtScript bindings fails when using EffectWindowList.
2013-06-04 17:17:08 +02:00
Fredrik Höglund de4b7e8db1 kwin: Add WindowQuadList::makeInterleavedArrays()
Unlike makeArrays() this function writes into a pre-allocated array,
and takes a matrix that's used to transform the texture coordinates.
This allows this function to handle coordinates for rectangular
textures correctly.
2013-05-28 18:13:06 +02:00
Fredrik Höglund d4aacd678e kwin: Add more accessors in WindowVertex
Reorder some of the methods and add new u() and v() accessors,
which are aliases of textureX() and textureY().
2013-05-28 16:35:37 +02:00
Martin Gräßlin 49e734f743 Change the way how effects can get mouse events
With the removal of BoxSwitch all effects which want mouse events use the
fullscreen input window. The available functionality is too complex both
in EffectsHandler and in the Effects.

With this change only fullscreen input windows are supported and all
effects share the input window. This means there is at maximum one input
window. This simplifies the code in the Effects as they don't have to
keep track of the window they created any more. In EffectsHandler it
means that only one window needs to be created, destroyed and raised.
Also it means that we can properly react on screen size changes which had
been ignored in the past. Also quite some roundtrips to X are no longer
needed as we do not need to query the window geometry when creating the
input window.

REVIEW: 110156
2013-05-03 08:15:42 +02:00
Martin Gräßlin 1a3bc3f60c Split Outline in a composited and non-composited part
The non-composited part handles the showWithX case with the four small
windows. The composited part shows a translucent QWidget with the
FrameSvg as done by the selection effect frame.

Outline connects to the Compositor toggled signal to switch the mode if
compositing gets suspended/resumed. This works fine also in the case that
the switch happens while the outline is shown. To support this Outline
is now a QObject and created with Workspace as a parent.

Given that the Outline handles both cases by itself, the outline effect
is no longer needed and is dropped together with all the hooks into the
effect system.
2013-04-25 09:04:02 +02:00
Thomas Lübking ee1d6d568d add effect debug interface and dbus export
allows for effect specific debugging details

REVIEW: 107063
2013-03-28 20:31:02 +01:00
Martin Gräßlin 32b6ef42b9 Strip module path from all Qt #include <>
Done with:
fixqt4headers.pl --strip-modules

REVIEW: 109176
2013-03-06 10:26:56 +01:00
Martin Gräßlin b01f5684c5 Remove not needed includes from kwineffect header files
Only include what's actually needed in the headers. This causes of course
some additional needed includes in some implementation files.
2013-03-06 10:23:09 +01:00
Thomas Lübking 39499de9cc add AnimationEffect::set() and ::cancel()
This will allow to sue the AnimationEffect class for
(temorarily) persistent changes like required by the
translucency effect

REVIEW: 109211
2013-03-05 19:24:30 +01:00
Martin Gräßlin c3423b15e7 Add method to EffectsHandler to define the cursor for an input window
Convenience method to replace XDefineCursor used in the effects.

REVIEW: 109039
2013-02-25 13:35:19 +01:00
Martin Gräßlin 4cb4697029 Increase KWIN_EFFECT_API_VERSION_MINOR
ABI change in new screen edge implementation
2013-02-07 11:43:40 +01:00
Martin Gräßlin 10c07080bb Notify effects when the screen gets locked
EffectsHandlerImpl starts to monitor DBus for the screen being locked and
provides this information to the Effect system by allowing them to ask
whether the screen is currently locked and by emitting a signal when the
screen gets locked/unlocked.

This information is needed to ensure that no private data is shown on the
screen. The following effects are adjusted:
* taskbar thumbnails
* thumbnail aside
* mouse mark
* screen shot

BUG: 255712
FIXED-IN: 4.11
REVIEW: 108670
2013-02-07 10:23:30 +01:00
Martin Gräßlin 9bab40d995 Notifications when approaching a screen edge
For each edge an additional "approach" area window is created. When the
mouse enters this approach window, it gets unmapped and a mouse polling
interval is started. If the mouse leaves the approach area again, the
window gets mapped again and the mouse polling is stopped.

During the approaching a signal is emitted with a factor in [0.0,1.0] to
describe how close the mouse is to the edge. 0.0 means far away, 1.0
means triggering the edge. This signal is passed to the effects to allow
using this information. E.g. to provide a glow corner effect or to make
use of it in the cube animation effect to start the animation on desktop
switch.
2013-02-07 09:48:09 +01:00
Martin Gräßlin 7a7f9d1a34 Change the way how screen edges interact with Effects/Scripts
The main difference is that the activation of an edge is no longer
broadcasted to all effects and scripts, but instead a passed in slot of
the Effect/Script is invoked.

For this the EffectsHandler API is changed to take the Effect as an
argument to (un)reserveElectricBorder. As callback slot the existing
borderActivated is used.

In addition the ScreenEdge monitors the object for beeing destroyed and
unregisters the the edge automatically. This removes the need from the
Effect to call unregister in the dtor.

BUG: 309695
FIXED-IN: 4.11
2013-02-07 09:46:52 +01:00
Martin Gräßlin e47fdf5caa Remove unused screen edge related methods from kwineffects interface
No effect has ever used these methods and there is no reason why an
effect should use them. Reserve/unreserve is sufficient as the effect
will be notified anyway.
2013-02-07 09:46:51 +01:00
Thomas Lübking c158507a66 signal change of stacking order to the effects
REVIEW: 108059
2013-02-05 19:15:39 +01:00