Commit graph

20 commits

Author SHA1 Message Date
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
Fredrik Höglund
c92f65583a kwin: Clear the decoration textures after resizing
This fixes artifacts from over-sampling along the edges of the
decorations when effects such a wobbly windows are active.

The textures are only cleared when framebuffer objects are supported.
All drivers support FBO's now, so in practice this shouldn't be
a problem.
2013-06-05 00:41:22 +02:00
Fredrik Höglund
d0703292fc kwin: Align decoration texture sizes to 128 pixels
This reduces the number of texture reallocations while
resizing windows.
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
Fredrik Höglund
e862bfe569 kwin: Refactor some code in the PaintRedirector
Add virtual resizePixmaps() and updatePixmaps() methods that resizes and
updates all the pixmaps. Make resize() and paint() regular virtuals
with stub implementations.

The new methods will be used by OpenGLPaintRedirector in the next commit.
2013-06-05 00:41:22 +02:00
Martin Gräßlin
9df3af1dc6 Do not needlessly copy from QPixmap to QImage in PaintRedirector
The scratch PaintDevice is provided by the PaintRedirector's subclasses
allowing the ones wanting a QImage to provide the QImage directly and the
ones needing a QPixmap to provide a pixmap. This means the copy from
QPixmap to QImage is no longer needed in the OpenGL and XRender/raster
paint redirector.

REVIEW: 109138
2013-03-11 11:36:41 +01:00
Martin Gräßlin
aa549f45d5 OpenGLPaintRedirector updates textures directly
Ownership of decoration textures is moved from SceneOpenGL::Window to
OpenGLPaintRedirector. The PaintRedirector is responsible for updating
the textures whenever they change. For this GLTexture is extended by an
update(QImage, QPoint) method which uses glTexSubImage2D to update only
the changed parts.

The big advantage compared to before is that if e.g. only a button is
animated only the button part is updated instead of the complete deco
part.
2013-03-11 11:21:11 +01:00
Martin Gräßlin
fba7504063 Introduce dedicated PaintRedirector subclasses for OpenGL/XRender
PaintRedirector is turned into an abstract class providing a factory
method which returns either an instance of
* OpenGLPaintRedirector
* NativeXRenderPaintRedirector
* RasterXRenderPaintRedirector

OpenGLPaintRedirector is basically doing exactly the same as the parent
class used to do before. Though the idea is to extend the functionality
to have the PaintRedirector write directly into OpenGL textures to limit
copying the complete decorations.

NativeXRenderPaintRedirector is similar to OpenGLPaintRedirector by
rendering into a QPixmap and providing the pictureHandle for the QPixmap
to SceneXRender.

RasterXRenderPaintRedirector is providing the functionality for the case
that the QPixmap/XPixmap relationship is not present. From the QPixmap
containing the pending decoration paint a QImage is created and then the
relevent parts are copied directly into the decoration pixmap.

REVIEW: 109074
2013-03-11 11:19:57 +01:00
Martin Gräßlin
0d81d1d7c0 Move decoration pixmap handling from Client to PaintRedirector
The only task of the PaintRedirector is to redirect the painting of the
window decorations into Pixmaps. So it should actually do this by also
handling the four pixmaps for the decoration. This simplifies the code
as all the logic concerning redirecting the painting is now grouped
together.

Furthermore the PaintRedirector is now a child of the decoration widget,
which means it gets automatically destroyed whenever the decoration is
destroyed - the Client does not have to care about it.

Also the PaintRedirector gets only created if the Compositor is active as
it is not needed in the non-compositing case.

REVIEW: 106620
2012-10-12 07:45:31 +02:00
Martin Gräßlin
7497ef9148 Make the Compositor a proper Singleton
The Compositor class actually behaves like a Singleton so it should be
one. Therefore four static methods are added:
* self() to access the Singleton
* createCompositor() to be used by Workspace to create the instance
* isCreated() to have a simple check whether the Singleton is already
  created
* compositing() as a shortcut to test whether the compositor has been
  created and is active

The isCreated() check is actually required as especially Clients might
be created and trying to access the Compositor before it is setup.
2012-09-06 09:55:22 +02:00
Martin Gräßlin
7a1fe42be0 Fix uninitialized memory and logic error in PaintRedirector
The refactoring of Compositor starting with b1739c3 caused some
regressions due to variables in Workspace and Compositor not
being initialized. Furthermore there was a boolean logic error
in PaintRedirector causing the decorations not to paint.

BUG: 305875
2012-08-27 19:45:01 +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
Philipp Knechtges
b44580f02e kwin: dont gather scheduled decoration repaints
Instead of scheduling and gathering the Workspace::addRepaint calls at the end of the main loop
we directly emit the signal which ends up in a call to addRepaint. The compositeTimer assures
that the higher number of scheduled repaints are executed in the same rendering pass.
2011-07-11 18:47:36 +02:00
Martin Gräßlin
66d22738e4 Disable PaintRedirector when non-composited
Without Compositing we do not really need the PaintRedirector,
it only adds overhead. This reverts the behavior to how it was before
the PaintRedirector was introduced by just not redirecting the paint
in the event filter when compositing is not active. This should have
the lowest impact on the existing source base.

The change breaks at least oxygen window decoration when compositing
is not active as the decoration is no longer double buffered. But
as written this is exactly the behavior as used before 4.3. Given
the push today there should be enough time for all affected decos
to adjust to the change.

REVIEW: 101413
2011-06-23 12:37:15 +02:00
Martin Gräßlin
0a7e48f7aa KWin uses kdelibs coding style. 2011-01-31 20:07:03 +01:00
Fredrik Höglund
69bc0f3a0e Use integer math.
svn path=/trunk/KDE/kdebase/workspace/; revision=1130554
2010-05-25 16:59:36 +00:00
Fredrik Höglund
e969813b4a Wait two seconds before deleting the scratch pixmap in the paint redirector
in case we need it again.

This should improve performance with drivers where creating pixmaps is
expensive.

svn path=/trunk/KDE/kdebase/workspace/; revision=1104069
2010-03-16 16:34:39 +00:00
Jacopo De Simoi
637ff72e1f Make sure that the paintredirector pending region is added to the repaint region only once in case the window gets minimized.
TAB--

svn path=/trunk/KDE/kdebase/workspace/; revision=1050675
2009-11-17 21:34:58 +00:00
Hugo Pereira Da Costa
bc2cb84b6e use Qt::ToolTip windowFlags to identify tooltip widgets
svn path=/trunk/KDE/kdebase/workspace/; revision=1036142
2009-10-16 17:17:08 +00:00
Fredrik Höglund
e92aab0518 Implement initial support for ARGB window decorations.
Based on earlier work done by Lubos Lunak and ideas by Lucas Murray.

svn path=/trunk/KDE/kdebase/workspace/; revision=957680
2009-04-22 17:29:56 +00:00