Commit Graph

43 Commits (0dda9dc7d09c6750885e30a6e20658563e204c37)

Author SHA1 Message Date
Vlad Zahorodnii 0dda9dc7d0 Use namespace kwin only in autotests
In kwin core, we prefer not to put `using namespace KWin` because it
makes defining forward declared classes more trickier.
2020-08-21 22:06:36 +00:00
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
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
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 2adbcf7b1d [effects/windowgeometry] Fix -Wdeprecated-declarations 2019-09-12 22:19:34 +03: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
Martin Flöser f8be3f746b [effects] Delay creation of EffectFrames in WindowGeometryEffect
Summary:
Without Xwayland KWin starts so fast that the creation of the EffectFrame
triggers a crash in the Wayland integration as the KWin internal
connection isn't fully setup.

To workaround this crash the creation of the EffectFrame is delayed till
the first usage. It doesn't make sense to try to fix the actual crash as
it would require to defer the creation of all Effects.

Test Plan: New test case added which crashes without this fix.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8821
2017-11-21 19:28:00 +01:00
Martin Gräßlin 2132b1e0c8 [effects] Use arg="true" in the kcfg files
Summary:
By changing all kcfg to have arg="true" we can pass in the same
KSharedConfigPtr into all effects. This allows to have fake config in
the tests and in the planned effect demo mode.

Also it means that we don't have to hardcode the name kwinrc into the
files. In the configs - where we cannot access the effectshandler - we
use the define KWIN_CONFIG which gets generated based on the compile
time arguments.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3571
2017-04-15 10:03:34 +02:00
Martin Gräßlin e96c86e045 Remove unused #include <KWindowSystem> 2015-02-17 13:35:30 +01:00
Martin Gräßlin 77fff7af6a [kwin] Port away from deprected KCoreConfigSkeleton::readConfig
Most is just switched to the ::read(). That should be enough for all the
Effects which have a KSharedConfig::Ptr underneath. If not we just need
to find a good place to put the reload.
2014-03-25 16:29:03 +01:00
Martin Gräßlin b57885a1bf Add registerGlobalShortcut method to kwineffects
Implemented in KWin core to forward to new global shortcut system. This
method should be extended/changed once we go to Qt5/KF5 to make the usage
easier (no more KAction).

Each global shortcut in the effects makes use of this new method.
2014-03-19 14:14:56 +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 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 145f0c096f [kwin/effects] Do not use KActionCollections for the global shortcuts
Most effects had a "collection" for one action. We don't need the
action collection, all it was used for is setting the object name.

With the removal of KActionCollection the effects do not need to link
XmlGui any more, though the dependency is still pulled in through
plasma.
2013-12-10 11:45:33 +01:00
Martin Gräßlin 969e6b85e7 Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/client.cpp
	kwin/effects/highlightwindow/highlightwindow.cpp
	kwin/libkwineffects/kwingltexture.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/scene_opengl.cpp
	kwin/workspace.cpp
	plasma/desktop/applets/kickoff/CMakeLists.txt
	plasma/desktop/applets/taskmanager/package/contents/code/tools.js
	plasma/desktop/applets/taskmanager/package/contents/ui/Task.qml
	plasma/desktop/applets/taskmanager/package/contents/ui/main.qml
	plasma/desktop/applets/taskmanager/package/metadata.desktop
	plasma/desktop/applets/taskmanager/plugin/textlabel.h
	plasma/desktop/applets/tasks/CMakeLists.txt
	plasma/desktop/applets/tasks/package/metadata.desktop
	plasma/desktop/applets/tasks/tasks.cpp
	plasma/desktop/toolboxes/plasma-toolbox-desktoptoolbox.desktop
	plasma/generic/applets/activitybar/activitybar.cpp
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-09-24 11:28:38 +02:00
Thomas Lübking 3eb0b27d00 windowgeometry effect, keep hint inside screen
and use passed geometry parameter to position the labels
(required with resize effect because the actual geometry is
not updated)

REVIEW: 112849
2013-09-24 00:50:55 +02:00
Martin Gräßlin 86b9ce67a0 Use QLocale in WindowGeometryEffect 2013-09-05 10:48:30 +02:00
Reza Shah 61f452723e Port KWin effects away from KAction and KShortcut to Qt5/KF5 classes.
REVIEW: 111898
2013-08-15 04:13:12 +09: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 18f8493dee no layer repaints for the window geometry labels
insufficient since there can be windows/content on top of the
moved window and the labels are painted on top of the scene

BUG: 318390
FIXED-IN: 4.11
REVIEW: 111861
2013-08-05 20:43:28 +02:00
Martin Gräßlin ba7d50fdc5 Disable global shortcut handling in all effects
KAction and KShortcut needs porting, so disabled for now.
2013-07-24 09:58:44 +02:00
Martin Gräßlin 330d40f425 Fix no cast to/from ASCII intrduced issues
* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
2013-07-24 09:58:33 +02:00
Martin Gräßlin 0ccc060218 Include KGlobal were needed
With KF5 some includes which used to include KGlobal, e.g. KStandardDirs
do no longer include KGlobal. So if we use KGlobal we should include it.
2013-03-07 13:59:15 +01:00
Martin Gräßlin 60c42b7a34 s/KLocale/KLocalizedString/g
Many headers included KLocale to use i18n and co. But those methods are
defined in KLocalizedString and not in KLocale.

With KF5 klocale.h does no longer include KLocalizedString causing lots
of compile errors.
2013-03-07 13:59:15 +01:00
Thomas Lübking 70d19d9c80 Try to keep the labels in the expanded geometry
and ensure to repaint labels for very tiny windows
Also move to LayerRepaints

BUG: 278137
FIXED-IN: 4.10.1
REVIEW: 108676
2013-02-05 19:15:39 +01:00
Martin Gräßlin bd91fb10d7 Use KConfigXT in WindowGeometry
Thanks to Andrea Scarpino for providing the patch.

REVIEW: 106413
2012-09-19 10:17:17 +02:00
Martin Gräßlin 2007a7eab8 Use namespaced parameters in signals
Required to get scripting bindings working.
2012-03-12 21:37:40 +01:00
Thomas Lübking 011643d983 use contentsrect to calculate window size if baseUnit isn't 1,1
BUG: 283518
2011-11-13 18:40:17 +01:00
Thomas Lübking 795fbc643b do a full geometry calculation with the moveResize start, not first moveResize event
BUG: 285824
FIXED-IN: 4.7.4
(cherry picked from commit 19c6ab33b94cd3e531fa5c86fdff66a6f33f5e4a)
2011-11-05 16:21:57 +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
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 fe4744c1e9 Single quotes instead of double quotes
Krazy--
SVN_SILENT
2011-08-03 08:24:27 +02:00
Thomas Lübking 580aa665c9 use KLocale::positive/negativeSign in windowgeometry effect
BUG: 273169
FIXED-IN: 4.7
2011-05-13 17:38:13 +02:00
Martin Gräßlin b52975a57e Merge branch 'libkwineffects'
The branch contains the first step in reworking the kwineffects
library. This includes:
* replacing virtuals by signals and slots
* dropping some unused methods
* remove KWin::TimeLine

More to come.

Conflicts:
	kwin/workspace.cpp
2011-03-16 19:46:59 +01:00
Martin Gräßlin 32c903b05b Rework signals for move/resize windows
First a signal is emitted when the user starts a move/resize operation.
During the move/resize operation each geometry change emits an update signal.
Last but not least a finish signal is emitted.

This eliminates the specific method for geometry updates in drawbound resize
mode.
2011-03-13 12:41:30 +01:00
Lamarque V. Souza b0c43762e2 Fix two problems with one commit:
1. The I18N_ARGUMENT_MISSING that appears when moving or resizing one
window. The problem happens because when declaring the variables
myResizeString, myCoordString[0] and myCoordString_[1] i18nc tries to
replace %1, %2, %3, and %4, but those arguments are not passed here.
Using #define we avoid the argument passsage.

2. Replace QString::arg() with direct formating, which is better for
performance.

I know we should avoid #define but in this case I think it is the best
option. If anyone has a better alternative feel free to change this
commit.
2011-03-03 00:37:17 -03:00
Martin Gräßlin eeb10c69d5 Signal for windowUserMovedResize
In core a new signal is added for maximizedState change of client.
Other function calls remain as direct calls for the moment.
2011-02-28 21:03:13 +01:00
Martin Gräßlin b265537962 Drop dependency to libplasma from kwineffects library
Since the EffectFrames have been moved into KWin core nothing in the
Effects lib actually used Plasma. The only remaining method is moved
to core as it's not used in the Effects. The Effects itself still
link against Plasma, so nothing changes for them.

The Plasma includes in the kwineffects header seemed to pull in
quite some additional headers, so the includes in some effects have
to be adjusted (most often KConfigGroup). This should speed up the
compilation of the library and the effects.
2011-02-17 19:38:42 +01:00
Martin Gräßlin 0a7e48f7aa KWin uses kdelibs coding style. 2011-01-31 20:07:03 +01:00
Martin Gräßlin 21c0066dc5 Fix Char/String Krazy issue
SVN_SILENT

svn path=/trunk/KDE/kdebase/workspace/; revision=1210597
2011-01-01 09:40:49 +00:00
Martin Gräßlin fcf6778057 Fix typos reported by Krazy
SVN_SILENT

svn path=/trunk/KDE/kdebase/workspace/; revision=1210596
2011-01-01 09:39:02 +00:00
Thomas Lübking 68fbd31ad8 add windowgeometry tip effect, bind it to the general setting and generalize effect feature provide api, thus update resize effect
BUG: 219755

svn path=/trunk/KDE/kdebase/workspace/; revision=1195300
2010-11-10 19:21:56 +00:00