Commit graph

18692 commits

Author SHA1 Message Date
Vlad Zahorodnii
170a0b6395 Provide cursor geometry in device-independent pixels
QImage::size() returns the size of the cursor image in the native
pixels. We cannot use it as the cursor size.
2020-10-27 06:04:17 +00:00
Vlad Zahorodnii
c8eeefbd7d platform/drm: Fix clipped HiDPI hardware cursors
If an output is rotated, we will compute a transform matrix for the
cursor plane to rotate its contents.

In order to compute that matrix we need the rect of the cursor in the
device-independent pixels, the scale factor and the output transform.

The problem is that we provide a rect of the cursor in the native
pixels. This may result in the cursor being partially or fully clipped.

CCBUG: 424589
2020-10-27 06:04:17 +00:00
Ismael Asensio
3d80665c0a [kwinrules] Allow negative numbers in position
This was limited by the range of the edition spinbox, not by the
rules mechanism which already allowed it.

BUG: 428083
2020-10-26 21:15:38 +01:00
Vlad Zahorodnii
0ad4901687 wayland: Provide a way to force xdg surface configure events
XdgSurfaceClient tries to avoid sending unnecessary configure events,
but in some cases, the compositor has to send one even if the surface
state hasn't changed, for example in response to a set_maximized()
request, etc.

This change introduces a special flag to indicate that the scheduled
event has to be sent no matter what.
2020-10-26 18:18:42 +02:00
Vlad Zahorodnii
4a0128cac1 Clip software cursors
If you play some video and the software cursor doesn't hover it, then
the shadow cast by the cursor will be getting darker and darker with
every frame.

The main reason for that is that kwin paints the software cursor even
if the rect behind it hasn't been damaged or repainted.
2020-10-26 13:45:55 +02:00
Vlad Zahorodnii
4b12afced9 screencast: Handle the case where pipewire is not installed
If pipewire is not installed, pw_loop_new() may return a nullptr.

BUG: 427949
2020-10-26 11:42:38 +00:00
Vlad Zahorodnii
9b09f0399f Mark the cursor as rendered after performing compositing
If a cursor animation is driven purely by frame callbacks and kwin
uses hardware cursors, the cpu usage may spike to 100%.

This change addresses that issue by sending frame callbacks after a
compositing cycle has been performed.
2020-10-26 10:02:17 +02:00
Ismael Asensio
7cf74d7df7 Revert "[kwinrules] Show defaults indicator in System Settings"
That commit broke CI's build, while it's building fine locally.

Let's revert it until having a better understanding of the cause.
Also revert the attempt to fix it, which didn't succeed.

This reverts commit 9cbac6fe3a.
This reverts commit 3e15f64055.
2020-10-25 21:26:40 +01:00
Ismael Asensio
3e15f64055 Fix CI error caused by 9cbac6fe
Include header "rulebookdata.h" instead of class forwarding.
The header is automatically generated by kcmutils_generate_module_data
and includes a namespace
2020-10-25 20:32:41 +01:00
Xaver Hugl
4462ecf6ef Detect some DrmConnector properties and ignore non-desktop displays
BUG: 419032
2020-10-25 19:18:06 +00:00
Ismael Asensio
9cbac6fe3a [kwinrules] Show defaults indicator in System Settings
The default is having no rules, so the indicator will show
whenever there is one or more rules in the list.
2020-10-25 18:57:44 +01:00
Xaver Hugl
cdab4be19e Automatically detect the proprietary NVidia driver and use EGLStreams accordingly 2020-10-25 17:47:58 +00:00
Vlad Zahorodnii
6b940c1280 scenes/opengl: Properly render cursors with hidpi
GLTexture::width() and GLTexture::height() return the size of the cursor
texture in native pixels, but we need a size in device independent pixels.

CCBUG: 424589
2020-10-25 08:57:13 +00:00
Vlad Zahorodnii
64b7cc3cf3 wayland: Fix drag-and-drop cursors with hidpi
QImage::rect() returns a rect in the native pixels, however we need a
rect that is in the device independent pixels.

CCBUG: 424589
2020-10-25 08:57:13 +00:00
Laurent Montel
2ac8611523 If include is define in .h remove it if it's defined in .cpp too (scripted) 2020-10-23 21:37:16 +02:00
Laurent Montel
9ffc8bf7d5 Now it depends against new version. Old code can be removed 2020-10-22 14:06:09 +02:00
Méven Car
fe41af9e50 ScreenshotEffect: don't expect authorization for interactive screenshots 2020-10-22 12:20:31 +02:00
Nicolas Fella
fee696ec88 Remove defunct calls to KAboutData::pluginInfo
They always return nullptr since the info was never registered.
2020-10-22 09:43:52 +00:00
Luigi Toscano
773e0355b3 Generic wording for apps which can remember their settings
Only a subset of KDE applications (part of KXMLGUI ones) support
this setting, and on the other hand non KDE applications
may support it as well.
As there is no way to identify the subset of affected applications
not even with technical terms, make the description a bit more
generic, leaving it open to future improvements to the set of
supported applications.
2020-10-21 19:17:23 +00:00
Bhushan Shah
733692f439 input: reconfigure after setting up the libinput
Previously seat interface was keeping track of the repeat information,
but now it is taken care by KeyboardInterface, which is created only if
the setHasKeyboard is set to true.

So, since we are setting up various capabilities on seat in libinput,
re-parse configuration here, so that various information like key repeat
is notified to kwayland-server

BUG: 428039
2020-10-21 16:01:06 +05:30
Andrey Butirsky
f30ad51bfd fix KeyboardLayoutTest
FAIL!  : KeyboardLayoutTest::testChangeLayoutThroughDBus() '!layoutChangedSpy.wait(1000)' returned FALSE. ()
   Loc: [/home/bam/kde/src/kwin/autotests/integration/keyboard_layout_test.cpp(250)]
2020-10-20 20:50:59 +00:00
Vlad Zahorodnii
7301564e4f Use bilinear interpolation to compute texture coords of subquads
On Wayland, a surface must be displayed the same way no matter how the
attached buffer is transformed. In order to guarantee that, we build the
surface-to-buffer matrix, which is used to compute the texture coords.

The surface-to-buffer matrix represents an affine transformation. Thus,
performing linear interpolation between texture coordinates won't end up
in corrupted rendered results. This is the main assumption that we make
during generation of contents window quads. After creating a sub-quad,
the new quad's texture coordinates are computed by interpolating between
the source quad's texture coords.

However, WindowQuad::makeSubQuad() makes a concrete assumption about the
order of texture coords, which might be false if the attached wayland
buffer is rotated 90 or 270 degrees.

This issue went unnoticed after merging the viewporter patches because
the developer who was working on it had been using primarily nested
kwin_wayland for testing purposes. And it appears like kwin schedules
full screen repaints even though it supports buffer age. It still needs
some investigation why that happens.

BUG: 428003
2020-10-20 15:41:00 +00:00
Bhushan Shah
5e037570fe wayland: adapt to changes in the keyboard and seat interface 2020-10-20 14:48:29 +00:00
Vlad Zahorodnii
fb5143d34d qpa: Query various properties of the platform OpenGL context
Qt checks OpenGL version to determine if some features can be enabled.
This change ensures that the format EGLPlatformContext returns has
properly initialized the OpenGL version, the context profile and the
format options (e.g. whether it's a debug context, etc).
2020-10-20 09:54:17 +00:00
Lewis Lakerink
16cb4286b1 Fix pipewire stream double free 2020-10-20 18:56:37 +11:00
l10n daemon script
f782c1f7ee SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-10-20 06:33:09 +02:00
Aleix Pol
ba1737787a xwl: properly check type inheritance 2020-10-20 02:16:00 +02:00
Aleix Pol
c016f34dee xwl: prefer using local variable than fetching again 2020-10-20 02:14:18 +02:00
Aleix Pol
e81e950693 xwl: simplify logic of boolean function 2020-10-20 02:13:42 +02:00
Aleix Pol
6ec13c41a5 xwl: Remove unnecessary lambda 2020-10-20 02:11:33 +02:00
Alexander Lohnau
d1a0c1491a Do not explicitely define Exec line for KCM 2020-10-19 15:53:26 +00:00
Fabian Vogt
96635ea29c Detect softpipe and llvmpipe on Mesa 20.2+
It seems like the vendor string changed from "VMware Inc." to "Mesa/X.org".
2020-10-19 14:53:38 +00:00
Vlad Zahorodnii
9c20df5030 screencast: Use fences to avoid stalling the graphics pipeline
Currently, we use glFinish() to ensure that stream consumers don't see
corrupted or rather incomplete buffers. This is a serious issue because
glFinish() not only prevents the gpu from processing new GL commands,
but it also blocks the compositor.

This change addresses the blocking issue by using native fences. With
the proposed change, after finishing recording a frame, a fence is
inserted in the command stream. When the native fence is signaled, the
pending pipewire buffer will be enqueued.

If the EGL_ANDROID_native_fence_sync extension is not supported, we'll
fall back to using glFinish().
2020-10-19 14:23:06 +00:00
Vlad Zahorodnii
170c41681d Drop unused EGLSurface getter and setter in Platform
Besides being unused, we should avoid making OpenGL contexts current
against the EGLSurface of the first output because it's a slippery road
that may end up in leaking context-specific resources in the mid of a
compositing restart.
2020-10-19 13:13:08 +03:00
Vlad Zahorodnii
292335beac Introduce persistent global share context
On Wayland, internal windows that use OpenGL are rendered into fbos,
which are later handed over to kwin. In order to achieve that, our QPA
creates OpenGL contexts that share resources with the scene's context.

The problems start when compositing has been restarted. If user changes
any compositing settings, the underlying render backend will be
reinitialized and with it, the scene's context will be destroyed. Thus,
we no longer can accept framebuffer objects from internal windows.

This change addresses the framebuffer object sharing problem by adding
a so called global share context. It persists throughout the lifetime of
kwin. It can never be made current. The scene context and all contexts
created in our QPA share resources with it.

Therefore we can destroy the scene OpenGL context without affecting
OpenGL contexts owned by internal windows, e.g. the outline visual or
tabbox.

It's worth noting that Qt provides a way to create a global share
context. But for our purposes it's not suitable since the share
context must be known when QGuiApplication attempts to instantiate a
QOpenGLContext object. At that moment, the backend is not initialized
and thus the EGLDisplay is not available yet.

BUG: 415798
2020-10-19 12:13:15 +03:00
Vlad Zahorodnii
da12d3804f Fix a potential SIGSEGV
Compositor::self()->scene() may return nullptr while compositing is
being restarted.
2020-10-19 06:12:13 +00:00
Vlad Zahorodnii
cc8cb8db9d qpa: Create a pbuffer for internal windows
If the surfaceless context extension is unsupported by the underlying
platform, the QPA will use the EGLSurface of the first output to make
OpenGL contexts current.

If an internal window attempts to make an OpenGL context current while
compositing is being restarted, for example it's typically the case with
the composited outline visual, QPA will either try to make the context
current with a no longer valid EGLSurface for the first output or will
crash during the call to Platform::supportsSurfacelessContext(). The
latter needs more explanation. After the compositingToggled() signal has
been emitted, there is no scene and supportsSurfacelessContext() doesn't
handle this case.

In either case, we could return EGL_NO_SURFACE if compositing is being
restarted, but if the underlying platform doesn't support the surfaceless
context extension, then the composited outline will not be able to
delete used textures, framebuffer objects, etc.

This change addresses that problem by making sure that every platform
window has a pbuffer allocated in case the surfaceless context extension
is unsupported.
2020-10-19 06:12:13 +00:00
Vlad Zahorodnii
41d431de27 Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).

While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.

Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.

Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.

Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 16:11:13 +03:00
Vlad Zahorodnii
fea950f23a Track the input shape of the server-side decoration
In order to determine if a window accepts input at specified position,
we need to check if the decorated window and the server-side decoration
contain the given point.

While we have a way to determine if a point falls inside the input shape
of the decorated window, there is no any way to do the same for the deco.
2020-10-17 15:43:16 +03:00
Vlad Zahorodnii
ba4f6b35ae Introduce geometry conversion helpers
The new helpers are designed for the purpose of mapping points from the
global screen coordinates to the frame-local and the surface-local coords
2020-10-17 15:40:51 +03:00
Vlad Zahorodnii
7eccfdc528 wayland: Introduce logicalToNativeMatrix() helper
The new helper function computes the projection matrix from the logical
coordinate space to the display coordinate space.
2020-10-16 17:03:39 +00:00
Vlad Zahorodnii
f1741317cd platforms/drm: Fix software flip output transforms
Currently, flip output transformations in the software fallback code
path are equivalent to normal rotate output transformations.

This change implements flip output transformations according to the
wl_output spec.
2020-10-16 17:03:39 +00:00
Vlad Zahorodnii
3b8e489b6f platforms/drm: Compute correct cursor transform matrix
Currently, when the DRM platform uses cursor planes, the cursor on
a rotated output may be cropped because the math behind the current
cursor transform matrix is off.

In order to fix the cropping issue, this change replaces the current
cursor transform matrix with the core part of the surface-to-buffer
matrix, which was written against the wl_output spec.

BUG: 427605
CCBUG: 427060
2020-10-16 17:03:39 +00:00
Vlad Zahorodnii
33fad70c9b platforms/drm: Fix initialization of EGL displays
Currently, every time compositing is restarted, both the gbm and the egl
streams backend will re-obtain the EGLDisplay object.

This is wrong because the core assumption is that the EGL display doesn't
change once it has been obtained.
2020-10-16 17:12:33 +03:00
Vlad Zahorodnii
a195223a8d wayland: Fix Qt clients not being maximized initially
Currently, Qt clients send two maximize requests separated by the
initial commit. From spec's perspective, this is totally fine, the
client should receive two configure events with "maximized" state.

But because changeMaximize() in XdgToplevelClient and setMaximized()
operate on two different maximize modes, the second maximize request
will trick kwin into thinking that the client should be restored.
2020-10-15 11:35:06 +00:00
Benjamin Port
4acea54272 KCM: Adapt to KCMUtils change 2020-10-15 08:45:52 +00:00
Vlad Zahorodnii
2093820aba xwayland: Avoid creating a tree query on crash
If Xwayland has crashed, the Workspace will block stacking order updates
and start destroying all X11 clients.

Once stacking order updates are unblocked, the Workspace will mark the X
stacking order as dirty and create a new Xcb::Tree object.

We don't want to create that Xcb::Tree object because accessing it
after the XCB connection has been shut down will lead to a crash.

BUG: 427688
FIXED-IN: 5.20.1
2020-10-14 16:17:42 +00:00
Vlad Zahorodnii
37ffba8b0f libkwineffects: Specify more dependencies 2020-10-14 13:03:57 +00:00
Vlad Zahorodnii
ffeebc4c2f libkwineffects: Specify valid min Qt version in KWinEffects.config.in
REQUIRED_QT_VERSION is used primarily in KF projects, not in Plasma
projects.
2020-10-14 13:03:57 +00:00
Cyril Rossi
d11daecce5 KCM KWinTabbox use KCModuleData
Allow to display a dot in the category list when settings has changed
from default.

CCBUG: 426775
2020-10-14 12:10:36 +00:00