Commit graph

20094 commits

Author SHA1 Message Date
Xaver Hugl
f9f474d7e4 platforms/drm: fix property updating
A wrong index caused some properties to contain wrong values
2021-07-16 16:34:40 +02:00
Xaver Hugl
afcef2a6f8 platforms/drm: fix crash with secondary GPUs and buffer age
CCBUG: 433107
2021-07-15 11:42:57 +00:00
Vlad Zahorodnii
7863f3dc31 Add NOTIFY to toplevel x/y/width/height properties
Currently, when using Toplevel's x, y, width, and height properties in
qml, a bunch of warnings will be printed about missing NOTIFY.
2021-07-14 12:32:14 +03:00
Vlad Zahorodnii
64f7c03083 wayland: Emit geometryChanged signal if transform changes
If the output transform changes, the geometry may change as well;
otherwise qpa may not call QWindowSystemInterface::handleScreenGeometryChange()
with the corresponding platform screen.
2021-07-13 10:06:30 +00:00
Vlad Zahorodnii
adac3b8646 scripting: Guard against the case where a window is destroyed after changing visibility
If the visiblityChanged signal is emitted and then the window is
immediately destroyed, the slot will still be executed because the
connection has type of Qt::QueuedConnection.
2021-07-13 12:50:56 +03:00
Aleix Pol
23129c09ce SceneOpenGL2::paintCursor make sure the OpenGL context is current
Instead of painting right away when Cursors::currentCursorChanged is
emitted, mark as dirty and call again when paintCursor is called.

BUG: 439134
2021-07-12 13:15:29 +00:00
Xaver Hugl
2977ae8e37 platforms/drm: don't take the rotation property for granted
Should fix the crash on the pinephone
2021-07-12 14:28:38 +02:00
Xaver Hugl
3c28a78956 Fix build 2021-07-10 23:54:08 +02:00
Xaver Hugl
303132ae0f platforms/drm: update plane properties before updating outputs
Seems like some drivers change the properties in the time it takes to
initialize the scene
2021-07-10 21:18:37 +02:00
Xaver Hugl
b23dfd55ac platforms/drm: optimize cursor setting 2021-07-10 21:18:37 +02:00
Xaver Hugl
5ad0d18476 platforms/drm: update properties on VT switch and failing commits 2021-07-10 21:18:37 +02:00
Xaver Hugl
586efe94d4 platforms/drm: Introduce DrmPipeline
DrmPipeline is now what contains all the thing related to drm calls,
instead of DrmOutput. This allows for some more flexibility and tidies
the code up a bit. Additionally instead of rolling back changes if
presentation fails, changes are directly tested with atomic test only
commits.
2021-07-10 21:18:33 +02:00
Xaver Hugl
92726372f4 platforms/drm: simplify deleted output handling 2021-07-10 20:13:01 +02:00
Xaver Hugl
c89961a4e2 platforms/drm: save modelist in DrmConnector 2021-07-10 20:13:01 +02:00
Xaver Hugl
ee4b4fc9a3 platforms/drm: refactor presentation in gbm backend 2021-07-10 20:13:01 +02:00
Xaver Hugl
da71d218c8 platforms/drm: refactor the gbm surface 2021-07-10 20:13:01 +02:00
Xaver Hugl
4b5571163e inputmethod: save enabled state 2021-07-10 17:47:45 +00:00
Xaver Hugl
fe11219a0c improve gesture recognition
In order to not make misdetections with sub-pixel movements the gesture
recognizer completely ignored those. This fails however when you move
your fingers very slowly, so instead accumulate the delta and only use
it for direction detection if it's high enough.
2021-07-09 20:28:04 +00:00
Aleix Pol
eb62dbb9c5 Allow the KScreenEffect to work on Wayland
Makes it possible for wayland systems to show a dimming effect when a
display dpms is off.
2021-07-09 12:39:42 +02:00
Aleix Pol
1012adeaf7 Add support to DPMS to the Wayland Backend
Moves the DpmsInputEventFilter to libkwin, so that it can be used by
other backends other than DRM.
This mostly helps develop features around DPMS.
2021-07-09 02:41:26 +02:00
Xaver Hugl
caa8c8fd45 platforms/drm: always populate atomic req with connector props
If we don't then overscan and underscan are never applied
2021-07-08 16:14:25 +00:00
Xaver Hugl
4d8ae93f06 platforms/drm: fix underscan
The enums belong to "underscan", not to "underscan hborder".
The aspect ratio also needed correction
2021-07-08 16:14:25 +00:00
Vlad Zahorodnii
be6c33458f wayland: Allow placing sub-surfaces below their parent
According to the spec, if the wl_subsurface.place_below request is
called with the parent surface, the sub-surface must be placed below the
parent surface.

BUG: 438808
2021-07-08 06:55:38 +00:00
Vlad Zahorodnii
4ebe5d32b4 scene: Introduce z-property
This allows placing child items below their parent item by setting
negative Z values.
2021-07-08 06:55:38 +00:00
Vlad Zahorodnii
2a1f9f1646 wayland: Switch to SurfaceInterface::{below,above} 2021-07-08 06:55:38 +00:00
Xaver Hugl
a1847f77f1 platforms/drm: only show cursor on dpms on if not hidden
While always calling showCursor isn't a problem for when there's no
pointing device as the cursor image is empty in that case, it can
cause a temporarily stuck cursor image when it's supposed to be
hidden because of touch input
2021-07-07 21:05:49 +02:00
Xaver Hugl
925ff96401 platforms/drm: support underscan 2021-07-07 15:03:39 +02:00
David Redondo
5fe6de699c Handle when a xdg-toplevel changes its min or max size
We previously never emitted maximiziableChanged() meaning we never
synced the state to the decoration.
BUG:439578
2021-07-07 14:17:36 +02:00
David Edmundson
e35ed5088a [rules] Allow setting WindowType to KDE specific window type OSD
An example use case is allowing a user to write rules to put firefox
Picture in picture windows above fullscreen users

CCBUG: 439573
2021-07-07 10:32:29 +00:00
Vlad Zahorodnii
8b1e2fd50e kcmkwin/compositing: Remove Crisp scale method
The OpenGL backend now supports only smooth and accurate scale methods.
2021-07-06 12:34:59 +00:00
Vlad Zahorodnii
95adc883aa scenes/opengl: Use GL_LINEAR also on X11
We've been using GL_LINEAR on Wayland for a couple of years, and it has
caused us no issues. For the consistency sake, let's do the same on X11.
2021-07-06 12:34:59 +00:00
Andrey Butirsky
8da06a0bdb fix Meta key randomly stops opening Plasma launcher menu
BUG: 391322
2021-07-06 10:43:52 +00:00
Vlad Zahorodnii
1e1ad82f3b Remove unused geometry setters in Item
Originally, only x, y, width, and height property setters were used. A
bit later "position" and "size" helper setters were added to simplify
code in SurfaceItem sub-classes. It seems like setX(), setY(), setWidth(),
and setHeight() are unused now, so remove them.
2021-07-05 20:55:30 +03:00
Vlad Zahorodnii
db6b4c9c2e Update parent item's bounding rect explicitly
If the parent's bounding rect may change, call its update method
explicitly. This way the code is more readable as there is less
signal-slot magic.
2021-07-05 20:53:08 +03:00
Vlad Zahorodnii
fb276dbdd2 scene: Avoid discarding quads in more cases 2021-07-05 13:54:47 +00:00
Aleix Pol
0a1a4d362b tablet: Update the cursor as the surface changes
The tablet protocol offers us the cursor in a surface. This patch makes
sure we connect to the surface so that we can also refresh the
representation if the client submits a change.

BUG: 437777
2021-07-05 13:23:03 +00:00
Aleix Pol
d706d98e86 cursor: remove unused attribute 2021-07-05 13:23:03 +00:00
Vlad Zahorodnii
29ff0d30ad x11: Fix BadDamage warning
The XDamageDestroy has a weird requirement saying that it can be called
as long as the X11 window is still valid. On the other hand, one could
argue that it is more intuitive if the damage handle becomes inert if the
associated window is destroyed. Unfortunately, that's not the case and
as git history shows, it's an easy way to shoot yourself in the foot, we
had the exact warning many years ago.

The problem with the XDamageDestroy API is that it is simply unreliable
given the asynchronous nature of communication between kwin and xorg.

Anyway, with X11 sunsetting, let's destroy the damage handle only when
the X11 window is unmapped and not bother too much about it.
2021-07-05 13:22:07 +00:00
Erik Kurzinger
770875a76e platforms/drm: check wl_eglstream buffers before attaching
If a wl_eglstream buffer is attached to a surface, but then later a different
type of buffer, such as a dmabuf, is attached to the same surface, kwin will
mistakenly keep trying to acquire frames from the EGLStream associated with the
previous buffer. This can happen if an Xwayland window is made full-screen
causing it to switch to the flipping presentation path, for instance. The
result is that the window contents will no longer be updated.

Instead, the eglstream backend's loadTexture and updateTexture functions should
first pass the buffer to eglCreateStreamAttribNV. If it fails with
EGL_BAD_STREAM_KHR, that indicates it is indeed a wl_eglstream, and that we've
already associated a server-side EGLStream with it in attachStreamConsumer, so
we can proceed as usual. If it fails with EGL_BAD_ACCESS, though, that
indicates it is not a wl_eglstream and we should fall back to the parent class
which handles attaching other buffer types. If it doesn't fail at all, that
means the client tried to attach a new wl_eglstream to a surface without first
attaching the stream consumer. There's not really a great way to handle this,
so just re-use the previous EGLStream.
2021-07-05 11:13:24 +00:00
Vlad Zahorodnii
a1c6e2584a x11: Re-use Qt's EGLDisplay
This is to ensure that both kwin and Qt use the same EGLDisplay. Note
that the native context handle can have no display, however it's very
unlikely to happen.
2021-07-05 09:14:09 +00:00
Vlad Zahorodnii
9f6b5ea44f x11: Call eglGetPlatformDisplayEXT() without attrs
There are EGL implementations that will refuse to create a context if
the share context belongs to other EGLDisplay. Currently, that's the
case on some platforms.

If eglGetPlatformDisplayEXT() is called with the same parameters, it'll
return the same EGLDisplay. The main motivation behind this change is to
ensure that both kwin and Qt share the same EGLDisplay, QtXCB calls
eglGetPlatformDisplayEXT() without any additional args.

If EGL_PLATFORM_X11_SCREEN_EXT is not specified via attrs, the EGL
implementation will use the default screen, which is the same as
m_x11ScreenNumber.
2021-07-05 09:14:09 +00:00
Vlad Zahorodnii
12b14779ba x11: Gracefully handle failed compositing initialization
X11Platform includes NoCompositing in supported compositing types.
Therefore, Q_UNREACHABLE() cannot be used.
2021-07-05 11:53:26 +03:00
Vlad Zahorodnii
8b8669eece scene: Avoid discard quads when only position changes
Since the quads are in the item local coordinate space now, it is okay
not to discard cached quads if only the item position changes.
2021-07-04 16:12:33 +00:00
Vlad Zahorodnii
c6ffdf4f7f kwineffects: Remove WindowQuad::uvAxisSwapped
Since makeSubQuad() uses bilinear interpolation, the flag to indicate
whether UV-coordinates are swapped is redundant.
2021-07-04 16:12:06 +00:00
Aleix Pol
8386a8bb66 tablet+libinput: do not crash if there's a tablet event without a client
It triggers if you start with your pen on the tablet while starting
kwin.
2021-07-02 23:50:57 +02:00
Aleix Pol
c8a37ef27f tablet: use the right scope for the variable 2021-07-02 20:54:57 +02:00
Aleix Pol
df9978d6a1 tablet: no need to forward the cursorChanged signal
It's already emitted by updateCursor, so we were doing it twice.
2021-07-02 20:54:45 +02:00
Xaver Hugl
f54d7a2697 xdgshellclient: fix moveresize with touch and CSD
When moveresize is done with touch we need to use the current touch
point and not the mouse position.

BUG: 438283
CCBUG: 431489
2021-07-01 13:13:07 +00:00
Xaver Hugl
a4dcfbfb31 input: fix touch input getting borked on quick tile
The decorationPressId never gets reset as the decoration isn't below the
touch point anymore after the quick tile, so if we have no decoration
under the touch point reset the decorationPressId to -1.

CCBUG: 430560
2021-07-01 13:11:41 +00:00
David Edmundson
893f95eed8 Guard against null compositor in thumbnail item
If compositing is disabled, compositor will be null.

We hit a path where we could destroyOffscreenTexture when the
compositing is disabled then again when the Thumbnail is destroyed. In
this case we query Compositor::self()->scene() and crash.
2021-07-01 12:38:57 +01:00