Commit Graph

213 Commits (5de55b61e7d8a75a01cafef2d5b4754f69ab68e0)

Author SHA1 Message Date
Martin Gräßlin 93e717b072 [wayland] Drop Wayland support in SceneXRender
It didn't get adjusted for Xwayland, so probably doesn't work any more.
The rendering mode seems not very useful if honest and it's better to
use the QPainter backend.
2015-03-23 13:47:21 +01:00
Martin Gräßlin 147af71f8a Drop Workspace dependency from Scene
Only used for one connect which can also be done outside of Scene.
Subclasses got the singleton pointer and just passed to the parent.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 198ce47fec [scene-xrender] Trigger a full decoration repaint when sizes are dirty
When the pixmaps are re-created we should ensure that they are filled
with proper content.

BUG: 342980
REVIEW: 122148
2015-01-19 15:30:06 +01:00
Martin Gräßlin 2910645df0 [scene-xrender] Implement support for DecorationShadow
The DecorationShadow on XRender is implemented by creating the
required QPixmaps in ::prepareBackend. That way the rendering
infrastructure can be shared with the window based shadows.

BUG: 342758
REVIEW: 122009
2015-01-19 09:30:01 +01:00
Daniel Pastushchak 0d997b1093 Introduce categorized logging for kwin core
Done by Daniel Pastushchak for KDE during GCI-2014.
2014-12-05 14:27:15 +01:00
Martin Gräßlin 21dca7ac14 Keep a QPointer<DecoratedClientImpl> in Client
This allows to remove the internal access to the DecoratedClientPrivate
in the KDecoration API.
2014-10-21 07:46:44 +02:00
Martin Gräßlin e32da9d9e0 Merge branch 'master' into kdecorations2
Conflicts:
	CMakeLists.txt
	paintredirector.cpp
	scene_opengl.h
	scene_qpainter.h
	scene_xrender.h
2014-10-20 16:04:52 +02:00
Volker Krause 5db2d5a556 Make constants const, saves a few symbols in the .data section. 2014-09-27 20:30:49 +02:00
Martin Gräßlin 5eceda4ae6 ShmPool returns Buffer instead of wl_buffer
Requires c561316236279754c5570009ec6adb5da215efd8 in kwayland.
2014-09-20 15:13:17 +02:00
Martin Gräßlin 237ee7fcc7 wayland_client and wayland_server moved to kwayland
kwayland is provided by kde:kwayland and is located at
kde/workspace/kwayland

It's an optional build dependency needed only for kwin_wayland.
2014-09-19 13:59:51 +02:00
Fredrik Höglund 32e9de1e23 Refactor the swap completion interface
Move the buffer-swap-pending state from the compositing backends to
the Compositor class. The Compositor is the only class that needs to
access the state, and this way it to do it without calling through
a chain of virtual functions. This commit adds two new functions to
Compositor; aboutToSwapBuffers() and bufferSwapComplete(). The
backends call these functions to set and reset the buffer-swap-pending
state.

This commit also renames a number of functions and variables to make
their meaning clear.

The act of promoting the contents of the back buffer to become the
contents of the front buffer is referred to as posting the buffer,
presenting the buffer, or swapping the buffers; rendering the buffer
is what paintScreen() does.
2014-09-18 20:21:20 +02:00
Fredrik Höglund ada5d02170 xrender: Remove findFormatForVisual()
Use XRenderUtils::findPictFormat() instead.
2014-09-01 17:45:58 +02:00
Martin Gräßlin 08ab2c424e [kwin_wayland] Split out Buffer and ShmPool into dedicated files
Moved from wayland_backend.[h|cpp] to buffer.[h|cpp] and
shm_pool.[h|cpp]. Buffer is slightly adjusted to have the ShmPool
passed in as a ctor argument and the ctor is private and friended with
ShmPool, so that it can only be constructed from ShmPool.
2014-08-27 08:57:06 +02:00
Martin Gräßlin ce8c4240f7 [kwin_wayland] Create a dedicated Surface class
A Surface class is split out which holds a wl_surface and supports
attaching a buffer, setting the damage and emitting a signal when the
frame callback got called.

It doesn't come with a unit test yet as it first needs the ShmPool
and Buffer properly split out to easily set it up.
2014-08-27 08:57:06 +02:00
Martin Gräßlin bd8ed3cd70 [kwin_wayland] Flush display connection before going to block
Integrate with QAbstractEventDispatcher::aboutToBlock and because of that
we can drop all direct calls to flush from the Scenes.
2014-08-27 08:57:06 +02:00
Fredrik Höglund 0aff9830df Remove the decoration opacity property
It has been broken since cross-fading was introduced, and no one has
filed any bug reports about it.
2014-08-25 17:25:04 +02:00
Martin Gräßlin 2b20aa8bd0 Drop CoordinateMode from Client::layoutDecorationRects
It's unused without the padding.
2014-07-25 14:02:27 +02:00
Martin Gräßlin 08d146de91 Introduce support for DecorationShadow
Surprisingly the DecorationShadow is modelled after the Shadow in KWin.
It provides the same offsets and a QImage exactly like the OpenGL
implementation needs it. This makes it easy to hook it into our existing
Shadow implementation with only a few changes.

Shadow now first tries to create a Shadow from the Decoration and only
if that fails it tries the X11 property. The pixmaps are not initialized
for the DecorationShadow and because of that currently only the OpenGL
backend gets initialized for DecorationShadows. The other backends might
need adjustments and also a transition to just using one image.
2014-07-25 14:02:27 +02:00
Martin Gräßlin c12199a8e0 Pass Decoration::Renderer to Deleted and use it in the Scenes
The Renderer gets reparented to the Deleted. While passing it to
the Deleted the Scene's implementation can ensure that the buffers
are up to date. After passing to Deleted it's no longer allowed to
call the render method.
2014-07-25 14:02:27 +02:00
Martin Gräßlin 0030eb7f84 Initial import of support for new KDecoration2 based decorations
NOTE: this is not working completely yet, lots of code is still ifdefed
other parts are still broken.

The main difference for the new decoration API is that it is neither
QWidget nor QWindow based. It's just a QObject which processes input
events and has a paint method to render the decoration. This means all
the workarounds for the QWidget interception are removed. Also the paint
redirector is removed. Instead each compositor has now its own renderer
which can be optimized for the specific case. E.g. the OpenGL compositor
renders to a scratch image which gets copied into the combined texture,
the XRender compositor copies into the XPixmaps.

Input events are also changed. The events are composed into QMouseEvents
and passed through the decoration, which might accept them. If they are
not accpted we assume that it's a press on the decoration area allowing
us to resize/move the window. Input events are not completely working
yet, e.g. wheel events are not yet processed and double click on deco
is not yet working.

Overall KDecoration2 is way more stateful and KWin core needs more
adjustments for it. E.g. borders are allowed to be disabled at any time.
2014-07-25 14:02:26 +02:00
Martin Gräßlin b039a07f4d Toplevel::vis becomes Toplevel::m_visual and is xcb_visualid_t
Only usage of the ::vis was the visualid, so have this as the member
instead of the XVisual*.
2014-05-05 08:09:10 +02:00
Martin Gräßlin fbec8ea12c [scene-xrender] Do not render deco part if it doesn't end on screen
If the deco part doesn't exist or the target rect is empty, KWin should
not try to composite the deco part on the screen. It can be an empty
rect for maximized windows. If the render composite is tried it results
in an error (note - man page says "This request does never generate any
errors.").

To simplify the macro is turned into a lambda.

The root cause for this problem is that PaintRedirector creates an
XRenderPicture for those invalid geometries and this requests arleady
fails. Thus RasterXRenderPaintRedirector is adjusted to not create the
XRenderPicture in that case and set it to nullptr. For a null
XRenderPicture XCB_RENDER_PICTURE_NONE is returned.

BUG: 332247
REVIEW: 117373
2014-04-07 08:00:52 +02:00
Martin Gräßlin 263b1f1faf [kwin/scene_xrender] Use size of shell surface as xpixmap size in XRender/Wayland
Most important connect to the surface size changed signal so that we can
create a new xpixmap which matches the size of the surface.
2014-03-19 14:14:39 +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
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 02a01f2006 Wayland backend for the XRender scene
This backend uses an XShm pixmap for the rendering back buffer. In
present() the content of this shm pixmap is copied into a Wayland shm
buffer freeing the pixmap to be used for the next frame again and by that
we have a double buffered rendering.

In opposite to the X11 XRender backend this backend doesn't use the
overlay window.
2014-01-08 09:22:40 +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 cfa1ead9e1 Introduce an XRenderBackend similar to OpenGLBackend
An abstract backend is split out of SceneXRender which takes care of
managing the render pictures and swapping them after a frame is rendered.

Having this abstract allows to implement further backends for XRender
which do not use the Overlay Window for compositing.

To have it consistant the SceneXRender is now also created by a factory
method.
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
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
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 57905c0cc2 And we got rid of KDebug
Usages of kBacktrace got dropped.
2013-09-02 13:14:39 +02:00
Martin Gräßlin 388944314a Drop QPixmap ctor of XRenderPicture
Was a todo to remove it as it's just using a toImage. Removing this
ctor should make it for the user more obvious that put image is used.
2013-08-13 09:57:50 +02:00
Thomas Lübking 772486511a implement crossfading on xrender
REVIEW: 111383
2013-08-06 23:26:51 +02:00
Thomas Lübking ebfd3f58d8 implement crossfading on xrender
REVIEW: 111383
2013-08-06 23:06:39 +02:00
Thomas Lübking bcf6c9c319 use configured xrender filter
that's why it's configured

REVIEW: 111428
BUG: 322074
FIXED-IN: 4.11
2013-07-08 18:53:36 +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
Thomas Lübking b7e6a334da rebase measuring to nano res + fix vsync padding
REVIEW: 109784
2013-05-20 16:09:27 +02:00
Martin Gräßlin 76d96506dc Remove damage argument in Toplevel::resetDamage
We always reset with the complete window geometry, so the subtracting
doesn't make any sense. We can just always set the damage to an empty
region.

REVIEW: 110438
2013-05-17 10:07:45 +02:00
Martin Gräßlin 2ab0de12e9 Remove dead code 2013-04-26 12:32:08 +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 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 1bb5a81292 Port SceneXRender to XCB
SceneXRender no longer uses XRender from XLib, but only XCB.

REVIEW: 109190
2013-03-13 08:19:14 +01:00
Martin Gräßlin 4e598ed641 Port SceneXRender::EffectFrame to XCB render 2013-03-13 08:12:40 +01:00