Commit graph

418 commits

Author SHA1 Message Date
Martin Gräßlin
f9dfb11144 [kwin] Drop EffectsHandlerImpl::displayWidth and EffectsHandlerImpl::displayHeight
Unused code.
2014-02-27 12:02:51 +01:00
Martin Gräßlin
29af52fbf1 Keep KWin responsive while loading all effects
Loading all effects during startup can take some time[1] and during
that time the screen is frozen as the loading blocks the compositor.

This change doesn't load effects directly but puts them into a queue.
The loading is controlled by invoking the dequeue through a queued
connection. Thus we get a firing compositing timer in between and can
ensure that a frame is rendered when needed and also react to X events
during the loading.

[1] On my high-end system the set of effects I use take about 200 msec
    to load.

REVIEW: 115297
2014-01-28 07:41:57 +01:00
Martin Gräßlin
76efe517a7 Turn built-in effects into a library kwin links against
As all effects have always been compiled into the same .so file it's
questionable whether resolving the effects through a library is useful
at all. By linking against the built-in effects we gain the following
advantages:
* don't have to load/unload the KLibrary
* don't have to resolve the create, supported and enabled functions
* no version check required
* no dependency resolving (effects don't use it)
* remove the KWIN_EFFECT macros from the effects

All the effects are now registered in an effects_builtins file which
maps the name to a factory method and supported or enabled by default
methods.

During loading the effects we first check whether there is a built-in
effect by the given name and make a shortcut to create it through that.
If that's not possible the normal plugin loading is used.

Completely unscientific testing [1] showed an improvement of almost 10
msec during loading all the effects I use.

[1] QElapsedTimer around the loading code, start kwin five times, take
average.

REVIEW: 115073
2014-01-24 14:13:59 +01:00
Martin Gräßlin
3c30b43fe9 Merge branch 'KDE/4.11'
Conflicts:
	kcontrol/randr/krandrtray.desktop
	kcontrol/randr/module/randrmonitor.desktop
	kcontrol/randr/randr.desktop
	kcontrol/screensaver/screensaver.desktop
	kcontrol/smartcard/smartcard.desktop
	kcontrol/workspaceoptions/workspaceoptions.desktop
	kdm/kcm/background/patterns/fish.desktop
	kdm/kcm/background/patterns/night-rock.desktop
	kdm/kcm/background/patterns/pavement.desktop
	kdm/kcm/background/patterns/rattan.desktop
	kdm/kcm/background/patterns/stonewall2.desktop
	kdm/kcm/background/programs/xearth.desktop
	kdm/kcm/background/programs/xglobe.desktop
	kdm/kcm/background/programs/xplanet.desktop
	kdm/kcm/kcmkdm_actions.actions
	kdm/kcm/kdm.desktop
	kdm/kfrontend/pics/stripes.png.desktop
	kdm/kfrontend/sessions/9wm.desktop
	kdm/kfrontend/sessions/aewm++.desktop
	kdm/kfrontend/sessions/aewm.desktop
	kdm/kfrontend/sessions/afterstep.desktop
	kdm/kfrontend/sessions/amaterus.desktop
	kdm/kfrontend/sessions/amiwm.desktop
	kdm/kfrontend/sessions/asclassic.desktop
	kdm/kfrontend/sessions/awesome.desktop
	kdm/kfrontend/sessions/blackbox.desktop
	kdm/kfrontend/sessions/cde.desktop
	kdm/kfrontend/sessions/ctwm.desktop
	kdm/kfrontend/sessions/cwwm.desktop
	kdm/kfrontend/sessions/e16.desktop
	kdm/kfrontend/sessions/enlightenment.desktop
	kdm/kfrontend/sessions/evilwm.desktop
	kdm/kfrontend/sessions/fluxbox.desktop
	kdm/kfrontend/sessions/flwm.desktop
	kdm/kfrontend/sessions/fvwm.desktop
	kdm/kfrontend/sessions/fvwm95.desktop
	kdm/kfrontend/sessions/gnome.desktop
	kdm/kfrontend/sessions/golem.desktop
	kdm/kfrontend/sessions/icewm.desktop
	kdm/kfrontend/sessions/ion.desktop
	kdm/kfrontend/sessions/kde-plasma-safe.desktop.cmake
	kdm/kfrontend/sessions/kde-plasma.desktop.cmake
	kdm/kfrontend/sessions/larswm.desktop
	kdm/kfrontend/sessions/lwm.desktop
	kdm/kfrontend/sessions/lxde.desktop
	kdm/kfrontend/sessions/matchbox.desktop
	kdm/kfrontend/sessions/metacity.desktop
	kdm/kfrontend/sessions/mwm.desktop
	kdm/kfrontend/sessions/olvwm.desktop
	kdm/kfrontend/sessions/olwm.desktop
	kdm/kfrontend/sessions/openbox.desktop
	kdm/kfrontend/sessions/oroborus.desktop
	kdm/kfrontend/sessions/phluid.desktop
	kdm/kfrontend/sessions/pwm.desktop
	kdm/kfrontend/sessions/qvwm.desktop
	kdm/kfrontend/sessions/ratpoison.desktop
	kdm/kfrontend/sessions/sapphire.desktop
	kdm/kfrontend/sessions/sawfish.desktop
	kdm/kfrontend/sessions/twm.desktop
	kdm/kfrontend/sessions/ude.desktop
	kdm/kfrontend/sessions/vtwm.desktop
	kdm/kfrontend/sessions/w9wm.desktop
	kdm/kfrontend/sessions/waimea.desktop
	kdm/kfrontend/sessions/wm2.desktop
	kdm/kfrontend/sessions/wmaker.desktop
	kdm/kfrontend/sessions/xfce.desktop
	kdm/kfrontend/sessions/xfce4.desktop
	kdm/kfrontend/themes/circles/KdmGreeterTheme.desktop
	kdm/kfrontend/themes/elarun/KdmGreeterTheme.desktop
	kscreensaver/kblank_screensaver/kblank.desktop
	kscreensaver/krandom_screensaver/krandom.desktop
	kscreensaver/libkscreensaver/screensaver.desktop
	kwin/kcmkwin/kwincompositing/kwincompositing.desktop
	kwin/tabbox/qml/clients/text/metadata.desktop
	kwin/tabbox/qml/clients/window_strip/metadata.desktop
	libs/kephal/service/kephal.desktop
	libs/plasmagenericshell/widgetsexplorer/package/metadata.desktop
	plasma/desktop/applets/kickoff/simpleapplet/plasma-applet-simplelauncher.desktop
	plasma/desktop/applets/pager/package/metadata.desktop
	plasma/desktop/applets/pager/plasma-pager-default.desktop
	plasma/desktop/applets/tasks/plasma-tasks-default.desktop
	plasma/desktop/applets/trash/plasma-applet-trash.desktop
	plasma/desktop/applets/window-list/metadata.desktop
	plasma/desktop/containments/desktop/package/metadata.desktop
	plasma/desktop/containments/panel/plasma-containment-panel.desktop
	plasma/desktop/shell/activitymanager/package/metadata.desktop
	plasma/desktop/shell/data/layouts/org.kde.plasma-desktop.SaL/metadata.desktop
	plasma/desktop/shell/data/layouts/org.kde.plasma-desktop.findWidgets/metadata.desktop
	plasma/desktop/shell/data/layouts/org.kde.plasma-desktop.photoActivity/metadata.desktop
	plasma/desktop/shell/data/plasma-desktop.desktop
	plasma/desktop/shell/data/plasma-desktop.notifyrc
	plasma/desktop/toolboxes/plasma-toolbox-desktoptoolbox.desktop
	plasma/generic/animators/default/plasma-animator-default.desktop
	plasma/generic/applets/batterymonitor/metadata.desktop
	plasma/generic/applets/calendar/plasma-applet-calendar.desktop
	plasma/generic/applets/systemtray/package/contents/ui/IconsList.qml
	plasma/generic/applets/systemtray/package/contents/ui/StatusNotifierItem.qml
	plasma/generic/applets/systemtray/package/contents/ui/main.qml
	plasma/generic/dataengines/metadata/plasma-engine-metadata.desktop
	plasma/generic/dataengines/nowplaying/plasma-dataengine-nowplaying.desktop
	plasma/generic/runners/nepomuksearch/plasma-runner-nepomuksearch.desktop
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
	plasma/netbook/applets/currentappcontrol/plasma-applet-currentappcontrol.desktop
	plasma/netbook/applets/searchbox/plasma-applet-searchbox.desktop
	plasma/netbook/containments/netpanel/plasma-containment-netpanel.desktop
	plasma/netbook/containments/sal/plasma-containment-sal.desktop
	plasma/netbook/containments/sal/plasma-sal-menu.desktop
	plasma/netbook/containments/sal/services/plasma-sal-bookmarks.desktop
	plasma/netbook/containments/sal/services/plasma-sal-contacts.desktop
	plasma/netbook/containments/sal/services/plasma-sal-development.desktop
	plasma/netbook/containments/sal/services/plasma-sal-games.desktop
	plasma/netbook/containments/sal/services/plasma-sal-graphics.desktop
	plasma/netbook/containments/sal/services/plasma-sal-internet.desktop
	plasma/netbook/containments/sal/services/plasma-sal-multimedia.desktop
	plasma/netbook/containments/sal/services/plasma-sal-office.desktop
	plasma/netbook/containments/sal/services/plasma-sal-system.desktop
	plasma/netbook/containments/sal/services/plasma-sal-utility.desktop
	plasma/netbook/dataengines/searchlaunch/plasma-engine-searchlaunch.desktop
	plasma/netbook/desktoptheme/air-netbook/metadata.desktop
	plasma/netbook/shell/data/layouts/org.kde.plasma-netbook.defaultPage/metadata.desktop
	plasma/netbook/shell/data/layouts/org.kde.plasma-netbook.defaultPanel/metadata.desktop
	plasma/netbook/shell/data/layouts/org.kde.plasma-netbook.defaultSal/metadata.desktop
	plasma/netbook/shell/data/layouts/plasma-layout-org.kde.plasma-netbook.defaultPage.desktop
	plasma/netbook/shell/data/layouts/plasma-layout-org.kde.plasma-netbook.defaultPanel.desktop
	plasma/netbook/shell/data/layouts/plasma-layout-org.kde.plasma-netbook.defaultSal.desktop
	plasma/netbook/shell/nettoolbox/plasma-toolbox-nettoolbox.desktop
2014-01-22 14:24:02 +01:00
Martin Gräßlin
91c420ada0 [kwin] Fix possible crash in desktopPresenceChanged
It's possible that the Client does not have an effect window when
the desktop presence changes. This results in a crash.

Unit test which triggered the crash on
https://git.reviewboard.kde.org/r/115190/

REVIEW: 115214
2014-01-22 14:17:48 +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 Klapetek
81f563d610 Fix an assert on KWin shutdown
Reviewed-by: Martin Gräßlin
2014-01-12 23:04:06 +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
Martin Gräßlin
5d3d8834ab Pass creation of Scene::EffectFrame to the Scene
Instead of having the EffectFrameImpl check the compositor type and do
the decision which Scene::EffectFrame to create, a pure virtual method
in Scene is called which returns the specific Scene::EffectFrame.
2014-01-07 15:34:19 +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
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
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
0ad6811684 [kwin] Fix crash in tear-down of EffectsHandlerImpl
Adding a simplified logic to unload all effects directly in the
dtor. Looks like Qt didn't like our double traversal over the list
any more and was causing double deletions.
2013-11-13 10:03:58 +01:00
Martin Gräßlin
be3a0cf4ca Fix reading of window properties from effects
That's what you get for changing code you cannot properly test. The
calculation was completely messed up. Now reads the correct byte size
for the byte array. In addition the usages in the effects are improved
to cast the data into the proper uint32_t values instead of the more
generic long. After all if the format is 32, the length is 32 and not
a long.
2013-09-25 09:12:31 +02:00
Martin Gräßlin
cf6d6e0515 Re-enable threaded query for effects
KConfig should be thread safe in KF5.
2013-09-24 14:32:21 +02:00
Martin Gräßlin
cebb4b86b5 Use new for-loop instead of foreach in kwin/effects.cpp
kdevelop was causing parsing errors, so I had to do it ;-)
2013-09-24 14:31:35 +02:00
Martin Gräßlin
969e6b85e7 Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/client.cpp
	kwin/effects/highlightwindow/highlightwindow.cpp
	kwin/libkwineffects/kwingltexture.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/scene_opengl.cpp
	kwin/workspace.cpp
	plasma/desktop/applets/kickoff/CMakeLists.txt
	plasma/desktop/applets/taskmanager/package/contents/code/tools.js
	plasma/desktop/applets/taskmanager/package/contents/ui/Task.qml
	plasma/desktop/applets/taskmanager/package/contents/ui/main.qml
	plasma/desktop/applets/taskmanager/package/metadata.desktop
	plasma/desktop/applets/taskmanager/plugin/textlabel.h
	plasma/desktop/applets/tasks/CMakeLists.txt
	plasma/desktop/applets/tasks/package/metadata.desktop
	plasma/desktop/applets/tasks/tasks.cpp
	plasma/desktop/toolboxes/plasma-toolbox-desktoptoolbox.desktop
	plasma/generic/applets/activitybar/activitybar.cpp
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-09-24 11:28:38 +02:00
Martin Gräßlin
5cf871d827 Port readWindowProperty in effects.cpp to XCB 2013-09-11 08:38:10 +02:00
Martin Gräßlin
592ea89b01 Port all remaining XDeleteProperty calls to XCB 2013-09-10 15:30:10 +02:00
Thomas Lübking
0dcdcf48eb copy and paste timebomb
bug as old as kwin compositing ....
BUG: 323688
FIXED-IN: 4.11.2
REVIEW: 112436
2013-09-08 23:43:45 +02:00
Martin Gräßlin
139201a2e2 KGlobal::config() -> KSharedConfig::openConfig()
KWin Core says good bye to KGlobal. We will not miss the threading
issues.
2013-09-04 16:11:40 +02:00
Martin Gräßlin
57905c0cc2 And we got rid of KDebug
Usages of kBacktrace got dropped.
2013-09-02 13:14:39 +02:00
Anselmo L. S. Melo
bef5b71898 Porting effects to Qt5/KF5: QStandardPaths
REVIEW: 111977
2013-08-13 17:56:04 -03: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
c47702294a Fix incorrect button press event processing in checkInputWindowEvent
Incorrect porting by merging ButtonPress and ButtonRelease into one
function.

This fixes the broken mouse button event handling in e.g. DesktopGrid
effect.
2013-08-06 12:19:20 +02:00
Martin Gräßlin
36429c0010 Fix loading of scripted effects
Port to QStandardPaths was incorrect - well it was a guess which I
couldn't test...
2013-08-01 08:04:31 +02:00
Martin Gräßlin
485f0a3e06 Process mouse events
Button Press/Release do no longer fall through to motion notify as
there is no shared mouse event in xcb. Also the methods in Effects and
TabBox are adjusted to process only button press/release or motion
notify.

ScreenEdges are no longer checked for button press/release. They don't
interact on button press/release so there is no need to check it.
2013-07-29 08:58:05 +02:00
Martin Gräßlin
1e0600bbc7 Port to new KDesktopFile constructor
I do not know whether that's the correct new way to locate the desktop
file for our service.
2013-07-24 09:58:41 +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
Martin Gräßlin
11dd05425e Plasma::Theme does no longer provide a global static theme
Need to hold a pointer instead.
2013-07-24 09:47:02 +02:00
Martin Gräßlin
93e2ce4bfd Use QVector instead of QList for the list of active effects
We only append to the list, so the advantage of insertion into QList
does not matter.

Thanks to Milian Wolff to point this out in his Akademy talk [1] and for
pointing me to Marc Mutz blog post [2] discussing this topic and
recommending the usage of QVector over QList.

[1] http://milianw.de/files/apps-on-speed-akademy2013/index.html
[2] http://marcmutz.wordpress.com/effective-qt/containers/

REVIEW: 111597
2013-07-19 16:03:50 +02:00
Martin Gräßlin
13ad458cca Use const_iterators for our Effect iterators
We never modify the list, so we don't need the mutuable iterator. This
ensures that the data doesn't get detached.
2013-07-19 16:03:50 +02:00
Thomas Lübking
5cf328fbec ensure to not add NULL effect windows to stacking
happens during threaded startup and crashes in blur effect
when initially enabled

REVIEW: 111360
2013-07-08 18:53:37 +02:00
Thomas Lübking
3b285ba572 don't query effects threaded
calls sycoca/kconfiggroup...

BUG: 321576
FIXED-IN: 4.11
REVIEW: 111374
2013-07-08 18:53:36 +02:00
Thomas Lübking
a3d502338d delay adding Unmanaged clients by 50ms
This provides some sort of synthetic XSYNC support
for unmanaged clients and allows them to do an initial
update after mapping and before being painted (prevent
flicker)
Also it helps with Unmanaged clients performing quick
map/unmap/map cycles what also seems to induce the black
window issue on the nvidia blob.

CCBUG: 284888
BUG: 319184
FIXED-IN: 4.11
REVIEW: 111292
2013-07-01 21:19:54 +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
b501e07b21 Fix typo: ScopedCPointer instead of QScopedPointer
BUG: 321470
2013-06-21 18:45:19 +02:00
Thomas Lübking
b8439145bd always defer delete of Deleted to next event cycle
BUG: 317765
FIXED-IN: 4.11
REVIEW: 110756
2013-06-05 14:10:59 +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
Martin Gräßlin
a4ec610d23 Copy modal state and mainWindows from Client to Deleted
Otherwise it's not possible to access them in the windowClosed handler.
That the dialog parent effect worked at all was pure chance.
2013-06-04 17:17:08 +02:00
Thomas Lübking
7efc42774f delay withdraw of support props
The CM selecton withdraw delay was introduced to mostly unburden
plasma from recreating the theme on temporary changes, but since
plasma also watches some properties hinting supported features
and acts in consequence, this isn't sufficient and actually causes
two theme changes instead of one in the case of a regular suspend

REVIEW: 110232
CCBUG: 179042
2013-05-15 22:18:29 +02:00
Montel Laurent
dd8cf0b678 normalize signal/slot 2013-05-11 14:09:15 +02:00
Martin Gräßlin
4022de7075 Use signal/slots instead of deep function calls into decoration
For all the decoration updates called from Client into the decoration we
also have a signal being emitted. So turning the pure virtual public
functions into slots means we can just connect our existing signals and
get rid off the deep function calls.

The keepAbove/Below signals are changed to take a boolean argument as
needed by KDecoration and a few emitted signals are moved to a better
fitting location.

REVIEW: 110335
2013-05-07 16:53:58 +02:00
Thomas Lübking
1abff98c07 clear m_activeEffects when effects change
If a screen with different refreshrate is attached, kwin currently resets
the compositor, altering the effect list.
If at the same time quads are rebuilt, the iteration operates on a pot.
invalid list of dangeling active effects.

Many thanks to Toralf Förster for his testing efforts.

BUG: 308201
FIXED-IN: 4.10.3
REVIEW: 110294
CC: release-team@kde.org
(cherry picked from commit 07d3ac9d8c781755d19c71ccde6d182868a2bfb5)
2013-05-04 11:56:28 +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
2e758ed6a7 Add an elevate() method to Toplevel
Shortcut to set an elevated window without the need to check whether
effects pointer is valid and retrieving EffectWindow etc.

REVIEW: 110147
2013-04-25 09:08:27 +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
Martin Gräßlin
466bef3a6d Adding a DesktopThumbnailItem declarative item
Similar to WindowThumbnailItem for rendering a desktop thumbnail.
Uses the new paintDesktop hook.

FEATURE: 296067
FIXED-IN: 4.11.0
REVIEW: 104441
2013-04-24 11:45:47 +02:00
Martin Gräßlin
ae7be07d0f Effects Hook to paint a desktop
A specialised paintScreen method to render all windows of one
desktop. It's intended to be called during an already started
paintScreen process to get e.g. a thumbnail of a desktop.

Currently not yet exported to the Effects.
2013-04-24 11:43:23 +02:00
Martin Gräßlin
8037e6529c Rename ThumbnailItem to WindowThumbnailItem
This is for discrimination from the to be added DesktopThumbnailItem.
The name for QML is unchanged to keep the public API stable.
2013-04-24 11:43:22 +02:00
Martin Gräßlin
db91db3a4f Refactoring: break out a base class for ThumbnailItem
Everything that has nothing to do with rendering the window thumbnail
goes into an AbstractThumbnailItem.

This is a preparation step for adding a DesktopThumbnailItem.
2013-04-24 11:43:22 +02:00
Martin Gräßlin
edb074cbc2 Split out screen handling from Workspace into own class Screens
Following the approaches of other split out functionality Screens is a
singleton class created by Workspace.

The class takes over the responsibility for:
* screenChanged signal delayed by timer
* number of screens
* geometry of given screen
* active screen
* config option for active screen follows mouse

The class contains a small abstraction layer and has a concrete subclass
wrapping around QDesktopWidget, but the idea is to go more low level and
interact with XRandR directly to get more detailed information.

All over KWin the usage from QDesktopWidget is ported over to the new
Screens class.

REVIEW: 109839
2013-04-15 10:25:10 +02:00
Martin Gräßlin
265b5523e2 Move decoration related methods from Workspace to DecorationPlugin
They were all just delegating to the DecorationPlugin.
2013-04-15 09:59:09 +02:00
Martin Gräßlin
d503d9ffb6 Turn TabBox into a proper singleton
There is only one instance hold by Workspace which means it should follow
the common approach with ::self and ::create.

The hasTabBox is completely removed as it's rather useless and the same
as the ifdef around the usages any way.

REVIEW: 109851
2013-04-11 14:18:30 +02:00
Martin Gräßlin
da85b5fdc7 Split out Activities related code from Workspace
All activities related code moves into new singleton class Activities.
This class gets only included into the build if the build option is
enabled which means there are less ifdefs all over the code and it also
handles better the moc doesn't like ifdef case.

The class holds the list of open and all activites, the current and the
previous activity and the KActivities::Controller. It also emits the
signals for any activities related changes.

Workspace still contains some activities related code. That is the
adjustment on change of current activity. Nevertheless the code looks
much cleaner now and does not contain the confusing naming conflict with
takeActivity() which existed before.

In all the places where Activities got used the code got adjusted and
quite often the ifdef got added with a fallback for the disabled case.
2013-04-11 13:01:36 +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
1468c1ed51 Fix includes in effects.cpp
Used "kfoo.h" instead of <KDE/KFoo>
2013-03-07 13:59:16 +01:00
Martin Gräßlin
0ccc060218 Include KGlobal were needed
With KF5 some includes which used to include KGlobal, e.g. KStandardDirs
do no longer include KGlobal. So if we use KGlobal we should include it.
2013-03-07 13:59:15 +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
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
f12cf0efba Replacement class for QCursor
With Qt5 QCursor does no longer provide ::handle() which was used to
set a cursor on a native XWindow for which we do not have a QWidget.

Also KWin has had for quite some time an optimized version to get the
cursor position without doing XQueryPointer each time ::pos() is called.

These two features are merged into a new class Cursor providing more or
less the same API as QCursor.

In addition the new class provides a facility to perform mouse polling
replacing the implementations in Compositor and ScreenEdges.

For more information about the new class see the documentation for the
new class in cursor.h.
2013-02-25 13:35:14 +01:00
Martin Gräßlin
8efe111162 Fix compile error with building screenedges disabled 2013-02-22 12:37:12 +01:00
Thomas Lübking
004bdee7a2 do not try to raise possible panel proxies
but drop screenedges below the supportWindow instead
that's why it exists, that's deterministic, that's faster

includes adaption to new screenedge and xcb invocation (compared to 4.10)

BUG: 314625
FIXED-IN: 4.10.1
REVIEW: 108867
2013-02-12 21:58:46 +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
beb00478e1 Only start animating in cube slide on window move if core uses switch desktop on edge
For this new KWinOptions are exposed to query whether core uses switch on
desktop on move or always.

BUG: 299901
FIXED-IN: 4.11
REVIEW: 108671
2013-02-07 10:10:25 +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
a8539ff54e Turn ScreenEdges into a Singleton
In fact it already used to be a Singleton as there is just one object
hold by the Singleton Workspace. So let's make it a proper Singleton
following our kind of standard approach of having a ::create factory
method called from Workspace ctor and a ::self to get to the singleton
instance.
2013-02-07 09:46:52 +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
d9aedf620b Rewrite of KWin's Screen Edge Handling
This rewrite is mostly motivated by the need to handle multi screen
setups correctly. That is have edges per screen and not for the combined
geometry. Also porting from XLib to XCB has been a motivation for the
rewrite.

The design of the new ScreenEdge handling is described in the
documentation of ScreenEdges in screenedge.h.

In addition the following changes have been performed:
* move configuration from Options to ScreenEdge
* add screen edge information to Workspace::supportInformation (obviously
  replaces what had been read from Options)
* have Workspace hold a pointer to ScreenEdges instead of an object
* forward declaration of ScreenEdges in workspaces.h, this explains the
  seemingly unrelated changes of just another include in some files

BUG: 290887
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
Martin Gräßlin
2d4b67d361 Do not use a shared pointer for the Xcb::Wrapper
It's not really needed, the required functionality can be achieved in a
more implicit way. The reply pointer is managed by the Wrapper class as
long as the method take() is not invoked. This method follows the
semantics of QScopedPointer::take(). That is the pointer is set to null
and the responsibility to free the pointer is passed to the callee.

By this change we do not have the overhead of creating a QSharedPointer.

In addition the Wrapper provides a copy ctor and assignment operator also
using the semantics of take().
2013-01-25 08:51:38 +01:00
Martin Gräßlin
fa3fa8c3ca Port Input Window handling for Effects to XCB
REVIEW: 107817
2013-01-07 10:00:43 +01:00
Martin Gräßlin
565b4ed6a3 Common way to announce support for specific effects through X11
Instead of each effect, which needs to announce support, having custom
code to create a property and set it on the root window, there is now a
common API in EffectsHandler to take care of this.

The methods takes care of creating the atom if it has not already done
and set the property on the root window. Furthermore it allows multiple
effects to announce the same property without getting in conflict with
each other.

As a further convenience the property is automatically removed when the
effect is unloaded, so less things an effect author has to care about.

REVIEW: 107815
2013-01-07 10:00:01 +01:00
Martin Gräßlin
334b4bf622 Move handling of Virtual Desktops into a VirtualDesktopManager
The ownership for virtual desktops is moved from Workspace into a new
VirtualDesktopManager. The manager is responsible for providing the count
of virtual desktops and keeping track of the currently used virtual
desktop.

All methods related to moving between desktops are also moved from
Workspace to the new manager, though all methods related to Clients on
Virtual Desktops remain in Workspace for the time being. This is to have
the new manager as independent from KWin core as possible.

An rather important change for the handling of virtual desktops is that
the count and the id of a desktop is now an unsinged integer instead of
an integer. The reason for that is that we cannot have a negative count
of desktops as well as it is not possible to be on a desktop with a
negative identifier.

In that regard it is important to remember that a Client can be on a
desktop with a negative identifier. The special value for a Client being
on all desktops is handled by using -1 as a desktop. For the time being
this is not adjusted but instead of comparing the virtual desktop ids one
should prefer to use the convenient methods like isOnDesktop and
isOnAllDesktops. This would allow in future to internally change the
representation for on all desktops.
2013-01-07 09:47:51 +01:00
Thomas Lübking
b301c357d5 disconnect all client signals when it's closed
the client can still live on and emit stuff, but the
compositing has been fininshed for it, so the effect window is NULL

BUG: 310142
FIXED-IN: 4.10
REVIEW: 108008
2013-01-02 19:05:10 +01:00
Fredrik Höglund
5f220bef2e Revert "delay unsynced window ready_for_painting state"
The next commit will solve this problem in a different way.

This reverts commit e617f176d1e293abcaafbb14d0afcf8aee24f054.
2012-11-07 22:16:49 +01:00
Martin Gräßlin
6d2dfe06e7 Introduce dedicated OpenGL1 and OpenGL2 compositing types
The CompositingType enum turns into flags and two new values are
introduced: OpenGL1Compositing and OpenGL2Compositing.

Those new values are or-ed to OpenGLCompositing so that a simple check
for the flag OpenGLCompositing works in case of one of those two new
values. To make the generic check for OpenGL compositing easier a method
in EffectsHandler is introduced to just check for this.

The scenes now return either OpenGL1Compositing or OpenGL2Compositing
depending on which Scene implementation. None returns OpenGLCompositing.
2012-09-29 15:33:57 +02:00
Ni Hui
720f9239cc fix build without scripting 2012-09-23 13:23:41 +08:00
Martin Gräßlin
6152cc4fa5 Split out the windowing system related part of SceneOpenGL
The handling for creating and managing the OpenGL context is
split out of the SceneOpenGL into the abstract OpenGLBackend
and it's two subclasses GlxBackend and EglOnXBackend.

The backends take care of creating the OpenGL context on the
windowing system, e.g. on glx an OpenGL context on the overlay
window is created and in the egl case an EGL context is created.
This means that the SceneOpenGL itself does not have to care
about the specific underlying infrastructure.

Furthermore the backend provides the Textures for the specific
texture from pixmap operations. For that in each of the backend
files an additional subclass of the TexturePrivate is defined.
These subclasses hold the EglImage and GLXPixmap respectively.

The backend is able to create such a private texture and for
that the ctor of the Texture is changed to take the backend as
a parameter and the Scene provides a factory method for
creating Textures. To make this work inside Window the Textures
are now hold as pointers which seems a better choice anyway as
to the member functions pointers are passed.
2012-09-16 21:28:05 +02:00
Martin Gräßlin
35237aadcb Splitting up of KWin's global D-Bus interface
Two new interfaces are introduced:
* org.kde.kwin.Compositing
* org.kde.kwin.Effects

The Compositing interface is generated from scriptable elements on the
KWin::Compositor class and the Compositor is exported as /Compositor.
It provides the general Compositing related D-Bus methods like whether
the compositor is active and toggling and so on.

The Effects interface is generated from scriptable elements on the
KWin::EffectsHandlerImpl class and the instance is exported as /Effects.
It provides all the effects related D-Bus methods like loading an effect
or the list of all effects.

This removes the need to have all these methods provided on the global
org.kde.KWin interface. For backwards compatibility they are kept, but
no longer provided by the Workspace class. Instead a new DBusInterface
is generated which wrapps the calls and delegates it to one of our three
related Singleton objects:
* Workspace
* Compositor
* EffectsHandlerImpl
2012-09-06 09:58:12 +02:00
Thomas Lübking
976037717b delay unsynced window ready_for_painting state
by at max 50ms (and thus trigger a full repaint with the state change)

BUG: 295254
REVIEW: 106173
FIXED-IN: 4.9.1
2012-08-28 21:08:02 +02:00
Martin Gräßlin
8e5b2ae1aa Pass Compositor to EffectsHandlerImpl
Obsoletes the need to go through the Workspace object to get to
the Compositor.

TODO for future: make the Compositor being the parent object for
the EffectsHandlerImpl.

Closing Review and bug from this commit, which is the top most
of the patch series.

REVIEW: 106060
BUG: 299277
FIXED-IN: 4.10
2012-08-26 20:49:08 +02:00
Martin Gräßlin
62c4d449f5 Use signals'n'slots instead of deep function call into Compositor
For most actions where the compositor needs to perform an action
(e.g. scheduling another repaint) signals were already emitted.
So it's easier to just connect the signals to the Compositor
which in turn makes the code much more readable.

All signals are connected from the Workspace when either the
Compositor gets constructed or a Toplevel gets created.
2012-08-26 20:44:46 +02:00
Martin Gräßlin
2d954a6bf3 Make the Scene owned by the Compositor
The Scene has always been created and destroyed inside what is
now the split out compositor. Which means it is actually owned
by the Compositor. The static pointer has never been needed
inside KWin core. Access to the Scene is not required for the
Window Manager. The only real usage is in the EffectsHandlerImpl
and in utils.h to provide a convenient way to figure out whether
compositing is currently active (scene != NULL).

The EffectsHandlerImpl gets also created by the Compositor after
the Scene is created and gets deleted just before the Scene gets
deleted. This allows to inject the Scene into the EffectsHandlerImpl
to resolve the static access in this class.

The convenient way to access the compositing() in utils.h had
to go. To provide the same feature the Compositor provides a
hasScene() access which has the same behavior as the old method.
In order to keep the code changes small in Workspace and Toplevel
a new method compositing() is defined which properly resolves
the state. A disadvantage is that this can no longer be inlined
and consists of several method calls and pointer checks.
2012-08-26 20:43:57 +02:00
Arthur Arlt
f3739469a2 Move Workspace's compositing functions to own class Compositor
All Workspace functions which were implemented in the file composite.cpp
were moved to an own class Compositor. The header entries were moved as well.
All functions calls are updated.
2012-08-26 20:43:56 +02:00
Martin Gräßlin
90365e27d0 Merge branch 'KDE/4.9'
Conflicts:
	khotkeys/data/kde32b1.khotkeys
	kinfocenter/Modules/opengl/opengl.desktop
	kwin/tabbox/tests/CMakeLists.txt
	plasma/generic/applets/system-monitor/plasma-applet-sm_hdd_activity.desktop
2012-08-17 17:59:49 +02:00
Martin Gräßlin
23f2de009b Effects can provide support information through properties
The supportInformation is extended to also read the properties
on all effects. In addition each effect can be queried just for
itself through D-Bus, e.g.:
qdbus org.kde.kwin /KWin supportInformationForEffect kwin4_effect_blur

All effects are extended to provide their configured and read
settings through properties. In some cases also important
runtime information is exposed.

REVIEW: 105977
BUG: 305338
FIXED-IN: 4.9.1
2012-08-17 17:49:49 +02:00
Thomas Lübking
7231694072 don't try to raise unmapped input windows
or screenedges over unmapped
causes race with kscreenlocker

BUG: 303579
REVIEW: 105585
FIXED-IN: 4.10
2012-07-22 10:57:29 +02:00
Thomas Lübking
6c4ef3ef35 re-use input window, prevent destryoing it
we cannot fix Qt DnD crashing on client destruction (eg. also occurs with toolptips)
but we can prevent it to happen with effects by just un/mapping the input window instead
of destroying and re-creating it

BUG: 179077
FIXED-IN: 4.10
REVIEW: 105339
2012-07-10 01:00:20 +02:00
Martin Gräßlin
30bb8be037 Add activity support to Workspace Script Wrapper and Effects
New properties for the current activity and the available
activities plus related signals in scripts. Signals added to
effects.

BUG: 302060
FIXED-IN: 4.9.0
2012-06-24 18:35:56 +02:00
Thomas Lübking
b6c84775ab HACK around bug 288791 - search for likely panel proxies and raise them after destroying an effect input window
BUG: 288791
REVIEW: 105245
FIXED-IN: 4.9
2012-06-18 22:11:06 +02:00
Thomas Lübking
601243e549 handle m_currentBuildQuadsIterator validation independent form painting pass
issue is that the effect chain may (will) change between two paint passes and buildQuads is called outside the paint pass
(shadows / decos whatever changes) so that the iterator may dangle

BUG: 299582
FIXED-IN: 4.9
REVIEW: 104881
2012-05-10 19:33:23 +02:00
Martin Gräßlin
f3443a6b07 Add CMake variable to rename kwin binaries
A CMake variable is used to specify the name of the binary.
By default this is "kwin" but building for PA changes the
name to "kwinactive". The variable adjusts all names, e.g.
kwinnvidiahack becomes kwinactivenvidiahack.

The remaining usage of kwinrc in core and libs is replaced
by a cmakedefine for the configuration name and all data
installations are moved to the defined name. Dynamic loading
for scripts & co is adjusted for loading based on defined name.

This change allows the side-by-side installation of both kwin
for desktop and kwin for Plasma Desktop without the known
issues like conflicts in config files or missing build options
if kwin desktop is used for Plasma Active.

Likewise the KCMs are not adjusted as they are not intended to
be used for kwinactive.

REVIEW: 104299
BUG: 296084
FIXED-IN: 4.9.0
CCMAIL: active@kde.org
2012-05-10 10:25:15 +02:00
Thomas Lübking
a332bf183b add desktopChanged signal to effects that carries the optionally changing widget
CCBUG: 213847
FIXED-IN: 4.9
2012-05-03 22:56:27 +02:00
Thomas Lübking
3a6095726e Only reserve required electric borders for ElectricAlways
CCBUG: 293011
REVIEW: 104073
2012-05-03 19:48:20 +02:00
Thomas Lübking
590d9b42d8 restrict animationeffect repaints
REVIEW: 103932
2012-05-03 17:52:49 +02:00
Martin Gräßlin
e3f2dd7612 Move KServiceTypeTrader query for Effects into a thread
By moving the query for effects into an own thread the
startup does not have to wait till all effects are loaded.
The thread moves the loading of the effects after the
Window Manager and Compositor has been fully initialized.
This is possible as EffectsHandler is fully functional even
without any effects.

The compositor ensures that at least one frame is rendered
before the started thread returns which makes the complete
startup more responsive.

REVIEW: 104583
2012-05-01 08:49:20 +02:00
Thomas Lübking
ab86f0e837 add screen inversion through XF86VidModeSetGammaRamp or XRRSetCrtcGamma
use opengl invert effect as fallback

REVIEW: 104371
2012-04-17 21:11:03 +02:00