Commit Graph

496 Commits (84954b9e4fa422d636512ff6374e5cc77275e976)

Author SHA1 Message Date
Thomas Lübking 26febda4a0 Merge branch 'KDE/4.11'
Conflicts:
	ksmserver/screenlocker/greeter/greeterapp.cpp
	ksmserver/screenlocker/greeter/greeterapp.h
	ksmserver/screenlocker/greeter/themes/org.kde.passworddialog/contents/ui/main.qml
	kwin/libkwineffects/kwineffects.cpp
	kwin/useractions.cpp
	plasma/desktop/applets/window-list/metadata.desktop
	plasma/desktop/containments/panel/plasma-containment-panel.desktop
	plasma/desktop/toolboxes/plasma-toolbox-paneltoolbox.desktop
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
2013-11-24 15:35:17 +01:00
Martin Gräßlin 2e3eb5402b Fallback to XRender if scene-graph uses GUI thread for OpenGL rendering
This is a workaround fo QTBUG-34898 and affects the VirtualBox driver
and SandyBridge Mobile. OpenGL compositing is just not possible and
crashes as soon as there is anything rendered with QtQuick. This change
should be reverted once the Qt bug is fixed.

To nevertheless use OpenGL one can as always use the KWIN_COMPOSE env
variable, though this will result in crashes. An alternative is to set
QT_OPENGL_NO_SANITY_CHECK which forces Qt into using the threaded
rendering. At least for Sandybridge this seems to be a workable solution
as it's only causing flickering in fullscreen and KWin doesn't use any
fullscreen QtQuick elements.
2013-11-23 10:54:41 +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
Fredrik Höglund 76adeb6a13 kwin: Optimize WindowQuadList::makeGrid()
This is the same optimization that was done in makeRegularGrid()
in 45782d387ab894c682b4ccc220e596c8b72c4167.
2013-11-21 23:38:43 +01:00
Fredrik Höglund 006529d8b2 kwin: Optimize WindowQuadList::makeRegularGrid()
Instead of looping over every quad for every grid cell and checking
for possible intersections, loop over the quads once and compute
the top left corner of the first intersecting grid cell. Then loop over
all the intersecting cells from that point and create the sub quads.

This new algorithm also preserves the order of the quads in the
original list.
2013-11-21 23:37:10 +01:00
Àlex Fiestas 1a1a79ca87 Make everything use org.kde.kded5 for now
NOBODY should use org.kde.kded5 but instead directly the service
register by its own modulem, but for now let's just switch to .kded5
so we can get this running fast.
2013-11-21 11:51:38 +01:00
Martin Gräßlin 7c2448227a [libkwineffects] Improving linking of kwinglutils library
Only needs:
* Qt5::DBus for the communication with color correction
* Qt5::X11Extras for access to XCB, pulls in needed Qt5::Gui
* XCB component XCB for xcb calls in kwinglobals.h
2013-11-19 12:12:57 +01:00
Aleix Pol 7b110f0671 Improve CMake usage
It's basically a run of the port-cmake.sh script in here, mostly the changes
are the following:
- Using KF5::* targets
- Using the proper macros, following recent developments in frameworks
2013-11-15 13:37:47 +01:00
David Faure 57ff76150e Fix cmake warnings due to LINK_INTERFACE_LIBRARIES, use PUBLIC/PRIVATE instead. 2013-11-10 20:45:23 +01:00
Martin Gräßlin e3618e8796 [kwin] Follow Qt's OpenGL choice for KWin
As KWin indirectly uses Qt's OpenGL through QtQuick we need to ensure
to not mix OpenGL and OpenGLES. So we have to built KWin only against
OpenGL if Qt is built against OpenGL and we have to built KWin only
against GLESv2 if Qt is built against GLESv2.

This means the kwin_gles binary is no more. There is only kwin which
either links GL or GLESv2.
2013-10-14 09:04:03 +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
Thomas Lübking 3f5ef10c8e introduce GLTexture::clear and use it from paintredirector
also work around broken fbo texture clearing on fglrx

so far supports FBO/glClear and resorts to glTexSubImage2D

if the fbo cannot be created or is (in case of fglrx)
known to break, resort to glTexImage2D loading of an
argb array of zeros

BUG: 323065
FIXED-IN: 4.11.2
REVIEW: 112526
2013-09-24 00:50:55 +02:00
Alex Richardson 109c504ef7 fix mismatched struct/class forward declaration
Found by compiling with clang
2013-09-13 16:52:25 +02:00
Martin Gräßlin ff6cb5e75c Drop the GlobalShortcutsEditor from libkwineffects
As our need can be satisfied without sub-classing KShortcutsEditor
we can drop this class.
2013-09-09 07:10:08 +02:00
Martin Gräßlin caad13ff95 Use new components based Find XCB 2013-09-09 06:03:35 +02:00
Thomas Lübking 3859f67862 glsl is not supported on indirect contexts
and fglrx yells an invalid_enum error when being asked
for the version

BUG: 323527
FIXED-IN: 4.11.2
REVIEW: 112419
2013-09-08 23:43:04 +02:00
Martin Gräßlin 5e29cc24dc Remove XLib dependency from kwinglobals
As a side effect we need some fixx11h.h includes at places which still
use too much xlib.
2013-09-05 09:56:50 +02:00
Martin Gräßlin 8a78e71c97 Drop KWin::Extensions from kwinglobals
Replaced by KWin::Xcb::Extensions. This removes the remaining
Xlib extension dependencies form kwineffects.
2013-09-05 09:14:09 +02:00
Eike Hein fbc957c048 Second 'unbreak kwin build' of the day ...
Port from kFatal to qFatal - kFatal is still in kde4support,
but lacking debug area support arguably isn't that big a
deal since fatals can't be turned off anyway.

CCMAIL:mgraesslin@kde.org
2013-09-02 18:42:20 +02:00
Martin Gräßlin add219d5bc Port libkwinglutils from KDebug to QDebug
And another lib doesn't need kde4support any more.
2013-09-02 11:31:46 +02:00
Martin Gräßlin 99bcac1cc7 Port libkwineffects away from KDebug
And with that it doesn't need kde4support anymore.
2013-09-02 10:43:55 +02:00
Martin Gräßlin 16df417cc6 XCB variant for displayWidth/Height and update after RandR event
DisplayWidth and height provide proper values though internally
things are wrong as QDesktopWidget seems to not emit the signal.
2013-09-02 10:23:30 +02:00
Thomas Lübking 9001af8e5a reset custom cube shaders on screen change
the reset/setup invokes the viewport dimensions...

BUG: 323311
FIXED-IN: 4.11.1
REVIEW: 112133
2013-08-27 07:53:02 +02:00
Thomas Lübking 1d778f4600 c++ cannot invoke other constructors
BUG: 324004
FIXED-IN: 4.11.1
BUG: 112274
2013-08-25 17:05:37 +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 84a2f3020b Use Qt5:: in target link libraries in KWin 2013-08-20 09:14:24 +02:00
Anselmo L. S. Melo 49c04f13b1 Porting libkwineffects to Qt5/KF5: QStandardPaths
REVIEW: 111976
2013-08-13 17:55:57 -03: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
Sebastian Kügler 08a53e6a11 Remove K_EXPORT_PLUGIN macros
Include .moc file in configs_builtins.cpp, and reenable the build of the
configs.

REVIEW:111940
2013-08-08 13:47:25 +02:00
Martin Gräßlin 9291b18cee Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/effects.cpp
	kwin/effects/logout/logout.cpp
	kwin/effects/presentwindows/main.qml
	kwin/effects/presentwindows/presentwindows.cpp
	kwin/effects/presentwindows/presentwindows.h
	kwin/effects/zoom/zoom_config.cpp
	kwin/libkwineffects/kwinglutils_funcs.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/nvidiahack.cpp
	kwin/xcbutils.h
	plasma/desktop/containments/desktop/plasma-containment-desktop.desktop
	plasma/generic/wallpapers/image/image.cpp
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-08-07 10:10:06 +02:00
Thomas Lübking b92ebe02aa add synthetic repaint after crossfade finished
prevents glitches after crossfading translucent window

REVIEW: 111888
2013-08-06 09:12:05 +02:00
Thomas Lübking e9e73f1134 add XRenderPicture(QImage) constructor
was implicitly present for QPixmap::toImage

REVIEW: 111878
2013-08-05 20:43:28 +02:00
Martin Gräßlin 469828c847 Cache display and rootWindow
No need to go through the QPA interface each time we access the
Display variable or need the root window.
2013-08-02 08:31:53 +02:00
Martin Gräßlin 1807265813 KDebug moved to KDE4Support
Adjust target link libraries.
2013-07-31 14:07:58 +02:00
Casian Andrei 4d24fe8b30 Fix many color correction problems with OpenGL ES
On GLES, check for OES_texture_3D extension for color correction

Remove a block of ugly hack code that was supposedly needed to build
with OpenGL ES.

Convert the lookup texture data to uint8 on OpenGL ES before sending it
via glTexImage3D, because uint16 is not supported.

Check if the shaders have been reinitialized successfuly when trying to
activate color correction, prevent black screens when there are issues
with the shaders.

BUG: 315419
REVIEW: 111225
(cherry picked from commit 68c68ee3c2b54f968c4d8275f1e8a2e0ccc90dd7)
2013-07-28 17:44:06 +03:00
Martin Gräßlin 9ab751042a Drop X11_XCB library dependency
We don't need it anymore - the xcb connection is also provided by
QX11Info.
2013-07-24 09:58:43 +02:00
Martin Gräßlin 202bc2fbf9 Fix include path to QX11Info 2013-07-24 09:58:43 +02:00
Martin Gräßlin f04b39c548 Adjust target link libraries 2013-07-24 09:58:42 +02:00
Martin Gräßlin e32635fb2e QMatrix4x4 does no longer wrap qreal 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 8dd61fdc53 Introduce a define to mark code areas which need porting 2013-07-24 09:47:02 +02:00
Martin Gräßlin 1d2c2d5982 Use Q_SLOTS and Q_SIGNALS instead of slots and signals
Fixes compilation with Qt5/KF5 setup.
2013-07-24 09:46:54 +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
Fredrik Höglund 4b120288b6 kwin: Use glBufferSubData() when preferred
Use glBufferData() to reallocate the data store, and glBufferSubData()
to upload data to unused ranges of vertex buffers.
2013-07-08 01:23:38 +02:00
Fredrik Höglund 9de4c490ba kwin: Add GLPlatform::preferBufferSubData()
This method returns true when glMapBufferRange() is likely to perform
worse than glBufferSubData() when updating an unused range in a buffer
object.

This is the case with the NVIDIA driver, where glMapBufferRange()
will force thread serialization. The driver tracks which ranges of
the buffer are in use, so calls to glBufferSubData() should not
cause a pipeline stall.
2013-07-08 01:23:37 +02:00
Fredrik Höglund 6562fcc665 kwin: Don't query GL_VIEWPORT in pushRenderTarget()
Assume that the default framebuffer has the same dimensions as the screen.

By not quering the dimensions of the viewport we don't risk serialization
in drivers that use threaded dispatch.
2013-06-27 00:06:54 +02:00
Fredrik Höglund 7124f5190b Revert "kwin: Make WindowQuadList inherit from QVector"
This reverts commit 23dff966437bb664a2ffdb3f7957ef39978f5fad.

Using QVector is not a win when effects such as wobbly windows are
active, due to the realloc overhead. So revert this change for now.
2013-06-27 00:06:49 +02:00
Martin Gräßlin db2e6687e1 Remove dead assignment in GLVertexBuffer::draw
Variable primitiveMode is not read in the branch and there's a return in
the same branch.

REVIEW: 111192
2013-06-26 17:58:48 +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
Aurélien Gâteau 4a426d731d kwin: Fix build on arm
CCMAIL: ubuntu@kitterman.com
2013-06-26 10:13:33 +02:00
Casian Andrei 8f92e2ab91 Avoid calling expensive GLShader::setUniform overload
REVIEW: 111196
2013-06-24 21:34:32 +03:00
Casian Andrei 40acb1da14 Remove unnecessary checkGLError() calls from color correction
Keep only the ones that should only be called once

REVIEW: 111060
2013-06-24 21:33:56 +03: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 2fc2004119 kwin: Reset the dirty flags in GLTexture
m_wrapModeChanged and m_filterChanged were never set to false,
causing the sampler parameters to be set every time a texture was bound.
2013-06-13 18:46:34 +02:00
Fredrik Höglund 9d03e16c34 kwin: Check that color correction is enabled in setupForOutput()
Return early if color correction is disabled, so this function
becomes a no-op in that case.
2013-06-11 23:28:48 +02:00
Fredrik Höglund 15dae59999 kwin: add a GLVertexBuffer::draw() overload
This overload doesn't take a clip region. Added for symmetry
with the render() method.
2013-06-11 05:11:41 +02:00
Thomas Lübking 88be3d0caf ensure to init animationeffect bindings
it seems an animation can be triggered and the resp.
window deleted in the first event cycle (before the deleted
signal is bound) - so we add an initialization flag to ensure
the binding happens before the first animation is added

BUG: 320562
FIXED-IN: 4.11
REVIEW: 110872
2013-06-10 16:38:03 +02:00
Martin Gräßlin 5660801192 Add DecorationOpacity to AnimationEffect
Just like Opacity for transforming only the decoration opacity.

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

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

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

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

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

REVIEW: 110578
2013-06-05 08:18:28 +02:00
Fredrik Höglund 40918e0193 kwin: Make WindowQuadList inherit from QVector
This avoids the overhead of allocating each WindowQuad on the heap
when appending items to the list, and also ensures that the quads
are continuous in memory.
2013-06-05 00:43:17 +02:00
Fredrik Höglund dbbda21129 kwin: Support quads in makeInterleavedArrays()
A new type parameter is added for specifying the primitive type.
2013-06-05 00:41:24 +02:00
Fredrik Höglund 7e22bd314c kwin: Add support for rendering quads using an index buffer
This reduces the size of the geometry that needs to be uploaded by
one-third, and allows kwin to take advantage of the post-transform
cache in the GPU.
2013-06-05 00:41:24 +02:00
Fredrik Höglund 479ea5db61 kwin: Resolve functions for GL_ARB_copy_buffer 2013-06-05 00:41:24 +02:00
Fredrik Höglund 5e7b2a34a8 kwin: Resolve functions for GL_ARB_draw_elements_base_vertex 2013-06-05 00:41:23 +02:00
Fredrik Höglund 993b50cf1c kwin: Add a new GLVertexBuffer::draw() method
Expose bindArrays(), unbindArrays() and add a draw() method that takes
an offset and a count. This makes it possible to upload geometry, call
bindArrays(), and then call draw() multiple times to draw different
subsets of the uploaded geometry.
2013-06-05 00:41:23 +02:00
Fredrik Höglund ac5f1317e9 kwin: Split WindowQuadDecoration into two types
Split WindowQuadDecoration into WindowQuadDecorationLeftRight
and WindowQuadDecorationTopBottom.

This simplifies the code in SceneOpenGL::Window::paintDecoration().
2013-06-05 00:41:22 +02:00
Martin Gräßlin 4b4646973b Use QList<KWin::EffectWindow*> as return type for mainWindows()
QtScript bindings fails when using EffectWindowList.
2013-06-04 17:17:08 +02:00
Martin Gräßlin aa92d2dbd9 No repaints for keepAtTarget and before started
Do not schedule repaints in AnimationEffect if there are no animations
going on. If an animation is waiting for starting or kept after ending
the visual appearance is no longer changed, so no repaint is needed.

REVIEW: 110795
2013-06-03 15:45:02 +02:00
Fredrik Höglund d6fadfa91c kwin: Add an SSE2 vertex upload path
Use MOVNTDQ instructions to write vertex data into the buffer object.
2013-05-29 17:53:08 +02:00
Fredrik Höglund de4b7e8db1 kwin: Add WindowQuadList::makeInterleavedArrays()
Unlike makeArrays() this function writes into a pre-allocated array,
and takes a matrix that's used to transform the texture coordinates.
This allows this function to handle coordinates for rectangular
textures correctly.
2013-05-28 18:13:06 +02:00
Fredrik Höglund a5a2561f69 kwin: Simplify WindowQuadList::makeArrays()
Note that unlike the previous commit, this doesn't fix texture coordinates
for rectangular textures. That case cannot be handled correctly without
knowing the dimensions of the texture.
2013-05-28 16:35:37 +02:00
Fredrik Höglund d4aacd678e kwin: Add more accessors in WindowVertex
Reorder some of the methods and add new u() and v() accessors,
which are aliases of textureX() and textureY().
2013-05-28 16:35:37 +02:00
Fredrik Höglund 7a99b8c0ef kwin: Add GLTexture::matrix()
This method returns a matrix that transforms normalized or un-normalized
texture coordinates, taking the texture target and y-inversion flag into
account.
2013-05-28 16:35:36 +02:00
Fredrik Höglund 38678bb84f kwin: Don't unbind vertex array buffers
KWin always updates the array buffer binding before it calls GL functions
that reference it, so there is never any need to reset it.

This should eliminate half the calls to glBindBuffer() while painting
the scene.
2013-05-28 16:35:36 +02:00
Fredrik Höglund 159bcf11b6 kwin: Simplify the two setData() methods
Simplify the two setData() methods in GLVertexBuffer by implementing
them in terms of the new map() and unmap() methods.
2013-05-28 16:35:36 +02:00
Fredrik Höglund 188e6d04ca kwin: Expose a map() and an unmap() method in GLVertexBuffer
These methods make it possible to write directly into the buffer object
when building vertex arrays.

If the buffer object cannot be mapped, the map() method will return
a pointer to local memory which will be submitted to the buffer object
with glBufferData() when unmap() is called.
2013-05-28 16:35:36 +02:00
Fredrik Höglund ab8c6aeec3 kwin: Add a new setData() method in GLVertexBuffer
This overload makes it possible to upload data of an arbitrary size and
type into the buffer object.  The intent is for this method to be used
to upload interleaved vertex data.

This commit also adds setVertexCount() and setAttribLayout().

The rationale for decoupling attribute specification from data uploading
is that the attribute formats and layout change less frequently than
the vertex data.

The vertex count is also specified using a separate function to enable
the caller to upload data for multiple draw calls at the same time.
2013-05-28 16:35:35 +02:00
Fredrik Höglund 395ff72555 kwin: Change the way attrib formats are stored in GLVertexBuffer
Store the formats as an array in GLVertexBufferPrivate.

This simplifies the code for enabling the generic vertex arrays,
and also makes it easier to add new arrays.
2013-05-28 16:35:35 +02:00
Fredrik Höglund 1de20a39a0 kwin: Add convenience classes for working with bitfields 2013-05-28 16:35:35 +02:00
Fredrik Höglund 5782d5307e kwin: Add a Color uniform in GLShader
And use it in GLVertexBufferPrivate::bindArrays(). Also store the color
as a QVector4D in GLVertexBufferPrivate.
2013-05-28 16:35:35 +02:00
Fredrik Höglund c41d05d36c kwin: Do some more refactoring in GLVertexBuffer
Consolidate the code for binding and unbinding the vertex arrays into
two new methods called bindArrays() and unbindArrays() respectively.

This patch also removes the three paint implementations, since the only
difference between them is the code that sets up the arrays. The actual
painting code is moved into GLVertexBuffer::render(), which uses the
new methods to bind and unbind the arrays.
2013-05-28 16:35:35 +02:00
Martin Gräßlin 769c746a06 Use GLSL 1.40 shaders as GLSL 300 es shaders
In case OpenGL ES 3 is provided by the driver we can use the GLSL 1.40
shaders as GLSL 300 ES shaders. The #version declarative is rewritten in
such a case.

REVIEW: 110590
2013-05-23 09:06:21 +02:00
Martin Gräßlin ad1203e3b2 Add defines from EXT_robustness
Seem to be missing in the headers used on build.kde.org.
2013-05-23 08:38:16 +02:00
Fredrik Höglund 19796b8263 kwin: Use the robust access functions
Use glReadnPixels() instead of glReadPixels(), and glGetnUniformfv()
instead of glGetUniformfv().
2013-05-21 00:22:57 +02:00
Fredrik Höglund 2f87b7542f kwin/es: Resolve functions for GL_EXT_robustness 2013-05-21 00:22:57 +02:00
Fredrik Höglund adc581d2ab kwin: Resolve functions for GL_ARB_robustness
Only the subset of functions available in core contexts is resolved,
except for glGetnTexImageARB() and glGetnUniformivARB(), which are
not used by kwin.

Instead of setting the function pointers to NULL when the extension isn't
supported, kwin provides its own implementations that call the non-robust
versions of the functions.  This is so callers don't have to check if the
extension is supported before calling the functions.
2013-05-21 00:22:55 +02:00
Montel Laurent dd8cf0b678 normalize signal/slot 2013-05-11 14:09:15 +02:00
Fredrik Höglund 2f11f71930 kwin: Bind attributes to the same indices in all shaders
This saves us from having to look up the attribute locations each
time we update the vertex array state.
2013-05-08 18:37:39 +02:00
Fredrik Höglund 87ad8789f1 kwin: Update the GL1 code in GLVertexBuffer to match the VBO code
This saves two memory allocations in the GL1 path in setData().
2013-05-08 18:37:27 +02:00
Fredrik Höglund e1a33cec44 kwin: Don't reallocate the vertex buffer on every setData() call
Allocate enough space to hold the geometry for multiple draw calls,
and use glMapBufferRange() to gradually fill the buffer.  Once the
data store is full, it's orphaned and a new one is allocated.
2013-05-08 18:37:12 +02:00
Fredrik Höglund 0475559120 kwin: Use one buffer object in GLVertexBuffer
Store the vertex positions and texture coordinates in the same buffer
object. This saves one buffer allocation in every setData() call.

The attributes are also interleaved as they are uploaded into the buffer
to maximize locality of reference.
2013-05-08 18:37:02 +02:00
Fredrik Höglund e65f717b47 kwin/es: Resolve functions for GL_EXT_map_buffer_range 2013-05-08 18:36:50 +02:00
Fredrik Höglund b6585c2d8b kwin/es: Resolve functions for GL_OES_mapbuffer 2013-05-08 18:36:45 +02:00
Fredrik Höglund 11b9323f3d kwin: Resolve functions for GL_ARB_map_buffer_range 2013-05-08 18:36:38 +02:00
Fredrik Höglund 08d3b6cc3a kwin: Resolve more functions from ARB_vertex_buffer_object
This patch resolves:
    glMapBuffer()
    glUnmapBuffer()
    glBufferSubData()
    glGetBufferSubData()
2013-05-08 18:36:04 +02:00
Fredrik Höglund b7f1856a35 kwin: Fix color correction with GLSL 1.40 2013-05-08 18:33:03 +02:00
Fredrik Höglund 54308889f0 kwin: Bind fragdata locations in ShaderManager
Fragment shaders are expected to declare a vec4 fragColor output,
which will be bound to the first draw buffer.
2013-05-08 18:33:03 +02:00
Fredrik Höglund 54b63a85a6 kwin: Add GLSL 1.40 versions of the scene shaders
Adjust ShaderManager to load the 1.40 versions when GLSL 1.40
is supported.
2013-05-08 18:33:03 +02:00
Fredrik Höglund 79db2fc98a kwin: Move the scene shaders into shaders/1.10 2013-05-08 18:33:03 +02:00
Fredrik Höglund fe559c2f2c kwin: Refactor the ShaderManager code
This patch reduces code duplication and simplifies the code in general.
2013-05-08 18:33:03 +02:00
Fredrik Höglund 85a87bfcd1 kwin: Refactor GLShader to allow explicit linking
This patch adds a link() function, along with bindAttributeLocation()
and bindFragDataLocation().

These functions must be called after creating the program, but before
linking it.

A new ExplicitLinking flag must be passed to the constructor to prevent
automatic linking. This is to keep existing code working without
modifications.
2013-05-08 18:33:02 +02:00
Fredrik Höglund e0003db385 kwin: Resolve functions for GL_EXT_gpu_shader4 2013-05-08 18:33:02 +02:00
Fredrik Höglund 2bcad53bbb kwin: Resolve functions for GL_ARB_vertex_array_object 2013-05-08 18:33:02 +02:00
Fredrik Höglund 2b00beecd2 kwin: Don't require GL_ARB_shading_language_100
This version of GLSL is not supported in a core context.
2013-05-08 18:33:02 +02:00
Fredrik Höglund 5b80d8d513 kwin: Fix shader function resolution for core contexts 2013-05-08 18:33:02 +02:00
Fredrik Höglund cb81e11375 kwin: Fix FBO function resolution for core contexts 2013-05-08 18:33:02 +02:00
Fredrik Höglund 855a7cc897 kwin: Fix glActiveTexture() resolution for core contexts 2013-05-08 18:33:02 +02:00
Fredrik Höglund 1bcf95f3f9 kwin: Fix VBO function resolution for core contexts
Mesa doesn't advertise extensions that were core in 1.5 in an OpenGL
context that uses the core profile.
2013-05-08 18:33:02 +02:00
Fredrik Höglund 63e0d32706 kwin: Fix extension list query for core contexts
Use glGetStringi() to list the extensions when the GL version is 3.0
or greater. glGetString() does not accept the GL_EXTENSIONS token
in an OpenGL core context.
2013-05-08 18:33:01 +02:00
Fredrik Höglund d116ef6655 kwin/egl: Add defines for EGL_KHR_create_context 2013-05-08 18:33:01 +02:00
Fredrik Höglund aab026af93 kwin: Resolve functions for GLX_ARB_create_context 2013-05-08 18:12:43 +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
Jaime Torres 4ec0f64ea3 initialize a member and initialize a boolean
one less valgrind warning and one cppcheck warning less

REVIEW: 107603
2013-04-29 18:14:50 +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 0fb27fd12e Defines to create the boilerplate code for KWin's singleton classes
The define KWIN_SINGLETON adds to a class definition:

public:
    static Foo *create(QObject *parent = 0);
    static Foo *self() { return s_self; }
protected:
    explicit Foo(QObject *parent = 0);
private:
    static Foo *s_self;

There is an additional define KWIN_SINGLETON_VARIABLE to set a different
name than s_self.

The define KWIN_SINGLETON_FACTORY can be used to generate the create
method. It expands to:

Foo *Foo::s_self = 0;
Foo *Foo::create(QObject *parent)
{
    Q_ASSERT(!s_self);
    s_self = new Foo(parent);
    return s_self;
}

In addition there are defines to again set a different variable name and
to create an object of another inheriting class.

All the classes currently using this pattern are adjusted to use these
new defines. In a few places the name was adjusted. E.g. in Compositor
the factory method was called createCompositor instead of create.

REVIEW: 109865
2013-04-15 09:57:25 +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
Thomas Lübking 6fb5353cab remove moveResizeMaximized option
REVIEW: 103948
BUG: 91703
BUG: 299245
FIXED-IN: 4.11

- The setting is ignored, the decoration always gets a "true" for it
- moving a maximized window requires breaking a "strong" snap (1/16 of screen height - unless you use quick maximization)
- all snapping is done towards the client, not the frame
- QuickTileMode is exported to the decoration (just as the maximizeMode) so that it can fix the bordersize alongside that.
2013-03-24 22:26:48 +01:00
Thomas Lübking a5cce085af catch geometry updates of moving clients
and bind geometry change signals dynamically

REVIEW: 109570
2013-03-20 22:23:43 +01:00
Thomas Lübking 5299f728fe catch geometry updates of moving clients
and bind geometry change signals dynamically

REVIEW: 109570
(cherry picked from commit eb2db41304f1ec1e597e9bd282a9c4f0b7dd1e54)

Conflicts:
	kwin/libkwineffects/kwinanimationeffect.cpp
2013-03-20 22:23:41 +01:00
Martin Gräßlin 98a04893a6 Use mgraesslin@kde.org for my mail address in Copyright and AboutData 2013-03-12 13:17:53 +01:00
Martin Gräßlin fbc11aad13 Temporarily revert to XDisplayWidth/Height
We don't like broken master. Proper fix coming later on.

BUG: 316040
2013-03-11 15:14:21 +01:00
Martin Gräßlin 7ab5df9de8 Define GL_UNPACK_* for gles if not defined
Should fix build error in build.kde.org.
2013-03-11 12:36:40 +01:00
Martin Gräßlin 9206f530ce Adding support for GL_EXT_texture_format_BGRA8888 in GLES
If extension is present texture format BGRA_EXT is used for loading
textures from QImages.

REVIEW: 109090
2013-03-11 11:21:14 +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 6424a44632 Add some missing includes with Qt5/KF5 2013-03-07 13:59:16 +01:00
Martin Gräßlin 544b772e42 Use non obsoleted ctor for KXMessages 2013-03-07 13:59:16 +01:00
Martin Gräßlin 32b6ef42b9 Strip module path from all Qt #include <>
Done with:
fixqt4headers.pl --strip-modules

REVIEW: 109176
2013-03-06 10:26:56 +01:00
Martin Gräßlin b01f5684c5 Remove not needed includes from kwineffect header files
Only include what's actually needed in the headers. This causes of course
some additional needed includes in some implementation files.
2013-03-06 10:23:09 +01:00
Martin Gräßlin 5a2d14baf7 More fine grained linking than X11_LIBRARIES
Use X11_X11_LIB and actually needed additional libs instead of
everything coming with X11_LIBRARIES.

REVIEW: 109141
2013-03-06 10:14:21 +01:00
Martin Gräßlin c6be37bc84 Effects no longer need xfixes and xrender from XLib 2013-03-06 10:14:15 +01:00
Martin Gräßlin 928e5d4912 Split the libs we link to into multiple variables
Using a lib variable for:
* own libs
* qt libs
* kde libs
* xlib libs
* xcb libs

and link those groups together in target_link_libraries. This should
make the code easier to read and easier to support in future for some
time both Qt4 and Qt5.
2013-03-06 10:14:15 +01:00
Martin Gräßlin ea83a9c578 Cmake cleanup: empty endfoo() 2013-03-06 10:14:15 +01:00
Martin Gräßlin 5ea22e362d CMake Cleanup: empty endif 2013-03-06 10:14:15 +01:00
Thomas Lübking 39499de9cc add AnimationEffect::set() and ::cancel()
This will allow to sue the AnimationEffect class for
(temorarily) persistent changes like required by the
translucency effect

REVIEW: 109211
2013-03-05 19:24:30 +01:00
Martin Gräßlin 87b7ae2218 Fix compile error introduced with d6b3f698
I should be more careful when reordering commits in my local branches :-)
2013-02-27 11:55:21 +01:00
Martin Gräßlin e2cbe329c1 XCB port for kwinglobals.h
displayWidth/Height() are rewritten on top of XCB. rootWindow() and
xTime() return xcb datatype instead of XLib datatype.

Unfortunatelly it's not possible to cache the result for displayWidth and
Height, but getting the default screen is cached and provided in another
method.

REVIEW: 109177
2013-02-27 11:47:55 +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 e72fec3110 Cache the xcb_connection_t* in connection()
This is for two reasons:
1. Fixes crash on tear-down when XGetXCBConnection returns junk
2. In Qt5 getting the connection is not cheap enough for our uses

REVIEW: 108826
2013-02-14 14:21:11 +01:00
Martin Gräßlin f45ade7785 Port preMultiply of color to xcb_render
Method returns a xcb_render_color_t instead of an XRenderColor.

With this change kwinxrenderutils is XLib free!
2013-02-14 14:20:27 +01:00
Martin Gräßlin 881664b42e Port helper function createPicture to XCB
Uses query_pict_formats to retrieve all formats and iterates over them to
find the one matching the requested depth. Results are now cached in an
QHash with the depth as key instead of an array using the depth as index.
2013-02-14 14:20:27 +01:00
Martin Gräßlin 24c681448a Use XCB types in XRenderPicture API
Usage of xcb_pixmap_t and xcb_render_picture_t
2013-02-14 14:20:27 +01:00
Martin Gräßlin 7faede41c7 Use PutImage to convert QPixmap to XRenderPicture
In case of native graphics system nothing is changed for the moment - the
X11Pixmap-QPixmap bridge is continued to be used.

But in case of graphics system raster (or Qt5) this relationship is no
longer used. Instead the QPixmap is converted to a QImage and the image
bits are put into the created X11Pixmap for this XRenderPicture.

Note: Qt5 uses shm to transfer image data to drawables. This seems
unsuited in this case as it's only a one time transformation.

For Qt5 the native pixmap block needs to be removed and the ctor might be
changed to taking an QImage as argument to make more clear that there is
no mapping from QPixmap to X11Pixmap.
2013-02-14 14:20:27 +01:00
Martin Gräßlin f20ec15053 Port xRenderOffscreenTarget away from QPixmap
Instead of having a pointer to a QPixmap the offscreen target holds an
xcb_render_picture_t. To make this possible in SceneWindow the tempPixmap
is changed from a QPixmap* to a XRenderPicture*. QPixmap was only used
for convenience.

ScreenShot Effect as only user of the offscreen target is adjusted but
as it needs a QImage, still uses a QPixmap wrapper.
2013-02-14 14:20:27 +01:00
Martin Gräßlin a1ac6df20e Move XRender based rendering of unstyled EffectFrame into scene_xrender
This follows how it is done for OpenGL where the renderRoundBox() got
dropped some time ago.

New implementation implements the box with round corners using xrender
directly instead of using a QPainter on a QPixmap.
2013-02-14 14:20:26 +01:00
Martin Gräßlin 368de6842a Wrapper class to create an xcb_xfixes_region_t from a QRegion
Replaces the previously existing method to convert a QRegion which did
not take care of freeing the region again.

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

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

BUG: 255712
FIXED-IN: 4.11
REVIEW: 108670
2013-02-07 10:23:30 +01:00
Martin Gräßlin 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 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