Commit Graph

496 Commits (84954b9e4fa422d636512ff6374e5cc77275e976)

Author SHA1 Message Date
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
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 9f85f7f597 Port non-composited Outline to XCB
Use xcb to create and manage the X11 backend of Outline. In addition the
used background pixmaps are rendered with XRender instead of using a
QPainter on a QPixmap. This is done because QPixmap is no longer bound to
an X Pixmap.

To create the XRender Picture the available functionality from
kwinxrenderutils is used. To be able to use it in KWin core the compile
option to build without XRender is removed for kwinxrenderutils, but
still supported for effects.

Obviously the port to XCB is not complete as xremderutils itself is still
on XLib.

REVIEW: 108642
2013-02-04 08:55:21 +01:00
Martin Gräßlin 58019b9ce3 Merge branch 'KDE/4.10'
Conflicts:
	kwin/client.cpp
2013-01-30 15:16:56 +01:00
Martin Gräßlin 0c92e1f30c Use translucent/dialogs/background elements where possible
In effects it's obvious that compositing is enabled, so specifying the
translucent element is no problem.

In tabbox a context property "compositing" is injected which decides
whether "translucent" or "opaque" elements should be used. Here the
translucent elements are only used if the Blur effect is available - for
this a new Effect::Feature Blur is introduced and in addition it is
tested whether the theme provides the translucent element.

Also the masking is adjusted to ensure that only the shadow is not
blurred.

Reason for this change is that Plasma theme seems not always to pick up
whether compositing is used when used from inside KWin. It does not cover
the Desktop Change OSD which uses PlasmaCore.Dialog and there we cannot
(yet) inject that we use compositing.

Overall I'm quite unhappy with this patch and I do hope we can fix it in
the proper place in the lifetime of 4.10 and revert this patch.

CCBUG: 311995
REVIEW: 108438
2013-01-30 15:14:54 +01:00
Thomas Lübking c88742db98 fix copy and paste error
setting from because to is invalid is rather wrong
2013-01-30 13:06:59 +01:00
Thomas Lübking e2db836def Merge branch 'KDE/4.10'
Conflicts:
	kwin/client.cpp
2013-01-30 12:43:39 +01:00
Thomas Lübking 56cd3f8928 fix copy and paste error
setting from because to is invalid is rather wrong
2013-01-30 10:45:21 +01:00
Martin Gräßlin b967527db3 Use XCB to resolve the X11 Extensions
The extension handling is removed from kwinglobals and moved into the
xcbutils in KWin core in namespace KWin::Xcb. The motivation for this
change is that the Extensions are only used in KWin core and are marked
as internal. So there is no need to have them in the library.

What remains in Extensions are the non-native pixmaps. This will be
removed once we are on Qt 5 as QPixmap can no longer reference an XPixmap.

The remaining code in kwinglobals also still initialize the XLib versions
of extensions emitting events. It seems like there are no XEvents emitted
if not done so even if the extension is correctly initialized with xcb.
This needs to be removed once the event handling is ported over to xcb.

REVIEW: 107832
2013-01-22 07:50:03 +01:00
Martin Gräßlin 819b474a79 Introduce property "visible" on EffectWindow
This property can be used to check whether a window is currently visible
to the user, that is:
* not minimized
* on the current desktop
* on current activity

This is a common need for various effects.

REVIEW: 108341
2013-01-21 15:56:58 +01:00
Casian Andrei 7a6e48ef3b Fix premultiplied alpha issue with color correction
When correcting a color that was with premultiplied alpha, the alpha
value was not multiplied back again as a final step. This was breaking
color correction when the blend function was GL_ONE,
GL_ONE_MINUS_SRC_ALPHA. The blend function was changed for normal
windows (a workaround), but not for effect frames, i.e. the effect
frames were broken with color correction enabled.

Removes the blend function workaround.

Removes a useless setupForOutput.

BUG: 311319
REVIEW: 108189
2013-01-13 19:10:54 +02:00
Casian Andrei df034c16ad Abort color correction initialization and disable it in case of errors
Checks are now performed for GL errors and in case of errors everything
is aborted. The error handling mechanism introduced for this purpose
somewhat improves the color correction code.

Fix gl invalid operation in color correction, when first setting up the
lookup texture uniform.

REVIEW: 107754
2013-01-13 19:10:54 +02:00
Thomas Lübking d0dd23b7b7 Merge branch 'KDE/4.10' 2013-01-08 20:50:37 +01:00
Thomas Lübking b3f71b5986 protect list iterators against ext. manipulation
REVIEW: 108151
2013-01-08 20:47:50 +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
Martin Gräßlin 533d57da60 Mark most ctors as explicit as reported by Krazy2 checker 2013-01-02 18:35:46 +01:00
Martin Gräßlin 18cccad806 Introduce a templated animationTime overload for the KConfigXT case
This method can be used to get the animationTime in case a configuration
class generated through KConfigXT is used. In general the configuration
stores the magic value 0 for a property "duration". This magic value
indicates that a hard-coded default value should be used.

So the common logic to test the stored value for 0 and then either pass
the stored value or the default value to animationTime is encapsulated
in this method in a generic way.

A MyEffect can use it in the following way:
animationTime<MyEffectConfig>(200);

BUG: 310646
FIXED-IN: 4.10
REVIEW: 107460
2012-11-25 20:19:31 +01:00
Martin Gräßlin b2512b1479 Increase KWIN_EFFECT_API_VERSION_MINOR for 4.10 2012-11-22 12:49:22 +01:00
Ralf Jung 96bc979ca8 Fix buffer swap prototypes
BUG: 309647
REVIEW: 107302
2012-11-18 12:50:31 +01:00
Montel Laurent 7fb7f2b5e1 Merge branch 'master' of git.kde.org:kde-workspace 2012-11-14 21:43:42 +01:00
Montel Laurent 6d278c1665 Pedantic 2012-11-14 21:43:13 +01:00
Thomas Lübking 7bc5832429 use QELapsedTimer to measure animation delay
QElapsedTimer uses a monotic clock on all relevant systems
and is thus invarant against date/time changes (while the
bug was likely caused by daybreaks)

BUG: 306186
REVIEW: 107250
FIXED-IN: 4.10

use monitc clock
2012-11-14 21:16:32 +01:00
Casian Andrei 01adbe6dc5 Implement color correction (per output)
Add an option to kcmcompositing in the 'Advanced' tab, to enable or
disable color correction. It is specified that it's experimental and it
needs Kolor Manager.

Before painting for a particular screen, ColorCorrection::setupForOutput
should be called.

A screen property is added for WindowPaintData.

In kwinglutils, The fragment shaders are intercepted before being
compiled and they get a couple of lines of code inserted in order to do
the color correction. This happens only when color correction is enabled, of
course.

For D-Bus communication with KolorServer, everything is async.

The implementation basically manages a set of color lookup tables for
different outputs and for different window regions. These are taken via
D-Bus. Each lookup table has around 700 KB.

This commit reintroduces the changes from the former merge with the
"color2" branch. In this form, it can be easily reverted.

REVIEW: 106141
2012-11-13 22:47:09 +02:00
Casian Andrei 22569f7eb9 Remove forceAlpha uniform, which is no longer needed
This was originally added by d467fc1bdbcf69bd6ef213bd909633c2edfb6878,
to prevent alpha ending up to be 0 with blending disabled. Apparently,
that was a driver issue that is no longer present.

REVIEW: 107090
2012-11-13 22:23:18 +02:00
Casian Andrei a46d247702 Revert "Merge branch 'color2'"
This merge is incomplete and it does not include the review number of
the associated review request. It should have been pushed as a single
commit, because the merged commits were not intended to be published in
their form.

This reverts commit dcba90263069a221a5489b1915c5cf1ca39d090c, reversing
changes made to 50ae07525c7fde07794e7548c3d6e5a69cb1a89d.

Conflicts:
	kwin/scene_opengl.cpp
	kwin/scene_opengl.h
2012-11-13 22:19:32 +02:00
Martin Gräßlin 9308028fa4 Decoration can announce whether it currently requires an alpha channel
A decoration can provide the AbilityAnnounceAlphaChannel in addition to
AbilityUsesAlphaChannel. If this ability is provided the decoration can
enable/disable the use of the alpha channel through setAlphaEnabled().

The base idea behind this mechanism is to be able to tell the compositor
that currently alpha is not needed. An example is the maximized state in
which the decoration is fully opaque so that there is no need to use the
translucency code path which would render all windows behind the deco.

In addition also the blur effect honors this setting so that behind a
known opaque decoration no blurring is performed.

Oxygen is adjusted to disable translucency in maximized state and Aurorae
is adjusted to allow themes to enable/disable translucency. For Plastik
translucency and with that also blurring is disabled.

REVIEW: 106810
2012-11-09 10:36:43 +01:00
Kai-Uwe Behrmann 479be668d7 Merge branch 'color2'
Conflicts:
	kwin/libkwineffects/kwinglplatform.cpp
2012-11-07 23:54:18 +01:00
Fredrik Höglund bb9f59a89c kwin: Use xcb to optimize damage event handling
Use XDamageReportNonEmpty instead of XDamageReportRawRectangles.

In XDamageReportNonEmpty mode the server generates a single damage
event when the damage state transitions from not-damaged to damaged.
When the compositor is ready to paint the screen, it requests the
damage region for each window and resets the state to not-damaged.

With XCB we can request the damage regions for all windows in a
single roundtrip, making this the preferred mode.

This should reduce the number of wakeups and the time spent
processing damage events between repaints.
2012-11-07 22:17:14 +01:00
Fredrik Höglund 4821c15b97 kwin: Add a function that returns the xcb_connection_t 2012-11-07 22:13:12 +01:00
Fredrik Höglund 6e9901e5c3 Merge branch 'KDE/4.9'
Conflicts:
	kwin/eglonxbackend.cpp
	kwin/glxbackend.cpp
	kwin/libkwineffects/kwinglplatform.cpp
2012-10-30 23:26:06 +01:00
Fredrik Höglund e262d4fde6 kwin: Enable loose binding with the Intel driver 2012-10-30 18:23:06 +01:00
Fredrik Höglund 076ea58732 kwin: Rename numberVertices to vertexCount 2012-10-29 21:31:35 +01:00
Fredrik Höglund 82c1e1168d kwin: Store the usage hint in GLVertexBufferPrivate
..instead of computing it every time setData() is called.
2012-10-29 21:31:35 +01:00
Christophe Giboudeaux 007733f14a Fix include 2012-10-29 17:20:19 +01:00
Martin Gräßlin 26a9a35b2f Increase runtime requirement to Mesa 8.0
Adjustment to reality. KWin has had a dependency on Mesa 8.0 for quite
some time given that it is what basically all distributions ship.

It is better to clearly state what is required. For KWin Mesa 8.0 is a
more reliable dependency as all DRI drivers which do not support DRI2
have been removed.

Packagers have been informed about this intended change some weeks ago.

REVIEW: 106799
2012-10-25 11:45:36 +02:00
Martin Gräßlin 57c27c2e0b GLPlatform can recommend the compositor to use
During detecting the OpenGL capabilities also a recommended compositor
can be set. This recommendation is honoured by the OpenGL based
compositors. That is the SceneOpenGL2 requires a recommendation for at
least OpenGL2 and the SceneOpenGL1 requires at least a recommendation for
OpenGL1. If the driver recommends XRender compositing the SceneOpenGL
performs the existing fallback to XRender.

With this recommendation the hacks in the Scene are removed, e.g. it is
no longer checked whether the driver is software emulation as that is
provided through the recommendation.

To overrule the recommendation the environment variable KWIN_COMPOSE is
extended by the values O1 and O2 to enforce either OpenGL 1 or OpenGL 2.
This overwrites all other checks. As a side-effect this allows now to run
KWin on the llvmpipe:
LIBGL_ALWAYS_SOFTWARE=1 KWIN_COMPOSE=O2 kwin --replace &

But not that I would recommend to use it :-)

REVIEW: 106741
2012-10-25 11:40:18 +02:00
Martin Gräßlin cf5de22586 Introduce a build option KWIN_BUILD_OPENGL_1_COMPOSITING
If the build option is enabled KWIN_HAVE_OPENGL_1 is passed as a compile
flag when build against OpenGL.

This compile flag is meant to replace the KWIN_HAVE_OPENGLES. So far code
has been ifdefed for special behavior of OpenGL ES 2.0 and to remove
fixed functionality calls which are not available in OpenGL ES 2.0.

With this build flag the fixed functionality calls which are only used in
the OpenGL1 Compositor can be removed and keeping the KWIN_HAVE_OPENGLES
for the real differences between OpenGL 2.x and OpenGL ES 2.0.

E.g. a call like glColor4f should be in an
glColor4f(1.0, 1.0, 1.0, 1.0);

while a call like glPolygonMode should be in an
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

Building for OpenGL ES 2.0 of course implies that KWIN_HAVE_OPENGL_1 is
not defined.
2012-10-25 11:34:12 +02:00
Martin Gräßlin e84118d9f8 Add detection support for VMware driver (SVGA3D) to GLPlatform
VMware uses a Gallium driver which means that OpenGL based compositing
works out of the box without any adjustments to GLPlatform.

Just adding recognizing code for the SVGA3D driver.

REVIEW: 106826
2012-10-25 11:27:42 +02:00
Martin Gräßlin 388edab9e5 Add support for OpenGL in VirtualBox
OpenGL is properly working if there is a direct rendering context.
If LIBGL_ALWAYS_INDIRECT is set VirtualBox falls back to Mesa's software
rasterizer. So in order to get OpenGL the driver is now whitelisted in
the opengltest.

GLPlatform is extended to recognize the VirtualBox driver and has new
methods to report whether it is a virtual machine and VirtualBox. The
detection is rather limited as we don't get access to the underlying
hardware, so we do not know whether the features are really supported.
We need to trust the driver here in announcing the right extensions.

The driver does not provide glxQueryDrawable although it is part of
GLX 1.3. A hack is added in the glxbackend to set the function pointer to
NULL. This can unfortunately not be done in glxResolveFunctions() as
QueryDrawable seems not to be provided by an extension (at least not
listed in the OpenGL registry) and getProcAddress resolves a function but
it only prints an OpenGL Warning to stderr.

As a note: the driver reports that it is using XSHM for
GLX_EXT_texture_from_pixmap.

REVIEW: 106821
2012-10-25 11:27:28 +02:00
Martin Gräßlin 711b434970 Detect latest Intel hardware in GLPlatform
Added support for IvyBridge and Haswell.

REVIEW: 106819
2012-10-25 11:27:14 +02:00
Jurica Vukadin bcdc74f8d6 Fix more C++11 narrowing warnings
REVIEW: 106997
2012-10-24 20:43:19 +02:00
Jurica Vukadin e68955866d Fix C++11 narrowing warnings
REVIEW: 106992
2012-10-24 20:42:14 +02:00
Martin Gräßlin e962fd9ce2 Typo--
SVN_SILENT
2012-10-12 08:43:34 +02:00
Martin Gräßlin ba08ff6a14 Fix build error when GLES is not available
Note to me: always rebuild with all possible build options if something
is changed.

Sorry for the inconvenience and thanks to the early report of the issue.

BUG: 307866
FIXED-IN: 4.10
2012-10-06 13:44:12 +02:00
Martin Gräßlin 476adac337 Do not resolve glx functions specified in GLX 1.3
According to the OpenGL ABI for Linux GLX 1.3 is a minimum requirement.
Therefore we do not need to resolve the symbols which are present in that
version.

KWin did always require at least 1.3, for all the resolved functions
there were checks in the Scene, but they might have been incorrect.
Instead now the GLX version is checked and OpenGL compositing is blocked
if there is not at least GLX 1.3.

REVIEW: 106704
2012-10-04 17:17:51 +02:00
Martin Gräßlin 15d714d82c Do not resolve glBlendColor
glBlendColor has been added to OpenGL 1.2 which means it is part of
the OpenGL ABI defined for Linux.

See http://www.opengl.org/registry/ABI/ section 3.4.
2012-10-04 17:17:45 +02:00
Martin Gräßlin cf35c26396 Rework the resolving of OpenGL function pointers
The macro GL_RESOLVE_WITH_EXT was fundamentally broken as it tried to
resolve a symbol first by it's name and then by the extension name if
the returned pointer is null.

From GLX spec:
"A non-NULL return value for glXGetProcAddress does not guarantee that an
extension function is actually supported at runtime. The client must also query
glGetString(GL EXTENSIONS) or glXQueryExtensionsString to determine if an
extension is supported by a particular context."

This macro is now reworked to be used only in case the symbol name does
not match our function name. E.g. glUniform1f vs glUniform1fARB.

The resolving itself also had quite some issues as:
* in same cases function pointers are not nulled
* in same cases only the arb or only the ext is checked
* in same cases the wrong extension is checked

This is now reworked to always check first the ARB extension if available
then the EXT extension and if both are not available the pointers are set
to NULL.
2012-10-04 17:17:45 +02:00
Martin Gräßlin a401558a43 Provide OpenGL over Egl
The Egl backend is decoupled from the OpenGL ES build option which makes
it possible to use it as a replacement for glx.

To make this possible a new build flag is added when egl is available at
compile time and any egl specific code is now ifdefed with this flag
instead of the gles flag. In addition at runtime a windowing system enum
value is passed to the various detect methods to have egl/glx specific
detection for e.g. function pointer resolving.

By default egl is used if compiled with OpenGL ES, otherwise glx is used.
But in the non-gles case the windowing system can be selected through the
new environment variable KWIN_OPENGL_INTERFACE. Setting this variable to
"egl" the EglOnXBackend is used.

REVIEW: 106632
2012-10-04 17:17:01 +02:00
Martin Gräßlin c2a4f81927 Introduce a helper class to automatically push/pop Shaders
The ShaderBinder class can be used for the case that a block of code
should be executed with a given Shader being bound. This is useful for
all the cases where there is a if-block for OpenGL2 execution with a
Shader being pushed in the first line to the ShaderManager and popped in
the last line of the block. With the helper this can be simplified to:

ShaderBinder binder(myCustomShader);

or

ShaderBinder binder(ShaderManager::GenericShader);

The ctor of ShaderBinder pushes the given Shader to the stack and once
the helper goes out of scope it will be popped again from the stack.

In addition the helper can take care of OpenGL 1 compositing, that is it
just does nothing. So it can also be used where there is a shared OpenGL1
and OpenGL2 code path where the Shader should only be pushed in OpenGL2.
This basically removes all the checks for the compositing type before
pushing/popping a Shader to the stack.

REVIEW: 106521
2012-09-29 15:33:57 +02:00
Martin Gräßlin f9a2ecbf33 Do not use ShaderManager::isValid to check for OpenGL2 compositing
The main usage of ShaderManager::isValid was to have OpenGL2 specific
code pathes. Now we have an actual OpenGL2Compositing type and we know
that the ShaderManager is valid if we have this compositing type and we
know that it is not valid on OpenGL1Compositing. This gives us a much
better check and allows us to use the isValid method just for where we
want to check whether the shaders compiled successfully.

In addition some effects require OpenGL2, so we do not need to check
again that the ShaderManager is valid. Such usages are removed.
2012-09-29 15:33:57 +02: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
Casian Andrei 2dcf424d63 CC: Enable cc with OpenGL ES >= 3 (should support 3d textures) 2012-09-23 12:40:20 +03:00
Casian Andrei 8341d4406b Merge remote-tracking branch 'origin/master' into color2
Results in cleaner changes.
Put all the color correction stuff from SceneOpenGL in SceneOpenGL2.

Conflicts:
	kwin/eglonxbackend.cpp
	kwin/glxbackend.cpp
	kwin/scene.h
	kwin/scene_opengl.cpp
	kwin/scene_opengl.h
2012-09-23 11:57:38 +03:00
Martin Gräßlin 5a6d9400b2 Split SceneOpenGL into a concrete SceneOpenGL1 and SceneOpenGL2
SceneOpenGL turns into an abstract class with two concrete subclasses:
* SceneOpenGL1
* SceneOpenGL2

It provides a factory method which first creates either the GLX or EGL
backend which is passed to a static supported() method in the concrete
sub classes. These method can test whether the backend is sufficient to
be used for the OpenGL version in question. E.g. the OpenGL 2 scene
checks whether the context is direct.

The actual rendering is moved into the subclasses with specific OpenGL 1
and OpenGL 2 code. This should make the code more readable and requires
less checks whether a Shader is bound. This is now known through the
Scene: the OpenGL1 scene will never have a shader bound, the OpenGL2 scene
will always have a shader bound.

To make this more reliable the ShaderManager is extended by a disable
method used by SceneOpenGL1 to ensure that the ShaderManager will never
be used. This also obsoletes the need to read the KWin configuration
whether legacy GL is enabled. The check is moved into the supported
method of the OpenGL2 scene.

REVIEW: 106357
2012-09-16 21:28:11 +02:00
Casian Andrei ba4cd78419 CC: Redo init and uninit, try to avoid fatal IO errors
Additional checks for GL errors.
Attempt to fix transparency issues again.
2012-09-16 16:30:35 +03:00
Casian Andrei 87515dc9a9 Merge remote-tracking branch 'origin/master' into color2
Conflicts:
	kwin/workspace.cpp
2012-09-16 13:42:45 +03:00
Fredrik Höglund f21ef431c4 kwin: Don't enable/disable texturing when using shaders
This state has no affect on the programmable pipeline.
2012-09-13 22:54:09 +02:00
Casian Andrei 5247c56f5e CC: Fix unused variable warning 2012-09-04 22:01:07 +03:00
Casian Andrei f211961064 CC: Fix premultiplied alpha issue 2012-09-04 21:55:37 +03:00
Casian Andrei 6f18533b9c CC: Remove useless check for minimum number of texture units 2012-08-27 17:35:25 +03:00
Casian Andrei 7742e9d852 CC: Remove useless enabling and disabling for gl_texture_3d 2012-08-27 17:35:05 +03:00
Casian Andrei c2bed6d20e CC: Fix texture clamp issues 2012-08-27 17:30:13 +03:00
Casian Andrei 005ab28ad6 CC: No singleton for ColorCorrection 2012-08-27 17:24:30 +03:00
Casian Andrei 34bcf10c51 CC: Remove unused code related to regions, until they get implemented 2012-08-27 15:48:18 +03:00
Casian Andrei c42797637b CC: Constify d_ptr 2012-08-27 15:34:51 +03:00
Casian Andrei 2afa88a889 CC: int instead of qint32 2012-08-24 17:08:11 +03:00
Casian Andrei a417888b0e Implement color correction support
The implementation consists of a class in libkwineffects.

There are some slight modifications in the compositor. Regions for
different outputs are drawn at different times.

Currently only per output color correction is implemented. However, the
grounds are prepared for implementing per window color correction
easily.

The ColorCorrection class needs to communicate via D-Bus with a KDED
module, KolorServer, which is a part of KolorManager.

The only visible part for the user consists of a check box in the
advanced tab for the compositing KCM.

The actual correction is done by injecting a piece of code in the
fragment shader, code that does a 3D lookup into a special color lookup
texture. The data for these textures is obtained from KolorServer. All
D-Bus calls are async.
2012-08-20 20:37:25 +03:00
Martin Gräßlin f775229a80 Don't use GL Matrix Stack on OpenGL 2 backend
Currently the GL Matrix Stack is also used with OpenGL 2.
That is pushMatrix, multMatrix and popMatrix are executed
although this does not influence the rendering at all. The
OpenGL 1 matrices are not passed to the shaders.

With this change the calls to the matrix stack are no longer
executed if the Shader based backend is used. This means we
have a few less matrix multiplications in the rendering.

Mostly affects a few effects which have not yet completely be
ported over to OpenGL 2.

BUG: 303093
FIXED-IN: 4.10
REVIEW: 105455
2012-07-22 10:17:12 +02:00
Martin Gräßlin c7262e8bd3 Getter/setters for opacity, saturation and brightness in WindowPaintData
The public member variables for opacity, saturation and brightness
are removed in favor for getter and setters. The variables are
moved into a private class. Those are now qreal instead of double.

To make usage inside the effects easier a multiply method is added
which multiplies the current value with passed in factor and returns
the new value in a functional programming style.

This commit is the top-most of a patch series to refactor
ScreenPaintData and WindowPaintData. Other related commits are:
* 0811772
* ebdc7ec
* 2c8dd8d
* 7699726
* 68e0201
* 611cb09

REVIEW: 105141
BUG: 303314
FIXED-IN: 4.10
2012-07-19 18:25:48 +02:00
Martin Gräßlin f723f132ca Drop support for explicit contents opacity from WindowPaintData
No effect has ever made use of contents opacity. Which means it
is not needed. Removing means faster effects as we used to
multiply the value (always 1.0) with the opacity in each frame
for each window.
2012-07-19 18:25:03 +02:00
Martin Gräßlin dd067b075b Split out common part of ScreenPaintData and WindowPaintData
New common d-pointered class PaintData is added which cannot
be instantiated.
2012-07-19 18:25:03 +02:00
Martin Gräßlin a2b0d42916 Replace translation by QVector3D in Screen/Window PaintData 2012-07-19 18:25:03 +02:00
Martin Gräßlin 0eff12eb92 Use QGraphicsScale for scale information in ScreenPaintData 2012-07-19 18:25:03 +02:00
Martin Gräßlin 966047ccd2 Replace custom RotationData with QGraphicsRotation 2012-07-19 18:25:03 +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
Martin Gräßlin 13fcc29d40 Reset error flag in checkGLError
From API doc:
glGetError should always be called in a loop, until it returns
GL_NO_ERROR.

REVIEW: 105127
2012-06-24 18:34:47 +02:00
Thomas Lübking 759eed1d62 remove (broken) mimpmap support check, disable use of mipmaps and align texture filter
BUG: 296289
FIXED-IN: 4.9
REVIEW: 105249
2012-06-18 22:11:28 +02:00
Martin Gräßlin a210b75009 Initialize variables in GLPlatform
m_textureNPOT and m_limitedNPOT have not been initialized in the ctor resulting in
m_limitedNPOT being incorrectly being true sometimes for Intel drivers. For other
drivers the value had been set.
2012-06-13 09:19:27 +02:00
Andre Woebbeking 6cde471ec8 -pedantic 2012-06-07 00:38:13 +02:00
Martin Gräßlin 812c310dcf Fix unused variable warnings
SVN_SILENT
2012-05-27 16:35:04 +02:00
Thomas Lübking fc665106c9 Swap vsync order, trade in 1frame lag
REVIEW: 103058
2012-05-17 11:41:26 +02:00
Thomas Lübking 41a39a9928 add clipping support to AnimationEffect
REVIEW: 104898
2012-05-10 19:35:13 +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
Ghislain MARY c66c78f1d2 Key Bindings for Switching between Windows of current Application
Additional TabBox Mode which allows to switch between all open
windows of the current selected application. By default Alt+tilde
is used which is on qwerty just one key above tab. For non-qwerty
layouts the shortcut is unfortunately not convenient.

REVIEW: 104730
FEATURE: 299308
FIXED-IN: 4.9.0
2012-05-10 09:53:10 +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 c67ba0fafb change animationEnded signature 2012-05-03 17:53:02 +02:00
Thomas Lübking 590d9b42d8 restrict animationeffect repaints
REVIEW: 103932
2012-05-03 17:52:49 +02:00
Martin Gräßlin eb5aa92746 Revert 236d4c8 for EffectsHanlder::effectConfig
EffectConfig is used also in the config modules which
means kwinrc needs to be explicitly specified.

BUG: 299163
REVIEW: 104808
2012-05-02 17:44:55 +02:00
Philipp Knechtges 05a8777edf kwin: adding proper clipping for transformed windows
This patch kind of reintroduces the old PaintClipper functionality.

REVIEW: 104397
2012-05-01 23:19:04 +02:00
Martin Gräßlin bb5dce0e3b Use KGlobal::config() instead of specifying kwinrc
Inside KWin we can just use the global configuration
instead of manually opening kwinrc which is just the
same.

REVIEW: 104754
2012-04-29 21:55:45 +02:00
Martin Gräßlin ed7d612ef3 Ensure that Extension::init() is only performed once
And call init from Workspace ctor before it gets called
somewhere else (e.g. in the compositor).

REVIEW: 104578
2012-04-22 22:29:17 +02:00
Philipp Knechtges 93b2674313 kwin: dropping several gl(Push|Pop)(Attrib|Matrix) calls
This makes kwin in OpenGL2 mode more coherent with kwin_gles.
Despite some fullscreen effects they should now make the same
(pure) OpenGL calls.

REVIEW: 103804
2012-04-19 21:01:46 +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
Martin Gräßlin 27643f5a9e Drop kephal dependency from KWin
Kephal has turned into not being more than a wrapper around
QDesktopWidget and does not even provide syntax sugar.

REVIEW: 104427
2012-04-01 08:11:57 +02:00
Christoph Thielecke 99b233e2ed define missing defines if nessary 2012-03-22 15:10:30 +01:00
Thomas Lübking 5e2414544f add offscreen render support to xrender
REVIEW: 104151
cherry-picked from b9534b4ca82973c2e99451b2e151241fd1b6e7cb
2012-03-21 00:35:31 +01:00
Martin Gräßlin 875df96143 Fix exporting of EffectWindowList to scripts 2012-03-12 21:37:42 +01:00
Martin Gräßlin d0beb0b9a2 Make some EffectsHandler methods scriptable 2012-03-12 21:37:41 +01:00
Martin Gräßlin a8d3732240 Adding properties to EffectsHandler 2012-03-12 21:37:41 +01:00
Martin Gräßlin 3af37460f8 Make minimize EffectWindows work through scripting 2012-03-12 21:37:41 +01:00
Martin Gräßlin 98dd3ead43 Make some EffectWindow methods scriptable 2012-03-12 21:37:41 +01:00
Martin Gräßlin 8a74ad380c Some more properties for EffectWindow 2012-03-12 21:37:41 +01:00
Martin Gräßlin e3aaf017c0 Make EffectWindow's activities available to scripts 2012-03-12 21:37:41 +01:00
Martin Gräßlin 5c02d0e41b Define Q_PROPERTIES for EffectWindow 2012-03-12 21:37:40 +01:00
Martin Gräßlin e824412535 Export FPx2 to scripted effects
Simplifies the API. An FPx2 can be defined as a single real value
or a complex object with two real values:
{
value1: 1.0,
value2: 2.0
}
For a default ctor a null value can be used.
2012-03-12 21:37:40 +01:00
Martin Gräßlin 5592dffb48 JavaScript bindings for KWin effects
Scripted effects follow the Plamsoid package structure and the effect
loader recognizes a scripted effect at the according line in the desktop
file. If it is a scripted effect a different loader is used which
instantiates an object of the ScriptedEffect class. This class inherits
the AnimationEffect and exports the animate method and the EffectsHandler.
2012-03-12 21:37:40 +01:00
Martin Gräßlin 2007a7eab8 Use namespaced parameters in signals
Required to get scripting bindings working.
2012-03-12 21:37:40 +01:00
Martin Gräßlin e8a038d66f More getters for GlPlatform
A few more getters for parsed information are added to GlPlatform.
This includes the driver information retrieved through glGetString
and information like direct rendering and loose binding.

Additionally the methods to convert version, driver and chipClass
to string are added to the public interface.

These changes allow parts outside GlPlatform to get the same debug
information about the GL system.
2012-03-04 15:21:10 +01:00
Montel Laurent b8478624aa Fix warning 2012-03-02 13:58:39 +01:00
Martin Gräßlin 711fd0b876 Drop include for config-workspace.h
None of the definitions is used anywhere in kwin.
REVIEW: 104081
2012-02-26 17:23:19 +01:00
Thomas Lübking d73f2f25ab Revert "restrict AnimationEffect repainting"
Fun with git/rebase ...

This reverts commit ff167657282c8e424984155018a4f4113870c34f.
2012-02-12 17:34:47 +01:00
Thomas Lübking 39fb788103 restrict AnimationEffect repainting
BUMPs Effect API to 183
2012-02-12 17:29:01 +01:00
Philipp Knechtges 239d5757f2 kwin: move/resize events shall not force a repaint of all layers
This patch adds a new function Toplevel::addLayerRepaint, that in contrast
to addWorkspaceRepaint does not invalidate every blur texture cache that
overlaps with that region. As the name suggests it rather invalidates the
to the window associated layer at that position. This is especially useful
in the case of move/resize events in combination with oxygen-transparent,
where the altered window is almost always the topmost window and the blur
texture cache of the windows underneath are unchanged.

For the case of fully opaque windows the behaviour of addLayerRepaint
and addWorkspaceRepaint should be same.

REVIEW: 103906
2012-02-12 16:57:12 +01:00
Thomas Lübking 85635dd485 fix tabbing
BUG: 290959
BUG: 265160
BUG: 229292
BUG: 238279
BUG: 290758
BUG: 222831
BUG: 278275
BUG: 245747
BUG: 230000

BUG: 253697
BUG: 230570
BUG: 265977
BUG: 225337
BUG: 225339

REVIEW: 103855
2012-02-11 16:30:22 +01:00
Thomas Lübking bf88ec09ac Revert "fix tabbing"
pushed out of branch, not master - leading to absent revision, found hash collision??

This reverts commit 94b2ad7b85801e37e2df4671cdc4f26b6d7e5506.
2012-02-11 16:29:14 +01:00
Thomas Lübking d245035a17 fix tabbing
BUG: 290959
BUG: 265160
BUG: 229292
BUG: 238279
BUG: 290758
BUG: 222831
BUG: 278275
BUG: 245747
BUG: 230000

BUG: 253697
BUG: 230570
BUG: 265977
BUG: 225337
BUG: 225339

REVIEW: 103855
2012-02-11 16:01:41 +01:00
Philipp Knechtges ba39d1f917 kwin:remove PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS
paintSimpleScreen can handle the affected effects now.

REVIEW: 103827
2012-02-09 14:52:25 +01:00
Martin Gräßlin 9c174905d3 Merge branch 'KDE/4.8' 2012-02-04 11:24:49 +01:00
Martin Gräßlin 90e59121dc Properly detect SandyBridge chipsets in GLPlattorm 2012-02-04 11:24:18 +01:00
Philipp Knechtges f5b5e5c8d0 kwin: cleaning up the GLTexture API 2012-01-31 23:10:58 +01:00
Philipp Knechtges 87bcabdf99 kwin: improving the texture update handling
This patch changes the behavior of strictly bound textures such that
they are only updated if the corresponding window has been damaged.
Additionally GLTexture now keeps track of the current filter and
wrapmode setting.

REVIEW: 103655
2012-01-31 23:09:58 +01:00
Martin Gräßlin 128ab01c8f Use invoke method for addRepaint* methods
REVIEW: 103567
2012-01-27 08:28:37 +01:00
Martin Gräßlin a38faa4329 Add visibleInClientGroup property 2012-01-27 08:25:21 +01:00
Martin Gräßlin 20add1c656 Add property shaped for hasOwnShape method
Inclusive notify signal.
2012-01-27 08:24:15 +01:00
Martin Gräßlin bfdcbe60f5 Turn isManaged and isDeleted into properties on Toplevel
Property invokes virtual methods returning false by default. Deleted
reimplements the isDeleted and returns true. Client returns true for
isClient. Method is not called isManaged as this is already used
inside Client.
2012-01-27 08:21:53 +01:00
Martin Gräßlin 18f64bd36d Use invokeMethod for closeWindow 2012-01-27 08:21:52 +01:00
Martin Gräßlin a348df0d34 Use properties in EffectWindow where possible instead of inheritance
If possible use the property to Toplevel or Client instead of the
pure virtual methods. This makes it easier to get a stable ABI.
Adding new methods to the class no longer requires to add a pure
virtual method.

From a performance point of view this change should not matter.
Most EffectWindow methods are not invoked during the repaint chain.
But only in response to an event like a window got added. There the
overhead does not really matter as well the previous implementation
made strong use of dynamic casts which are also not knwon for being
very fast.
2012-01-27 08:21:52 +01:00
Martin Gräßlin 3c59983589 EffectWindow becomes a QObject 2012-01-27 08:21:52 +01:00
Thomas Lübking d845b60c6c change geometry w/o compositor restart
This possibly fails on some (older?) ati chip/driver combos
-> Waiting for bugreports

REVIEW: 103246
2012-01-24 22:27:15 +01:00
Dario Freddi fb090a76d2 Merge branch 'KDE/4.8' 2012-01-17 04:45:17 +01:00
Thomas Lübking 2062b8eabd Nanny the Sun compiler by an explicit cast ;-)
BUG: 291690
2012-01-16 22:11:46 +01:00
Philipp Knechtges 050d991cb1 kwin: simplifying paintSimpleScreen
This patch reduces the number of QRegion and WindowQuadList operations
by drawing the opaque and translucent parts of the window within the
same bottom to top pass.

REVIEW: 103671
2012-01-11 18:04:28 +01:00
Thomas Lübking 5b40492a84 add support for graphicssystem selection
REVIEW: 103430
CCBUG: 289904
(cherry picked from commit ded4ed4e9dc32316c41a43b6e906bece4b92338f)
2012-01-02 18:56:21 +01:00
Thomas Lübking 0b23c516a7 add support for graphicssystem selection
REVIEW: 103430
CCBUG: 289904
2012-01-02 18:53:20 +01:00
Martin Gräßlin 11be6d5b40 Fix typos
SVN_SILENT
2012-01-01 09:26:27 +01:00
Martin Gräßlin 5c6febf147 Use Q_SLOTS instead of slots
Krazy wants it that way.
SVN_SILENT
2012-01-01 09:23:48 +01:00
Martin Gräßlin 6e445fb75c Less unused parameter/variable warnings in kwin
SVN_SILENT
2011-12-31 15:08:54 +01:00
Thomas Lübking daf4255f1b call animationEnded when the animation ended... 2011-12-10 21:26:21 +01:00
Philipp Knechtges 9e2b6edf02 kwin: bugfix nouveau GLES + loose texture bindings in kwin_gles
There seems to be a problem with nouveau GLES if you want to create an
EGLImageKHR more than once in a frame for the same pixmap. This patch
circumvents the problem in the way that it implements tfp the same way
as the mesa example in
mesa/demos/src/egl/opengles1/texture_from_pixmap.c does it. A nice
side effect of this is that it also avoids the overhead of recreating
the texture for every damaged window.

REVIEW: 103303
2011-12-01 22:38:20 +01:00
Thomas Lübking e022efe2a2 pick bottomRight as current hook, cannot be < 0 (ie. no position transform in this direction) 2011-11-29 22:56:56 +01:00
Thomas Lübking 82bf9d2d44 deny glsl by limited NPOT, not GLSL
BUG: 278828
REVIEW: 103283
2011-11-29 21:11:11 +01:00
Thomas Lübking 5f9f4db401 export AnimationEffect class, add non float Point/Size construtors to FPx2
CCMAIL:kde-bindings@kde.org
This API change is in the kwin effect library and probably not of interest
2011-11-24 20:17:19 +01:00
Fredrik Höglund 965feeb9f3 kwin: fix glBlitFramebuffer resolution
This function is also provided by GL_ARB_framebuffer_object.
2011-11-09 18:03:10 +01:00
Fredrik Höglund d858df569c kwin: Update a quirk for Gallium drivers in Mesa 7.10
The bug that prevented loose binding from working should be
fixed in Mesa 7.10.1.
2011-11-09 18:02:06 +01:00
Thomas Lübking d3331eed9c export the baseincrement size to the effectwindow and utilize it in the windowgeometry effect
BUG: 283518
REVIEW: 103033
FIXED-IN: 4.8
2011-11-03 21:49:20 +01:00
Montel Laurent 98b843e51f Fix compile with strict iterator 2011-10-30 20:29:28 +01:00
Thomas Lübking 67e79ea13a Add AnimationEffect class
REVIEW: 102922
2011-10-27 21:40:14 +02:00
Pierre-Loup A. Griffais 7fff9705b4 kwin-gles: define EGL_POST_SUB_BUFFER_SUPPORTED_NV if it's not there
This fixes the build with older versions of eglext.h.

REVIEW: 102915
2011-10-19 20:15:40 +02:00
Pierre-Loup A. Griffais 2570e9ec61 kwin-gles: add support for EGL_NV_post_sub_buffer
The EGL path had no support for presenting sub-regions of the screen, we can
leverage EGL_NV_post_sub_buffer for that. This wouldn't be a win if we didn't
have to opt-out of flipping.

REVIEW: 102889
2011-10-17 20:27:23 +02:00
Pierre-Loup A. Griffais 5971daf1c6 kwin-gles: check for EGL_image OR EGL_image_base + EGL_image_pixmap
EGL_KHR_image is a functional superset of both EGL_KHR_image_base and
EGL_KHR_image_pixmap, which were split off later to allow the former to be
more modular. Older drivers might only expose EGL_KHR_image if they were
released before the split happened.

REVIEW: 102879
2011-10-17 20:25:36 +02:00
Martin Gräßlin fb2fbed035 Generate texture coordinates for limited NPOT support
Fixes rendering issues with R300 and similar GPUs. If the texture
uses GL_TEXTURE_RECTANGLE_ARB as target the tex coordinates need
to be adjusted. This at least fixes missing text on EffectFrames
with graphicssystem native on R300. Hopefully more issues are
resolved by the change.

BUG: 269576
CCBUG: 282882
FIXED-IN: 4.7.3
2011-10-15 14:14:44 +02:00
Thomas Lübking 51ef7518dd add EffectWindow::windowType 2011-09-25 15:08:35 +02:00
Philipp Knechtges ef9aeafe0d kwin: Optimizing Blur Part II
This patch adds an optional texture cache to the blur effect such that damaged windows in
front of the blurred region dont trigger a repaint of the whole blurred region which pretty
often results in a avalanche repaint of nearly the whole screen.

REVIEW: 101977
2011-09-18 02:01:31 +02:00
Martin Gräßlin 309b94c10e Add newline at end of file
KRAZY--
SVN_SILENT
2011-08-31 18:16:21 +02:00
Martin Gräßlin 31386d2f25 Drop unused variables
SVN_SILENT
2011-08-31 17:55:04 +02:00
Martin Gräßlin fe4329a252 Only call active effects in the effect chain
Each effect is able to declare itself as currently being active,
that is transforming windows or painting or screen or doing anything
during the current rendered frame.

This change eliminates the hottest path inside KWin identified by
callgrind.

REVIEW: 102449
2011-08-29 07:06:58 +02:00
Martin Gräßlin 5b0d1739c2 Constify methods in MotionManager 2011-08-29 07:06:57 +02:00
Andre Woebbeking 88a33c67c4 -pedantic 2011-08-27 09:31:38 +02:00
Martin Gräßlin 225c362a04 Add support for framebuffer blit extension
Resolving of blit function and method in GLRenderTarget to blit
from the framebuffer to the RenderTarget.

REVIEW: 102354
2011-08-20 10:58:27 +02:00
Martin Gräßlin b016b618b5 Ignore driver checks for GLSL and limited GLSL on GLES
Makes KWin support OpenGL ES on the ExoPC.
2011-08-19 21:32:33 +02:00
Philipp Knechtges 4f50a8df3c kwin: Implement "use by value" and implicit sharing for GLTexture.
Additionally:
- hide the GLTexture implementation using dpointers
- drop the unused function SceneOpenGL::Texture::optimizeBindDamage()
- Texture::load now loads a new texture and does not update the existing one

REVIEW: 101999
2011-08-14 17:08:54 +02:00
Martin Gräßlin 9c2d6f8fdc Drop hacks for gcc-3.3.3
According to Thiago minimum supported gcc is 4.2.
2011-08-14 08:59:51 +02:00
Martin Gräßlin b17edd2d05 Cleanup libkwineffects/CmakeLists.txt
* we always have OpenGL(ES) - no need to check for it
* we always have the X extensions used by kwineffects
2011-08-13 16:46:44 +02:00
Martin Gräßlin f5a187d224 Remove KWIN_HAVE_OPENGL from kwingl(es)utils
Yes building an OpenGL support library requires OpenGL...
2011-08-13 16:46:43 +02:00
Martin Gräßlin 0c47ca5e97 Remove defines for X extensions
The following dependencies have become mandatory build deps:
* XRandR
* XRender
* XFixes
* XDamage
* XComposite
2011-08-13 16:46:43 +02:00
Martin Gräßlin 987bc837d9 Remove define KWIN_HAVE_OPENGL_COMPOSITING
Due to changes in build system we have always either OpenGL or OpenGL ES.
This allows to remove the KWIN_HAVE_OPENGL_COMPOSITING define. In the
effects the define is kept as KWIN_HAVE_OPENGL which can be used in
future to build also an XRender only effect system.
2011-08-13 16:46:43 +02:00
Martin Gräßlin b7d2b16b8d Remove define KWIN_HAVE_COMPOSITING
Building the workspaces requires to have all the build dependencies
which were required for KWIN_HAVE_COMPOSITING to be set. This allows
us to remove all the ifdefs for this and gives us a cleaner code.
2011-08-13 16:46:43 +02:00
Thomas Lübking a2d9ff72aa fix close button side for present windows effect
BUG: 262543

pint desktop as background when including desktop in switcher
BUG: 262137

zoom windows as hover/selection indicaton (1/8 of the screen or 105%)
BUG: 215348
CCBUG: 175521

no closer on "show desktop" desktop
show closer immediately but have it disabled for a short time to allow the user realize it

REVIEW: 101318
2011-08-09 22:57:54 +02:00
Allen Winter 8584104bf0 Improve Find OpenGLES.cmake a bit by only setting the FOUND varaible
if both the GLES and EGL libs and headers are found.
Fold all the includes and libraries into 1 varaible each and use those.

in other words, you need to have both OpenGLES and EGL to do a successful build.
2011-08-06 09:29:20 -04:00
Martin Gräßlin 9f78276dc7 Detect Driver "Software Rasterizer"
Fixes a major regression which allowed OpenGL
compositing to be used with software rasterizer, which
either did not work or crashed directly.

Cherry-picked from cf2f572 in branch KDE/4.7.
2011-08-03 20:02:15 +02:00
Jaime Torres 664aaa1b60 ++ prefix for non-trivial data-types
change suffix ++ to prefix ++ to speed up a little bit not-trivial
data-types. discovered by cppcheck

REVIEW: 102057
2011-08-02 17:21:56 +02:00
Martin Gräßlin c807e97e0a Split glutils out of kwineffects
All OpenGL related files are build as a kwinglutils library for OpenGL
and as a kwinglesutils library for OpenGL ES. The appropriate defines
are set using target_properties and removed from kwinconfig.h.cmake.
2011-07-27 18:34:31 +02:00
Martin Gräßlin c3cf4482a3 Move GLX detection from kwinglobals to CompositingPrefs
Removes the Extension::glxAvailable() from kwinglobals and
implements the functionality in CompositingPrefs, where it
is only needed. There used to be one additional check in
scene_opengl_glx.cpp which is moved into composite.cpp
before the OpenGL Scene is created.

REVIEW: 102002
2011-07-27 18:34:31 +02:00
Martin Gräßlin 787b2bf8cc Fix regression introduced with 909b4efa
I still don't understand how I actually tested my patch
before committing. It was working, sigh. That were
several hours of annoyance including a git bisect presenting
my own commit I assumed to be correct. Sigh.
2011-07-23 21:32:12 +02:00
Martin Gräßlin 2fc1ed25a5 Add a define KWIN_SHADER_DEBUG to all shaders
If the environment variable KWIN_GL_DEBUG is set to 1
the define KWIN_SHADER_DEBUG is added to the glsl
source code allowing to add some custom ifdefed
visual debug handling.

As an example it's added to scene-fragment.glsl to
paint everything in a greenish way.
2011-07-23 18:57:50 +02:00
Fredrik Höglund 8c430e22b6 kwin: Add the Sumo and Cayman chipsets 2011-07-15 18:56:15 +02:00
Fredrik Höglund 31ea6ff0b8 kwin: Reorder the Evergreen chipsets to match the order in r600g 2011-07-15 18:51:54 +02:00
Fredrik Höglund 7f4709b4ea kwin: Whitespace fixes 2011-07-15 18:47:52 +02:00
Martin Gräßlin eae91e189c Remove include to kwinglutils.h from kwineffects
No more OpenGL is used in the effects library itself.
2011-07-05 20:40:27 +02:00
Martin Gräßlin 3524e70fe2 Drop EffectsHandler::saturationSupported
Not used by any effect or anywhere in core.
2011-07-05 20:35:32 +02:00
Martin Gräßlin 9b9f4619b0 Remove scissoring code from PaintClipper
Not used any more and means we don't have OpenGL code in kwineffects.
2011-07-05 20:18:19 +02:00
Martin Gräßlin cd82616ece Remove PaintClipper from OpenGL Scene rendering
Construct window quads which will end on the screen instead of
rendering the windows several times and using scissoring to
restrict to the area which will end on screen.

REVIEW: 101765
2011-07-05 20:17:29 +02:00
Philipp Knechtges ec1df109d9 kwin: cleaning up KWin::GLTexture::convertToGLFormat
Now convertToGLFormat does no longer mirror the texture, so that we can
avoid a deep copy in case we render a GL_BGRA texture on a little endian system.

REVIEW: 101739
2011-07-04 18:06:45 +02:00
Martin Gräßlin 08b2aebd30 Merge branch 'KDE/4.7'
Conflicts:
	kwin/libkwineffects/kwinglutils.cpp
	kwin/libkwineffects/kwinglutils.h
2011-07-03 09:30:38 +02:00
Martin Gräßlin b837a3fca1 Render Shadow with only one GL texture
Copies the shadow parts into one image and creates a GLTexture
from the image, so that we can render the complete shadow with
just one texture and one painting pass.

Should remove most of the overhead involved when rendering the new Shadows.

As a side effect this should fix missing shadows with non-NPOT GPUs and
a rendering glitch reported with NVIDIA.

REVIEW: 101742
2011-07-03 09:24:28 +02:00
Martin Gräßlin c8daeef43c Remove (en|dis)able(Un)NormalizedTexCoords from GLTexture
Those are not used anymore as makeArrays only renders normalized
texCoords and also honors the y-Inverted case.
2011-06-26 09:15:31 +02:00
Arthur Arlt 25654f25b8 Removing TopMenu
Since the funtionality of TopMenu did no longer work in KDE4 this feature was
removed from Workspace. Every reference to it was removed as well as commentaries
and documentation.

REVIEW: 101485
2011-06-24 12:27:56 +02:00
Philipp Knechtges 116e024d12 kwin: moving KWin::GLTexture to a separate file 2011-06-22 13:03:36 +02:00
Michael Zanetti e1bf590a1c - fixes calculation of WindowMotionManager in case a new destination is set when the window is not at its original position and provide a function to check if windows
are currently moving (by Thomas Lübking)
- make use of new function and bugfix in SlideBack effect
2011-06-20 21:56:56 +02:00
Martin Gräßlin a05ad98896 Remove textureWidth/textureHeight from all Shaders
The uniforms textureWidth and textureHeight were only needed for
normal windows. For everything else it was just 1.0/1.0, that is
normalized.

The makeArrays method is changed to produce normalized texcoords
obsoleting the need for these uniforms. So two uniforms less, one
calculation in vertex shaders less and many many lines of code
removed.

At the same time makeArrays is also adjusted to take care of
yInverted of the texture, which is needed as we no longer can use
the enableUnnormalizedTexCoords which did the yInverted transformation.

REVIEW: 101646
2011-06-19 20:54:13 +02:00
Thomas Lübking 3af7395ab8 avoid calling QPixmap::paintEngine() in scene rendering
by checking the graphicssystem at startup
also avoid pixmap and memory leaking on the xrender backend, validate some pointers
on deletion in SceneOpnGL and avoid attempts to render ::isNull pixmaps
2011-06-11 15:23:03 +02:00
Martin Gräßlin ae40bce25d Disable Shader Scene for LimitedGLSL GPUs
This was causing problems with R300G. The GPU supports only limited
GLSL and seems not to be up to rendering the scene appropriate. So
let's better disable the OpenGL 2 branch for such GPUs. If the user
really wants to use it, there is the GLES backend which does not
check for limited GLSL.
BUG: 274457
CCBUG: 274607
FIXED-IN: 4.7.0
2011-06-01 18:25:45 +02:00
Martin Gräßlin 234ec644d2 KWin supports graphicssystem Raster
With raster a QPixmap is no longer a XPixmap which fails all code
which assumes that an QPixmap is an XPixmap. Depending on were in
the codebase we either convert such pixmaps to images (OpenGL) or
create a XPixmap and use QPixmap::fromX11Pixmap to get a "real"
pixmap.

It is possible that there are more code pathes were we would need
a XPixmap. Currently tested is basic functionality of no-compositing,
XRender compositing, OpenGl/GLX and OpenGL ES/EGL compositing.

For OpenGL compositing raster might result in performance improvements,
for XRender it is possible that there are regressions when using raster.
By default KWin uses whatever is the default of the system, so we just
no longer enforce native.

Of course it is a bad idea to use graphicssystem OpenGL. As that
is broken anyways in Qt, we do not check for it.

Many thanks to Philipp Knechtges for bringing up the issue, convincing
me that we need it and providing most of the patch.

REVIEW: 101132
CCMAIL: Philipp.Knechtges@rwth-aachen.de
2011-05-12 18:52:38 +02:00
Martin Gräßlin 1dd614ee4b Improved detection of OpenGL software emulation
Adding a new method to retrieve whether the OpenGL implementation
uses any kind of software emulation and no software emulation can
provide GLSL support, even if it claims so.

Thanks to Maurel for testing again and again proposed patches.

BUG: 271166
2011-05-06 18:16:38 +02:00
Fredrik Höglund e5ea420e96 kwin: Add an enabledByDefault() function to the effects interface
This makes it possible to decide at runtime if an effect should
be enabled by default.
2011-05-02 02:06:17 +02:00
Martin Gräßlin 5290e78106 Adding an option GLLegacy to force OpenGL 1
Setting option "GLLegacy" to true in config group "Compositing"
will disable all GLSL shaders and kwin uses the legacy OpenGL 1
code pathes. Obviously the option is ignored with GLES.

As my Qt Designer is refusing to work, there is no GUI option yet.
2011-04-29 16:44:48 +02:00
Thomas Lübking 676d180e4f remove comments from commit 7da7090bc802a8b9d1ee0a969ea794921a74b86b 2011-04-28 21:43:13 +02:00