Commit graph

275 commits

Author SHA1 Message Date
Aleix Pol
d5ac0cf919 drm: Also release the pipeline buffer when DrmOutput::releaseBuffers() 2021-04-20 13:02:46 +02:00
Aleix Pol
b82840d7e0 drm: Don't call virtual methods from a parent class destructor
We'd be relying on AbstractEglDrmBackend on calling cleanup but we'd be
doing it when cleanupSurfaces cannot be reached out anymore, turning it
into a half-baked cleanup.

Instead call cleanup from the leaf class destructors.
2021-04-20 13:02:46 +02:00
Aleix Pol
4c74a24059 Do not schedule further repaints when terminating
We'd hit a deleted options singleton and in any case it's not something
we need.
2021-04-20 13:00:28 +02:00
Xaver Hugl
7a9676dc0a Introduce the legacy flag for drm properties
There are properties like for example rotation
that don't have the atomic flag, yet work and
are needed in atomic mode setting.
2021-04-20 09:22:50 +02:00
Vlad Zahorodnii
5839e59e24 effects: Properly reset present times in coverswitch and flipswitch effects
The last presentation timestamps should be reset when all animations
finish rather than when the effect finishes. Otherwise, the calculated
time diff for the first animation frame will be too big.

BUG: 433471
2021-04-19 17:03:36 +00:00
Xaver Hugl
0292c4a74c platforms/drm: Add support for setting overscan
BUG: 428201
2021-04-19 18:46:41 +02:00
Felipe Kinoshita
ff3cb59967 [effects/presentwindows] Show Panels by default
Showing the panels makes this effect a little bit more integrated
with the desktop. With the panels disabled it creates a separate state,
with the panels enabled it creates a more friendly state with
the effect adding to the already existing experience.
2021-04-19 15:17:32 +00:00
Vlad Zahorodnii
9719d6c5a2 wayland: Fix handling of exclusive zone of -1
We cannot use Workspace::clientArea() to get the geometry of the screen
as the clientArea() method needs a valid frame geometry. This is not the
case if the layer shell surface is being configured for the first time.
2021-04-19 13:16:17 +00:00
Xaver Hugl
7dddcf202b platforms/drm: Don't create outputs without primary plane in AMS 2021-04-19 12:12:26 +00:00
Vlad Zahorodnii
d6cca178f7 wayland: Pick better initial window class string
With ksplash migrating to the layer-shell protocol, it no longer
provides an app id. This means that the window class string will be
different, e.g. "ksplashqml " instead of "ksplashqml ksplashqml", and
some effects (login, etc) will stop working as expected.

In order to keep effects working as before, this change adjusts the
window class initialization in WaylandClient so both the resource class
and the resource name are set to the executable file name.
2021-04-19 09:53:03 +00:00
Vlad Zahorodnii
675d5c4216 effects: Remove outdated ksplash window class strings
ksplash nowadays has only "ksplashqml ksplashqml" window class.
2021-04-19 10:42:58 +03:00
Ömer Fadıl Usta
94f558356b Add missing include for errno 2021-04-16 20:32:50 +00:00
Xaver Hugl
5a22deda3b platforms/drm: Introduce DrmPipeline
DrmPipeline is what now contains all the drm bits related to
modesetting and presentation, instead of that being in DrmOutput.
This gives a lot more freedom for managing drm resources and
enables far better usage of the atomic API with guaranteed
immutability for failed tests.
2021-04-16 20:26:34 +02:00
Aleix Pol
b68cd3110a Fix streaming of windows when we are using a mix of scales
At the moment a streamed screen when the screen scale was differnt
buffer scale would render wrong. This change addresses it by
compensating it.

This change compensates it resizing the rendered viewport to their
difference.

BUG: 428594
2021-04-16 17:18:56 +02:00
Aleix Pol
a8867e292d tablet: Show a default cursor when the cursor has not been set
In this context, the cursor will (almost) always be defined as we set it
as soon as an application is bound to it. We need to show the default
cursor if set_cursor hasn't been called yet. The way to do that is to
check whether the serial is still.
2021-04-15 15:25:55 +00:00
Aleix Pol Gonzalez
bd7300215e Apply 1 suggestion(s) to 1 file(s) 2021-04-15 15:00:52 +00:00
Aleix Pol
ca1e4a255a udev: never construct UdevDevices with a null device
It allows to trust the device we have as it's referenced. We were
already checking for pointer validity when getting them so it still
makes sense.
2021-04-15 15:00:52 +00:00
Aleix Pol
bec580f3c5 udev: Add a method to get all properties of an UdevDevice
It's useful for debugging.
2021-04-15 15:00:52 +00:00
Aleix Pol
01f7ef35e7 drm: Make sure we read all pending udev events 2021-04-15 15:00:52 +00:00
Aleix Pol
d216e74cfc udev@drm: Acknowledge that udev_monitor_receive_device can return NULL
Do not build UDevDevice unless the device itself is valid.
2021-04-15 15:00:52 +00:00
Aleix Pol
97b9e516d1 tablet: account for the activeClient to occasionally being nullptr
Instead use the device assigned output.

 #0  KWin::Toplevel::screen() const (this=0x0) at /home/apol/devel/frameworks/kwin/src/toplevel.cpp:409
 #1  0x00007fe60ad9bef9 in KWin::LibInput::Connection::processEvents() (this=0x55d9efc155f0) at kwin/src/libinput/connection.cpp:579
 #2  0x00007fe60ad4987c in KWin::InputRedirection::setupLibInput()::$_3::operator()() const (this=0x55d9efc29a70) at kwin/src/input.cpp:2315
2021-04-15 15:00:15 +00:00
Aleix Pol
b49c7497fa --warning: remove unused class member 2021-04-15 16:40:38 +02:00
Xaver Hugl
888a08530e Make DrmObject::Property flags const 2021-04-15 11:16:18 +00:00
David Edmundson
ab34fa348c Follow kwindoweffects::windowSizes deprecation 2021-04-15 05:55:46 +00:00
l10n daemon script
82723be8db 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"
2021-04-15 01:16:21 +00:00
Alois Wohlschlager
59f6b77612
Fix crash when stopping PipeWire streaming
The stream object was deleted from a slot connected to its stopStreaming
signal. This is unsafe and can lead to memory corruption and ultimately
crashes when PipWwire streaming is stopped. Use deleteLater instead.

BUG: 428268 435588
2021-04-13 10:28:15 +02:00
Xaver Hugl
68f58076f4 Fix sendToScreen for fullscreen apps
screen() only gets updated after AbstractClient::sendToScreen if invoked
by a shortcut or menu (as opposed to moveresize), so we can't use it in
AbstractClient::updateGeometryRestoresForFullscreen as it points to the
old screen.
2021-04-12 20:47:29 +00:00
Xaver Hugl
a461ff918d platforms/drm: replace dpms property hack with proper check
Instead of marking the dpms property as immutable, read the
DRM_MODE_PROP_ATOMIC flag and only add atomic properties to
atomic requests.
2021-04-12 19:30:17 +02:00
Xaver Hugl
18f857b1f3 platforms/drm: fix crash with multi-gpu 2021-04-11 20:52:08 +02:00
l10n daemon script
fbdcdaf125 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"
2021-04-11 01:15:44 +00:00
Yuri Chornoivan
60d12b91f2 Add touch screen KCM docs 2021-04-10 18:59:20 +03:00
Aleix Pol
2894913f93 lockscreen: also activate lock screen windows
We are running a slightly different code path, make sure that we still
honour conventions like screen focus.

BUG: 427882
2021-04-09 12:18:29 +00:00
Vlad Zahorodnii
62432133e0 const'ify Platform::findOutput() 2021-04-09 09:21:59 +03:00
Vlad Zahorodnii
e88033f914 wayland: Fix blank window thumbnails
With the introduction of stripped down window items, the WindowPixmap
objects no longer form a hierarchy. WindowPixmap::children() method was
removed.

Surprisingly, the removal of the children() method didn't result in a
compilation error because the QObject class has a method with the same
name.

Currently, a window pixmap will have no QObject children even if the
associated wayland surface has child sub-surfaces. This may result in
blank thumbnails of apps that use sub-surfaces, e.g. Firefox. In order
to fix that issue, we need to check if there are child items instead.
2021-04-08 22:15:33 +03:00
Vlad Zahorodnii
24d865ea38 wayland: Generate valid output uuids
Currently, kwin generates invalid output uuids.
2021-04-08 19:04:17 +00:00
Aleix Pol
d419729331 debug_console: Improve rendering of non-x11 clients
We'd always get "0x0: something" where the 0x0 is the xcb_window which
obviously doesn't translate.

Instead show the class name so we can easily track what kind of object
we are dealing with.
It's an easy way to show which shell it's using on Wayland, will be
useful in other cases as well.
2021-04-08 16:01:34 +00:00
David Redondo
1419993b89 Add a DBus interface to the presentWindows effect
The same as for the highlightWindows effect. Toggling it through
DBus is platform independent.
2021-04-08 09:09:00 +00:00
David Redondo
26bf4f51d0 Add a DBus interface to the highlightWindows effect
The Taskmanager can now activate it this way, instead of using X
atoms. This means it will also work on Wayland.
2021-04-08 09:09:00 +00:00
Vlad Zahorodnii
ab58171ed8 wayland: Check workspace position after creating decoration
If a decoration is created for an already mapped maximized window, check
the workspace position to ensure that the window still fits the maximize
area.

BUG: 432326
2021-04-07 20:38:05 +00:00
Vlad Zahorodnii
d1c5970273 Fix build 2021-04-07 20:49:32 +03:00
Vlad Zahorodnii
da5fc3d9e9 wayland: Wire in subpixel information
kwaylandserver has all the code to send subpixel information but kwin
doesn't really use it.
2021-04-07 16:33:50 +03:00
Vlad Zahorodnii
9d9747490e wayland: Send missing output-device properties
Currently, we don't set eisa id and the serial number.
2021-04-07 15:00:56 +03:00
Vlad Zahorodnii
5619a2939a wayland: Send only current wl_output mode 2021-04-07 14:23:16 +03:00
Vlad Zahorodnii
707c724d61 wayland: Adjust kwin to OutputInterface changes
The new OutputInterface class has not create() method and it also works
around the wl_global race condition.
2021-04-07 14:23:16 +03:00
Vlad Zahorodnii
c27230719c wayland: Move Wayland-specific code out of AbstractWaylandOutput
Currently, output properties are looked up either on the wl_output
object or the output device object. This puts a hard dependency on the
wayland server in the platforms.

This change intends to fix some flaws in the current output
abstractions, and allow creating/destroying wayland-specific globals as
we wish.

With the work done in this patch, the need for the AbstractWaylandOutput
class is unclear, and it might be a good idea to merge it with the base
AbstractOutput class.
2021-04-07 14:23:16 +03:00
Vlad Zahorodnii
3d231b3cb5 Remove documentation for already documented methods in AbstractOutput
The documentation in AbstractWaylandOutput is the same as the one in the
AbstractOutput class.
2021-04-07 14:23:16 +03:00
Xaver Hugl
50f03ac6dc platforms/drm: improve buffer handling with GbmBuffer 2021-04-06 23:18:25 +02:00
Vlad Zahorodnii
dbdc30da7b wayland: Return a type of NET::Unknown for popups
This is to ensure that isNormalWindow() returns false for popups. One
could argue that we abuse netwm window types, on the other hand, we
don't know the exact type of popups and NET::Unknown is the closest type.
2021-04-06 15:15:37 +00:00
Nate Graham
dd3f85d19a Improve text for "keep above"/"keep below" buttons
It may not be totally clear what exactly they're being kept above.

CCBUG: 435292
2021-04-06 13:33:23 +00:00
Vlad Zahorodnii
913d242bd9 platforms/drm: Fix crash in EglGbmBackend::presentOnOutput()
If the damage history is empty and EGL_KHR_partial_update is supported,
kwin may crash.
2021-04-06 11:53:26 +03:00
Andrey Butirsky
91f47c9092 fix global shortcuts for non-Latin symbols
Re-use Qt's implementation of handling non-Latin layouts here
For full ASCII range support (Alt+`, etc.) Qt needs to be patched still,
see QTBUG-90611

BUG: 375518
2021-04-05 19:39:06 +00:00
Jan Blackquill
bc3ac17141 GlobalShortcuts: clang-format 2021-04-05 19:28:38 +00:00
Jan Blackquill
ccca3b2af2 GlobalShortcuts: refactor
I consider this a prerequisite commit to improving the quality of touchpad gestures provided by KWin.
In short, this breaks apart a weird all-in-one class into an std::variant for the different types
of shortcuts in order to make it easier to add new types of global shortcuts. For the byte shavers, this
roughly halves the size of the GlobalShortcut class as well. On top of all this, the code is about half
the size it was before, mostly due to newer C++ concepts being used that allow us to let the compiler
do more work for us.
2021-04-05 19:28:38 +00:00
Jan Blackquill
9f215a06fa Fix crash on hotplugging displays while switched to another TTY
Currently, we inhibit renderloops when switching to another TTY, and unhibit
when switching back. When we hotplug a display while switched to another TTY,
its renderloop isn't inhibited by default, yet when we switch back, we try
to uninhibit the fresh renderloop, which triggers an assert.

Inhibiting newly created outputs while switched to another TTY fixes this crash.

BUG: 435388
FIXED-IN: 5.21
2021-04-05 15:08:59 -04:00
David Edmundson
c53b2fa3c5 Fix crash in Unmanaged without compositing
Without compositing we don't have surfaceItems

BUG: 435322
2021-04-05 12:56:34 +01:00
Xaver Hugl
8bbd186f8e platform/drm: add dpmsFinishOn to atomicEnable
Without it the output will stay blank after enabling
2021-04-05 11:03:53 +00:00
Xaver Hugl
b2653c45c8 platforms/drm: drop connector name from modelName with serial
The connector name is not relevant to applications or
users - expectation is that the same physical monitor always gets the
same name, regardless of how it's connected. If no serial is available,
fall back to the old scheme to prevent multiple connected outputs from
having the same name.
2021-04-05 11:02:01 +00:00
Alexander Lohnau
002c4612e3 kwinscripts kcm: Only delete entries once changes are applied
This makes it consistent with other QML KCMs
2021-04-05 09:59:08 +00:00
Vlad Zahorodnii
d1b537b587 Move insertion of safety points to X11Compositor
Safety points only work on X11. On Wayland, we gain nothing from them.
2021-04-05 07:27:10 +00:00
Nicolas Fella
dcdca9be6a Remove unused include 2021-04-03 16:28:49 +02:00
Vlad Zahorodnii
9168ced30f wayland: Make KWinDisplay less chatty
There is no point for printing a warning if kwin cannot read the exe
symlink in /proc. It may happen for processes such as polkit agent.
2021-04-02 06:45:53 +00:00
Vlad Zahorodnii
7054f6b2d6 platforms/drm: Drop stream operator for DrmOutput
There is already one that works for all AbstractOutput classes and
properly restores the state of QDebug.
2021-04-01 18:15:42 +03:00
Vlad Zahorodnii
dd9a1e5320 platforms/drm: Rename DrmCrtc::resIndex()
The value that the DrmCrtc::resIndex() function returns is better known
as "pipe index." This change renames the method to match the terminology
used by kernel developers and other compositor developers.
2021-04-01 14:41:07 +03:00
Vlad Zahorodnii
53796aacb2 platforms/drm: Remove unused parameter in DrmCrtc constructor 2021-04-01 14:41:07 +03:00
Vlad Zahorodnii
d883cccfd3 platforms/drm: Minor coding style fixes
This reformats some code according to the KF coding style.
2021-04-01 14:41:05 +03:00
Vlad Zahorodnii
7926fce598 platforms/drm: Make DrmObject::m_id private
There's already a getter for the object id.
2021-04-01 14:19:48 +03:00
Vlad Zahorodnii
2ea66eb4c3 platforms/drm: Remove unused field in DrmObject 2021-04-01 14:17:46 +03:00
Vlad Zahorodnii
f534b64e5c platforms/drm: Associate drm objects with their gpus
This makes the code more consistent. At the moment, we initialize drm
objects either with the corresponding gpu object or with its fd.
2021-04-01 14:15:42 +03:00
Vlad Zahorodnii
75e7562953 platforms/drm: Fix handling of missing EDID
drmModeGetPropertyBlob() may return null and we should handle that. In
addition to that, m_conn is not initialized in DrmConnector so kwin will
crash whenever the connector info is accessed.
2021-04-01 11:01:53 +00:00
Vlad Zahorodnii
53f7bda7d2 platforms/drm: Make DRM backend less chatty
These warnings can be safely ignored, their priority can be lowered.
2021-04-01 13:21:33 +03:00
Xaver Hugl
2efb9c473d Move Edid and DPMS into DrmConnector 2021-03-31 16:08:33 +00:00
Vlad Zahorodnii
326d211691 platform: Use damage tracked by SurfaceItem
There is no need for both kwin and kwaylandserver track damage.
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
2ade92d69b platform: Make OpenGLBackend::scanout take SurfaceItem
This allows removing SurfaceInterface::trackedDamage().
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
36b55261da Drop AbstractClient::addRepaintDuringGeometryUpdates()
It's not needed since the scene keeps track of repaints.
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
98b0b13f98 libkwineffects: Drop windowPaddingChanged signal
It makes no sense on Wayland.
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
a9d5b84596 scene: Refactor damage teardown in X11SurfaceItem
This introduces the markedAsZombie signal, which is emitted when the
window is about to become deleted. The X11SurfaceItem uses this signal
to determine when the damage must be destroyed.
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
47113e09b8 scene: Introduce window items
Currently, dealing with sub-surfaces is very difficult due to the scene
design being heavily influenced by X11 requirements.

The goal of this change is to re-work scene abstractions to make improving
the wayland support easier.

The Item class is based on the QQuickItem class. My hope is that one day
we will be able to transition to QtQuick for painting scene, but in
meanwhile it makes more sense to have a minimalistic internal item class.

The WindowItem class represents a window. The SurfaceItem class represents
the contents of either an X11, or a Wayland, or an internal surface. The
DecorationItem and the ShadowItem class represent the server-side deco and
drop-shadow, respectively.

At the moment, the SurfaceItem is bound to the scene window, but the long
term plan is to break that connection so we could re-use the SurfaceItem
for things such as software cursors and drag-and-drop additional icons.

One of the responsibilities of the Item is to schedule repaints as needed.
Ideally, there shouldn't be any addRepaint() calls in the core code. The
Item class schedules repaints on geometry updates. In the future, it also
has to request an update if its opacity or visibility changes.
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
b61c800cee libkwineffects: Introduce windowExpandedGeometryChanged()
This signal can be useful if you want to know when the visible geometry
has changed to update cached repaint region during an animation.
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
c6d2eee3c1 Introduce signals to notify about Shadow changes
These signal can be useful if you need to know when the shadow must be
repainted or its geometry has changed.
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
0f1afdbdc0 scene: Pass dirty region to SceneOpenGLTexture::updateTexture 2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
369b768f36 wayland: Mark Xwayland windows ready for painting when mapped
This makes the logic that determines when Xwayland windows can be marked
as ready for painting more robust.

At the moment, we call setReadyForPainting() when the surface is damaged,
but we want Toplevel stop managing damages.
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
0bb5a51da8 x11: Move damage fetching code to X11Compositor
This is needed to make damage fetching specific to X11 surfaces.
2021-03-31 13:56:55 +00:00
Xaver Hugl
c0c3ec09af Refactor DrmObject 2021-03-31 10:19:42 +00:00
Xaver Hugl
e262c8df33 Move pageFlipHandler to DrmGpu 2021-03-30 14:32:43 +02:00
Vlad Zahorodnii
72cc1daf22 wayland: Introduce an environment variable to disable Xauthority
This is primarily intended for debugging purposes.
2021-03-29 11:37:28 +00:00
David Edmundson
a7aee99a23 Port kwin from Plasma Components2
Testing done:
 - ran present windows, checked the button
 - changed desktop with the OSD enabled
 - toggled nightcolour (which shows the other OSD)
2021-03-27 23:26:31 +00:00
Ismael Asensio
3048d92c09 kcm/kwinrules: Unify windows properties methods in KCM class
Put together the two methods about window properties and rules
into the same class, since they are tightly related and they seem
a bit out of place within RuleBookModel

Small refactor patch. No behavior changes
2021-03-27 01:51:39 +07:00
Vlad Zahorodnii
6fdfd8be5f wayland: Switch to new keyboard event notify methods in SeatInterface 2021-03-26 12:33:12 +02:00
Aleix Pol
57aec19744 Remove cleanTabBox duplicated code 2021-03-25 13:56:17 +01:00
Xaver Hugl
ad7a826ea1 Drag'n'drop: only activate clients after still hover
BUG: 395368
2021-03-25 12:40:16 +00:00
Jan Blackquill
1f39c45a10 PopupEventFilter: handle keyboard events too
XDG popups want keyboard events routed to the topmost popup
as well as the pointer-outside-of-popup-cancels functionality.
2021-03-25 12:38:43 +00:00
Nate Graham
63b96d7c0d Correct use of KUIT markup in kill dialog text
<p> is HTML; the correct KUIT tag is <para>.
2021-03-24 16:46:30 -06:00
Vlad Zahorodnii
0683597099 effects/screenshot: Introduce dbus interface version 2
With the new interface, the compositor sends raw image data instead of
encoding it as a png image, which causes a lot of overhead on Wayland.

In addition to that, the new interface is more extensible, for example
we can add new options or change the written image data format, however
the latter is less likely to happen.

BUG: 433776
2021-03-24 10:52:22 +00:00
Xaver Hugl
eb7703cd64 Only use drmModeAddFB2WithModifiers if supported 2021-03-23 22:13:00 +00:00
Xaver Hugl
c1635c1179 Explicitly preserve buffer contents in EglDmabuf 2021-03-23 20:00:00 +00:00
Xaver Hugl
c737fde3da DRM: Use QSharedPointer 2021-03-23 15:47:59 +00:00
Vlad Zahorodnii
5c15cca190 wayland: Switch to SeatInterface::notifyPointerButton() 2021-03-23 11:20:50 +02:00
Vlad Zahorodnii
ade861d6de Refactor session code
At the moment, the session code is far from being extensible. If we
decide to add support for libseatd, it will be a challenging task with
the current design of session management code. The goal of this
refactoring is to fix that.

Another motivation behind this change is to prepare session related code
for upstreaming to kwayland-server where it belongs.
2021-03-23 08:01:19 +00:00
Vlad Zahorodnii
aad767f91f Fix initialization of ColorManager
There might be some outputs during the initialization of the color
manager, we need to handle this case.
2021-03-23 08:01:19 +00:00
Vlad Zahorodnii
9e999fe2a1 x11: Move event filter logic to kwinApp()
This allows the X11 platform plugin to create event filters before the
workspace object is created.
2021-03-23 08:01:19 +00:00