108 Commits (0c0fb99919bc00578ef80aafa39526b072a04505)

Author SHA1 Message Date
Xaver Hugl 1746af4b02 gesture: use the global direction enums 2 years ago
Vlad Zahorodnii b0d04895cc build: Link testOpenGLContextAttributeBuilder with epoxy::epoxy 2 years ago
Aleix Pol 8417492781 Include org.freedesktop.locale1 support
Makes it possible to follow the dbus service for locale configuration,
making it possible to have third parties integrate with Plasma.

This is done opt-in for now, it can be adopted generally in the future,
if necessary.
2 years ago
Xaver Hugl a587e426f8 add autotest for the drm platform 2 years ago
Vlad Zahorodnii 38600a6235 Revert "Merge gesture structs/enums"
This reverts commit d29c7a6c2b.

It was pushed with unreviewed changes and not fully resolved issues.
2 years ago
Eric Edlund d29c7a6c2b Merge gesture structs/enums
- Now only 1 GestureDirection enum
- Now only 1 registerGesture() call
- The 4 kinds of gesture (Pinch/Swipe) and (Touchpad/Touchscreen) in globalshortcuts.h/cpp are merged into 1 GestureShortcut
- Change from range to set of finger counts in gestures

No behavior should change, just a refactor.
2 years ago
Kai Uwe Broulik 3646620430 utils: Introduce RamFile class for memfd
This class can be used to create an anonymous file, for instance
to pass data between compositor and clients, through means of a
file descriptor, as is done in various Wayland protocols, notably
the keymap exchange.

It also implements sealing the file, so that it can be shared
between multiple clients without them being able to modify it.

If supported, memfd_create is used, otherwise a `QTemporaryFile`
is used.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2 years ago
Xaver Hugl ff0e89b030 backends/x11/standalone: rename files to be more consistent 2 years ago
Vlad Zahorodnii fa78de6219 kwineffects: Strip ScreenPaintData of transforms
ScreenPaintData provides a way to transform the painted screen, e.g.
scale or translate. From API point of view, it's great. It allows
fullscreen effects to transform the workspace in various ways.

On the other hand, such effects end up fighting the default scene
painting algorithm. For example, just have a look at the slide effect!
With fullscreen effects, it's better to leave to them the decision how
the screen should be painted. For example, such approach is taken in
some wayland compositors, e.g. wayfire, and our qtquick effects already
operate in similar fashion.

Given that, strip the ScreenPaintData of all available transforms. The
main motivation behind this change is to improve encapsulation of item
painting code and simplify model-view-projection code in kwin. It will
also make the job of extracting item code for sharing purposes easier.
2 years ago
David Edmundson 419c0b81fd Support an alternative harcoded scale for X
Anything in xcb_ structs are always in X local, all member variables
aside from buffers are in kwin local space.

This patch ignores a few paths that are not relevant on wayland.
2 years ago
Kai Uwe Broulik a2c91f9434 backends/x11: Cleanup KWinXRenderUtils and move it to eglx11common
The XRender backend has been removed, leaving most of KWinXRenderUtils unused.

The few features that are still used, notable `XRenderPicture` and pict format
are moved into the x11/common directory.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2 years ago
Vlad Zahorodnii b64f95b703 Integrate kwaylandserver
This makes KWin switch to in-tree copy of KWaylandServer codebase.

KWaylandServer namespace has been left as is. It will be addressed later
by renaming classes in order to fit in the KWin namespace.
2 years ago
Volker Krause 972534eb3c Adapt to changes in the Qt6 QPA API
As a pleasant surprise this turned out much easier than anticipated,
all the API is still there, just moved to Qt::GuiPrivate.
2 years ago
Volker Krause 2a171e5fa8 Adapt build system to also support building against Qt6 3 years ago
Volker Krause 57e0119d23 Adapt to Qt6's removal of Qt::X11Extras 3 years ago
Vlad Zahorodnii 0e1d65d5a2 Move opengl context attribute builders to utils directory 3 years ago
Vlad Zahorodnii 7b1bbf6e0a autotests: Drop effect loader tests
Effect loading is already tested using integration tests, for example
the maximize test verifies that the maximize effect is loaded _and_ it
actually does something useful when a window is maximized or restored,
testScriptedEffectLoader only verifies that the effect is loaded, which
is less helpful than what integration tests provide us.

But perhaps the main problem with these tests is that they require us
building a mockverse around them. This litters code with ifdef
preprocessor directives and makes changing such code a living nightmare.

Another problem with these two tests is that they cannot use OpenGL
because it means mocking OpenGL, which we obviously not going to do.
With integration tests, it's not a problem.

The bottom line is that unit tests can be useful but they make life
notoriously difficult when it comes to testing components that depend on
other components.
3 years ago
Vlad Zahorodnii d89501a079 Move platform backends to backends directory
This improves file organization in kwin by putting backends in a single
directory.

It also makes easier to discover kwin's low level components for new
contributors because the plugins directory may come as the last place to
look for. When one hears "plugin", the first thing that comes to mind is
regular plugins, not low level backends.
3 years ago
Vlad Zahorodnii 141947d2e8 effects: Link builtin effects with executables
The main motivation behind this change is to prepare kwin for importing
kwayland-server code in libkwin.

As is, builtin effects are linked with libkwin. Some builtin effects
have wayland specific code. If we move wayland stuff in libkwin, there's
going to be a circular dependency between kwin4_effect_builtins and
libkwin targets.

This change intends to break that dependency by linking builtin effects
to kwin executable.

The main issue with that is that EffectLoader would need to discover the
effects indirectly. QStaticPlugin is used for that purpose.

Besides breaking the cyclic dependency, it makes builtin effects use the
same plugin infrastructure in libkwineffects that external effects use.

Metadata in src/effects/effect_builtins.cpp was converted in a list of
python dictionaries, which was fed to a python script that generated
main.cpp and metadata.json files.
3 years ago
Vlad Zahorodnii bf620fbe04 Move Xkb::LEDs enum to KWin namespace
With the LEDs enum being defined in kwinglobals.h, wayland_server.h
won't need to include keyboard_input.h, which is good for compilation
times and wayland_server.h will drag less stuff, e.g. QtWidgets (input.h
includes QAction)
3 years ago
Vlad Zahorodnii ca1c72dd16 wayland: Fix cross cursor in Xwayland apps
Startup code in plasmashell was changed so xsetroot is not called
anymore, which is sort of fine.

Unfortunately (or not?), it exposed a bug in kwin. Cursor::x11Cursor()
only works in the standalone X11 session.

On Wayland, Cursor::x11Cursor() will return XCB_NONE which results in
seeing cross cursor when there should be arrow cursor.

This change moves xcb_cursor_t look up code from X11Cursor to the base
Cursor class. In hindsight, I would like to introduce a window manager
class where the xcb cursor and other x11 specific code can be moved in
the future for better encapsulation of platform-specific code.

CCBUG: 442539
3 years ago
Vlad Zahorodnii 901e479482 autotests: Rewrite testScreenEdges as an integration test
Due to the screen edges test not being an integration test, it's very
hard to change output related code in libkwin. screens.cpp needs to have
a few ifdefs to successfully compile.

This change rewrites the screen edges test as an integration test in
order to allow us using other components of kwin in screens.cpp and
screenedge.cpp without ifdef guards.

It's not a one-to-one port.
3 years ago
Xaver Hugl da71d218c8 platforms/drm: refactor the gbm surface 3 years ago
Nicolas Fella f910b0de97 Use version-less qt DBus macros
They work with both Qt5 and Qt6
3 years ago
Andrey Butirsky 91f47c9092 fix global shortcuts for non-Latin symbols
Re-use Qt's implementation of handling non-Latin layouts here
For full ASCII range support (Alt+`, etc.) Qt needs to be patched still,
see QTBUG-90611

BUG: 375518
4 years ago
Xaver Hugl c0c3ec09af Refactor DrmObject 4 years ago
Vlad Zahorodnii e7a5726c8b cmake: Use versionless Qt::Qml imported target
While resolving merge conflicts in a patch that ported kwin away from
QtScriptEngine to QJSEngine, I forgot to switch to versionless imported
targets.
4 years ago
Aleix Pol 4638f2f309 inputmethod: Refactor VirtualKeyboardDBus to have its own InputMethpd
This way we can have it call methods directly instead of connecting to
its signals.
4 years ago
Aleix Pol 63a7b25801 inputmethod: Provide DBus API so the shell can integrate with it
It makes it possible to show if the virtual keyboard is being shown and
if it is to hide it.
4 years ago
Aleix Pol b409f523f0 Revert "cmake: Get XKB information directly from PkgConfig"
This reverts commit 3c97cecdb0.

It seems to break on the CI and I don't understand why.
4 years ago
Aleix Pol 3c97cecdb0 cmake: Get XKB information directly from PkgConfig
Rather than having it abstracted in a local FindXKB package.
Makes the code more standard and removes a custom finder we ultimately
don't need.
4 years ago
David Edmundson ae6e6dc63c [scripting] Port ScriptedEffects to QJSEngine
Summary:
QScriptEngine is deprecated for years and suffers bitrot.
Plasma hit one super major bug with it in 5.11.0 and has now ported
away.

Main porting notes:
- creating low level functions no longer exists
The old global functions are exposed on the ScriptedEffect instance
and then the QJSValue wrappers of the globalObject are modified to
trampoline the methods at a wrapper level.

- We can then use QJSEngine to automatically do argument error checking
rather than unmarshalling a QJSValue manually which significantly
reduces a lot of code.

- We can't make FPX2 a native type, so these are QJSValue args and
unboxed there.

Long term I want overloads for animate that take int/QSize/QPoint which
are native JS types, but that might be an API break.

Test Plan:
Hopefully comprehensive unit test which passes
Tested fade/fadeDesktop manually.

It's a very invasive change, so I expect some things will be broke
please help test any JS effects.

Reviewers: #kwin, mart, fvogt

Subscribers: fvogt, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14536
4 years ago
Vlad Zahorodnii 93e0265e4e Move source code to src/ directory
Once in a while, we receive complaints from other fellow KDE developers
about the file organization of kwin. This change addresses some of those
complaints by moving all of source code in a separate directory, src/,
thus making the project structure more traditional. Things such as tests
are kept in their own toplevel directories.

This change may wreak havoc on merge requests that add new files to kwin,
but if a patch modifies an already existing file, git should be smart
enough to figure out that the file has been relocated.

We may potentially split the src/ directory further to make navigating
the source code easier, but hopefully this is good enough already.
4 years ago
Nicolas Fella 99947c8bd8 Use versionless Qt cmake target
This makes it easier to build against both Qt5 and Qt6

GIT_SILENT
4 years ago
Vlad Zahorodnii 15d6be5c0c cmake: Drop Qt5::Sensors dependency
QOrientationSensor is no longer used by kwin.
4 years ago
David Edmundson 85d04cf60d Add ftrace markers
This logs to a tracefs filesystem which can be viewed in tools such as
gpuvis to see precise timings of activities in relation to other trace
markers in X or graphic drivers.

This patch is loosely based on D23114. Though modified with thread
safety, support for string building, and a RAII pattern for durations.
Ultimately that expanded it somewhat.
4 years ago
Vlad Zahorodnii 93194a6720 autotests: Convert testScreens into an integration test
At the moment, the Screens class is convoluted with ifdefs because of
MockScreens.

The goal of this change is to reduce the number of usages of the
MockScreens class so it is possible to get rid of the ifdefs.
4 years ago
Aleix Pol 3a9d7a6e9d Port KWin to KWaylandServer
Summary: Away from KWayland::Server and KF5WaylandServer.

Test Plan: Builds, ran nested session

Reviewers: #kwin, #plasma, #frameworks, davidedmundson, zzag

Reviewed By: #kwin, #plasma, davidedmundson, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29278
4 years ago
Aleix Pol 9f183642ca Fix build
Could reproduce the problem in the CI on Neon, this fixes the build there.
We'll probably want to untangle xcb and wayland dependencies some day...
5 years ago
Aleix Pol 6abd23ed02 Make it possible to have a separate cursor for the tablet
Summary:
As is KWin only had 1 Cursor which was a singleton. This made it impossible for
us to properly implement the tablet (as in drawing tablets) support and show where
we're drawing.
This patch makes it possible to have different Cursors in KWin, it makes all the
current code still follow the mouse but the tablet can still render a cursor.

Test Plan: Tests pass, been using it and works as well as before but with beautiful tablet cursors.

Reviewers: #kwin, cblack, davidedmundson

Reviewed By: #kwin, cblack, davidedmundson

Subscribers: davidedmundson, cblack, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28155
5 years ago
Roman Gilg 2c66e1f690 Remove orientation sensor
Summary:
This functionality will instead be implemented in KScreen such that manual and
automatic output rotation can be used and configured through a single UI in
unison together.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin, bshah, davidedmundson, zzag

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26036
5 years ago
Vlad Zahorodnii 03ae441e23 Change project name to "KWin"
Summary: It's not "KWIN" nor "kWin" nor "kWIN" nor "kwin"

Test Plan: Qt Creator displays "KWin" with correct capitalization.

Reviewers: #kwin, meven

Reviewed By: meven

Subscribers: apol, meven, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26500
5 years ago
Vlad Zahorodnii ffcbe24e2b Rename Client to X11Client
Summary:
Currently each managed X11 client is represented with an instance of
Client class, however the name of that class is very generic and the
only reason why it's called that way is because historically kwin
was created as an x11 window manager, so "Client" was a sensible choice.

With introduction of wayland support, things had changed and therefore
Client needs to be renamed to X11Client in order to better reflect what
that class stands for.

Renaming of Client to X11Client was agreed upon during the last KWin
sprint.

Test Plan: Compiles, the test suite is still green.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24184
5 years ago
Vlad Zahorodnii 09b47b5250 Undo some recent cmake changes
Unfortunately linking can be very fragile so let's not break things.
5 years ago
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.
5 years ago
Roman Gilg 1a11abc821 [platforms/x11/standalone] Port to AbstractOutput
Summary:
Represent outputs in the X11 session via AbstractOutput. For that we
move all Wayland specific parts of AbstractOutput into a new subclass
AbstractWaylandOutput and let the outputs of our Wayland backends inherit
from there.

This should allow us to get rid of the Screens class later on.

Test Plan: Manually in X session.

Reviewers: #kwin, zzag, davidedmundson

Reviewed By: #kwin, zzag, davidedmundson

Subscribers: ngraham, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19208
5 years ago
David Edmundson aa11e4f777 Avoid duplicating screensaver interface definition file
Summary:
Kwin has a mandatory dependency on kscreenlocker, we can use the
screensaver interface definition installed from there.

Test Plan: Compiles

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20764
5 years ago
David Edmundson 47be4be020 [scripting] Make DBus invokable run method return result after execution
Summary:
In 403038 the user expected the DBus call to run to finish before
processing the next request. For a singleshot script that makes a lot of
sense, otherwise you have no idea when it finishes.

This also allows us to return errors.

CCBUG: 403038

Test Plan:
NUM=$(qdbus org.kde.KWin /Scripting org.kde.kwin.Scripting.loadScript /noFile.js Minimize)
qdbus org.kde.KWin /$NUM org.kde.kwin.Scripting.run
  Error: org.kde.kwin.Scripting.FileError
  Could not open /noFile.js

Running a real script behaved effectively the same as before.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18127
6 years ago
David Edmundson 7e8facc3fd [wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)

Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)

Test Plan: used a bit a plasma session together with D12820, D13748 and D13746

Reviewers: #plasma, #kwin, graesslin, davidedmundson

Reviewed By: #plasma, #kwin, davidedmundson

Subscribers: hein, zzag, davidedmundson, kwin

Tags: #kwin

Maniphest Tasks: T4457

Differential Revision: https://phabricator.kde.org/D13887
6 years ago
Martin Flöser bbf00fdd98 Require libinput and udev
Summary:
The main reason for not having it as a mandatory dependency was that BSD
doesn't support it. But as I learned recently it is available on our CI
system. So BSDs have support now.

Even more it showed that the code doesn't compile if the dependency is
missing. And there's one thing I hate: broken build configuration
options.

So let's make UDEV and libinput a required dependency and get rid of the
problems.

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10057
7 years ago