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.
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
Summary:
Font scaling is based on the screen scale factor so we can just return
dpi of 96.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22219
Summary:
Depending on whether the underlying platform supports offscreen surfaces,
QOffscreenSurface may create an invisible QWindow. In our case that's the
case, for each offscreen surface a native window is created. This may
lead to some funky results related to window decorations, see bug 407612.
There are several ways to implement offscreen surfaces - either use pbuffers
or utilize a surfaceless context extension. For the sake of simplicity
this change sticks with pbuffers, but it's a good idea to support both
methods.
CCBUG: 407612
Reviewers: #kwin, romangg
Reviewed By: #kwin, romangg
Subscribers: romangg, alexeymin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22150
Summary:
Since QPA only performs off-screen rendering, it does not require an EGLConfig
that supports any particular surface type. Currently it requests a config
supporting window surfaces, however the EGLDeviceEXT platform, which is the
basis of the EGLStream back-end used with the proprietary NVIDIA driver, does
not support such surfaces resulting in eglChooseConfig not returning any valid
configs when that back-end is in use. Since QPA doesn't actually create any
window surfaces, it should be fine to remove this restriction to allow it to
initialize properly with the EGLStream back-end.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin, davidedmundson
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20455
Summary:
Using the Wayland protocol for OpenGL is no longer used or useful. KWin
internal windows only use OpenGL through QtQuick. We either have the
sharing context (KWin uses OpenGL for compositing) or we have the
QPainter compositor which also turns QtQuick to use software renderer.
Thus a situation where the Wayland platform context is useful doesn't
exist any more. Removing it helps getting the QPA plugin Wayland free.
Test Plan:
Run nested KWin triggering Outline once with OpenGL and once
with QPainter compositor.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19012
Summary: Required for kwin_wayland to find it's own plugin.
Test Plan: My kwin_wayland was crashing and gdb showed wrong plugin being loaded
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19010
Summary:
So far we didn't try to do high DPI on kwin internal windows, such as
the user context menu and tab bars and whatever.
Due to wayland scaling they were the correct phyiscal size but upscaled.
This patch fixes our QPA to enable Qt's high-dpi support.
BUG: 402853
Note icons are still low res. This is because the global
QGuiApplication::devicePixelRatio which is the max of all connected
screens is static for the duration of the app. QIcon uses this when
determining the DPR to use. This will require a Qt change.
Test Plan:
Ran at 2x on my normal DPI screen (as that's easier to see anything)
* User action menu is high DPI
* Window deco tooltips are still fine
* Tab switcher is high DPI
* Overlay in present windows Desktop grid are still ok
Reviewers: #kwin
Subscribers: zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18042
Summary:
Even though the buffer is passed through a side channel some properties
we might use are double-buffered on the surface commit.
Test Plan: Used by unit test InternalWindowTest::testScale in linked commit
Reviewers: #kwin, graesslin
Reviewed By: #kwin, graesslin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18085
Summary:
This is a preparation step to move this to ECM (or possibly CMake),
which makes sense now that qtbase is using this too (for Qt6).
Reviewers: #build_system, cgiboudeaux
Reviewed By: cgiboudeaux
Subscribers: cgiboudeaux, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17547
Summary:
Ideally KWin would not depend on private headers... but at least we can
remove unused ones.
Test Plan: still builds, I don't see anything requiring the header.
Reviewers: zzag
Reviewed By: zzag
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D16655
Summary: This file was required for Qt 5.8. We require 5.11 as minimum version.
Test Plan: Grepped for the file being used in other cmake code, rebuilt KWin without it.
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: kwin, zzag
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D16654
Summary:
Qt does not like having no screens. Both Qt XCB and Wayland QPAs have
systems pretend there's always at least 1 screen
present.
Kwin already uses a dummy screen on startup, this patch reinserts the
dummy screen if the platform states that all real screens are removed.
BUG: 399564
Test Plan:
Logged in, everything still worked
Did not reproduce the original bug
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D16096
Summary:
QOpenGLContext was changed to call platform->makeCurrent before it
called setCurrentContext.
Because we bind window FBO and ultimately that calls
QOpenGlContext::format we need Qt to know which context is current so it
can tell us the format.
This matches the QtWayland EGL code.
BUG: 399392
Test Plan:
Switched virtual desktop with the OSD (previously reliably crashed)
Now it doesn't
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15957
Summary:
This patch implements using EGL_IMG_context_priority to request
high-priority rendering contexts if the extension is available.
EGL_IMG_context_priority is currently used in this fashion by
e.g. Android's SurfaceFlinger (RenderEngine.cpp) and libweston
(gl-renderer.c) and seems promising given this widespread
acceptance.
Reviewers: #kwin, graesslin, romangg, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D11572
Summary:
The test DontCrashUseractionsMenu (Waylandonly) found an issue in our
screen handling implementation in the QPA. The code exposed a short time
frame between the dummy screen getting destroyed and the first screen
being added. This could result in a crash of KWin.
There is actually no need to implement Screen on top of Wayland screen.
KWin has all the knowledge, so we can also base this on top of the
Screens API.
Advantages:
* no delays due to Wayland roundtrips
* handle screen getting removed (was a TODO)
* handle resolution changes (was a TODO)
The new implementation has a disadvantage that it destroys and readds
all screens whenever something around the screen changes. This shouldn't
be an issue in practice as it's only for the internal QPA and thus only
affects KWin internal windows which is placed in global coordinates
anyway. If it turns out to be a problem we need to track better the
screen changes - so far those were not tracked at all.
Test Plan: Run a few unit tests which change screens
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8345
Summary:
Introduces a few more attributes needed for creating the OpenGL context
used by the QPA.
Test Plan:
Extended test and run KWin/Wayland and verified that OpenGL context
gets created correctly.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D6734
Summary:
This is a regression due to changes in Breeze to support Qt 5.8+ behavior
change. KWin's own QPA operates like < Qt 5.7 and breeze was programmed
against that. Due to that it can happen now that Breeze hits code paths
in which KWin does not have a surface.
To trigger one only needed to open the user actions menu twice.
This change adds a test case which simulates the problem and fixes all
crashes happening in the code path.
Most likely shadows are now broken for KWin's own windows, this change is
only to prevent the crash and thus is for 5.10 branch, while shadow
fixing will go to master branch.
BUG: 382063
FIXED-IN: 5.10.4
Test Plan: New test case
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D6533
Summary: Basically just a copy and paste from the relevant Qt Wayland
parts.
Reviewers: #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D5172
Summary:
With the TabBox I observed the following issue:
1: trigger TabBox through screen edge
2: exit TabBox
3: trigger TabBox again through screen edge
Actual behavior: in step 3 the GUI does not show. If now using Alt+Tab
to show the TabBox the gui shows, but through screen edge it stays
broken.
Investigation showed that the difference is a direct show in screen edge
case and a delayed show in Alt+Tab case. Futher investigation shows that
an invalid geometry gets requested in the broken case. While this might
indicate an issue in another area it makes sense to protect KWin
internally against it and not to break rendering.
Thus this change ensures that a valid FBO does not get replaced by an
invalid sized FBO.
Test Plan:
Tested that Alt+Tab works correctly when triggered through
edge
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5438
Summary:
Increases minimum Qt version to 5.7. This allows to drop the pre-5.7
virtual keyboard and various ifdefs for now unsupported versions.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D4485
On build.kde.org the autotests started to crash on tear down due to a
newer Wayland library. The reason is that the KWayland::Client::Outputs
are destroyed after the internal Wayland connection is destroyed.
This change parents the created Outputs to the Registry like the other
objects. To ensure that the KWin::QPA::Screen doesn't have a problem
with that, it is changed to a QPointer - nullptr checks are already in
place.
Hopefully that will fix the crashes on build.kde.org, but there is a
chance that more errors are hidden.
Summary:
SharingPlatformContext::swapBuffers needs to make the context current.
For this is calls makeCurrent. Later on this tries to bind a fbo, which
checks calls into the current QOpenGLContext. As we called makeCurrent on
our own platform context Qt doesn't know that the context is current and
returns in the worst case a nullptr and crashes.
This change calls makeCurrent on the QOpenGLContext so that Qt also knows
that this context is current now. The QOpenGLContext calls makeCurrent on
the platform context, so what our code tried to do is still being done.
In addition the method context() in AbstractPlatformContext is renamed to
eglContext to no longer shadow the method in QPlatformContext.
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D2582
Summary:
With this change KWin can create window decorations for internal windows.
Thus it's also possible to move internal windows and resize them which is
especially important for the debug console.
Reviewers: #kwin, #plasma_on_wayland, sebas
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D2371
Summary:
So far SharingPlatformContext was only used if the OpenGL context
supports EGL_KHR_surfaceless_context. If not supported, KWin tried to
create a context through the Wayland API. Unfortunately on hwcomposer
platform this results in a crash as libhybris only supports the init
of EGLDisplay for one native platform.
This change tries to also use the SharingPlatformContext if there is
an OpenGL context in general. It reuses the native EGLSurface created
for the compositing scene and makes its own OpenGL context current on
that surface, too. As KWin creates an FBO, it never renders to it, so
it shouldn't matter at all.
In order to prevent EGL_BAD_MATCH errors when making Qt's OpenGL context
current also the EGLConfig from the scene is used to create the context.
Test Plan: Tested on Nexus5 with qtvirtualkeyboard in KWin
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D2231
We didn't check whether creating the QPlatfromInputContext worked and
accessed the m_inputContext unconditionally which obviously crashed.
Now the connects related to QInputMethods are not setup if we failed
to create the QPlatfromInputContext.
Reviewed-By: bshah
Summary:
The idea is to have KWin provide a virtual keyboard. To support this
KWin uses the QT_IM_MODULE qtvirtualkeyboard and makes sure that the
QPA plugin loads it.
KWin has a new class VirtualKeyboard which acts as the focus object and
the "proxy" for input methods. The QPA plugin ensures that this is the
focusObject, so that all input method related events are sent to this
class. From there it will be possible to delegate to other applications
through the Wayland interfaces.
Reviewers: #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D1638
Summary:
If a user specifies the QT_WAYLAND_FORCE_DPI env variable, KWin uses
it to force a logicalDPI, just like QtWayland.
Test Plan: Normally sized window decorations
Reviewers: #plasma
Subscribers: plasma-devel
Projects: #plasma
Differential Revision: https://phabricator.kde.org/D1605
Summary:
Mostly intended for plugins loaded into KWin and wanting to use
KWayland::Client::ConnectionThread::roundtrip(). By providing this
function we can ensure that KWin does not block and nevertheless
perform the required roundtrip.
Reviewers: #plasma
Subscribers: plasma-devel
Projects: #plasma
Differential Revision: https://phabricator.kde.org/D1153
Qt has problems initializing everything correctly if there is no screen
at startup. E.g. the breeze widget style tries to initialize some pixmaps
and this fails. In worst case hitting asserts in Qt (debug build).
This change creates a dummy screen which gets destroyed as soon as there
is a real screen.
Reviewed-By: notmart and sebas