Replace dynamic_casts to check the type for for Toplevel by isFoo()
calls and use static_casts in such blocks.
Furthermore method shape() returns now a constant reference instead of a
copy of the QRegion.
REVIEW: 106364
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
The code was basically copy'n'pasted to handle both Client and Deleted
requiring to cast the Toplevel to both Client and Deleted to test whether
it is one of those.
This is now changed from runtime to compile time polymorphism. A
templated method is used to start the rendering process for the decos.
This on the one hand simplifies the code and on the other does not
require any dynamic casts any more as we use the available check on
Toplevel whether it is a Client or Deleted.
The Window implementation performed many checks whether the rendering
uses the OpenGL 1 or OpenGL 2 code path and there were quite a few
cludges around to make this work.
So instead of many if-else blocks the specific code has now been moved
into a specific sub class and calls to pure virtual method in the base
class are used to trigger this behavior. Although that adds some overhead
in a rather hot code path it should be better than the many chained
method calls used before to handle OpenGL 1 and 2.
It also makes the code a little bit more readable as all the complete
OpenGL 1 implementation is now in one block ifdefed for OpenGL ES.
The handling for creating and managing the OpenGL context is
split out of the SceneOpenGL into the abstract OpenGLBackend
and it's two subclasses GlxBackend and EglOnXBackend.
The backends take care of creating the OpenGL context on the
windowing system, e.g. on glx an OpenGL context on the overlay
window is created and in the egl case an EGL context is created.
This means that the SceneOpenGL itself does not have to care
about the specific underlying infrastructure.
Furthermore the backend provides the Textures for the specific
texture from pixmap operations. For that in each of the backend
files an additional subclass of the TexturePrivate is defined.
These subclasses hold the EglImage and GLXPixmap respectively.
The backend is able to create such a private texture and for
that the ctor of the Texture is changed to take the backend as
a parameter and the Scene provides a factory method for
creating Textures. To make this work inside Window the Textures
are now hold as pointers which seems a better choice anyway as
to the member functions pointers are passed.
According to Pierre-Loup Griffais (Plagman on IRC) this is causing
choppy VDPAU video playback when compositing is enabled.
Removing these calls doesn't seem to cause any regressions, and the
commit that added them doesn't give a reason. So let's just get rid
of them for now.
This commit should be cherry-picked to the stable branch if no one
else notices any regressions.
CCMAIL: kwin@kde.org
Left over from the cleanup which basically resulted in the active window
being put to the inactive's window opacity.
Thanks for the early notification of that issue.
BUG: 306449
FIXED-IN: 4.9.2
The method windowType needs actually two implementations:
* one for Clients
* one for Unmanaged
as for Clients also the window rules are checked and hacks are applied
which is both not needed for Unmanaged windows.
To have the Client specific behavior in windowType the function used to
perform two dynamic_casts which made this method one of the most
expensive during compositing, e.g. for ~1000 frames
* called ~43000 times
* ~85000 dynamic casts
* incl. cost of method: 0.24
* self cost of method: 0.05
* incl. cost of the casts: 0.12
After the change to remove the dynamic casts we have for ~1500 frames
in Client::windowType:
* called ~31000 times
* incl. cost of 0.06
* self cost of 0.02
Calls on Unmanaged and Deleted are so low that we do not need to consider
them.
BUG: 306384
FIXED-IN: 4.10
REVIEW: 106349
The oo.o related hack can be removed for several reasons:
1. The dialog in question from bug 66065 is nowadays a utility
2. The window class name changed to libreoffice
3. It's not the task of the window manager to workaround bugs in Clients
CCBUG: 66065
BUG: 306383
FIXED-IN: 4.9.2
KDE has not supported the TopMenu in any 4.x release and most of the
TopMenu related code has already been dropped from KWin. It is extremely
unlikely that there is still a window around which would need this
specific check. And even if there were such a check it would be broken.
So let's just remove this hack which means less checks in one of the
hottest code pathes of KWin.
CCBUG: 306383
The effect should have had two animations:
* on move resize
* on active/inactive change
But the timeline was adjusted in the prePaintWindow call and the timeline
is effect global and not per window. Which means that for each window the
same time is added. So instead of adding time t each frame t*n with n
being the number of windows got added. So in most cases the animation
ended in the first or second frame which means its not visible.
Through git blame I was able to track down that this incorrect behavior
was introduced in 2008. An animation broken for more than four years
without anybody noticing is probably not required. Because of that it's
dropped from the effect. As this includes quite some code and performance
improvements it goes into the release branch.
A better solution could be implemented, but that should be for 4.10.
BUG: 306263
FIXED-IN: 4.9.2
REVIEW: 106335
There were quite some useless checks like e.g. first checking whether
a window is the desktop and taking a different code path for that case
and in the other code path checking again.
Also using the new introduced boolean values for the checks instead of
comparing floating point numbers all the time.
The effect gets a set of boolean values to check whether it is active for
one of the categories (e.g. move resize, decorations).
This allows to easily check whether the effect is active at all, that is
if all values are at 1.0 the effect will never affect a window.
In all other cases it can be combined with looking at the available
windows to e.g. enable the effect for move resize only when there is a
window which is either moved or resized. This check is performed whenever
an action happens which could cause a window to become inactive.
BUG: 306262
FIXED-IN: 4.9.2
Nobody is interested in whether the Abilities are supported.
There is one method in KWin core checking for the colors
supported by the currently loaded decoration:
Workspace::decorationSupportedColors
This method is not called from anywhere inside KWin, but is
part of the D-Bus interface, though nobody in KDE's repository
is calling it [1].
As it is part of public API the Abilities are only deprecated
and scheduled for removal with the next big break.
[1] http://lxr.kde.org/search?filestring=&string=decorationSupportedColors
REVIEW: 105785
A script can register a callback through registerUserActionsMenu to be
informed when the UserActionsMenu is about to be shown. This menu calls
the Scripting component to gather actions to add to a Scripts submenu.
The Scripting component now asks all scripts for the actions, which will
invoke the registered callbacks with the Client for which the menu is to
be shown as argument.
The callback is supposed to return a JSON structure describing how the
menu should look like. The returned object can either be a menu item or
a complete menu. If multiple menu items or menus are supposed to be added
by the script it should just register multiple callbacks.
The structure for an item looks like the following:
{
text: "My caption",
checkable: true,
checked: false,
triggered: function (action) {
print("The triggered action as parameter");
}
}
The structure for a complete menu looks quite similar:
{
text: "My menu caption",
items: [
{...}, {...} // items as described above
]
}
The C++ part of the script parses the returned object and generates
either QAction or QMenu from it. All objects become children of the
scripts QMenu provided by the UserActionsMenu.
Before the menu is shown again the existing menu is deleted to ensure
that no outdated values from no longer existing scripts are around. This
means the scripts are queried each time the menu is shown.
FEATURE: 303756
FIXED-IN: 4.10
REVIEW: 106285
The new methods suspend and resume are meant to provide a better way to
influence the current compositing state than toggleCompositing. In
addition an overload setCompositing(bool) is added. The resume method is
implemented in a way that it can be used to try to start the compositor
again in case it failed.
Internally the method suspendResume is dropped as it does the same as
setCompositing just with inverted binary logic and worse name. The
compositingToggled signal is now emitted from within setup and finish to
ensure that especially the compositingToggled(true) signal is only
emitted if the Compositor could start.
Also the updateCompositingBlocking is adjusted to use the new dedicated
suspend and resume methods instead of the toggle method.
REVIEW: 106273
Two new interfaces are introduced:
* org.kde.kwin.Compositing
* org.kde.kwin.Effects
The Compositing interface is generated from scriptable elements on the
KWin::Compositor class and the Compositor is exported as /Compositor.
It provides the general Compositing related D-Bus methods like whether
the compositor is active and toggling and so on.
The Effects interface is generated from scriptable elements on the
KWin::EffectsHandlerImpl class and the instance is exported as /Effects.
It provides all the effects related D-Bus methods like loading an effect
or the list of all effects.
This removes the need to have all these methods provided on the global
org.kde.KWin interface. For backwards compatibility they are kept, but
no longer provided by the Workspace class. Instead a new DBusInterface
is generated which wrapps the calls and delegates it to one of our three
related Singleton objects:
* Workspace
* Compositor
* EffectsHandlerImpl
The Compositor class actually behaves like a Singleton so it should be
one. Therefore four static methods are added:
* self() to access the Singleton
* createCompositor() to be used by Workspace to create the instance
* isCreated() to have a simple check whether the Singleton is already
created
* compositing() as a shortcut to test whether the compositor has been
created and is active
The isCreated() check is actually required as especially Clients might
be created and trying to access the Compositor before it is setup.
If the start Client is not part of the focus chain the call to
nextClientFocusChain() cannot return the Client again. So the loop break
condition is never reached and as the focus chain is not empty the call
always returns a not null Client which means KWin is caught in an endless
loop.
This change checks that the starting Client is in the focus chain and if
not the first Client of the focus chain is used.
BUG: 306260
BUG: 306275
FIXED-IN: 4.9.2
It seems not all Qt installs will automatically #include QElapsedTimer
from QtCore/QTimer, this caused a build failure on my system and on a
RHEL 6.2 VM I've been testing on.
Checking the Qt docs, QBasicTimer also has a separate include so
although this didn't cause a build failure, I've thrown in its
separate #include as well. I have not checked for other #include errors,
and a very quick search on b.k.o for bugs mentioning "build" did not
return any bugs to close.
I'm pretty sure this build failure applies only to master but I haven't
checked thoroughly.