Commit Graph

18553 Commits (439dcc4b1f6c249ff92dc1807d6a7416e4af25e7)

Author SHA1 Message Date
Aleix Pol 439dcc4b1f xwl: Include errors and warnings 2020-10-29 15:56:13 +01:00
Vlad Zahorodnii 2715cbc86c Transform a pending repaint into a workspace repaint before destroying Deleted
The sliding popups effect schedules a repaint and then unreferences the
deleted window. The problem with doing so is that the scheduled repaint
will be effectively discarded because the Deleted will be destroyed once
we are back in the event loop.

This issue is most noticeable on Wayland. Not sure why. If you close
Kickoff, you may see its flickering ghost in background.

If it happens that a Deleted has a pending repaint, transform it into a
workspace repaint to avoid discarding any scheduled repaints.
2020-10-29 12:56:51 +02:00
Vlad Zahorodnii 5442762371 platforms/drm: Use a software cursor if the cursor image is too big
When dragging files on the desktop, the cursor image might be just too
big for the cursor plane, in which case we need to abandon hardware
cursors for a brief moment and use a software cursor. Once the files
have been dropped and the cursor image is small enough, we can go back
to using hw cursors.

BUG: 424589
2020-10-29 08:53:07 +00:00
Vlad Zahorodnii d5ee009ba5 Fix capitalization in the word "software" 2020-10-29 08:53:07 +00:00
Vlad Zahorodnii ae883aaa2d Include cursor theme name and size in support info
It might be useful while triaging cursor related issues.
2020-10-29 06:55:17 +00:00
Ismael Asensio f397f072df Reply a meaningful dBus error when detecting unmanaged windows
Currently, the method `createErrorReply()` with empty strings
errors out and the client gets no answer:
```
QDBusConnection: error: could not send error message to service "":
Error name cannot be empty
```

Simple test:
qdbus org.kde.KWin /KWin org.kde.KWin.showDebugConsole
qdbus org.kde.KWin /KWin org.kde.KWin.queryWindowInfo

Error name uses D-Bus Interface-like notation as suggested in
https://doc.qt.io/qt-5/qdbuserror.html#name

CCBUG: 340477
2020-10-28 21:41:21 +01:00
Vlad Zahorodnii e5b2fca409 scenes/opengl: Use GL_CLAMP_TO_EDGE wrap mode with sw cursor
We use the GL_LINEAR magnification filter. This means that GL_REPEAT
wrap mode cannot be used for the software cursor because sampling texels
beyond the right texture edge is the same as sampling texels on the
left edge. This may produce undesired visual artifacts.
2020-10-28 19:20:46 +02:00
Ismael Asensio 329e816f16 Port from deprecated QString::SkipEmptyParts 2020-10-28 06:30:35 +00:00
Vlad Zahorodnii 7372efffc6 platforms/drm: Remove redundant args in DrmBackend::moveCursor()
Similar to the cursor image, the cursor position can be retrieved by
checking Cursors::self()->currentCursor()->pos().
2020-10-28 06:28:41 +00:00
Ismael Asensio 73f335adc2 kwinrules: Fix binding loop on coordinate editor
Only set the model value when the user explicitly interacts
with the control.

This fixes a bug where some detected properties (position
and size) were not fully applied due to the the binding loop.
2020-10-27 21:50:00 +01:00
Vlad Zahorodnii b53d195f34 platforms/drm: Hide sw cursor if there is no pointer
Currently, if there is no pointer, only the hardware cursor will be
hidden. If the software cursor is forced, you are going to see a dead
immovable cursor.
2020-10-27 11:46:34 +02:00
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