Commit Graph

128 Commits (master)

Author SHA1 Message Date
Vlad Zahorodnii 4ce853e8e4 Prettify license headers 2020-08-07 19:57:56 +00:00
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00
Benjamin Port 864f355870 Set cursor size default to 24 to align with KCM
Reviewers: #plasma, meven, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T12040

Differential Revision: https://phabricator.kde.org/D28654
2020-04-17 14:43:51 +02:00
Ismael Asensio 7706e17d94 Port away from deprecated KIconLoader::IconSize
Summary: Use `QStyle::pixelMetrics` instead

Test Plan:
No compiler warning
Icon still happily bounces on application launch

Reviewers: #kwin, davidedmundson, broulik

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T11637

Differential Revision: https://phabricator.kde.org/D27726
2020-02-29 00:29:13 +01:00
David Edmundson 5114494b57 [effects/startupfeedback] Port to KConfigWatcher
Summary:
startupfeedback is a special case, rather than loading our own config we
load settings from klaunchrc.

In order to reload this means leaking kwin specific calls into the
launch feedback KCM. Using the new KConfigWatcher syntax, we can use a
generic solution for all this code.

Test Plan:
Changed the value in KCM
Opened dolphin
cursor did the right thing

Reviewers: zzag

Reviewed By: zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25834
2019-12-10 11:21:23 +00:00
Kai Uwe Broulik 66f2e2b158 Merge branch 'Plasma/5.17' 2019-11-01 22:43:50 +01:00
Kai Uwe Broulik 87f36f53b3 [effects/startupfeedback] Fallback to small icon size when no cursor size is configured
As appears to be the case with the default setup...

BUG: 413605
FIXED-IN: 5.17.3

Differential Revision: https://phabricator.kde.org/D25065
2019-11-01 22:40:35 +01:00
Albert Astals Cid e144748c7a Add some const &
Summary:
Won't make things go much faster since everything that was
being passed by value is refcounted but still const & is a bit faster
than refcounting

For shared pointers instead of adding const & we move them into the
destination variable saving some cpu usage but at the same time making
clear the pointer is being stored by not being const &

Reviewers: zzag

Reviewed By: zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25022
2019-10-30 19:23:01 +01:00
Kai Uwe Broulik 2497f901d7 [effects/startupfeedback] Scale application icon size with cursor size
KWin doesn't use Qt scaling and as such the icon remains tiny.
Instead, make it follow the cursor size as the user is likely to have larger cursors on high dpi.

Differential Revision: https://phabricator.kde.org/D24714
2019-10-17 19:04:14 +02:00
Vlad Zahorodnii 62a7db7028 Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.

This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson, romangg

Reviewed By: #kwin, davidedmundson, romangg

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 17:48:21 +03:00
Vlad Zahorodnii dcf91d4321 Cleanup style in CMakeLists.txt files
We have lots of inconsistency at the moment in CMakeLists.txt files. Most
of it is due to kwin being a very old project. This change hopefully fixes
all of it.
2019-09-17 16:03:05 +03:00
Vlad Zagorodniy 8af2fa73dc Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.

The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.

Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.

A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!

The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.

The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, apol, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 20:03:22 +03:00
Kai Uwe Broulik f86d70aa63 Merge branch 'Plasma/5.15' 2019-02-05 13:28:56 +01:00
Kai Uwe Broulik 7a914e70b6 Merge branch 'Plasma/5.12' into Plasma/5.15 2019-02-05 13:28:45 +01:00
Kai Uwe Broulik bc5978b759 [effects/startupfeedback] Fix shader
Provide both 1.10 and 1.40 shaders.

Differential Revision: https://phabricator.kde.org/D18757
2019-02-05 13:28:14 +01:00
Vlad Zagorodniy 253ff428a7 [effects] Port to new connect syntax
Summary:
The new connect syntax has several advantages over the old syntax:

(a) Connecting with the new syntax is faster;
(b) It is compile time checked.

There are still a few places where the old connect syntax is used, e.g.
connecting to QML buttons in the Desktop Grid effect.

Test Plan:
Have been testing this patch for ~2 weeks, haven't noticed any
regressions.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, broulik, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18368
2019-01-26 01:22:06 +02:00
David Edmundson a3cff85e7a Remove Qt module declarations in includes
Summary:
Test Plan: Compiles

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13359
2018-06-05 18:07:23 +01:00
Martin Gräßlin 857d8a9c37 Add a KSharedConfigPtr for kcminputrc to KWin::Application
Summary:
There are a few places where KWin needs to read values from kcminputrc.
As I need to add yet another one it makes more sense to properly
structure it like in other cases and have only one kcminputrc hold in
the application. This also allows to better mock the config values in
the integration tests.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5540
2017-04-24 21:01:03 +02:00
Martin Gräßlin 288cf06b90 Create KSelectionOwner in StartupFeedbackEffect only on X11
Summary:
On Wayland we do not need the selection. By only creating the
KSelectionOwner on X11 an X11-runtime dependency is removed from the
StartupFeedbackEffect.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3121
2016-11-07 11:42:10 +01:00
Martin Gräßlin 613d76f2df [effects] Combine all shaders in resources
One resource is used for shader version 1.10 and one for version 1.40.

The ideas behind this change is to remove the locating of the shader
sources and also to fix that user provided shaders could be loaded
instead of the original ones (possible attack vector on Wayland).

To simplify the ShaderManager provides a new method call to load the
shader from the resource. This means the effects don't need to
duplicate the check for the shader version any more and also don't
need to duplicate the file reading functionality.

REVIEW: 126905
2016-02-01 08:42:30 +01:00
Martin Gräßlin 712e46e468 [effects] Port startupfeedback to shader trait api
The blinking shader is adjusted to use a shader trait vertex shader
and gets generated with a shader trait variant.

Overall the code is simplified to ensure that we always have a shader
bound with the correct mvp matrix when rendering the icon.
2016-01-25 14:11:54 +01:00
Sergio Martins e283bda8e5 Fix unintentional no-op, unite() doesn't change the object
REVIEW: 123618
2015-05-03 22:31:23 +01:00
Martin Gräßlin 7c3197b1eb Use new ctors for KXMessages and KSelectionOwner
Allows to pass the connection and rootWindow and doesn't depend on
QX11Info.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 5e47d41f7b [effects/startupfeedback] Use dedicated shader for bouncing cursor
BUG: 342203
REVIEW: 121941
2015-01-13 08:46:11 +01:00
Martin Gräßlin 075422fc5e [effects] Add type property to StartupFeedback Effect
Allows to read the configured type in support information.
2014-10-20 14:50:41 +02:00
Martin Gräßlin 4a1bc2ec96 [effects] Drop the .desktop files for the BuiltIn Effects
All KCMs and KWin core use the BuiltInEffects namespace to find and
interact with the effects. There is no information left in the desktop
file which are of usage. Thus they can be removed.
2014-04-28 13:52:43 +02:00
l10n daemon script e1f418f4d0 SVN_SILENT made messages (.desktop file) 2014-04-28 09:00:35 +00:00
l10n daemon script f44575ddbf SVN_SILENT made messages (.desktop file) 2014-04-28 05:16:52 +00:00
l10n daemon script 69c3289c18 SVN_SILENT made messages (.desktop file) 2014-04-27 21:02:43 +00:00
l10n daemon script e6db000065 SVN_SILENT made messages (.desktop file) 2014-04-04 05:29:27 +00:00
l10n daemon script eef56c98b2 SVN_SILENT made messages (.desktop file) 2014-04-03 05:10:09 +00:00
David Faure 20bc3ff68b Include ksharedconfig.h (since it will be removed from kpluginfactory.h) 2014-03-29 09:32:06 +01:00
Martin Gräßlin 3bbc9436db [kwin] Add a virtual Effect::requestedEffectChainPosition
This method replaces the X-KDE-ORDERING property in the Effect's desktop
files. This change is a preparation step for integrating the new Effect
Loader which doesn't read the ordering information. Thus it needs to be
provided by the Effect itself so that the EffectsHandler can properly
insert it into the chain.

Also for the built-in Effects on the long run it doesn't make much sense
to install the desktop files. And binary plugin effects will migrate to
json metadata which also doesn't have the KService::Ptr. Thus overall it
simplifies to read this information directly from the Effect.
2014-03-28 14:04:54 +01:00
Martin Gräßlin 1ab37878cd [kwin] Port remaining XLib usage in effects to XCB
Affected effects
* Blur and Contrast Shader to get atom name
* Glide effect for the slide atom
* startupfeedback for cursor size - read from config now and cached
* showfps used an xsync, replaced by flush
* logout effect for creating hack items

REVIEW: 116828
2014-03-26 13:56:21 +01:00
Aleix Pol c72e519d9c Remove KDE/ prefix in include directories
It's unneeded and deprecated since KF5.
2014-03-17 16:24:10 +01:00
Martin Gräßlin aeb90a2411 [kwin] Introduce a X-KWin-Internal in kwineffect services
X-KWin-Internal should be used for effects which are either internal
to KWin and are configured at a different location in KWin. Examples
are:
 * CoverSwitch - configured in WindowSwitcher KCM, but not FlipSwitch
   as that one has a non WindowSwitcher mode
 * window geometry - configured in moving

And it should also be used for helper effects to the overall
kde-workspace module. Examples are:
 * Dashboard - required by Plasma
 * KScreen - required for KScreen
 * Screenshot - required by KSnapshot

Why a new category and not the already existing NoShow property?
The idea is to just filter on the effects in the list. Thus it should
be possible to show them. But NoShow is clearly intended to not be
shown at all.

REVIEW: 116754
2014-03-13 09:09:44 +01:00
Martin Gräßlin c7d986c7fe [kwin] Remove the legacy OpenGL 1 compositing backend
KWin already has a de facto OpenGL 2 dependency through QML. Combined
with the fact that the OpenGL 1 backend is basically unmaintained and
also unused, it's better to remove it for the new major release.

This change includes:
 * Removal of cmake option KWIN_BUILD_OPENGL_1_COMPOSITING
 * Removal of KWIN_HAVE_OPENGL_1 compile option and all code
   ifdef'ed with it (partially removal of if-else constructs)
 * Removal of CompositingType::OpenGL1Compositing (flags are kept
   as a core flag should get introduced)
 * Driver recommendation for OpenGL1Compositing changed to XRender
   (should be evaluated whether the drivers can provide GL2)
 * Removal of configuration option "GLLegacy"
 * Removal of fooMatrix function in kwinglutils
 * Removal of ARBBlurShader
 * Removal of legacy code path in GLVertexBuffer
 * Removal of GLShaderManager::disable
 * if-blocks with ShaderManager::instance()->isValid() removed

REVIEW: 116042
2014-03-10 08:59:11 +01:00
Martin Gräßlin 76efe517a7 Turn built-in effects into a library kwin links against
As all effects have always been compiled into the same .so file it's
questionable whether resolving the effects through a library is useful
at all. By linking against the built-in effects we gain the following
advantages:
* don't have to load/unload the KLibrary
* don't have to resolve the create, supported and enabled functions
* no version check required
* no dependency resolving (effects don't use it)
* remove the KWIN_EFFECT macros from the effects

All the effects are now registered in an effects_builtins file which
maps the name to a factory method and supported or enabled by default
methods.

During loading the effects we first check whether there is a built-in
effect by the given name and make a shortcut to create it through that.
If that's not possible the normal plugin loading is used.

Completely unscientific testing [1] showed an improvement of almost 10
msec during loading all the effects I use.

[1] QElapsedTimer around the loading code, start kwin five times, take
average.

REVIEW: 115073
2014-01-24 14:13:59 +01:00
Martin Gräßlin 7a380fa343 Reduce timeout of startupfeedback to a sensible default
It's 2014 and we don't have to wait half a minute for an application
to start. In fact we mostly get false positives due to applications
not handling correctly startup notifications for already running
instances (e.g. click on link in email).

So let's reduce to a default which doesn't look like a broken setup.

REVIEW: 115046
2014-01-20 17:08:03 +01:00
l10n daemon script 22a5e1109f SVN_SILENT made messages (.desktop file) 2014-01-19 04:06:03 +00:00
Jacob Logan ac72e9fb73 Changed debug statements in kwin/effects from qDebug() to qCDebug(KWINEFFECTS)
A new .cpp file is added containing the declaration of the logging
category and compiled into the effects lib.

REVIEW: 114194
2013-11-29 08:47:56 +01:00
Martin Gräßlin b7be3cb621 Better handling for making the compositing OpenGL context current
With QtQuick2 it's possible that the scene graph rendering context either
lives in an own thread or uses the main GUI thread. In the latter case
it's the same thread as our compositing OpenGL context lives in. This
means our basic assumption that between two rendering passes the context
stays current does not hold.

The code already ensured that before we start a rendering pass the
context is made current, but there are many more possible cases. If we
use OpenGL in areas not triggered by the rendering loop but in response
to other events the context needs to be made current. This includes the
loading and unloading of effects (some effects use OpenGL in the static
effect check, in the ctor and dtor), background loading of texture data,
lazy loading after first usage invoked by shortcut, etc. etc.

To properly handle these cases new methods are added to EffectsHandler
to make the compositing OpenGL context current. These calls delegate down
into the scene. On non-OpenGL scenes they are noop, but on OpenGL they go
into the backend and make the context current. In addition they ensure
that Qt doesn't think that it's QOpenGLContext is current by calling
doneCurrent() on the QOpenGLContext::currentContext(). This unfortunately
causes an additional call to makeCurrent with a null context, but there
is no other way to tell Qt - it doesn't notice when a different context
is made current with low level API calls. In the multi-threaded
architecture this doesn't matter as ::currentContext() returns null.

A short evaluation showed that a transition to QOpenGLContext doesn't
seem feasible. Qt only supports either GLX or EGL while KWin supports
both and when entering the transition phase for Wayland, it would become
extremely tricky if our native platform is X11, but we want a Wayland
EGL context. A future solution might be to have a "KWin-QPA plugin" which
uses either xcb or Wayland and hides everything from Qt.

The API documentation is extended to describe when the effects-framework
ensures that an OpenGL context is current. The effects are changed to
make the context current in cases where it's not guaranteed. This has
been done by looking for creation or deletion of GLTextures and Shaders.
If there are other OpenGL usages outside the rendering loop, ctor/dtor
this needs to be changed, too.
2013-11-23 10:54:41 +01:00
Martin Gräßlin 139201a2e2 KGlobal::config() -> KSharedConfig::openConfig()
KWin Core says good bye to KGlobal. We will not miss the threading
issues.
2013-09-04 16:11:40 +02:00
Martin Gräßlin 57905c0cc2 And we got rid of KDebug
Usages of kBacktrace got dropped.
2013-09-02 13:14:39 +02:00
Martin Gräßlin 987fd41d24 Port KWin/Effects from KDebug to QDebug
Still using KDE4Support as it's used in other areas.
2013-09-02 11:03:29 +02:00
Anselmo L. S. Melo bef5b71898 Porting effects to Qt5/KF5: QStandardPaths
REVIEW: 111977
2013-08-13 17:56:04 -03:00
Martin Gräßlin 9291b18cee Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/effects.cpp
	kwin/effects/logout/logout.cpp
	kwin/effects/presentwindows/main.qml
	kwin/effects/presentwindows/presentwindows.cpp
	kwin/effects/presentwindows/presentwindows.h
	kwin/effects/zoom/zoom_config.cpp
	kwin/libkwineffects/kwinglutils_funcs.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/nvidiahack.cpp
	kwin/xcbutils.h
	plasma/desktop/containments/desktop/plasma-containment-desktop.desktop
	plasma/generic/wallpapers/image/image.cpp
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-08-07 10:10:06 +02:00
Thomas Lübking bc80d2417a re-fix bouncing startup feedback
BUG: 304253
FIXED-IN: 4.11
REVIEW: 111729
2013-08-02 22:01:25 +02:00
Thomas Lübking 3aa2e22b32 fix passive startup feedback
BUG: 260727
FIXED-IN: 4.11
REVIEW: 111634
2013-07-24 21:04:32 +02:00
Martin Gräßlin 330d40f425 Fix no cast to/from ASCII intrduced issues
* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
2013-07-24 09:58:33 +02:00