Commit Graph

440 Commits (8d3b12b9280aa7a9b3954d9cbca2ccd229ca246e)

Author SHA1 Message Date
Martin Gräßlin aa7db138e8 Remove unused variables
Thanks to clang for better warnings than g++.
2014-04-04 13:55:57 +02:00
Martin Gräßlin ca5f8cfe03 [kwin] Remove unused config-workspace.h includes 2014-03-18 09:23:25 +01:00
Martin Gräßlin 92761e9e30 [kwin] Fix ifdefs for Wayland
With the switch to FindWayland from ECM WAYLAND_FOUND was no longer set
thus the ifdef didn't work. Now we use HAVE_WAYLAND and HAVE_WAYLAND_EGL.
2014-03-18 09:00:49 +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 2675b5d4e7 Merge branch 'KDE/4.11'
Conflicts:
	CMakeLists.txt
	kcontrol/screensaver/screensaver.desktop
	kdm/kfrontend/themes/elarun/KdmGreeterTheme.desktop
	khotkeys/kcm_hotkeys/kcm_hotkeys.cpp
	kinfocenter/main.cpp
	kscreensaver/kblank_screensaver/blankscrn.cpp
	kscreensaver/krandom_screensaver/random.cpp
	kstyles/oxygen/config/main.cpp
	kstyles/oxygen/demo/main.cpp
	ksysguard/gui/ksysguard.cpp
	kwin/clients/oxygen/demo/main.cpp
	kwin/kcmkwin/kwincompositing/kwincompositing.desktop
	kwin/tabbox/qml/clients/text/metadata.desktop
	kwin/tabbox/qml/clients/window_strip/metadata.desktop
	libs/plasmagenericshell/widgetsexplorer/package/metadata.desktop
	plasma/desktop/applets/pager/package/metadata.desktop
	plasma/desktop/shell/activitymanager/package/metadata.desktop
	plasma/desktop/shell/data/layouts/org.kde.plasma-desktop.defaultPanel/contents/layout.js
	plasma/desktop/shell/desktopcorona.cpp
	plasma/desktop/shell/main.cpp
	plasma/desktop/toolboxes/plasma-toolbox-desktoptoolbox.desktop
	plasma/desktop/toolboxes/plasma-toolbox-paneltoolbox.desktop
	plasma/generic/applets/batterymonitor/contents/ui/batterymonitor.qml
	plasma/generic/applets/systemtray/protocols/fdo/fdographicswidget.cpp
	plasma/generic/applets/systemtray/protocols/fdo/fdographicswidget.h
	plasma/generic/applets/systemtray/protocols/fdo/x11embeddelegate.cpp
	plasma/generic/runners/nepomuksearch/plasma-runner-nepomuksearch.desktop
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
	plasma/netbook/shell/nettoolbox/plasma-toolbox-nettoolbox.desktop
	statusnotifierwatcher/statusnotifierwatcher.cpp
	systemsettings/app/main.cpp
2014-03-10 21:21:16 +01:00
Martin Gräßlin c7d986c7fe [kwin] Remove the legacy OpenGL 1 compositing backend
KWin already has a de facto OpenGL 2 dependency through QML. Combined
with the fact that the OpenGL 1 backend is basically unmaintained and
also unused, it's better to remove it for the new major release.

This change includes:
 * Removal of cmake option KWIN_BUILD_OPENGL_1_COMPOSITING
 * Removal of KWIN_HAVE_OPENGL_1 compile option and all code
   ifdef'ed with it (partially removal of if-else constructs)
 * Removal of CompositingType::OpenGL1Compositing (flags are kept
   as a core flag should get introduced)
 * Driver recommendation for OpenGL1Compositing changed to XRender
   (should be evaluated whether the drivers can provide GL2)
 * Removal of configuration option "GLLegacy"
 * Removal of fooMatrix function in kwinglutils
 * Removal of ARBBlurShader
 * Removal of legacy code path in GLVertexBuffer
 * Removal of GLShaderManager::disable
 * if-blocks with ShaderManager::instance()->isValid() removed

REVIEW: 116042
2014-03-10 08:59:11 +01:00
Thomas Lübking e9a8ea24a6 fix frontbuffer copying swap preference
REVIEW: 115523
CCBUG: 330794
CCBUG: 322060
2014-02-24 20:11:31 +01:00
Martin Gräßlin 5b07d4c2a1 Merge branch 'KDE/4.11'
Conflicts:
	kwin/egl_wayland_backend.cpp
	kwin/eglonxbackend.cpp
	kwin/glxbackend.cpp
	kwin/scene_opengl.cpp
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2014-01-28 08:18:41 +01:00
James Jones 6acef12932 Don't call into GL without a context
After losing current from the EGL or GLX
context, calls to the GL or GLES functions
have undefined behavior.  Perform all
cleanup that may touch OpenGL and check for
GL errors before losing current from the
context.

REVIEW: 115311
2014-01-28 07:54:32 +01:00
Martin Gräßlin 1be3a7a9f0 Introduce a method shouldUseWaylandForCompositing() in KWin::Application
Returns true if the OperationMode requires KWin to composite to a
Wayland surface. This replaces the checks for the WaylandBackend or env
variable used so far in the construction of the Scene.
2014-01-09 15:16:42 +01:00
Martin Gräßlin b28effff23 A Scene doesn't need to use an X11 Overlay Window
Only the X based Scenes need an overlay window, so the Compositor doesn't
need to check for it in the Wayland case.

OverlayWindow is moved from OpenGLBackend to the sub classes which need
to provide it.
2014-01-08 09:22:40 +01:00
Martin Gräßlin c9779825d1 Support frame callback in Wayland backend
The egl wayland backend registers for the callback for a rendered frame.
This allows to throttle KWin's compositor so that we don't render frames
which wouldn't end up on the screen.

For this the Scene provides a method to query whether the last frame got
rendered. By default this returns true in all backends. The Egl Wayland
backend returns true or false depending on whether the callback for the
last frame was recieved.

In case the last frame has not been renderd when performCompositing is
tried to be called, the method returns just like in the case when the
overlay window is not visible. Once the frame callback has been recieved
performCompositing is invoked again.
2014-01-08 09:22:40 +01:00
Martin Gräßlin ef4c32f79a Move Scene::Window handling methods into base class
The pure virtual methods windowAdded, windowClosed, windowDeleted and
windowGeometryShapeChanged had identical implementations in both XRender
and OpenGL scene. They were accessing the hash with Scene::Windows which
is nowhere else used except for creating the stacking order in ::paint.

The implementations are moved to the base class, the only Scene specific
code is a pure virtual factory method to create the Scene window. This
already existed in SceneOpenGL to create either a SceneOpenGL1 or 2
window.

Also the hash of windows is a Scene private member now and the creation
of the stacking order is provided by a method, so that the Scene sub
classes do no longer need to access the stacking order at all.

REVIEW: 111207
2014-01-07 15:34:19 +01:00
Martin Gräßlin 1a0e586b9c Pass creation of Shadow sub class instance to Scene
Instead of having the Shadow factory method check the compositor type and
do the decision which Shadow sub class to create, a pure virtual method in
Scene is called which returns the specific Shadow sub class instance.
2014-01-07 15:34:19 +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 9b0c6ddef3 Drop pure virtual Scene::windowOpacityChanged slot
It's neither implemented in the XRender nor in the OpenGL Scene.
2014-01-07 15:34:19 +01:00
Martin Gräßlin afbc5222e1 Merge branch 'KDE/4.11' into master
Conflicts:
	CMakeLists.txt
	doc/kcontrol/screensaver/index.docbook
	kcontrol/krdb/krdb.cpp
	kscreensaver/kblank_screensaver/kblank.desktop
	kscreensaver/krandom_screensaver/krandom.desktop
	kscreensaver/libkscreensaver/main.cpp
	ksplash/ksplashqml/SplashApp.cpp
	kstyles/oxygen/config/main.cpp
	kstyles/oxygen/demo/main.cpp
	kstyles/oxygen/oxygenstylehelper.cpp
	kwin/clients/oxygen/config/oxygenexceptiondialog.cpp
	kwin/clients/oxygen/config/ui/oxygenconfigurationui.ui
	kwin/clients/oxygen/config/ui/oxygenexceptiondialog.ui
	kwin/clients/oxygen/demo/main.cpp
	kwin/clients/oxygen/oxygenconfigdata.kcfg
	kwin/egl_wayland_backend.cpp
	kwin/eglonxbackend.h
	kwin/glxbackend.cpp
	kwin/glxbackend.h
	kwin/kcmkwin/kwinoptions/kwinactions.desktop
	kwin/scene_opengl.cpp
	kwin/scene_opengl.h
	plasma/desktop/applets/pager/pager.cpp
	plasma/desktop/shell/activitymanager/activitymanager.cpp
	plasma/desktop/shell/activitymanager/activitymanager.h
	plasma/desktop/shell/controllerwindow.cpp
	plasma/desktop/shell/data/plasma-desktop.desktop
	plasma/generic/dataengines/geolocation/geolocation.cpp
	plasma/generic/dataengines/nowplaying/plasma-dataengine-nowplaying.desktop
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/image.cpp
	plasma/generic/wallpapers/image/image.h
2014-01-07 09:36:11 +01:00
Laurent Navet 88fc43beeb kwin : replace Q_FOREACH with for(a:b)
replace Q_FOREACH loops with newer for (a:b) notation

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>

REVIEW: 114222
2013-12-13 08:54:34 +01:00
Fredrik Höglund eeb309c149 kwin: Add support for EXT_buffer_age
This patch adds support for GLX_EXT_buffer_age, and
EGL_EXT_buffer_age on X11.
2013-12-12 01:36:46 +01:00
Fredrik Höglund a9e49e218f kwin: Return the modified damage in a separate paintScreen() parameter 2013-12-12 01:36:46 +01:00
Fredrik Höglund c25b2939b1 kwin: Prepare the backend interface for EXT_buffer_age
Allow prepareRenderingFrame() to return a region that will be
repainted in addition to the damaged region.

Pass both the damaged region and the repainted region, which
may be larger, as parameters to endRenderingFrame().
2013-12-12 01:36:45 +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
Raul Fernandes 4af303a48a Calculate the intersection only once
The intersection of rects are calculated twice without need.
The function QRectF::intersected() calculate and returns the intersection.
If there are no interesection, the returned QRectF is empty.
If the intersected QRectF is equal to QRectF argument, it contains the QRectF argument.

Reviewed in: https://git.reviewboard.kde.org/r/114036/
2013-11-28 10:19:48 -02: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 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 b01f9ca077 Only create ColorCorrection if it is enabled in the options
According to massif just creating the ColorCorrection costs 2 MiB, so
it makes sense to not create it if it is not used.

REVIEW: 111604
DIGEST: Smaller memory footprint in KWin 4.11.2 if color correction is disabled
2013-09-04 14:42:45 +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
Martin Gräßlin 37334f400a Drop no longer needed XLib includes from KWin 2013-08-20 10:29:20 +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 5d0433f20b Drop some no longer needed includes
Less warnings
2013-08-06 11:38:52 +02:00
Thomas Lübking fbac18a635 Hotfix GL crossfading
Not correct crossfading
Purpose of the hotfix is to manipulate opacities of the "semi-crossfaded™"
pixmaps so that on a quick animation and sloppy check it looks somehow
believable (instead of bumping the window to full opacity)

REVIEW: 111888
2013-08-06 09:10:53 +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 2f9ff5591c Drop support for native graphics system
Qt 5 only supports raster which means our pixmaps are always non native,
so we don't need the Extension information any more and can drop all
special code handling for mapping a native QPixmap to an X11 pixmap.
2013-07-24 09:46:54 +02:00
Thomas Lübking 9f69a793e8 fix GL1.2 saturation modulation for non opaques
whether a window is ARGB or just not opaque does
not matter

BUG: 319091
FIXED-IN: 4.11
REVIEW: 111433
2013-07-08 18:53:36 +02:00
Casian Andrei 79c35d0164 Enable color correction only after successfuly contacting KolorManager
Prevents the possiblity of using shaders modified for color correction
without valid data from KolorManager. If that happened, everthing
blacked out.

Now the color correction shaders are enabled only after successfuly
contacting KolorManager.

The issue was highlighted after ab7e228d.

BUG: 321217
2013-06-18 17:27:34 +03:00
Fredrik Höglund fc70985c82 kwin: Call reserve() on the quad list before clipping
Assume that we will end up with the same number of quads.
2013-06-11 23:28:53 +02:00
Fredrik Höglund 4a95f7f1f1 kwin: Check for an empty quad list in beginRenderWindow()
BUG: 320845
2013-06-07 23:46:06 +02:00
Martin Gräßlin bab5f16d3c Egl Backend using a Wayland surface for rendering
This backend is able to composite on a Wayland surface instead of an X11
overlay window. It can be considered as a prototype for a Wayland session
compositor.

For texture from X11 pixmap the backend uses XShm. This is far from
optimal, but the KHR_image_pixmap extension is not available in Mesa's
Wayland backend. It's a temporary solution till we have XWayland and
texture from Wayland buffer.

To use this backend one needs to specify the environment variable
KWIN_OPENGL_INTERFACE with "egl_wayland". In future KWin should probably
use this backend if the Wayland display env variable is defined.

To use this setup:
1. Have a normal X-Server running on e.g. VT7
2. Start Weston on VT1
3. Start a terminal on Weston
4. start KWin with:

DISPLAY=:0 KWIN_OPENGL_INTERFACE=egl_wayland kwin --replace &

This should map a Wayland surface to Weston showing the content of the X
setup. At the moment it's not yet possible to interact with the surface
as input events are not yet recieved in the backend.

There are still a lot of limitations as documented in the code.
2013-06-05 13:45:45 +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 e7ab3adafd New class to encapsulate a Window's Pixmap
The behavior for creating a pixmap for a window is moved from Toplevel
into a dedicated class WindowPixmap. Scene::Window holds a reference to
this class and creates a new WindowPixmap whenever the pixmap needs to be
discarded. In addition it also keeps the old WindowPixmap around for the
case that creating the new pixmap fails. The compositor can in that case
use the previous pixmap which reduces possible flickering. Also this
referencing can be used to improve transition effects like the maximize
windows effect which would benefit from starting with the old pixmap.

For XRender and OpenGL a dedicated sub-class of the WindowPixmap is
created which provides the additional mapping to an XRender picture and
OpenGL texture respectively.

BUG: 319563
FIXED-IN: 4.11
REVIEW: 110577
2013-06-05 08:18:11 +02:00
Fredrik Höglund 57b78daf33 kwin: Use the new API for rendering quads 2013-06-05 00:41:25 +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 7c4b736cec kwin: Upload all the vertex data at the same time
With this change we only map the vertex buffer once per window.
The vertex arrays are also only set up once.
2013-06-05 00:41:23 +02:00
Fredrik Höglund 40d6bd66d4 kwin: Refactor SceneOpenGL::Window
Reimplement performPaint() in SceneOpenGL1Window and SceneOpenGL2Window.

The roles between begin/endRenderWindow() and performPaint() are now
reversed; performPaint() contains the specialized code while begin/
endRenderWindow() contains the shared code.

This reduces the state churn in the OpenGL2 backend from the repeated
calls to prepare/restoreStates().
2013-06-05 00:41:23 +02:00
Fredrik Höglund 631769d18f kwin: Rename SceneOpenGL::debug to m_debug and add an accessor 2013-06-05 00:41:23 +02:00
Fredrik Höglund 4f2d12a4a7 kwin: Rename SceneOpenGL::Window::texture to m_texture 2013-06-05 00:41:23 +02:00
Fredrik Höglund 7bac2dd425 kwin: Add new convenience methods in SceneOpenGL
Add a paintRedirector() and a getDecorationTextures() method.
These will be used in an upcoming commit.
2013-06-05 00:41:22 +02:00
Fredrik Höglund 70921b8119 kwin: Make hardwareClipping a member 2013-06-05 00:41:22 +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
Fredrik Höglund 120e65b2c1 kwin: Use texture atlases for the decorations
Use two textures per window instead of four, storing the left and
right borders in the first texture, and the top and bottom borders
in the second.

This makes it possible to render the whole decoration with only two
calls to glDrawArrays(). It also reduces the number of texture
allocations while resizing a window.
2013-06-05 00:41:22 +02:00