Commit Graph

268 Commits (5a2d14baf786f8dea57c1a25f6a46f26b15b2d70)

Author SHA1 Message Date
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