Commit graph

129 commits

Author SHA1 Message Date
Aleix Pol Gonzalez
bf1ce85474 Make it possible to build KWin without libxcb
Now that we have Wayland around, there's a whole branch of dependencies
that shouldn't be necessary anymore.
This allows to build KWin without all of it, allowing us to have a much
more compact alignment for cases where all the legacy software isn't
necessary anymore.

Bundle KWindowSystem X11-specific headers into it too, since it's part
of the same process.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2024-02-28 16:03:50 +00:00
Vlad Zahorodnii
e01116149b tests: Fix constraint region in pointerconstraints example 2024-01-24 10:23:45 +02:00
Bart Ribbers
a879c59a08 Fix building of tests on Musl by making sure to include sys/select.h
Required for access to fd_set
2024-01-11 17:00:09 +01:00
Jonathan Esk-Riddell
cc4eac4c85 Port to renamed kwayland
https://invent.kde.org/plasma/kwayland/-/merge_requests/107  use renamed kwayland
2023-11-23 19:34:24 +00:00
Vlad Zahorodnii
ec2a4f4120 Add missing QPointer include
Otherwise renderingservertest.cpp fails to build on my machine.
2023-11-13 10:18:46 +00:00
Laurent Montel
bc6116c5a7 There's no QVector anymore, QList is the QVector in Qt6 2023-10-19 13:43:53 +00:00
Vlad Zahorodnii
8b2b8d87c7 Don't mark wayland demos as tests 2023-10-06 11:21:00 +00:00
Vlad Zahorodnii
7d56aa3687 Merge wayland tests with other tests
This makes wayland tests organization consistent with other kwin tests.
2023-10-06 11:21:00 +00:00
Laurent Montel
b823747c3b Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
2023-07-15 08:40:49 +00:00
Vlad Zahorodnii
0a82f33db5 Drop XCB_ICCCM_FOUND checks
Qt requires xcb-icccm 0.3.9. On the other hand, 0.3.9 contains all the
types and functions used by kwin, so remove the corresponding
XCB_ICCM_FOUND checks to simplify the code.
2023-05-03 11:40:01 +00:00
Vlad Zahorodnii
e88a4e34a3 Remove some include_directories()
It seems we've settled on dir/dir/header.h includes, so let's use them
consistently.
2023-03-23 14:37:48 +02:00
Vlad Zahorodnii
4148be0d27 Port to versionless QML module imports
It's more convenient and Qt upstream seems to encourage to use it too,
e.g. example import statements have no version.
2023-03-12 14:18:34 +00:00
Vlad Zahorodnii
10df3b0eb0 Remove Qt 5 specific code 2023-02-28 18:30:26 +02:00
Vlad Zahorodnii
d9f5d432be Port to KF6 2023-02-28 18:30:26 +02:00
Vlad Zahorodnii
7fffe99328 build: Add -Wno-unused-parameter compiler option
Due to being a compositor, kwin has to conform to some certain
interfaces. It means a lot of virtual functions and function tables to
integrate with C APIs. Naturally, we not always want to use every
argument in such functions.

Since we get -Wunused-parameter from -Wall, we have to plumb those
unused arguments in order to suppress compiler warnings at the moment.

However, I don't think that extra work is worth it. We cannot change or
alter prototypes in any way to fix the warning the desired way. Q_UNUSED
and similar macros are not good indicators of whether an argument is
used too, we tend to overlook putting or removing those macros. I've
also noticed that Q_UNUSED are not used to guide us with the removal no
longer needed parameters.

Therefore, I think it's worth adding -Wno-unused-parameter compiler
option to stop the compiler producing warnings about unused parameters.
It changes nothing except that we don't need to put Q_UNUSED anymore,
which can be really cumbersome sometimes. Note that it doesn't affect
unused variables, you'll still get a -Wunused-variable compiler warning
if a variable is unused.
2022-10-31 15:50:37 +00:00
Aleix Pol
4f20e9216f Make it possible to raise windows on top of the lockscreen
Requires clients to have the
X-KDE-Wayland-Interfaces=kde_lockscreenallowed_v1 set in their desktop
file, then they will be able to use the kde_lockscreenallowed_v1
protocol to raise any surface above the lockscreen.
The protocol has only 1 method, raise_surface to do exactly that.

Makes it possible to implement
https://invent.kde.org/teams/plasma-mobile/issues/-/issues/98
2022-09-02 10:48:49 +00:00
Xaver Hugl
8955a2420e replace all uses of QScopedPointer with std::unique_ptr 2022-08-04 12:30:09 +00:00
Volker Krause
f8516c1b42 Port remaining QQC1 uses 2022-08-02 18:06:54 +02:00
Volker Krause
6eb8d1bbf7 Fix Qt6 build of the xdgactivationtest 2022-05-06 18:45:17 +00:00
Aleix Pol
7a279522a8 Provide an xdgactivationtest
Adds a test that has two windows and one activates the other.

There are two versions: qt5 and qt6.
The Qt 6 code is vastly different since Qt 6 knows about
xdg_activation_v1, so it makes sense to have both for now.
2022-04-27 23:14:29 +00:00
Vlad Zahorodnii
7096e3ead8 Run clang-format
The .clang-format file is based on the one in ECM except the following
style options:

 - AlwaysBreakBeforeMultilineStrings
 - BinPackArguments
 - BinPackParameters
 - ColumnLimit
 - BreakBeforeBraces
 - KeepEmptyLinesAtTheStartOfBlocks
2022-03-25 13:25:15 +02:00
Volker Krause
57e0119d23 Adapt to Qt6's removal of Qt::X11Extras 2022-03-16 06:45:42 +00:00
Vlad Zahorodnii
293b2244ac Move xcbutils to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
1b2c7b248b Run clazy with qt-keywords fixit
In C++20, there will be emit() class member, which can conflict with the
emit keyword. Given that, there are plans to enable QT_NO_KEYWORDS by
default in the future.

See also
https://lists.qt-project.org/pipermail/development/2020-February/038812.html
2021-06-08 10:49:42 +03:00
Aleix Pol
d6e8148675 Add missing Q_EMIT when emitting signals 2021-05-14 01:35:33 +02:00
Aleix Pol
4b3cc58073 Do not override parent's class signals with the same name 2021-05-14 01:35:33 +02:00
Aleix Pol
50dd08531e Make sure we do not get references on temporary objects 2021-05-14 01:35:33 +02:00
Vlad Zahorodnii
343338049c Drop libinputtest
There's little practical value behind it. If there are input related
issues, we will ask for WAYLAND_DEBUG output.
2021-03-23 08:01:19 +00:00
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.
2021-02-10 15:31:43 +00:00
Vlad Zahorodnii
68c675d00d Make source code more relocatable
Occasionally, I see complaints about the file organization of kwin,
which is fair enough.

This change makes the source code more relocatable by removing relative
paths from includes.

CMAKE_CURRENT_SOURCE_DIR was added to the interface include directories
of kwin library. This means that as long as you link against kwin target,
the real location of the source code of the library doesn't matter.

With autotests, things are not as convenient as with kwin target. Some
tests use cpp files from kwin core. If we move all source code in a src/
directory, they will need to be adjusted, but mostly only in build
scripts.
2021-02-10 15:31:42 +00:00
Nicolas Fella
99947c8bd8 Use versionless Qt cmake target
This makes it easier to build against both Qt5 and Qt6

GIT_SILENT
2021-01-30 17:18:21 +01:00
Vlad Zahorodnii
26b249061e cmake: Remove FindUDev.cmake
It's in extra-cmake-modules now.
2021-01-05 23:08:47 +02:00
Konrad Materka
d2f3372749 Fix Connections warnings
Qt 5.15 introduced new syntax for defining Connections. Fix warnings like this one:
QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
2020-11-11 19:22:40 +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
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
2020-02-29 09:59:30 +05:30
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
2020-01-25 03:05:02 +02:00
Vlad Zagorodniy
973f873dc7 [tests] Drop wl-shell test client
Summary: Drop waylandclienttest in favor of xdg-shell test client from KWayland.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23565
2019-09-23 17:28:56 +03: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
Vlad Zagorodniy
c7639fd7ed Port away from deprecated headers
Summary: Headers like stdio.h are deprecated in C++.

Test Plan:
Compiles.

clangd no longer spews these warnings

{F6997789, size=full}

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22351
2019-07-09 23:59:07 +03:00
Roman Gilg
054ccc3898 Use locked cursor position hint
Summary:
Listen for cursor position hint changes and set cursor position to the hint
on unlock if a valid position hint was set.

Test Plan: With pointer constraints test app.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin

Tags: #kwin

Maniphest Tasks: T4693

Differential Revision: https://phabricator.kde.org/D14176
2018-07-27 17:19:33 +02:00
Roman Gilg
fcfe8763f6 [tests] Fix unconfine Button 2018-06-10 19:50:44 +02:00
Roman Gilg
497d077349 [tests] Add pointer constraints test
Summary:
Provides a testing application for pointer locking and pointer confining in
a Wayland session.

The application can be started with QT_QPA_PLATFORM variable set to wayland
or xcb to test constraining in native mode as well as through Xwayland.

Several modes and properties can be selected to test various forms of locking
and confining.

{F5899580}

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13439
2018-06-09 15:22:49 +02:00
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
2018-02-04 15:00:42 +01:00
Martin Flöser
e0b1a5715b Add DBus interface to OrientationSensor and a persistent configuration
Summary:
The initial state for user enabled is now read from config. In addition
a DBus interface is provided exporting this property. This allows
KScreen to determine whether automatic screen rotation is available and
whether the user has it enabled or not.

Furthermore KScreen can change the property and this gets stored into
the configuration. Thus KScreen can offer a user interface to
enable/disable automatic screen rotation as well as enabling/disabling
the manual rotation based on the current user settings.

Test Plan:
Not yet tested, coded on the system which doesn't have an
orientation sensor

Reviewers: #kwin, #plasma, sebas, davidedmundson

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8738
2017-12-26 22:02:47 +01:00
Martin Flöser
9df1744830 Support automatic screen rotation based on orientation sensor
Summary:
This change introduces an OrientationSensor class which wraps a
QOrientationSensor. The OrientationSensor is hold by Screens and gets
enabled if Screens knows about an internal (e.g. LVDS) display which
supports rotation. In addition the OrientationSensor holds an KSni to
enable/disable the automatic rotation support.

The drm platform plugin is adjusted to make use of the OrientationSensor.
The API is defined in a way that this can also be implemented on other
platforms supporting rotation. Most important are hwcomposer and X11
standalone. The latter should be straight forward as rotation is provided
through XRandR. The former needs addition for rotation support first.

Test Plan: Rotated my Yoga 12

Reviewers: #kwin, #plasma, sebas

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8699
2017-11-08 17:44:38 +01:00
Martin Flöser
4bfeeb3084 [platforms/drm] Fix cursor hotspot for inverted landscape rotation
Summary:
This change fixes the hotspot calculation by introducing a dedicated
matrix to map the hotspot.

To better test the hotspot a small test application is added. The app
renders a red point at the cursor position and uses a cross for cursor
with the hotspot position being transparent. So if KWin renders the
cursor at the correct position a red point is visible in the center of
the cross. The test app supports several cursor hotspot positions:
 * center (default)
 * top left
 * top right
 * bottom right
 * bottom left

To switch between the variants press the space key.

Test Plan:
Rotated screen, used test app to verify the hotspot is
correct. Also scaled display, still correct

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8668
2017-11-06 16:48:44 +01:00
Martin Gräßlin
346619aa36 Remove KWin::display from kwinglobals
Summary:
And finally nothing inside libkwineffects, libkwinglutils,
libkwinxrenderutils and kwineffect and kwin core uses KWin::display.
We are finally XLib free!

This change drops KWin::display and removes the include to QX11Info from
kwinglobals.h. And the libraries no longer need to link X11Extras.  Due
to that removal a few seeming unrelated changes are required to add the
include where needed and linkage to X11Extras.

The biggest change is to x11 platform plugin which still needs the
display and caches it in the Platform and passes it to various places in
a way that the code doesn't need to be adjusted.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3337
2016-11-16 18:00:00 +01:00