Commit graph

2020 commits

Author SHA1 Message Date
Weng Xuetian
c074e2eb42 Try our best to convert preedit styling to text-input-v3 cursor range.
text-input-v3 does not have preedit styling, instead, it can only
specify the range of cursor. Try to keep track of any
highlight/selection style range and combine them together. If it matches
the cursor position, use it as the cursor range.
2021-12-27 06:32:31 +00:00
Weng Xuetian
f50866d3f8 Fix different semantics of delete_surrounding_text between zwp_input_method_V1 and text_input_v{2,3} 2021-12-27 05:33:58 +00:00
Vlad Zahorodnii
e4ccf24cd9 effects/overview: Change default shortcut to Meta+W
Ctrl+Meta+D is already taken by the Minimize All script. "W" in Meta+W
stands for "window". Meta+O wasn't chosen because it's one of a
finger-stretcher.

BUG: 445800
2021-12-26 23:24:01 +00:00
Xaver Hugl
f2b29e3555 backends/drm: deep color support
This commit makes 10 bits per color channel the default color depth, which
should reduce banding on outputs that support color formats with more than
8 bits per color channel. In order to support this the commit also removes
the dependency of the EglGbmBackend on a specific format and EglConfig and
instead makes those per-Output properties.
2021-12-25 18:32:58 +00:00
Xaver Hugl
cfeeb817bf backends/drm: query min and max values for properties 2021-12-25 18:32:58 +00:00
Weng Xuetian
4f2c3a00c4 Change InputMethod::show() and InputMethod::hide() to not change active state.
Qt usually request InputMethod::hide() upon unfocus, but
InputMethod::show() is actually never called if focus transfer is done
by keyboard, which leads to a permanent disabled input method state.

It can be easily reproduced with a window with two text field, e.g.
QFileDialog, by pressing tab to switch the focused widget.

The semantics of hide/show should not deactivate the input method.
Instead, it should simply hide/show the input panel. Also it should not
be a hard request for input method to permanently hide the window. When
input method asked to show it again, the input panel window should be
shown.
2021-12-23 03:00:52 +00:00
Weng Xuetian
119f0d02be Do no send empty preedit string to text-input-v3.
zwp_input_method_v1 has some different semantics comparing to
text-input-v3. There is no way to indicate that "clear preedit" with
zwp_input_method_v1. In some client (Namely, Gtk), receiving an empty
preedit string will also trigger replace selection action. For example,
focus into address bar in firefox will automatically select the URL in
the address bar, and a following empty preedit string will clear the
selection which is not desirable.

To avoid such behavior, simply send an empty "done()" to clear text
input v3 preedit if preedit is empty.
2021-12-23 02:18:55 +00:00
l10n daemon script
42110d7a46 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-12-23 01:45:03 +00:00
Nicolas Fella
f0cdc1c885 [effects/zoom] Don't allow to set non-global shortcuts
Only global shortcuts make sense here
2021-12-22 11:22:41 +00:00
Nicolas Fella
7fc8fbae63 [effects/mousemark] Don't allow to set non-global shortcuts
Only global shortcuts make sense here
2021-12-22 11:22:41 +00:00
Nicolas Fella
fa7e9323cd [effects/overview] Don't allow to set non-global shortcuts
Only global shortcuts make sense here
2021-12-22 11:22:41 +00:00
Xaver Hugl
3135f56576 backends/drm: don't reset damage with direct scanout 2021-12-21 16:07:36 +00:00
Weng Xuetian
6d6ce2981e Add preedit styling support for text-input-v2. 2021-12-20 19:18:45 +00:00
Weng Xuetian
a18ccb06e6 Use bufferGeometry as base point for input panel popup.
The cordinate from text-input protocol is based on original surface, instead
of the geometry based on any external protocol, e.g. xdg_surface.
2021-12-20 18:55:34 +00:00
Vlad Zahorodnii
defca98a1e effects: Declare logging category per effect
This allows us to decouple effects more and reduce the number of random
odd build failures on freebsd. Besides that, it provides more fine
grained control over logging, for example, one could select log output
from some concrete effect, etc.
2021-12-20 11:33:02 +00:00
Weng Xuetian
0b1565c54c
Do not send reset to an already active input context.
This may be problematic for certain client, e.g. firefox, and cause
input always reset after any key press. Also, sending reset on an
activate also does not match the text input v3 semantics.
2021-12-19 00:15:20 -08:00
Weng Xuetian
bd40db7dd1
Fix text input v3 related protocol usage.
zwp_input_method_v1 does not support generic double buffered event.
deleteSurroundingText need to be followed with done().
zwp_input_method_v1 preedit event order is preeditCursor,
preeditStyling, preeditString. To align it with text-input-v3 semantices,
send done() after receiving preedit_string() from input method.
2021-12-19 00:12:31 -08:00
Weng Xuetian
c07d3ce7ea
Also fix the flipped case anchor for input panel overlay mode. 2021-12-19 00:10:56 -08:00
Weng Xuetian
8c54c5937a
Fix the input panel popup anchor position.
It should be bottom left instead of top left of the cursor rect.
2021-12-18 21:06:14 -08:00
l10n daemon script
5d99392d1e 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-12-19 01:42:01 +00:00
Vlad Zahorodnii
4459463823 Make focused window and decoration mutually exclusive 2021-12-17 07:19:41 +00:00
Vlad Zahorodnii
41237ea30b Ignore decoration when updating focused window in PointerInput and TouchInput
Currently, it's possible to have the case where the pointer input device
handler or the touch input device handler thinks that there's a focused
window, but the corresponding focused surface in wayland seat is unset,
because the pointer hovers the server side decoration.

If the server side decoration is destroyed, the input device handler will
fail to update wayland seat's focused surface.

In order to make pointer input device handler and touch input device
handler code more intuitive, this change makes focusUpdate() functions
ignore the decoration.

BUG: 411884
BUG: 440380
2021-12-17 07:19:41 +00:00
David Redondo
b1686fd472 Always keep focus on active client when switching activities
While finding this to be benficial when working on the activity
switcher I think it makes sense in general to keep focus on the
current client instead of potentially switching away.
2021-12-16 17:17:27 +00:00
Xaver Hugl
dde7a2efac backends/drm: fix crash with direct scanout
BUG: 447079
2021-12-16 16:44:01 +01:00
Fushan Wen
1d0e75bc5c x11client: Replace activityList with m_activityList
KWin does not update activity status when setting `_KDE_NET_WM_ACTIVITIES`
to nullUuid outside of KWin, which causes "All Activities" not working
as expected for KWindowSystem.

`X11Client::activityList` is not kept in sync with
`AbstractClient::m_activityList`. Move `m_activityList` from private to
protected, and use it in `X11Client::readActivities`

BUG: 440496
2021-12-16 09:59:23 +00:00
Vlad Zahorodnii
34a0813567 wayland: Avoid creating abstract socket for Xwayland on FreeBSD
FreeBSD does not support abstract sockets.
2021-12-16 09:17:28 +00:00
Weng Xuetian
e71fe9ba79 Support text-input-v3 cursor position and position the overlay mode input panel within the screen. 2021-12-16 03:29:00 +00:00
Weng Xuetian
7a270b5d78 Use QPointer to monitor input method server connection.
Input method may crash and leave a dangling pointer. DBus interface may
access the invalid pointer and crash kwin.
2021-12-16 03:29:00 +00:00
Weng Xuetian
d66be7b99f Forward xkb modifier changes to input method.
Since not all the key are forwarded to input method, any modifier
changes need to be forwarded to input method as long as keyboard grab
is active.
2021-12-16 03:29:00 +00:00
Weng Xuetian
11f6292cb5 Move input keyboard filter to be just before the key is sent to application.
Features like global shortcuts should be handled before the input
method.
2021-12-16 03:29:00 +00:00
Weng Xuetian
9e68357ce9 Do not unset DISPLAY and XAUTHORITY for input method.
Those variable are required for XIM to work for Xwayland application.
2021-12-15 17:49:48 +00:00
Vlad Zahorodnii
92317c5eff Remove XdgSurfaceClient::updateGeometryRestoreHack()
It's not defined anywhere.
2021-12-15 15:53:57 +02:00
Vlad Zahorodnii
be32a1b1f5 Move createDecoration() and destroyDecoration() from AbstractClient to InternalClient
They are used only by InternalClient. AbstractClient doesn't need to
handle the destruction of DecorationBridge because its lifetime matches
kwin's lifetime.
2021-12-15 12:47:27 +00:00
Vlad Zahorodnii
acb0683e0d wayland: Properly handle async xdg-decoration updates
Currently, if a window switches between SSD and CSD, it is possible to
encounter a "corrupted" state where the server-side decoration is wrapped
around the window while it still has the client-side decoration.

The xdg-decoration protocol fixes this problem by saying that decoration
updates are bound to xdg_surface configure events.

At the moment, kwin sort of applies decoration updates immediately. With
this change, decoration updates will be done according to the spec.

If the compositor wants to create a decoration, it will send a configure
event and apply the decoration when the configure event is acked by the
client. In order to send the configure event with a good window geometry
size, kwin will create the decoration to query the border size but not
assign it to the client yet. As is, KDecoration api doesn't make
querying the border size ahead of time easy. The decoration plugin can
assign arbitrary border sizes to windows as it pleases it. We could change
that, but it effectively means starting KDecoration3 and setting existing
window deco ecosystem around kwin on fire the second time, that's off the
table.

If the compositor wants to remove the decoration, it will send a
configure event. When the configure event is acked and the surface is
committed, the window decoration will be destroyed.

Sync'ing decoration updates to configure events ensures that we cannot
end up with having both client-side and server-side decoration. It also
helps us to fix a bunch of geometry related issues caused by creating
and destroying the decoration without any surface buffer attached yet.

BUG: 445259
2021-12-15 12:47:27 +00:00
Vlad Zahorodnii
db996e0824 Remove updateDecoration() in AbstractClient 2021-12-15 12:47:27 +00:00
Vlad Zahorodnii
70f46970da Invalidate decoration explicitly
Lets us to remove AbstractClient::updateDecoration().
2021-12-15 12:47:27 +00:00
Vlad Zahorodnii
01a46ff389 Reduce code duplication between X11Client::createDecoration() and AbstractClient::createDecoration() 2021-12-15 12:47:27 +00:00
l10n daemon script
0db88c3ea6 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-12-15 01:55:28 +00:00
Xaver Hugl
9781f43a48 backends/drm: remove unneeded methods in DrmBackend 2021-12-14 16:31:15 +00:00
Xaver Hugl
5d5bb2422c backends/drm: move definitions into cpp file 2021-12-14 16:31:15 +00:00
Xaver Hugl
ca79f11ede backends/drm: minor refactor of DrmPipeline 2021-12-14 16:31:15 +00:00
Vlad Zahorodnii
991f6b458d Create effects handler after letting toplevels setup compositing
Many effects use the stacking order property of the effects handler in
their constructors. This means that windows should have compositing
setup by the time effects are loaded.

After changing how binary effect plugins are loaded, i.e. not queueing
loading effects, but loading them immediately, some effects broke
because the effects handler is created before windows setup compositing.

This change attempts to fix those effects by rearranging compositor
startup code so windows setup compositing first, then create the effects
pointer.
2021-12-14 15:49:49 +00:00
Vlad Zahorodnii
b26227348c wayland: Move or resize xdg-toplevel window during initialization only if geometry is enforced by a window rule
move() and resize() functions are not convenience helpers around the
moveResize() function. They communicate what kwin wants to see after the
corresponding change is applied. It's needed to make asynchronous
geometry updates work.

This change replaces a moveResize() during XdgToplevelClient
initialization with explicit move() and resize() function calls instead,
so it's more clear what the expected end result is.
2021-12-14 15:19:20 +00:00
jiya dong
fed45422cf fix: Fix the problem of rotating the screen in full-screen state and maximizing the state after exiting full-screen. 2021-12-14 02:13:25 +00:00
Aleix Pol
eaa2f538e3 libinput: Pass QStrings as constref 2021-12-13 18:53:23 +00:00
Aleix Pol
7c6b0d9ef4 libinput: Install org.kde.kwin.InputDevice.xml exposing libinput/device.h
It allows to more comfortably create tooling that implements it.
2021-12-13 18:53:23 +00:00
Aleix Pol
5ff22d7765 libinput: Successfully set the output of a device from the dbus interface 2021-12-13 18:53:23 +00:00
Matt Scheirer
449da861f3 Grammar and syntax changes suggested by @vladz 2021-12-13 18:53:23 +00:00
Matt Scheirer
6287ab16f4 [libinput] Add support for display mapping 2021-12-13 18:53:23 +00:00
Matt Scheirer
e51cefe136 [libinput] Serialize QMatrix4x4 for KConfig 2021-12-13 18:53:23 +00:00
Matt Scheirer
a719ceab4a [libinput] Persist device calibration & orientation 2021-12-13 18:53:23 +00:00
Matt Scheirer
21ef0925ab [libinput] Expose calibration and orientation on devices over dbus 2021-12-13 18:53:23 +00:00
Xaver Hugl
f392a9ba39 backends/drm: add some documentation about the drm api 2021-12-13 16:11:40 +00:00
Vlad Zahorodnii
64f2cdf9ed Fix memory leak in some plasma components
A few plasma components cache QSGTexture. Those components rely on
texture references going away with QSGNode users. However, with the
current tear down logic, OffscreenQuickView won't destroy any paint
nodes.

Destroy QQuickRenderControl before QQuickWindow to ensure that are no
paint nodes left alive after OffscreenQuickView.

BUG: 444429
BUG: 444381
BUG: 444077
BUG: 444306
2021-12-13 13:29:56 +00:00
Xaver Hugl
3fb14035cd backends/drm: only use atomic gamma size with AMS
For some reason the property exists with legacy, too. If you try to set
legacy gamma with atomic gamma size it'll fail
2021-12-13 09:23:57 +00:00
Xaver Hugl
58e5a5c9f7 backends/drm: also log properties with legacy
Can be useful to find bugs
2021-12-13 09:23:57 +00:00
Xaver Hugl
4dec21d8e4 backends/drm: remove unused user data 2021-12-13 08:32:33 +00:00
nerdopolis turfwalker
37c3e0d158 Fix crash on simpledrm 2021-12-13 08:02:58 +00:00
Vlad Zahorodnii
09b8f5d838 effects/overview: Animate window icon opacity
This looks better.
2021-12-13 03:53:31 +00:00
Alexander Lohnau
901cc62d28 Remove unused code for loading task switcher KCM
For all the task switchers on my system there is no KCM installed:

```bash
rg 'X-KDE-ParentComponents=(PlasmaXLight|org.kde.breeze.desktop|org.kde.breezedark.desktop|org.kde.breezetwilight.desktop|org.kde.breeze.desktop|org.kde.breezedark.desktop|org.kde.breezetwilight.desktop|org.kde.plasma.mycroft.bigscreen|small_icons|big_icons|compact|text|present_windows|thumbnail_grid|thumbnails|informative)'
```

As the docs state, this is only for buildin effects. Which means it is internal API.
Also I consider the choice of displaying a KCM *or* the preview odd, IMHO the preview
is the most important part.

I stumbled upon this when reviewing the metadata files as part of the preparation
for https://phabricator.kde.org/T14564.

Also this way of plugin loading is discouraged for performance reasons, because all the
plugins from the namespace have to be reopened to get their metadata.
2021-12-11 09:39:55 +01:00
l10n daemon script
92d3345310 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-12-11 01:41:35 +00:00
Vlad Zahorodnii
1f798485b9 effects/scale: Tune animation params
Use standard easing curves in animations. OutCubic for the intro
animation and the InCubic for the outro animation.

Hidden opacity options were removed because I don't think they are
needed anymore. I made the starting opacity 0.4 to make the animation
look closer to what it would have been with an ease-out curve without
realizing it.
2021-12-10 16:51:54 +02:00
Vlad Zahorodnii
acea685b04 autotests: Replace output management test with a more useful test
The output management test checks the implementation of output
management capabilities in the virtual backend, which is not helpful.

This change replaces it with a more useful test that verifies how
windows are placed after an output change.
2021-12-10 13:06:40 +02:00
Vlad Zahorodnii
eb080395ef backends/drm: Fix stuck cursors
Currently, if you move the cursor really fast between two outputs, there
may be stuck cursor on the previous output.

We need to query the old cursor visibility status before updating the
cursor position, otherwise the drm backend may not schedule an update to
move the cursor offscreen.
2021-12-10 06:24:21 +00:00
Vlad Zahorodnii
f51ad0897f effects/screentransform: Don't read kscreen effect's config
It's fine to have the animation duration hardcoded to 250ms. The main
issue with reading kscreen effect's config is that it adds inter-effect
dependencies, which is simply not worth the trouble.
2021-12-09 20:38:34 +00:00
Vlad Zahorodnii
bdc7ee649b effects/overview: Use out cubic easing curve consistently
The intro and the outro animations are very short and they usually
affect all windows on the screen. Windows have to travel a lot and in
very short time, this doesn't look.

Similar to other windows, this change makes the overview effect use the
out cubic curve for window movements (even though the HIG suggests us
using the InOutCubic easing curve). That way, user will look at
flatter parts of the easing curve more, i.e. the windows would move less
chaotically and simply jump to their target position.

Similar to the WindowHeap, this change makes the overview effect use the
out cubic everywhere else so the intro and the outro animations look
coherent.

Another advantage of the OutCubic easing curve is that it makes the
overview effect look more responsive and subtle.
2021-12-09 17:34:38 +00:00
Xaver Hugl
6ce0cc987d input: set tablet cursor hotspot 2021-12-09 17:09:12 +00:00
Vlad Zahorodnii
f308447cc2 plugins/screencast: Enable alpha channel for window streams
It appears like a dozen of applications that provide window
screencasting feature don't support BGR video format, only BGRA and BGRx.
2021-12-09 16:20:23 +00:00
Xaver Hugl
2817e7581f backends/drm: fix legacy cursor 2021-12-09 15:48:58 +00:00
Julius Zint
9537ea6d16 Use SmoothPixmapTransform when drawing cursor
This solves the pixelated look of the cursor under wayland, if the
scaling is set to a fractional value.
2021-12-09 16:04:31 +01:00
Vlad Zahorodnii
ab9bfb2993 wayland: Port to ServerSideDecorationInterface::preferredMode()
Currently, the wayland server updates the server side decoration mode,
which is counter-intuitive, because it doesn't cache the last preferred mode.

With ServerSideDecorationInterface::preferredMode(), it can be simpler.
2021-12-09 16:03:48 +02:00
Xaver Hugl
b526b35e9d backends/drm: refactor legacy cursor
This commit does away with the special handling of the legacy cursor and
makes it be applied directly in DrmPipeline, using the same state as the
atomic cursor and without dirty flags.
2021-12-09 10:05:16 +01:00
Xaver Hugl
7e2bd5a773 backends/drm: refactor DrmPipeline
Split out more things from commitPipelines, and split out the legacy stuff
into a separate file
2021-12-08 21:39:38 +01:00
Vlad Zahorodnii
358b45a4f2 Remove some no longer relevant KWIN_UNIT_TEST ifdefs 2021-12-08 16:29:55 +00:00
Vlad Zahorodnii
7b1bbf6e0a autotests: Drop effect loader tests
Effect loading is already tested using integration tests, for example
the maximize test verifies that the maximize effect is loaded _and_ it
actually does something useful when a window is maximized or restored,
testScriptedEffectLoader only verifies that the effect is loaded, which
is less helpful than what integration tests provide us.

But perhaps the main problem with these tests is that they require us
building a mockverse around them. This litters code with ifdef
preprocessor directives and makes changing such code a living nightmare.

Another problem with these two tests is that they cannot use OpenGL
because it means mocking OpenGL, which we obviously not going to do.
With integration tests, it's not a problem.

The bottom line is that unit tests can be useful but they make life
notoriously difficult when it comes to testing components that depend on
other components.
2021-12-08 16:29:55 +00:00
Xaver Hugl
494ef1c930 backends/drm: port cursors to atomic
The cursor being set out-of-band with atomic commits creates problems
because it can create false positive for atomic tests, if the cursor
state gets changed in between an atomic test and its matching commit.

This commit also ports the cursor to a swapchain instead of only one
image. This is not strictly required but may prevent artifacts and
will be needed for future optimisations.
2021-12-08 17:06:02 +01:00
Vlad Zahorodnii
b82897ce73 scripting: Register Options singleton
Context properties don't work with QML effects. At the moment, no effect
needs to access the options object, but it makes the QML API consistent.
The workspace is already a singleton type.
2021-12-08 09:10:19 +00:00
Vlad Zahorodnii
29a85e830c scripting: Fix type of KWinComponents.Workspace
Currently, the workspace.clients property doesn't work in declarative
scripts because wrong workspace wrapper is used.
2021-12-08 10:39:48 +02:00
Vlad Zahorodnii
5b04aa3ebe scripting: Print QQmlComponent errors
This makes it easier to spot errors in declarative scripts.
2021-12-08 10:38:24 +02:00
Vlad Zahorodnii
0765a08cc8 effects/overview: Remove premature optimization in ExpoLayout::calculateWindowTransformationsNatural()
The natural geometry can live in a different coordinate space than the
target area. Remove the premature optimization so the cell is properly
placed if the two are in different coordinate spaces.
2021-12-07 10:22:42 +00:00
Vlad Zahorodnii
a5028ab5c5 effects/overview: Make ExpoLayout agnostic about coordinates space where natural geometry is
Currently, the ExpoLayout wants the natural geometry to be in the local
coordinate space because of the default layout mode.

With the natural layout, the ExpoLayout will run a simple loop that
repels overlapping cells.

Once no two items overlap, the items will be scaled down based on their
bounding rectangle and the target area.

The problem is that the ExpoLayout includes the area where items will be
eventually placed when computing the bounding rectangle, which can
result in a sort of a bug where almost all windows are shifted to one
side of the screen, which is not at 0,0.

This change removes the target area from the bounding rect math so the
coordinate space where natural geometry is specified is irrelevant.

It fixes the issue where windows can be shifted to one side of the
screen after adding or removing a window. It also makes the ExpoLayout
API more simpler on the QML side and ensures that no relayouting will be
performed if only the position of the WindowHeap changes.
2021-12-07 10:22:42 +00:00
Vlad Zahorodnii
9cc80d7468 wayland: Resize the client to last requested client size if decoration is destroyed
If the decoration is destroyed before the window is mapped, kwin can
respond with a configure event that has 0x0 size. New tests check that
problematic case.

BUG: 444962
2021-12-07 09:50:19 +00:00
Fushan Wen
53e903a0b7 Drop warpXcbOnSurfaceLeft()
Xwayland didn't generate a leave event when changing pointer
focus. It was fixed in 1.19.
2021-12-07 09:22:41 +00:00
Vlad Zahorodnii
b96fa8a840 scripting: Add convenience DesktopBackgroundItem type
It's more ergonomic than creating a Repeater.
2021-12-07 08:05:49 +00:00
Carl Schwan
c0447c3681 Make activity popup menu consistent with VD menu
Instead of using a custom widget use normal widget

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-12-06 15:39:17 +00:00
Columbariu s
621c06deda screencast: Fix format announced with SHM enum format
Kwin announces a format with alpha when Dma-Bufs are available, even
when the texture doesn't contain any. This results in clients segfault
when trying to access the buffer assuming a maxsize wrt. the announced
format by ways of dimensions and bpp.

This patch moves the format masking to affect the Dma-Buf transport
only.
2021-12-06 04:02:01 +01:00
Vlad Zahorodnii
2b628ea412 backends/drm: Mark frame failed if presenting null buffer
If eglSwapBuffers() fails, there won't be a buffer and so we need to
mark the frame as failed. Otherwise, the screen can be frozen.

eglSwapBuffers() can fail if some effect calls makeOpenGLContext()
between RenderBackend::beginFrame() and RenderBackend::endFrame(), which
is the case with the zoom effect. It can set wrong draw surface in
ZoomEffect::recreateTexture()

BUG: 445412
2021-12-03 08:06:37 +00:00
Nicolas Fella
84c45b9fd7 [kcms/effectsmodel] Port away from KPluginInfo 2021-12-03 07:31:06 +00:00
xinbo wang
44285de0e1 fix: touch down to close popup window.
when a popup window is shown,use touch to operation window or
touch to move client,the popup window not be closed and be showing state.
2021-12-03 07:09:46 +00:00
Alexander Lohnau
bd17ca0110 kwinscripts kcm: Port to new KPluginWidget class
Task: https://phabricator.kde.org/T12265
2021-12-03 06:15:34 +00:00
Vlad Zahorodnii
4d7f1d1358 wayland: Rename wayland_fd arg to wayland-fd
This make argument naming consistent, for example we have xwayland-fd
arg, which has a dash instead of underscore.
2021-12-02 16:03:10 +02:00
David Edmundson
b3f5f9764f [kwin_wrapper] Sync kwin env after spawning 2021-12-02 13:25:50 +00:00
Vlad Zahorodnii
bf7bdf0be8 Setup touchpad shortcuts and input event filters only on Wayland
They work only on Wayland.
2021-12-01 10:59:32 +02:00
Vlad Zahorodnii
88d423ddcf Unify focus abstractions for internal and wayland windows
This simplifies focus related logic a bit. Instead of differentiating
between wayland and internal window focus, simply maintain window focus
that works both with regular wayland windows as well as the ones created
by kwin.
2021-12-01 10:23:55 +02:00
Vlad Zahorodnii
aba9440780 Move AbstractClient::isInternal() to Toplevel 2021-12-01 10:23:55 +02:00
Ismael Asensio
2797c64eea kcm/tabbox: Make the preview show desktop if the option is selected
The thumbnail that represents the "desktop" in the switcher preview
is taken from the default wallpaper, and it will update automatically
as it changes in future versions of Plasma.

The current one is also added along the other thumbnails as a fallback.

BUG: 309401
FIXED-IN: 5.24
2021-11-30 22:18:23 +01:00
Vlad Zahorodnii
356fff9920 autotests: Fix testScreens
Currently, the test doesn't pass due to Xwayland encountering a protocol
error.

That protocol error occurs because the xdg-output is destroyed before
the wl_output.

This change moves the ownership of the xdg-output to wl-output so they
are destroyed together.
2021-11-30 19:10:54 +02:00
Xaver Hugl
8d08306c48 backends/drm: support dmabuf-feedback
dmabuf-feedback allows the compositor to give the clients better feedback on what
formats and modifiers they should use, and for which device they should allocate.
This way they can reallocate for scanout whenever the compositor tells them to,
which makes direct scanout work for a lot more devices and applications.
2021-11-30 10:46:06 +00:00
Vlad Zahorodnii
3d0bdc56a4 Remove mysterious s_cursorUpdateBlocking boolean flag in pointer_input.cpp
From what I can tell, it's not really needed.
2021-11-30 10:23:54 +00:00
Vlad Zahorodnii
e44eeaafcf Remove redundant updateFocusMousePosition() call
InputDeviceHandler will call it when needed.
2021-11-30 10:23:54 +00:00
Vlad Zahorodnii
d3342c6897 Append "pointer" to AbstractClient::{enterEvent,leaveEvent}
KWin handles several types of pointing input devices, e.g. mice,
tablets, etc.

As is, enterEvent and leaveEvent are very ambiguous. This change
prepends "pointer" to those methods to make it explicit that they handle
pointer enter/leave events.
2021-11-30 10:23:54 +00:00
Vlad Zahorodnii
a93d24f4b0 Remove impossible case in PointerInputRedirection::cleanupInternalWindow()
If an internal window is hidden, the corresponding InternalClient will
be destroyed and input focus will be updated.
2021-11-30 10:23:54 +00:00
Vlad Zahorodnii
a02ca08d45 Make focus setters in InputDeviceHandler work as expected 2021-11-30 10:23:54 +00:00
Vlad Zahorodnii
9741b1db2f Remove unused InputDeviceHandler::atChanged signal 2021-11-30 10:23:54 +00:00
Vlad Zahorodnii
d957e99365 Improve variable names in InputDeviceHandler 2021-11-30 10:23:54 +00:00
Xaver Hugl
f097440eb4 backends/drm: don't cache formats
While it could be useful with tiled displays, the isFormatSupported and
supportedModifier functions can be called before prepareModeset, so where
m_formats is still empty. Additionally they're neither in a hot path nor
performance critical.
2021-11-30 10:29:51 +01:00
Xaver Hugl
1f79f421b4 backends/drm: only enforce modifiers default for surface creation
Whether or not we want to use explicit modifiers for our surfaces doesn't
matter for what format+modifiers drm planes support. This way direct scanout
works by default, without having to explicitly enable modifiers
2021-11-29 18:28:29 +00:00
Xaver Hugl
33f3a13a1a wayland: show cursor if stylus is in proximity
While a stylus is in proximity we want to show its cursor. In this commit
it only gets shown on move because for a still unknown reason the position
is out of date before the first move event.

BUG: 443921
2021-11-29 17:37:58 +00:00
Aleix Pol
5f16757090 libinput: Make sure we don't crash if we start without an output 2021-11-29 17:51:49 +01:00
Aleix Pol
4dca6408c2 tablet: Provide the position when proximity-in hits 2021-11-29 17:12:58 +01:00
Vlad Zahorodnii
4a69ca4146 Remove pointer focus handling in TabletInputRedirection
Handling pointer focus in TabletInputRedirection makes no sense and it
messes with state set by PointerInputRedirection, which is really bad.
2021-11-29 15:31:45 +00:00
Xaver Hugl
15993fa6bb backends/drm: fix KWIN_DRM_NO_AMS env var
It currently makes the session not start at all
2021-11-29 14:53:11 +00:00
Arjen Hiemstra
e5ca5df0c5 autotests: Use a shared library for the integration test framework
Ever since the effects were changed to static, each test of the
integration tests includes all the effects. The result of this is that
when doing a debug build each test is now 60MiB or more. With the amount
of tests, this results in ~8 GiB of diskspace used just for KWin's
binary output directory, which is rather excessive.

Since the tests all share a common framework library, we can change that
library to a shared library and that way avoid linking all the effects
into each test.

Most of this is shuffling around some link libraries in the integration
test CMakeLists, however, I needed to export the Xwayland class as it is
used by one of the tests but wasn't exported.
2021-11-29 14:04:54 +00:00
Vlad Zahorodnii
cbad78a360 Kill Toplevel::screenScale()
Tracking AbstractOutput properties in Toplevel is not extensible. Since
DecorationItem is the only one who needs Toplevel::screenScale(), make
it track the output device pixel ratio.
2021-11-29 13:14:01 +00:00
Vlad Zahorodnii
1f318a2245 effects/zoom: Rework how cursor texture is managed
Update the cursor texture on demand to avoid changing the current opengl
context in the middle of compositing cycle.

CCBUG: 445412
2021-11-29 12:48:28 +00:00
l10n daemon script
3bb3c604c8 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-11-29 01:38:36 +00:00
l10n daemon script
20e5fc62b1 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-11-28 01:32:42 +00:00
Vlad Zahorodnii
dc3d0444e4 Drop Screens::displaySize()
It's the same as the workspace geometry, i.e. the bounding geometry of
all outputs.
2021-11-26 10:32:55 +02:00
Vlad Zahorodnii
3ad7bf01c8 Allow specifying scene geometry
The main motivation behind this change is to decouple the scene a bit
further from Screens, which is also obsolete.
2021-11-26 07:48:47 +00:00
l10n daemon script
e20c9e7099 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-11-26 01:26:49 +00:00
Vlad Zahorodnii
4a1d5ea53c backends/drm: Improve PauseDevice/ResumeDevice signal handling
systemd takes care of setting and dropping master permissions when
sending PauseDevice and ResumeDevice signals.

When the ResumeDevice signal is received, the relevant drm device should
already have master permissions set up.

On the other hand, when the active property changes, there's still a
chance that systemd haven't granted drm master permissions to us.
2021-11-25 15:06:49 +00:00
Xaver Hugl
3a5cb1c441 backends/drm: only set pageflipPending when wanted
It shouldn't be set when the pipeline wants to be disabled. Whenever that
happens it will wait forever for the pageflip that doesn't come
2021-11-25 15:44:59 +01:00
Arjen Hiemstra
dda45a7829 Overview: Only trigger middle click close with mouse/pen
For some reason, while touch doesn't have a middle button, the
taphandler for middle click close still triggered on tap. So make it
explicitly only support mouse/pen so we exclude touch events.

BUG: 445755
2021-11-25 10:54:50 +00:00
Vlad Zahorodnii
9f93358bc1 backends/drm: Notify about failed frames if there are actually pending frames
In case a modeset needs to be performed, the drm backend will test all
pipelines to ensure that new mode won't cause any bandwidth issues on
other outputs, etc.

To do that, it may delay presenting frames. If the new configuration
doesn't work, it needs to notify about failed frames.

However, the relevant code that notifies the RenderLoop about failed
atomic commits doesn't check if there's actually a pending modeset
present.

When switching between VTs, systemd can revoke master permissions from
kwin. To make things even more trickier, kwin can try to present a frame
in that short time span.
2021-11-25 11:15:50 +02:00
Vlad Zahorodnii
d92bbdb2be effects/overview: Load close button in WindowHeap on demand
For many windows it will be invisible, so there's little point for
creating it ahead of time. Another reason for loading the close button
on demand is that Plasma components are typically heavy.
2021-11-24 15:16:34 +00:00
Vlad Zahorodnii
4881dd63a7 kwineffects: Make OffscreenQuickView generate double click events
Currently, MouseArea.doubleClicked doesn't work in QtQuick effects.
Luckily, the overview effect doesn't use it, but it's still worth making
sure that it works as expected regardless of whether it's a kwin effect.

With this change, the OffscreenQuickView will keep track of the last
mouse press event. If the second button press occurs within the mouse
double click interval, the OffscreenQuickView will generate a
QEvent::MouseButtonDblClick event, similar to what QGuiApplication would
normally do when processing window system events.
2021-11-24 14:02:44 +00:00
Vlad Zahorodnii
00273f10ff scripting: Use Toplevel::isOnOutput() in ClientFilterModel
This way, the ClientFilterModel will work as expected if there are
overlapping/cloned outputs.
2021-11-24 11:25:40 +00:00
David Edmundson
0f71b27c71 Ensure binary effects are loaded before cleints
The current code performed two functions:
 - metadata was read async
 - the event loop is spun between each effect loading

After we merged static and binary plugins this caused a problem for
things like blur and background contrast where loading an effect
influences what we advertise as supported. We don't want plasmashell to
have to reload all it's SVGs.

All KDE provided binary plugins are statically bundled so querying for
plugins is super duper fast anyway. It's not the same kbuildsycococa
path that it used to be.

The C++ plugins tend to be considerably faster in their constructor than
scripted counterparts, and if anything should be loaded lazily it can be
handled inside the effect.
2021-11-24 12:50:05 +02:00
Alexander Lohnau
b1e121397d GIT_SILENT Make kwin effects namespace not end with trailing slash
For the static plugins an exact string match is required
2021-11-24 10:48:51 +00:00
Alexander Lohnau
f61097f3cb Remove now unneeded static effect loader class 2021-11-24 10:48:51 +00:00
Alexander Lohnau
66352bfc87 Utilize KCoreAddons infrastructure for static plugins 2021-11-24 10:48:51 +00:00
Vlad Zahorodnii
f1e96676ef Remove boolean trap in AbstractClient::isShown()
Check shaded state where needed.
2021-11-24 08:11:35 +00:00
Ismael Asensio
9b3dfe2158 [WindowThumbnailItem] Expose the client's frameGeometry as implicit size
Set the implicit size of the item to the client frameGeometry size.

This is also more convenient for tabbox usage than accessing it through the
client's property, had a proper notify signal and abstracts it from the
implementation.

It also can be mimicked by the preview ThumbnailItem used in the tabbox KCM,
which has no client property.
2021-11-23 19:05:42 +01:00
Ismael Asensio
08f6e28a1d [kcm/tabbox] Add missing property to mock ThumbnailItem
The TabBox preview uses a mock WindowThumbnailItem mimicking the
real item, but it was missing the `sourceSize` property, preventing
some effects to be previewed if they use it.
2021-11-23 18:01:21 +00:00
Vlad Zahorodnii
4a62109f59 effects/overview: Honor panel's hidden state
If a panel is hidden, don't show it.
2021-11-23 13:15:37 +02:00
Vlad Zahorodnii
0b04db866a Add AbstractClient.hidden property
To be used in the overview effect.
2021-11-23 13:12:47 +02:00
Vlad Zahorodnii
3dfbd04396 effects/overview: Port to QuickSceneEffect 2021-11-23 09:53:18 +00:00
Vlad Zahorodnii
09f323a21a kwineffects: Add QuickSceneEffect type
This change moves some pieces of the Overview effect in a new
QuickSceneEffect class that can be useful for other QtQuick based
effects.

The QuickSceneEffect class is meant to deal with rendering bits, input
handling, etc.

As the user of the QuickSceneEffect class, you need to override the
createView() method. The createView() method is invoked by the
QuickSceneEffect when it wants to create a QtQuick scene for the given
screen.

The design of the QuickSceneEffect is based on the Overview effect.
2021-11-23 09:53:18 +00:00
Vlad Zahorodnii
ec5950aedb Rename EffectQuickScene to OffscreenQuickScene
EffectQuickScene is not used strictly by effects, aurorae decorations
use it too to render window decorations.

This change renames the EffectQuickView/Scene to
OffscreenQuickView/Scene to clear up the naming scheme.
2021-11-23 09:53:18 +00:00
Fushan Wen
1719c9cc07 Enable using stylus to switch focus and operate on the decoration
Add `tabletToolEvent()` to DecorationEventFilter class so it can handle
tablet events.

Add `tabletToolEvent()` to MoveResizeFilter class to avoid incorrect
titlebar highlight after a window is resized by using a stylus.

Add `tabletToolEvent()` to WindowActionInputFilter class so window focus
can be changed by clicking on the window content area when using a stylus.

Add `update()` to `TabletInputRedirection::tabletToolEvent()` to enable
switching window focus by using a stylus.

BUG: 432104
2021-11-23 08:50:42 +08:00
Vlad Zahorodnii
337261bbf7 effects/slidingpopups: Remove slide manager global with a delay 2021-11-22 17:04:56 +00:00
Vlad Zahorodnii
be183cd55b effects/contrast: Schedule contrast manager removal with a delay
This prevents flickering behind plasma panels after changing compositing
settings.

If the contrast effect is disabled, the destructor of the ContrastEffect will
start the contrast manager remove timer. When it expires, the contrast manager
global will be removed and it will be finally destroyed after 5s (to work
around the wl_global race condition).

If compositing is toggled, the destructor of the ContrastEffect will start
the remove timer and the constructor of the ContrastEffect will stop the
timer, the contrast manager object will be unaffected.

The contrast effect has no options that could affect the shader, so the
reconfigure() method was removed.
2021-11-22 17:04:56 +00:00
Vlad Zahorodnii
76db5d76e7 effects/blur: Schedule blur manager removal with a delay
This prevents flickering behind plasma panels after changing compositing
settings.

If the blur effect is disabled, the destructor of the BlurEffect will
start the blur manager remove timer. When it expires, the blur manager
global will be removed and it will be finally destroyed after 5s (to work
around the wl_global race condition).

If compositing is toggled, the destructor of the BlurEffect will start
the remove timer and the constructor of the BlurEffect will stop the
timer, the blur manager object will be unaffected.

The blur effect options don't affect the generated shader code, so the
shader status check was removed in reconfigure().
2021-11-22 17:04:56 +00:00
David Edmundson
190a92bc3f set EGL_NV_robustness_video_memory_purge where applicable
This enables kwin to get notified when a memory has been lost in the
system, allowing the driver to purge all the memory and have kwin create
new contexts.

This matches what we do on GLX.
2021-11-22 14:00:37 +00:00
David Edmundson
8febb1f343 Check for extensions in logic for global contexts
The current code for creating the root shared context is very naive and
does not take into account aspects like robustness or versions.

It is not always possible to mix attributes, in particular robustness
meaning we are unable to opt into these features in future contexts.

This refactors everything to use a common path to make all contexts.
2021-11-22 14:00:37 +00:00
Xaver Hugl
c4dcbb40d6 properly fix bsd build 2021-11-22 13:15:01 +00:00
Ismael Asensio
5e17de0ffd kcm/kwinrules: Port away from DelegateRecycler
We want to port from this compontent in general, as the ListView can reuse items
directly and it's a bit less bug-prone.

CCBUG: 445806
FIXED-IN: 5.24
2021-11-22 12:48:38 +00:00
Xaver Hugl
912b7d0b02 fix freebsd build 2021-11-22 13:36:57 +01:00
Xaver Hugl
c4d50e984f backends/drm: drop some unused stuff in DrmGpu 2021-11-22 11:30:31 +00:00
Xaver Hugl
95f64a7ac7 backends/drm: drop DrmBackend as a friend of DrmOutput
It's unused
2021-11-22 11:30:31 +00:00
Xaver Hugl
cd8a7ac0b0 backends/drm: don't make DrmGpu a friend of DrmOutput
Making the constructor and updateModes private isn't necessary
2021-11-22 11:30:31 +00:00
Xaver Hugl
6cea76bfaf backends/drm: inline DrmPipeline::updateProperties
It's only used in one place
2021-11-22 11:30:31 +00:00
Xaver Hugl
3e24bc008a backends/drm: force soft cursor if image creation fails
If the soft cursor is only set but not forced then KWin will try to update
cursors again, making it go into code paths that will crash.

BUG: 445507
2021-11-22 08:43:29 +00:00
Xaver Hugl
50c39e202b backends/drm: properly check for vrr property with legacy
BUG: 445907
2021-11-22 09:00:50 +01:00
Alexander Lohnau
468acd0cbe Fix determining of scripted effect config from KPluginSelector
In the KPluginSelector we don't have the possibility to set the args for
each KCM. Because of that we use the metadata of the KPluginFactory as a
fallback to read the plugin keyword, which specifies the KCM we want to display.

This requires kcmutils 54b196a9bad88732debe0b49111af4755268f09f, which landed in the last release.

BUG: 445667
2021-11-22 07:48:37 +00:00
l10n daemon script
16d473a326 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-11-22 01:30:44 +00:00
l10n daemon script
f07c66f040 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-11-20 01:25:15 +00:00
Vlad Zahorodnii
045c1337a9 effects/overview: Make Esc key handling more intuitive when searching
The person that added krunner search integration uses vim. It seemed
intuitive to that person that the Escape key should quit the search mode
instead of quitting the effect. But it seems like more intuitive thing
is to actually stop the effect.

BUG: 445708
2021-11-19 15:27:30 +00:00
Vlad Zahorodnii
17dbdf89bd effects/overview: Prevent WindowHeap accepting mouse events while searching
If the opacity property is set to 0, the item will still receive mouse
events. One either needs to set the enabled or the visible property to
false to ensure that the WindowHeap receives no mouse events.

The reason for setting the opacity to 0 instead of the visible property
to false was that I thought later will nuke the paint node, but it seems
like that's not the case.

BUG: 445707
2021-11-19 15:27:30 +00:00
Vlad Zahorodnii
35c6a3c0a1 effects/overview: Set Qt.ClosedHandCursor cursor shape during dnd
Many apps change the cursor shape during active dnd, do the same here
for the consistency sake.
2021-11-19 15:12:03 +00:00
David Edmundson
38348a006b [backends/x11] Fix typo causing crash 2021-11-19 13:20:48 +00:00
Vlad Zahorodnii
35b9950eb9 effects/overview: Implement internal implicit grab logic
This is needed to ensure that mouse release events go to the view that
received mouse press events; otherwise some views can get stuck in a
state thinking that button xyz is pressed.
2021-11-19 10:57:59 +00:00
Vlad Zahorodnii
caa62fa736 effects/overview: Sync cursor set by QtQuick
Currently, cursor shape set by QtQuick is not sync'ed, which can be seen
as the pointer not changing its shape to i-beam when hovering the search
field.
2021-11-19 10:53:26 +00:00
Vlad Zahorodnii
379ae2d5c2 effects/overview: Reuse qml loading results between effect activations
Currently, every time you launch the overview effect, QtQuick will go
out and parse QML files. With the overview effect gaining more features
and the code size getting bigger, it takes more time for the overview to
present the first frame after it got triggered.

With this change, the overview effect will keep the ScreenView
QQmlComponent object around that can be used to avoid reparsing qml code
every time the overview effect is launched.

It also ports the Overview effect from de-facto deprecated qml context
to initial properties, which yield slightly better startup times.

BUG: 445666
2021-11-19 10:52:45 +00:00
Vlad Zahorodnii
20aeff20ea Fix build
idOffset is a static const variable, it doesn't need to be captured.
2021-11-19 11:09:29 +02:00
Arjen Hiemstra
310ef5e1c2 Add support for touch events to Overview effect
Implement touchUp/touchMotion/touchDown and forward them to the
EffectQuickView.
2021-11-19 09:04:23 +00:00
Arjen Hiemstra
626e4bc7e6 Add support for forwarding touch events to EffectQuickView
This allows effects to support touch input.

Unfortunately, Qt's TouchEvents require the full touch point state,
whereas KWin's internal touch handling only deals with one point at a
time. So we need to keep track of the touch state in EffectQuickView and
pass that on to Qt. Additionally, we need a QTouchDevice as lots of Qt
code depends on it.
2021-11-19 09:04:23 +00:00
David Edmundson
044767e296 Speed up EffectQuickView teardown
On my Nvidia machine there was a massive lag exitingthe overview effect.
Hotspot showed it as being in QOpenGLVertexArrayObjectPrivate::destroy.
In this method we clean up some shared objects used in the context when
the context closes.

In order to do this we need the context to be current. If it is not
current Qt currently internally creates a temporary offscreen surface.

To fix this we need to have our context current during destruction,
which includes changing order so it is destroyed before the surface.
2021-11-19 08:09:39 +00:00
Vlad Zahorodnii
030cc2d844 effects/overview: Add basic keyboard navigation support in DesktopBar
With this change, user will be able to press Tab and use Enter, Delete,
and F2 keys to activate, remove, and rename virtual desktops, respectively.

Co-authored: Fushan Wen <qydwhotmail@gmail.com>
2021-11-19 07:00:08 +00:00
Aleix Pol
afd525ced0 Improve our reaction when primary changes
Ensure we sanitise the input so a client can't randomly crash KWin that
way.
2021-11-18 17:48:39 +00:00
Vlad Zahorodnii
039b1d031e wayland: Enable window rules for all xdg-toplevel
If a window wants to be initially shown in fullscreen mode, it will
issue an xdg_toplevel.set_fullscreen request before the first surface
commit.

If a window wants to be shown in fullscreen mode and there hasn't been
any first surface commit, kwin will cache the request and apply
fullscreen mode when checking window rules in the initialize() function.

On the other hand, window rules are disabled for plasma surfaces. The
motivation behind that was to forbid user from messing with plasma's
surfaces (this change was suggested during redesign of xdg-shell
implementation).

As it turns out, there are cases where plasma may ask to show a window
in fullscreen mode, which also has a plasma surface installed, e.g.
fullscreen application dashboard.

In order to fix the dashboard, this change allows window rules to be
applied to xdg-toplevel windows that also have plasma surfaces installed.

As is, xdg-toplevel surfaces and plasma surfaces are very different in
nature. Adding more quirks to handle plasma surfaces in
XdgToplevelClient is not worth the effort and there are better
alternatives, e.g. layer-shell.
2021-11-18 10:16:25 +00:00
Vlad Zahorodnii
262cb23dd9 effects/overview: Use PlasmaCore.ColorScope.backgroundColor in DesktopBar with light desktop themes 2021-11-18 07:26:33 +00:00
Vlad Zahorodnii
c167ef5208 effects/overview: Remove window caption drop shadow effect 2021-11-18 07:26:33 +00:00
Vlad Zahorodnii
555a8018fc effects/overview: Make text in desktop bar have the same color as in search results 2021-11-18 07:26:33 +00:00
Vlad Zahorodnii
4f04da4e7a effects/overview: Bump underlay opacity to 0.75
This improves contrast when searching using Milou.
2021-11-18 07:26:33 +00:00
Vlad Zahorodnii
195de46c91 effects/overview: Use Milou for search results
Based on user feedback, it will be great to have krunner functionality
integrated in the overview/present windows effect.

This change ports the overview effect to Milou for search results. With
it, one can search for existing windows or launch new applications.

BUG: 445207
2021-11-18 07:26:33 +00:00
Aleix Pol
a5899c2cbb screencast: Do not report a cursor geometry before we have a cursor texture
Otherwise we just crash as we don't know the size yet.
2021-11-18 03:02:19 +00:00
Aleix Pol
19df0996f5 scene: Do not clamp 1x1 windows
Without the margins, they become 0x0 and we crash.
2021-11-17 16:01:16 +00:00
Vlad Zahorodnii
e21a3c7955 effects: Add support for cross-compiling support
kwin-strip-effect-metadata needs to run on the host. First, one needs to
build it, e.g.

    cmake --build build-native --target kwin-strip-effect-metadata

then when cross-compiling, point cmake to the native build directory, e.g.

    cmake -DKWIN_HOST_TOOLING=${path}/build-native
2021-11-17 14:40:41 +00:00
Vlad Zahorodnii
a6090e7f83 effects: Strip unused builtin effect metadata
This improves plugin loading times. As is, the main issue is the number
of builtin effects and the fact that each has a lot of translated
strings, which combined adds up to noticeable loading times. KWin itself
will never read those translated strings, it only needs two pieces - the
plugin id and whether the plugin is enabled by default.

This change adds a little helper to strip unnecessary info from metadata
files.
2021-11-17 14:40:41 +00:00
Vlad Zahorodnii
068d60e36a Revert "wayland: Check workspace position when preferred deco mode changes"
This reverts commit 2560288e4b.

It broke alacricitty. The fix is not obvious, so revert the commit for
the time being.

BUG: 445444
2021-11-17 06:58:30 +00:00
Xaver Hugl
8528bbf800 backends/drm: ignore placholder outputs for the output config
They can only introduce intermediary state when a real output gets enabled
and are not relevant to the actual output config
2021-11-16 17:08:08 +01:00
Xaver Hugl
b6b0af727d backends/drm: don't take crtcs from dpms disabled outputs
Fixes a crash I have with dpms + suspend, which was caused by the udev
event for updating outputs being called before the output got enabled
again. When DrmGpu::updateOutputs got called it removed the crtc from
the inactive output and then disabled the output afterwards. Instead,
only remove crtcs if an output is really disabled.
This also allows to generalize the logic for lease outputs, and could
in the future allow for faster dpms on/off switching.
2021-11-16 17:05:31 +01:00
Xaver Hugl
47d5d50bdf backends/drm: don't assume we have a cursor plane
CCBUG: 445507
2021-11-16 16:16:30 +01:00
Vlad Zahorodnii
e605ea0c46 effects/blur: Fix tracking of blur region after compositing restart
updateBlurRegion() doesn't setup a
SurfaceInterface::blurChanged() signal connection. slotWindowAdded()
does that.
2021-11-16 13:57:31 +02:00
Vlad Zahorodnii
6234357675 effects/contrast: Fix tracking of contrast region after compositing restart
updateContrastRegion() doesn't setup a
SurfaceInterface::contrastChanged() signal connection. slotWindowAdded()
does that.
2021-11-16 13:56:27 +02:00
Vlad Zahorodnii
7228e9aefd Unify beginFrame() and endFrame() hooks for OpenGL and QPainter backends
This unifies frame hooks for OpenGL and QPainter render backends. There
are a couple of reasons why it's a good idea - it provides one mental
framework to start painting a frame, the Compositor will be able to
start and submit frames. The last one is very cool because it gives the
Compositor more power over compositing.

Besides unifying frame hooks, this cleans up a bit the arg naming mess
in endFrame(). As is, "damage" and "damagedRegion" are very confusing
names. "damage" arg has been renamed to "renderedRegion," because that's
what it is. The renderedRegion arg specifies the region that has been
repainted by the Scene. It's different from the damagedRegion as that
one specifies the surface damage, i.e. the difference between the
current and the next frame, while the renderedRegion may include a
region that had to be repainted to repair the back buffer. The main
reason why we need renderedRegion is the X11 platform. On Wayland, it's
unused.

In the future, we will need to extend this api with output layers.
2021-11-16 10:43:56 +00:00
Vlad Zahorodnii
aaf88cd906 scenes/opengl: Keep lanczos filter after changing outputs
The lanczos filter checks the screen size before rendering in
LanczosFilter::updateOffscreenSurfaces(), so this is not needed.

This simplifies lifetime handling of the lanczos filter, e.g. we
don't need to bother with opengl context anymore, and makes the
scene use less Screens' features.
2021-11-16 10:42:58 +00:00
Vlad Zahorodnii
af4c37c095 plugins/screencast: Rename PipeWireStream to ScreenCastStream
This change renames the PipeWireStream class to ScreenCastStream to make
naming consistent.
2021-11-16 09:04:10 +00:00
David Redondo
5d5780c770 Remove manual lnf default handling
This is now correctly set up when inside a plasma session.
2021-11-16 08:27:42 +00:00
Vlad Zahorodnii
0ebc563e6c Drop Toplevel::bufferScale()
On Wayland, a window can have subsurfaces. The spec doesn't require the
main surface and its sub-surfaces to have the same scale factor.

Given that Toplevel::bufferScale() makes no sense with Wayland windows,
this change drops it to make code more reasonable and to prevent people
from using Toplevel::bufferScale().
2021-11-16 09:38:51 +02:00
Vlad Zahorodnii
d755e74c29 Remove some manual repaints in X11Client
Let the scene schedule a repaint instead.
2021-11-16 07:26:44 +00:00
Vlad Zahorodnii
29235e122d kcmkwin/compositing: Hide Compositing label on Wayland
All compositing checkboxes are invisible on Wayland, so hide the
compositing label.
2021-11-16 07:26:09 +00:00
Vlad Zahorodnii
7013c1473c kwinglutils: Clean up persistent vbo fences at the start of the frame
With a persistent vbo, kwin will allocate one big enough buffer and
allocate memory out of it.

In order to prevent overwriting vertex buffer data that is currently
being accessed by the GPU, fences are inserted at the end of frame.

The signaled fences are destroyed after the buffer swap operation, which
seems a bit odd because the just inserted fence most likely won't be
signaled. Perhaps it's a historical artifact?

This change rearranges fence cleanup so it's performed right before
starting a new frame. With it, kwin will most likely re-use the
previously used memory chunk because there will be plenty of time for
the fence to become signaled.

Another motivation behind this change is to make refactoring SceneOpenGL
code easier. As is, m_backend->endFrame() is wrapped in
GLVertexBuffer::endOfFrame() and GLVertexBuffer::framePosted(). With
that, the Compositor can't call m_backend->endFrame(), which can be
desired for cleaning up render backend abstractions.
2021-11-16 07:25:20 +00:00
Vlad Zahorodnii
eecf14394e plugins/screencast: Introduce ScreenCastSource.closed signal
With the closed signal, we can unify how screen cast streams are closed.
2021-11-16 07:24:03 +00:00
Vlad Zahorodnii
e7cd2c4396 plugins/screencast: Optimize output screencasting with memfd
When screencasting an output, read the output texture directly.
2021-11-16 07:24:03 +00:00
Vlad Zahorodnii
92a461c687 plugins/screencast: Exclude client-side drop shadows
The buffer geometry may include client-side drop shadows, which looks
odd when screencasting.
2021-11-16 07:24:03 +00:00
Vlad Zahorodnii
8518a7ea8c Drop Scene::Window::windowTexture() 2021-11-16 07:24:03 +00:00
Vlad Zahorodnii
10032e99e3 plugins/screencast: Make embedded cursor position handling simpler
If the position of the cursor changes, let the screen cast source to
repaint memfd or dmabuf buffer.
2021-11-16 07:24:03 +00:00
Vlad Zahorodnii
c3c87ed8fa plugins/screencast: Introduce base ScreenCastSource type
Currently, when screencasting a window, kwin may render a window into a
temporary offscreen texture, copy that offscreen texture to the dma-buf
render target, and discard the offscreen texture.

Allocating and deallocating offscreen textures is inefficient. Another
issue is that the screencast plugin uses Scene::Window::windowTexture().
It's a blocker for killing scene windows.

This change introduces a base ScreenCastSource type. It allows us to
move away from Scene::Window::windowTexture() and make the dma-buf code
path efficient with applications such as Firefox that utilize
sub-surfaces.

With the ScreenCastSource, kwin can also provide screen cast frames with
arbitrary device pixel ratio.
2021-11-16 07:24:03 +00:00
Marco Martin
9eb5b92023 Apply roles to xdg popups if present
Like top level clients, apply plasmashell roles to popups as well (limiting them, don't allow dock or desktop roles in poups as they don't make sense)

This makes possible to recognize plasma tooltips as tooltips, treating them in a way closer to X, and makes morphingpopups work on wayland
2021-11-15 14:03:53 +00:00
Felipe Kinoshita
57b53e8d4e
Group compositing options in compositor KCM 2021-11-13 12:49:19 -03:00
Vlad Zahorodnii
cc50c64e8d effects/overview: Forward unhandled keys to search field
After user edits the name of a desktop, the search field is no longer
focused. If the user starts typing text, one could expect that it will
be forwarded to the search field without requiring a click.

This change forwards unhandled key events to the search field to ensure
that searching is intuitive.
2021-11-13 14:49:34 +00:00
Vlad Zahorodnii
0b56711bf4 Make ServiceType irrelevant when searching for binary effects
Since binary effects are installed in their own directory, checking
service type is redundant. Also, KPluginMetaData::serviceTypes() has
been deprecated.

Task: https://phabricator.kde.org/T14483
2021-11-13 09:27:58 +00:00
l10n daemon script
07e0205ca5 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-11-13 01:27:20 +00:00
Vlad Zahorodnii
b2f879eb33 effects/overview: Use strict equality operator in DesktopBar
It yields better performance.
2021-11-12 16:27:59 +00:00
Vlad Zahorodnii
b7d0f292f3 effects/overview: Load desktop name editor on demand
It's most likely going to be unused, so don't bother loading it.
2021-11-12 16:27:59 +00:00
David Redondo
3bebd3dce4 Start pointer gestures with fingerCount fingers not time fingers 2021-11-12 13:16:03 +01:00
Vlad Zahorodnii
ca4e643d67 effects/overview: Move Escape key handling to ScreenView
With this, no individual component has to handle the Escape key to
deactivate the effect.
2021-11-12 11:44:02 +00:00
Fushan Wen
25b035e84c effects/overview: Press Enter to create a new desktop
Add `Keys.onReturnPressd` and `Keys.onEnterPressed` to PC3.Button in
DesktopBar, so user can trigger the action by pressing Enter.
2021-11-12 19:20:46 +08:00
Oleg Solovyov
cd4bdaa8fe Use NewStuff Elements 2021-11-12 09:38:31 +00:00
Weng Xuetian
83a036e9d4 Fix XWayland abstract socket address.
NUL-termination byte is not needed for abstract socket. This leads to
XWayland listening to a wrong address.

Confirmed with lsof.

BUG: 442362
2021-11-12 09:02:35 +00:00
Xaver Hugl
0afd0aa4be backends/drm: some simplifications for multi gpu
There is only one type of egl backend now, so the abstract backend can be
removed
2021-11-12 09:30:13 +01:00
Xaver Hugl
c68f7f13f3 backends/drm,wayland: require gbm
The ifdefs for have_gbm obfuscate the code unnecessarily - the drm backend
is not a great experience with qpainter, so in practice noone should ship
it without gbm anyways.
2021-11-12 08:25:15 +00:00
Bharadwaj Raju
87afdb3e01 effects/overview: Make pressing Esc after closing label edit end the effect 2021-11-11 14:08:45 +00:00
Vlad Zahorodnii
affb640bcb Move OverlayWindow getter to RenderBackend 2021-11-11 11:49:13 +02:00
Vlad Zahorodnii
b8b8f93ca3 Drop Workspace::m_compositor
The Compositor is a singleton, there's no need to cache the return value
of Compositor::self().
2021-11-11 11:33:09 +02:00
Vlad Zahorodnii
9fca6209b7 Make Scene responsible for handling Workspace::deletedRemoved() 2021-11-11 11:33:09 +02:00
Vlad Zahorodnii
1fe8a18844 Make Scene responsible for scheduling repaint when current activity changes 2021-11-11 11:33:09 +02:00
Vlad Zahorodnii
6d0cca5c7f Move all dirty region scene repaint scheduling to Scene
The Compositor contains nothing that can potentially get dirty and need
repainting.

As is, the advantages of this move aren't really noticeable, but it
makes sense with multiple scenes.

Backend parts are far from ideal, they can be improved later on as we
progress with the scene redesign.
2021-11-11 11:33:04 +02:00
Vlad Zahorodnii
158fb016a4 Add Workspace::geometryChanged() signal
The new signal can be used to monitor workspace geometry changes. It can
be used by the Scene.
2021-11-11 11:29:23 +02:00
Vlad Zahorodnii
48f943bd75 Introduce explicit base render backend type
The main idea behind the render backend is to decouple low level bits
from scenes. The end goal is to make the render backend provide render
targets where the scene can render.

Design-wise, such a split is more flexible than the current state, for
example we could start experimenting with using qtquick (assuming that
the legacy scene is properly encapsulated) or creating multiple scenes,
for example for each output layer, etc.

So far, the RenderBackend class only contains one getter, more stuff will
be moved from the Scene as it makes sense.
2021-11-11 08:55:29 +00:00
Vlad Zahorodnii
f3071707f9 Simplify no compositing code path in Compositor::setupStart()
If either the render backend or the scene has failed to initialize,
both m_backend and m_scene will be null.
2021-11-11 08:54:52 +00:00
Nicolas Fella
44dff155b4 Remove unneeded X-Plasma-API from KCM metadata
It doesn't serve any purpose
2021-11-11 01:15:26 +01:00
Aleix Pol
bfe5c73541 Install the org.kde.KWin.TabletModeManager.xml 2021-11-10 14:20:56 +00:00
Fushan Wen
c517e6cebd xwl: Fix unused warning in xwldrophandler.cpp 2021-11-10 11:47:16 +00:00
Xaver Hugl
bad5752110 platforms/drm: kill the EglStreams backend
The proprietary NVidia driver now supports gbm, which vastly improves the
user experience. For older devices that will not get gbm support dropping
EglStreams will likely not have a big impact as it has several session breaking
issues anyways.

By removing the backend a lot of logic can be simplified, most notably multi-gpu.
2021-11-10 11:43:36 +00:00
Aleix Pol
f91ae3e975 xwayland: Also follow the primary output
We want to update the XRandR information so that X11 apps know which is
the primary display, since some of them make use of it to position
themselves.
2021-11-10 10:46:23 +00:00
Vlad Zahorodnii
7580d6c6e0 scenes/opengl: Remove NPOT extension check
NPOT textures are in core spec in OpenGL 2.0+.
2021-11-10 06:05:10 +00:00
Xaver Hugl
258b8b9bce WaylandServer: replace quotes with qstring 2021-11-10 03:33:29 +00:00
l10n daemon script
773de94486 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-11-10 01:20:01 +00:00
Nate Graham
6b949cac02 Use "Centered" window placement by default
The current "Minimize Overlapping" window placement tends to position
windows in locations that seem completely random, typically in a screen
corner. It is doing this because, true to its name, it is trying to
avoid overlapping other windows as much as possible. However in practice
this is rarely helpful. When the user opens a new window, it's because
they want to use it, and positioning the window far from where the
user is likely to be looking is counter-productive. This is even more
true on today's large and wide displays, where placing the window in a
corner may position it entirely outside the user's current field of
vision. We get bug reports about this exact issue for notifications
(which always appear in a corner by default) by users of such screens.
For notifications, this can be justifiable because notifications are
designed to be ignorable; app windows on the other hand, are not.

As a result, I commonly see Plasma users open windows and then
immediately, reflexively grab the window's titlebar and drag it to the
center of the screen. I have seen my wife do this. I have seen every
YouTube reviewer of Plasma do this. I have even see fellow KDE
developers at sprints do this. It seems like quite a common impulse
to want a newly-opened window to appear in the center of the screen,
which is where the user is likely to already be looking.

Thankfully, KWin already has a window placement mode that does this
automatically: "Centered". Accordingly, this commit changes the default
KWin window placement mode from "Minimize Overlapping" to "Centered".

No kconf migration script is provided because this is a better default
for most people in most cases, and existing users are highly likely to
appreciate this change.
2021-11-09 22:16:44 +00:00
Xaver Hugl
23d9341f6f platforms/drm: remove property blob handling from DrmProperty
It's no longer used
2021-11-09 22:15:31 +01:00
Xaver Hugl
3f62ea44dd platforms/drm: move gamma blob ownership to DrmPipeline::Gamma 2021-11-09 22:15:31 +01:00
Vlad Zahorodnii
02bb276ebf platforms/drm: Move ownership of mode blob to connector mode
The main motivation behind this change is to move management of drm
blobs out of property wrappers in specialized wrappers to simplify state
management with blobs.

Connector mode blobs are created on demand.
2021-11-09 22:15:31 +01:00
Xaver Hugl
1b5009ae2b platforms/drm: improve logging a bit
Only print the flags once for all pipelines and include changed unused objects
as well.
2021-11-09 22:15:31 +01:00
Xaver Hugl
7283c98f27 platforms/drm: disable unused resources on modesets
When we switch CRTCs it can happen that a CRTC would stay enabled yet has
no connectors anymore. In this case the kernel may reject our atomic commit,
which would cause the modeset to fail. To counteract that, properly disable
unused drm objects
2021-11-09 22:15:31 +01:00
Xaver Hugl
102fb3d5f2 platforms/drm: keep disconnected DrmConnectors around 2021-11-09 22:15:31 +01:00
Xaver Hugl
a07aae8282 platforms/drm: delay presentation for modesets
Currently KWin is combining modesets with presentation, which causes problems
when multiple monitors are used and crtcs need to be switched around, because
taking away a CRTC from another output causes the driver to disable the
other output. In order to avoid such problems, delay presentation until
all pipelines are ready to present and then do a modeset with a single atomic
commit. To process the resulting page flip events properly this commit also
ports KWin to page_flip_handler2 and changes how the pageFlipped and
notifyFrameFailed signals are processed.
2021-11-09 22:15:31 +01:00
Xaver Hugl
e2a0863843 platforms/drm: more dynamic crtc assignment
Hardware constraints limit the number of crtcs and which connector + crtc
combinations can work together. The current code is searching for working
combinations when a hotplug happens but that's not enough, it also needs
to happen when the user enables or disables outputs and when modesets are
done, and the configuration change needs to be applied with a single atomic
commit.

This commit removes the hard dependency of DrmPipeline on crtcs by moving
the pending state of outputs from the drm objects to DrmPipeline itself,
which ensures that it's independent from the set of drm objects currently
used. It also changes requests from KScreen to be applied truly atomically.
2021-11-09 22:15:31 +01:00
Xaver Hugl
29e5864402 waylandserver: fix logout crash
When we shut down we can have zero outputs, and thus a nullptr
primary output.
2021-11-09 22:14:14 +01:00
Vlad Zahorodnii
1d96b41bb4 build: Move software vsync helpers to libkwin
Compile software vsync helpers into libkwin for the consistency sake
with other helpers.
2021-11-09 18:15:32 +00:00
Fushan Wen
cc42e47ec5 Do not check m_inited again in focusUpdatesBlocked()
We have already checked m_inited in `InputDeviceHandler::update()`, and
`focusUpdatesBlocked()` will be only called by it.
2021-11-09 17:05:28 +00:00
Aleix Pol
c1e9cc283d Implement Primary Displays on the wayland session
Adopts the kde_outputmanagement_v2 hooks for it
2021-11-09 16:55:39 +00:00
Vlad Zahorodnii
2e8f811d3f Remove bogus full repaint in EffectsHandlerImpl::isEffectSupported()
It makes no sense to schedule a full repaint when somebody checks if the
specified effect is supported.
2021-11-09 15:34:08 +02:00
Vlad Zahorodnii
99bcb0eea7 Remove some redundant Toplevel::updateShadow() calls
Toplevel::setupCompositing() calls updateShadow().
2021-11-09 11:30:35 +02:00
Vlad Zahorodnii
c478722655 scenes/opengl: Remove redundant debug message
The Compositor will print whether opengl compositing has been
initialized successfully.
2021-11-09 09:22:12 +02:00
Vlad Zahorodnii
3ade20eea5 Make Compositor responsible for syncing the GlStrictBinding flag
The GlStrictBinding flag indicates whether it's okay not to re-bind the X11
pixmap to the OpenGL surface texture if the corresponding window is damaged.
It doesn't really affect the SceneOpenGL, only low level backend stuff.
2021-11-09 07:16:56 +00:00
Vlad Zahorodnii
dabcb558b4 Move opengl debug output initialization to kwinglutils
kwinglutils is a better place as the debug output is initialized for the
render backend's context, not scene's context.
2021-11-09 07:16:56 +00:00
Vlad Zahorodnii
2560288e4b wayland: Check workspace position when preferred deco mode changes
This ensures that the window will have correct geometry if a maximized
window changes preferred decoration mode. X11Client does something
similar, see X11Client::updateShape().

In hindsight, perhaps, AbstractClient::{create,destroy}Decoration() must
preserve the old frame geometry, but it's not clear how to do that
because it requires decoration updates to be truly async, otherwise
there will be ugly flickering.
2021-11-09 07:14:44 +00:00
l10n daemon script
268d799636 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-11-09 01:22:07 +00:00
Vlad Zahorodnii
cff74b568b Decouple render backend from scene
Currently, the scene owns the renderer, which puts more
responsibilities on the scene other than painting windows and it also
puts some limitations on what we can do, for example, there can be only
one scene, etc.

This change decouples the scene and the renderer so the scene is more
swappable.

Scenes are no longer implemented as plugins because opengl backend
and scene creation needs to be wrapped in opengl safety points. We
could still create the render backend and then go through the list
of scene plugins, but accessing concrete scene implementation is
much much simpler. Besides that, having scenes implemented as plugins
is not worthwhile because there are only two scenes and each contributes
very small amount of binary size. On the other hand, we still need to
take into account how many times kwin accesses the hard drive to load
plugins in order to function as expected.
2021-11-08 18:27:22 +00:00
Vlad Zahorodnii
3485eb6200 cmake: Move base render backend classes to libkwin
This allows using base opengl backends in libkwin, which can be useful
later on for the purpose of moving the ownership of render backends from
the Scene class to the Compositor class.
2021-11-08 18:27:22 +00:00
Vlad Zahorodnii
c5477011ed Add missing KWIN_EXPORT in QPainterBackend 2021-11-08 18:27:22 +00:00
Xaver Hugl
6ff4de2e05 port everything away from Q_FOREACH 2021-11-08 14:19:05 +00:00
Xaver Hugl
e1942cfa41 qpainter: remove outdated comment 2021-11-08 14:19:05 +00:00
Xaver Hugl
c01c15f241 AbstractClient: split up hideClient into hide and show
This makes the purpose of the method call more clear
2021-11-08 14:19:05 +00:00
Xaver Hugl
f522540e33 AbstractClient: remove placeIn
The method was only there to set the geometry restore. Instead, call on
Placement directly
2021-11-08 14:19:05 +00:00
Aleix Pol
b44f33c7ed DecorationItem: Prevent crash
We are calling a QPointer without checking it first.
2021-11-08 13:35:03 +00:00
Vlad Zahorodnii
0eb56fff6e kwineffects: Remove ShaderManager::selfTest()
It has been disabled with Mesa for almost half a decade due to false
positives and even if it weren't disabled, it contributes to the startup
time.

The commit message that added the self test doesn't explain why it was
added, but if it was added to detect unstable drivers, it's not worth it.
2021-11-08 10:29:51 +00:00
Vlad Zahorodnii
aead97c39f Move scenes to the src directory
Similar to the backends, it's far more intuitive to have scenes in the
toplevel source directory rather than the plugins directory.
2021-11-08 10:22:07 +00:00
Kristen McWilliam
efa08b1f30 helpers/wayland_wrapper: Move crash increment to not count restarts
The current behaviour has the crash counter immediately incremented
to 1 after a restart, this change has it set to 0 as expected.
2021-11-08 08:45:39 +00:00
Andrey Butirsky
43aec9ca18 fixup! [wayland] fix ignored keyboard RepeatRate
Ceiling so that it repeats on minimal 0.x rates accessible via UI

BUG: 443721
2021-11-08 10:37:51 +02:00
Vlad Zahorodnii
2fd93e329a scenes/opengl: Stop pushing map shader in SceneOpenGL constructor
KWin can work just fine even without an initially pushed MapTexture
shader. This simplifies the initialization of the SceneOpenGL.
2021-11-08 08:32:45 +00:00
Vlad Zahorodnii
350144cde6 scenes/opengl: Remove viewport check
It's unreliable and it sometimes produces false positives (due to buggy
drivers).
2021-11-08 08:32:45 +00:00
Vlad Zahorodnii
1cf1703dec scenes/opengl: Remove Mesa 10 check
Mesa 10 is a really old driver.
2021-11-08 08:32:45 +00:00
Kristen McWilliam
2a531847c7 dbusinterface: Add doc comment for replace() method
Replace can be in reference to anything, this should definitely
help to provide better context.
2021-11-08 08:31:01 +00:00
Xaver Hugl
75863454a0 RenderLoop: restrict repaint scheduling with fullscreen windows
With an opaque fullscreen window we can be sure that items under it don't
actually require us to repaint. This should yield some small efficiency
improvements and resolves stutter with adaptive sync.

BUG: 443872
FIXED-IN: 5.23.3
2021-11-07 00:41:38 +01:00
l10n daemon script
84a5c7b314 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-11-04 01:18:07 +00:00
Vlad Zahorodnii
22b7ac02b4 scripts/minimizeall: Try to preserve last active window
Windows in workspace.clientList() are sorted in the map order. This
means that the minimize all script will try to activate the last mapped
window when unminimizing windows, which is a bit annoying.

This change ensures that the minimize all script doesn't activate wrong
window by minimizing and unminimizing windows in the stacking order.
It's not a bullet-proof solution though, but it should produce good
enough results.
2021-11-03 16:48:27 +00:00
Vlad Zahorodnii
89067ff9db scenes/opengl: Remove backend failed check
If the backend has failed to initialize, the constructor won't run.
2021-11-03 16:47:55 +00:00
Vlad Zahorodnii
0f6f4ee624 scenes/opengl: Merge SceneOpenGL and SceneOpenGL2
There's no OpenGL 1 renderer anymore so we can have only one scene
class now.
2021-11-03 16:47:55 +00:00
Fushan Wen
2d93b625e2 effects/overview: Always show the delete button when tablet mode is on
It's very difficult for touch screen users to discover the delete
button,  so make the delete button always visible when tablet mode
is on.
2021-11-03 16:30:24 +00:00
Fushan Wen
f4ca7a43c1 effects/overview: Give the editor of desktop name a background
Show background to indicate the name of a virtual desktop is being edited.
2021-11-03 16:08:34 +00:00
Fushan Wen
61f7b2e499 effects/overview: Save desktop name when the text field loses focus
Replace onAccepted with onEditingFinished.
2021-11-03 16:07:47 +00:00
Aleix Pol
f0f2f0f469 screencast: Support reporting damage regions 2021-11-03 13:23:42 +00:00
Aleix Pol
76d53a0ce7 screencast: No need to describe the cursor while it's outside the viewport 2021-11-03 13:23:42 +00:00
Aleix Pol
d054b12123 screencast: Skip frames with no damage
Instead of issuing a full redraw. We'll be calling outputChanged when
uploading to drm, there's no need to stream that as well.
2021-11-03 13:23:42 +00:00
Andy Gebauer
f7bd6ef6c1 Update layers.cpp to compile with clang + libcxx 2021-11-03 06:29:57 +00:00
Vlad Zahorodnii
3eb5fa18fb backends/x11: Remove unused KWaylandServer includes 2021-11-02 11:40:30 +02:00
Vlad Zahorodnii
2870e4295b backends/wayland: Remove unused KWaylandServer includes 2021-11-02 11:39:37 +02:00
Vlad Zahorodnii
d89501a079 Move platform backends to backends directory
This improves file organization in kwin by putting backends in a single
directory.

It also makes easier to discover kwin's low level components for new
contributors because the plugins directory may come as the last place to
look for. When one hears "plugin", the first thing that comes to mind is
regular plugins, not low level backends.
2021-11-02 09:02:41 +00:00
Kristen McWilliam
ab09fdf0b2 dbusinterface: add doc comment for queryWindowInfo()
Adds a simple doc comment to explain what the method does.
2021-11-01 12:24:32 -04:00
Vlad Zahorodnii
94de28bfbe Move input backends in their own directory 2021-11-01 16:27:16 +02:00
Vlad Zahorodnii
9fc2f04c75 platforms/virtual: Port to InputDevice 2021-11-01 16:27:16 +02:00
Vlad Zahorodnii
69bca8cf71 platforms/wayland: Port to InputDevice
This ports the nested wayland platform plugin to the InputDevice
abstractions.

Some global handling logic has been simplified to make porting more
straightforward.
2021-11-01 16:27:16 +02:00
Vlad Zahorodnii
6c0b5be99d platforms/x11: Port to InputDevice and InputBackend 2021-11-01 16:27:16 +02:00
Vlad Zahorodnii
7f72e5627e wayland: Port fake input integration to InputDevice
This ensures that the cursor will be properly shown/hidden when a fake
pointer is added on a system with no physical pointer connected.
2021-11-01 16:27:16 +02:00
Vlad Zahorodnii
ef72bae42f Introduce base InputDevice class
The main motivation behind this change is to prepare input abstractions
for virtual input devices so the wl_seat can properly advertise caps or
the cursor getting properly mapped/unmapped when a fake pointer is
added/removed on a system without a hardware mouse connected.

With this, there are three abstractions - InputDevice, InputBackend, and
InputRedirection.

An InputDevice represents an input device such as a mouse, a keyboard, a
tablet, etc. The InputBackend class notifies the InputRedirection about
(dis-)connected devices. The InputRedirection manages the input devices.

Such design allows to unify the event flow for real and virtual input
devices.

There can be several input backends active. For example, the libinput
backend and an input backend that provides virtual input devices, e.g.
libeis or org_kde_kwin_fake_input.
2021-11-01 16:27:16 +02:00
Xaver Hugl
4206046f12 Re-enable proper gamma ramps with AMS
Instead of downgrading everyone else to legacy gamma, only exclude
the huge and buggy gamma ramp of Intel TIgerLake hardware.
2021-11-01 14:38:27 +01:00
Vlad Zahorodnii
eb62728f1f effects/slidingpopups: Reload slide data after restarting compositing
Otherwise some plasma popups may stop sliding after restarting
compositing.

CCBUG: 443711
2021-11-01 10:58:35 +02:00
Vlad Zahorodnii
f70c745ac0 Fix placement of windows on disconnected outputs
If an output is disconnected, the Workspace will update the
Toplevel.output property for all windows that are on that output, then
it will call AbstractClient::checkWorkspacePosition() to fix window
position.

That may result in some windows partially sticking outside visible area
because AbstractClient::checkWorkspacePosition() has no idea what output
the window was.

This change addresses that problem by delaying updating the
Toplevel.output property so AbstractClient::checkWorkspacePosition()
could pick better window placement.
2021-10-31 18:20:12 +00:00
l10n daemon script
954151ca97 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-10-31 01:14:25 +00:00
Vlad Zahorodnii
cd018b6ba3 effects/screenshot: Add org.kde.KWin.ScreenShot2.CaptureActiveScreen
The new method can be used to implement the "Current Screen" capture
mode in Spectacle.
2021-10-30 20:50:33 +00:00
Vlad Zahorodnii
d1b2a0e4d4 effects: Fix blur and background contrast metadata
The role of enabledByDefaultMethod was misinterpreted. It exists only
for kcms so they can display undetermined state. EnabledByDefault should
still be set to a valid value.
2021-10-30 23:41:13 +03:00
Vlad Zahorodnii
218db74000 Remove a GeometryUpdatesBlocker in AbstractClient::checkWorkspacePosition()
It was added to work around an async geometry issue on Wayland, which is
no longer actual.
2021-10-30 14:02:32 +00:00
Vlad Zahorodnii
4928f4db5b Try to preserve window position relative to their outputs during hotplug
Currently, if an output is hotplugged, all windows will be scrambled,
which is highly annoying.

With this change, windows will stick to their outputs if an output has
been connected or disconnected.

BUG: 296673
BUG: 378896
BUG: 412703
BUG: 443698
2021-10-30 14:02:32 +00:00
Vlad Zahorodnii
ee41e9b6e7 Fix Workspace::inUpdateClientArea() with auto-hide panels
If there's an auto-hide panel, m_oldRestrictedAreas will be empty, which
will break AbstractClient::checkWorkspacePosition().
2021-10-30 14:02:32 +00:00
Vlad Zahorodnii
6faf4ec3a2 Make mapping between outputs and cached screen geometries in Workspace robust
Integer screen ids are not robust. On the other hand, AbstractOutput
does not change if an output has been connected or disconnected.
2021-10-30 14:02:32 +00:00
Vlad Zahorodnii
bb687ff6f1 Stop abusing AbstractClient::geometryRestore()
Currently, AbstractClient::geometryRestore() is abused to put windows
back on their original screen. It makes window placement more complex
and it breaks restoring initially maximized windows.
2021-10-30 14:02:32 +00:00
l10n daemon script
d4b030b920 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-10-30 01:19:35 +00:00
Vlad Zahorodnii
09952e1dc7 wayland: Fix wayland windows growing after toggling decorations
After the decoration is destroyed, we need to resize XdgToplevelClient
to ensure that the scheduled configure event will have correct size.

As is, xdg-toplevel configure events are delayed. When it's actually the
time to send a configure event, XdgToplevelClient will compute the
requested client size from the moveResizeGeometry().

If the moveResizeGeometry() still includes window decorations, the
window will get bigger.

BUG: 444119
2021-10-29 14:40:17 +00:00
Vlad Zahorodnii
637d914f9f Use QScopedPointer to store decoration object
This simplifies memory management.
2021-10-29 14:40:17 +00:00
Vlad Zahorodnii
1e634be2f5 effects/slidingpopups: Schedule workspace repaints
For optimization purposes, kwin will ignore repaint regions scheduled by
invisible windows, e.g. hidden docks, minimized windows, etc.

The problem is that it sort of breaks w->addRepaintFull(). If a lot of
animation frames are dropped, for example due to heavy cpu load, the
sliding popups animation can jump from the middle of animation right up
to the end. It will schedule a repaint but it will be ignored.

In order to work around that issue, this change makes the sliding popups
effect schedule workspace repaints in postPaintScreen() to ensure that
the Scene will always repaint dirty regions.

Hopefully, this should fix bugs where auto-hide panels sometimes flicker
on Wayland.

BUG: 444502
2021-10-29 12:08:51 +00:00
Vlad Zahorodnii
b135a1c7b0 effects/screenshot: Add org.kde.KWin.ScreenShot2.CaptureActiveWindow
BUG: 386271
2021-10-29 12:06:43 +00:00
Vlad Zahorodnii
5379b010b4 effects/screenshot: Add API version property to org.kde.ScreenShot2 interface 2021-10-29 12:06:43 +00:00
l10n daemon script
24ad81e91b 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-10-29 01:21:24 +00:00
Kristen McWilliam
f5e598039b dbusinterface: add whitespace to declarations with doc comments
Without spacing it is not immediately evident where a doc comment
ends and a new declaration begins. Adding a line of whitespace
makes everything more readable and easier to scan quickly.
2021-10-28 11:12:54 -04:00
Vlad Zahorodnii
c09a03a927 Drop Platform::touchPointCount()
It can be accessed directly in the touch input device handler.
2021-10-28 10:55:48 +00:00
Vlad Zahorodnii
e83da51844 Simplify input event flow
Currently, input events can flow directly to input device handlers and
sometimes they go through the InputRedirection, which simply forwards
them to the corresponding input device handler.
2021-10-28 10:55:48 +00:00
Vlad Zahorodnii
bbe879988d Remove redundant Workspace checks in ForwardInputFilter
They don't use Workspace, so the workspace check can be removed.
2021-10-28 11:52:08 +03:00
Kristen McWilliam
9660f83e30 dbusinterface: add doc comment for getWindowInfo()
This method was lacking a doc comment, this adds basic context.
2021-10-28 05:56:36 +00:00
Vlad Zahorodnii
da6fbec424 Notify IdleInterface about user activity explicitly
In some cases, kwin may not forward input events to SeatInterface, which
can false trigger idle detection in IdleInterface.
2021-10-28 05:55:59 +00:00
Xaver Hugl
1626d7a51a platforms/drm: only use glDrawBuffer with desktop GL
That function is not available with GLES, and calling it is only necessary
for NVidia.
2021-10-27 11:49:00 +02:00
Kristen McWilliam
a7b833f319 Add class comment for Toplevel
A simple class comment to give the reader an idea what this is for.
2021-10-27 06:05:54 +00:00
Vlad Zahorodnii
9adb5eed02 Use a generic mechanism to watch input device properties
This reduces code duplication and provides a generic way to monitor all
relevant input device properties.
2021-10-27 05:59:49 +00:00
l10n daemon script
f15e6806f3 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-10-27 01:22:49 +00:00
Andrey Butirsky
be35ef6a9a [keyboard kcm] fix lost Locks state on keymap reconfigure
Fixes Num/Caps Locks (do we need Scroll also?)

BUG: 443739
2021-10-26 15:48:43 +00:00
Xaver Hugl
206689874f effects/overview: center drag hotspot 2021-10-26 14:33:35 +02:00
Vlad Zahorodnii
22eb154fa0 platforms/wayland: Allow resizing outputs 2021-10-26 13:31:36 +03:00
David Redondo
60c3b3ddfa Add support for hold gestures 2021-10-26 08:16:52 +00:00
Aleix Pol
1330376220 screencast: Support the creation of virtual displays to cast
In case the user has just the one display but they don't want to show it
in their main workspace when sharing video, allow creating a virtual
display.
This also will allow using remote devices as support displays.
2021-10-25 19:43:41 +02:00
Andrey Butirsky
4395caa256 [wayland] fix ignored keyboard RepeatRate
X11 can take float RepeatRate, Wayland - int only so the setting is to be
rounded.
Should be indistinguishable on usual rates.

BUG: 443721
2021-10-25 14:04:33 +00:00
Vlad Zahorodnii
fda7e150df kwineffects: Fix destruction of s_fbo with shared GLTexture objects
The WindowThumbnail item uses the GLTexture class. In order to destroy
the thumbnail texture, the item will schedule a destroy job.

This means that the GLTexture can be alive during or after graphics
reset.

On the other hand, as an implementation detail, GLTexture::clear() may
allocate a framebuffer object, which is going to be destroyed together
with the last texture.

Given that window thumbnail textures can be still alive after a graphics
reset and the fact that GLTexturePrivate::s_fbo gets destroyed when the
last texture is destroyed, kwin can end up trying to clear a decoration
texture with now defunct s_fbo.

Since the old old s_fbo is inert, the glBindFramebuffer() function will
fail and the glClear() operation will affect the default framebuffer,
thus leading to black flickering visual artifacts.

In order to fix that issue, this change makes GLTexture destroy s_fbo
unconditionally in GLTexturePrivate::cleanup() which is called whenever
OpenGL stuff is about to tear down, e.g. due to graphics reset, etc.

BUG: 443951
2021-10-25 13:00:55 +03:00
Vlad Zahorodnii
bd3d275293 wayland: Port away from deprecated legacy virtual desktop api in plasma window management 2021-10-25 06:35:35 +00:00
Nate Graham
4605fdcaa5 effects/overview: Give the "Delete desktop" button a tooltip
Icons-only buttons always need tooltips, even when they use a completely
recognizable icon.
2021-10-24 12:20:09 -06:00
Nate Graham
6d7d8ea699 effects/overview: only show "Delete desktop" button with >1 desktop
It doesn't make sense to let the user try to delete their only desktop.
2021-10-24 12:20:09 -06:00
Xaver Hugl
ca58ee875f WaylandOutput: schedule update on mode change
Without this there can be a mismatch between what clients expect and what
KWin actually uses, causing for example stutter in video players.

BUG: 444303
FIXED-IN: 5.23.2
2021-10-24 14:01:52 +02:00
l10n daemon script
839293f987 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-10-24 01:16:44 +00:00
Vlad Zahorodnii
99b38096ca platforms/drm: Fix a typo in DrmCrtc::setLegacyCursor()
bufferDirty should be reset so the legacy cursor is set after switching
between VTs or turning outputs back on.
2021-10-23 16:56:20 +00:00
l10n daemon script
0c6bf857be 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-10-23 01:16:55 +00:00
Xaver Hugl
49afd18018 platforms/drm: fix direct scanout check 2021-10-22 15:49:30 +02:00
David Edmundson
566bfbff5b Fix focus loss on decoration destruction
InputDeviceHandler keeps track of which client has focus, and whether
the decoration or main window has focus.

Should the decoration get destroyed whilst the decoration has focus we
don't update correctly. This can happen when
"BorderlessMaximizedWindows" is set, or if you use key presses whilst
above the decoration.

cleanupDecoration (which is an odd name) is called whenever a decoration
gains or loses focus. Here we can connect for the decoration destruction
and force a focus change.

BUG: 411884
2021-10-22 09:47:28 +00:00
Vlad Zahorodnii
252ba9e005 autotests: Use less Screens::size(int)
The same info can be retrieved from AbstractOutput::geometry().size().
2021-10-22 09:15:48 +00:00
Vlad Zahorodnii
15520888d9 kwineffects: Drop numScreens property
The screen count can be retrieved by checking the number of items in the
EffectHandler.screens property.

The replacement for the numberScreensChanged signal are the screenAdded
and the screenRemoved signals.

The main motivation behind this change is to clean up the screens api
and reduce the number of usages of the Screens class.
2021-10-22 09:14:52 +00:00
Xaver Hugl
0c7d97853e input: fix crash on touch quicktile
If the filter filters out touchDown it also has to always filter out the
matching touchUp
2021-10-22 09:08:27 +00:00
Vlad Zahorodnii
1a10718f6c Remove unused stuff in Screens 2021-10-22 08:29:57 +00:00
l10n daemon script
a04a134a7a 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-10-22 01:20:47 +00:00
Vlad Zahorodnii
c7c63ba269 effects/overview: Allow blurring desktop background
This puts more emphasis on windows and less on desktop background.
2021-10-21 08:49:40 +00:00
Vlad Zahorodnii
baf05ec4a5 Rename PlatformSurfaceTexture to SurfaceTexture
This is, primarily, to make naming consistent with SurfaceItem,
SurfacePixmap and just "Surface" in the future.
2021-10-21 10:21:56 +03:00
Vlad Zahorodnii
ce2fc670c4 effects/overview: Add desktop bar
This provides a way to create, destroy, and rename virtual desktops in
the overview effect as well as switch between desktops.

The mechanics of switching between virtual desktops can be revisited
later though.
2021-10-21 06:27:03 +00:00
Vlad Zahorodnii
d73610d6d6 scripting: Introduce VirtualDesktopModel
This can be useful for QML scripts that deal with virtual desktops.

The virtual desktop model keeps a copy of virtual desktop objects to
avoid hitting asserts in QAbstractItemModel (it has some asserts to
ensure that indices passed to beginInsertRows() or beginRemoveRows()
make sense).
2021-10-21 06:27:03 +00:00
l10n daemon script
2e56b718ea 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-10-21 01:16:09 +00:00
Méven Car
6d518e8ffe DRM Backend: Add some log trace for DrmConnector
CCBUG: 442980
2021-10-20 15:33:37 +00:00
Vlad Zahorodnii
6851996eb2 effects: Make effects responsible for handling skipsCloseAnimation flag
This allows to make painting code more generic.
2021-10-20 13:48:38 +00:00
Vlad Zahorodnii
701902fbec effects: Port effects from int screens ids to EffectScreen
EffectScreen objects are better as they are more stable and we avoid int
screen ids in kwin core.
2021-10-20 12:09:09 +00:00
Aleix Pol
c1a4414c42 drm: Do not call the egl backend pointer when it's null
It can be null, that's why we are also checking it down in the same
function.
2021-10-20 11:46:53 +00:00
Xaver Hugl
baebaa9eb4 platforms/drm: fix init with explicit modifiers
When we're adding the output to the EglGbmBackend pipelines aren't necessarily
setup yet and are thus missing the modifier list. As creating the gbm surface
immediately is useless anyways, delay that until we need it, where the modifier
list is available.
2021-10-20 10:54:24 +00:00
Xaver Hugl
ebaf2e61fc platforms/drm: allow overriding eglstream choice
Add a new environment variable KWIN_DRM_FORCE_EGL_STREAMS that, when set
to an integer value other than 0, makes KWin prefer EglStreams over gbm.
2021-10-20 10:54:24 +00:00
Xaver Hugl
d257850bd1 platforms/drm: set draw buffer for gbm 2021-10-20 10:54:24 +00:00
Xaver Hugl
dc56b03df4 platforms/drm: use gbm with NVidia driver 495+ 2021-10-20 10:54:24 +00:00
Xaver Hugl
866830d5ed platforms/drm: refactor output enablement 2021-10-20 11:39:05 +02:00
Alexander Lohnau
9dc6fd35db
GIT_SILENT Revert accidental change 2021-10-20 07:03:26 +02:00
l10n daemon script
2a3ec321a1 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-10-20 01:18:02 +00:00
Alexander Lohnau
dffbfcc9f7
Fully port away from KPluginLoader 2021-10-19 21:39:51 +02:00
Alexander Lohnau
e431b453b6
Port away from KPluginLoader::findPlugins 2021-10-19 21:19:23 +02:00
Nate Graham
6c2834cc8a decorations: small refactor for decorationpalette.cpp
Handle header color schemes first since the code is smaller for that
block, which makes things more readable.
2021-10-19 07:20:02 -06:00
Nate Graham
00ade26624 decorations: when color scheme has no Header colors, don't ask for them
First we check to see if the color scheme has header colors, and if it
doesn't, we turn around and ask for them anyway, relying on implicit
behavior in kcolorscheme that falls back to Window colors when Header
colors are requested but are not present. Instead, let's just ask for
Window colors to avoid the run-around and stop relying on implicit
behavior.
2021-10-19 07:16:58 -06:00
Vlad Zahorodnii
483ef644df Fix build 2021-10-19 12:56:58 +03:00
Vlad Zahorodnii
7d3bce21a1 plugins/idletime: Fix processing of user activity
Currently, idle timers are not restarted on user input which triggers
the lockscreen even though the user is active at computer.

This change fixes that by making sure that idle timers are restarted
whenever SeatInterface's timestamp changes, i.e. user moves the pointer
or presses a key, etc.
2021-10-19 09:55:22 +00:00
Vlad Zahorodnii
7d692fd2a4 plugins/idletime: Remove m_started boolean flag 2021-10-19 09:55:22 +00:00
Vlad Zahorodnii
a3de9bc93b kcmkwin: Load builtin effects from metadata files
Linking builtin effects against KCMs is really awkward. This change
decouples builtin effects from KCMs that use EffectsModel.

In order to discover builtin effects, metadata files are installed in
kwin's data dir, which will be subsequently read by EffectsModel.
2021-10-19 09:12:15 +00:00
Vlad Zahorodnii
141947d2e8 effects: Link builtin effects with executables
The main motivation behind this change is to prepare kwin for importing
kwayland-server code in libkwin.

As is, builtin effects are linked with libkwin. Some builtin effects
have wayland specific code. If we move wayland stuff in libkwin, there's
going to be a circular dependency between kwin4_effect_builtins and
libkwin targets.

This change intends to break that dependency by linking builtin effects
to kwin executable.

The main issue with that is that EffectLoader would need to discover the
effects indirectly. QStaticPlugin is used for that purpose.

Besides breaking the cyclic dependency, it makes builtin effects use the
same plugin infrastructure in libkwineffects that external effects use.

Metadata in src/effects/effect_builtins.cpp was converted in a list of
python dictionaries, which was fed to a python script that generated
main.cpp and metadata.json files.
2021-10-19 09:12:15 +00:00
Vlad Zahorodnii
2019dcd0fe Add support for static effect plugins
With static effect plugins, builtin effects can be linked to
executables. It also makes libkwin one step closer to being more
reusable.
2021-10-19 09:12:15 +00:00
Xaver Hugl
1763139834 platforms/drm: fix disabled outputs with legacy drivers
m_primaryBuffer could be nullptr when a pipeline was inactive before, causing
a crash
2021-10-19 07:37:50 +00:00
Ömer Fadıl USTA
3ec6dab5d0 Add other missing includes to fix bsd build 2021-10-19 06:18:27 +03:00
Ömer Fadıl USTA
a2a012be26 Add missing include to fix bsd compile problems 2021-10-19 06:03:49 +03:00
l10n daemon script
d154da1e0b 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-10-19 01:17:26 +00:00
Xaver Hugl
fbb5c95cc4 platforms/drm: tie primary planes to crtcs 2021-10-18 20:05:34 +00:00
Xaver Hugl
3a9491ca6d platforms/drm: Move legacy cursor handling into DrmCrtc
Makes things easier for tiling and reduces the complexity of DrmPipeline
2021-10-18 20:05:34 +00:00
Xaver Hugl
a70321c592 platforms/drm: split DrmObject::Property out in its own files 2021-10-18 20:05:34 +00:00
Xaver Hugl
307b5ce3ca platforms/drm: prettify some headers
Makes them much more readable
2021-10-18 20:05:34 +00:00
Xaver Hugl
72af309317 platforms/drm: reverse output creation order
This was inverted from 5.22, which switches plasma layouts and the default
Xwayland primary screen.
2021-10-18 19:32:59 +00:00
Vlad Zahorodnii
4dafacc00b kwineffects: Stop linking kwayland-server
As is, libkwineffects doesn't use any specific apis in kwayland-server,
it simply "forwards" wayland display and surfaces from libkwin. Given
that, there is no need to link libkwineffects with kwayland-server. If
an effect needs to access wayland specific stuff, it can link explicitly
against kwayland-server.

The main motivation behind this change is to further loosen up
dependencies between various kwin components and kwayland-server so the
latter can be moved back to kwin.
2021-10-18 16:03:30 +00:00
Vlad Zahorodnii
a5a2deef60 kwineffects: Remove effectively unused surface_interface.h include
SurfaceInterface can be an opaque pointer.
2021-10-18 11:34:15 +00:00
Vlad Zahorodnii
85f8a53360 x11: Properly unredirect windows if compositing is not possible
Before attempting to create scenes, kwin will redirect windows but if
the opengl scene can't be created, it won't unredirect windows, which
seems to cause issues on aarch64.

BUG: 443953
2021-10-18 13:20:35 +03:00
Vlad Zahorodnii
dda0c24187 wayland: Remove absolute position from processMotion() that handles relative moves
API-wise it's odd to require absolute position with relative pointer
moves.

This cleans up some of InputRedirection code by making it simply forward
pointer input events from input devices to the pointer input device
handler, which knows better what to do with the delta value.

The pointer input device handler will compute the absolute position based
on the specified delta value, but it could also do something else, e.g.
not move the pointer at all if it's locked, etc.
2021-10-18 08:47:21 +00:00
Alexander Lohnau
8adfd2f244 Use enum value for KAuthorized::authorize
Task: https://phabricator.kde.org/T11948
2021-10-18 07:03:50 +00:00
Vlad Zahorodnii
6d5fc9fd30 Restore old behavior of Workspace::clientArea(clientOpt, Toplevel)
When geometry updates are blocked, the output doesn't get updated. This
breaks Workspace::clientArea() overload that takes only the window.

Previously, clientArea() would look up the output where the window is
every time it's called, so the fact that the screen id or AbstractOutput
is unsynchronized with the frame geometry was irrelevant.

This change restores the old behavior as 5.23 is affected by the
output() being out of sync with the frameGeometry(). Specifically, when
kwin starts managing an X11 window, it will block geometry updates,
setup the window, e.g. make it fullscreen, and unblock geometry updates.

Since Workspace::clientArea(clientArea, Toplevel) uses the output(),
X11Client::setFullScreen() will most likely put the X11 window at a
wrong output if it's called inside X11Client::manage().

BUG: 443787
2021-10-18 05:25:06 +00:00
Vlad Zahorodnii
23e5039918 Fix build on Gentoo
AbstractEglBackend includes option.h, which includes main.h, which
includes QApplication. Since SceneOpenGLBackend doesn't link against
Qt::Widgets, kwin fails to build on Gentoo, but not on other distros
for some reason...
2021-10-17 15:49:57 +00:00
Aleix Pol
ff618e9f41 Do not ask for decoration settings without guarding
Otherwise we crash when no decoration is set (e.g. Plasma Mobile)
2021-10-17 14:41:34 +00:00
ivan tkachenko
aaa060d6c1 KCM: Implement better layout
Text labels without extra margins on the left looked mis-positioned.
2021-10-16 03:27:08 +00:00
Rodney Dawes
518c75a042 InputMethod: Use new API to pass modifiers map along to clients 2021-10-15 16:47:06 -04:00
Rodney Dawes
9818f4a4e5 InputMethod: Update for kwayland-server API change with keysym events
To avoid needless conversion of modifiers in kwayland-server, we needed
to break API so that the modifiers are simply passed through.
2021-10-15 16:47:06 -04:00
Vlad Zahorodnii
cc98001d4c Use move resize geometry in AbstractClient::applyWindowRules()
Abstract clients tolerate passing the shaded window geometry to
moveResize().

But the main issue with applyWindowRules() is that it uses the current
frame geometry even though it calls moveResize(). It's not a big deal
but it's error prone.

This change ports applyWindowRules() to the move resize geometry, which
makes code more straightforward and ensures that kwin uses right
geometry type with moveResize().
2021-10-15 20:19:20 +03:00
Vlad Zahorodnii
368bbde1ff Make geometry updates blocker pass last move resize geometry
X11Client tolerates passing shaded geometry to moveResize() and in many
cases kwin already does that.

Another issue is that this doesn't align well with new async geometry
handling abstractions. pos() can't be used because it corresponds to the
current frame position.

We can safely pass the last move resize geometry. It simplifies code a
bit and makes sure that everything works as expected with the move
resize geometry.
2021-10-15 20:18:59 +03:00
Vlad Zahorodnii
b90975b7a2 Replace AbstractClient::adjustedSize() with a simpler alternative
Currently, adjustedSize() does two things - it computes and constrains
the natural size of the window.

In many places where adjustedSize() is used, the natural size doesn't
need to be constrained and in some it's actually undesired because
AbstractClient::constrainClientSize() doesn't allow the client size to
be 0x0, which can happen when dealing with a client that has no buffer
committed yet.

This change replaces adjustedSize() with implicitSize(), which simply
calculates the natural frame size based on the current client size.

If the frame size needs to be constrained, for example during
interactive move-resize, use constrainFrameSize() or if you need to
constrain the client size - constrainClientSize().
2021-10-15 17:16:11 +00:00
Vlad Zahorodnii
a195290600 Simplify AbstractClient::applyWindowRules()
Trying to reconstrain the geometry after applying rules is unnecessary
because if the geometry is forced using a rule, resizeWithChecks()
should not change it; if the window is maximized or has entered fullscreen
mode, window gravity is irrelevant. If the window is shaded, this
resizeWithChecks() is not needed.

This change simplifies AbstractClient::applyWindowRules(), which allows
to split adjustedSize() to further simplify geometry handling.
2021-10-15 17:16:11 +00:00
Aleix Pol
3e77907d21 inputmethod: Use touch events to decide if the panel is shown not the state
Prefer hiding/showing the panel (i.e. the window) when not a touch event
than stopping to make the inputmethod active.
This way we remain compatible with non-virtualkeyboard inputmethods.
2021-10-15 15:41:35 +00:00
Xaver Hugl
5b9deafa14 InputMethod: only activate virtual keyboard when used with touch 2021-10-15 15:41:35 +00:00
Vlad Zahorodnii
f1e99e971f scripting: Guard against nullptr m_client in WindowThumbnailItem
BUG: 443765
2021-10-15 07:59:55 +00:00
Vlad Zahorodnii
59a4a908f9 Properly update parent item's bounding rect when moving item
The bounding rect of an item is in the item-local coordinate space. If
the item is moved, its bounding rect won't change, but the parent's
bounding rect, may change.

BUG: 443756
2021-10-15 10:30:49 +03:00
Vlad Zahorodnii
ff3465a80e Fix AbstractClient::adjustedSize() for wayland windows with no committed buffer
AbstractClient::constrainClientSize() forces the minimum client size of
1x1.

If AbstractClient::adjustedSize() is called before the XdgToplevelClient
is mapped, it will return 1x1 rather than 0x0 as expected, which will
confuse

    QSize s = adjustedSize();
    if (s != size() && s.isValid())
        resizeWithChecks(s);

in AbstractClient::applyWindowRules(). Since 1x1 is different from 0x0,
the xdg-toplevel surface is going to be resized to 1x1.

BUG: 443705
2021-10-15 05:38:54 +00:00
Vlad Zahorodnii
b4a4e8a45d Drop WaylandServer::terminateClientConnections()
Display will destroy all client connections before getting destroyed.
2021-10-14 10:02:50 +00:00
Vlad Zahorodnii
e550480c43 Rework input method teardown logic
Explicitly destroy input method rather than wait for the input method
connection to be destroyed by WaylandServer, it's less error prone.

BUG: 443603
2021-10-14 10:02:50 +00:00
Vlad Zahorodnii
4f46da46fc wayland: Move relative pointer extension instantiation to WaylandServer
Whether relative pointers are supported doesn't depend on the input
backend. This change moves the instantiation of the extension to the
WaylandServer class to make code more consistent.
2021-10-14 06:41:01 +00:00
Aleix Pol
3da0725404 Fix build
We forgot to remove the subdirectory when moving builtin plugins into
separate targets.
2021-10-14 02:44:29 +02:00
Vlad Zahorodnii
6b015d1e6e libinput: Drop mm position in Connection::pointerMotionAbsolute()
The position in millimeters is unused and it can't be applied to virtual
input devices.
2021-10-13 20:52:45 +03:00
Vlad Zahorodnii
bf620fbe04 Move Xkb::LEDs enum to KWin namespace
With the LEDs enum being defined in kwinglobals.h, wayland_server.h
won't need to include keyboard_input.h, which is good for compilation
times and wayland_server.h will drag less stuff, e.g. QtWidgets (input.h
includes QAction)
2021-10-13 17:49:19 +00:00
Vlad Zahorodnii
9cdd363fa1 effects: Pass full name to kwin4_add_effect
This way, it's more clear what target name is.
2021-10-13 17:05:06 +00:00
Vlad Zahorodnii
10b56bd43d effects: Modularize builtin effects build
Currently, cpp source files are included partially in effect sub-folders
and src/effects/CMakeLists.txt, which is really confusing and hard to
follow.

With this change, effect targets will be defined in their own subfolders.
This makes build files more straightforward.

Effect sub-targets are eventually merged into a monolithic
kwin4_effect_builtins target.

Another reason for modularizing builtin effects is that no two effects
can generate moc files with the same name atm even though they are in
different sub-folders. This can be potentially useful in the future, e.g.
making effects static plugins in order to decouple builtin effects from
libkwin (every effect subfolder would need a main.cpp or plugin.cpp file,
which will include the associated moc file).
2021-10-13 17:05:06 +00:00
Vlad Zahorodnii
ec6e6fa63c effects/showfps: Add destructor
The GLTexture class is forward declared and the ShowFpsEffect class has
a QScopedPointer<GLTexture> field. We either need to include the
kwinglutils.h header file or add a destructor that does nothing and
define it in the cpp file, where kwinglutils.h is included.
2021-10-13 17:05:06 +00:00
Aleix Pol
c07182490d pipewire: Fix downloading software-rotated textures
At the moment we'll be setting the YInverted setting, but in practice
that won't have any effect as it only changes the render matrix and
we'll end up streaming inverted textures.
This change addresses it by rendering it into another texture first to
resolve this situation and then download that new texture instead.
2021-10-13 17:16:15 +02:00
Aleix Pol
67ec16c335 pipewire: No need to create a QRect when we just need its size 2021-10-13 17:14:53 +02:00
Nate Graham
c1fb405b8d Rename "pack" actions for clarity
The English word "pack" is not really the correct word for these
actions, and does not succeed in communicating what they will do. Since
the actions simply move the active window as far as it will go in the
specified direction, the actions can be renamed to say that instead.

Also rename the action names in the code to match their new UI text for
clarity.
2021-10-13 14:28:23 +00:00
Méven Car
cc5b47ee30 abstract_client: convert some Q_FOREACH 2021-10-13 15:44:39 +02:00
Andrey Butirsky
59143eeef9 [wayland] fix crash on startup with lv3:ralt_alt XKB option
With lv3:ralt_alt ("Right Alt never chooses 3rd level") option set, we
get more layouts from libxkbcommon than it was configured, see:
https://github.com/xkbcommon/libxkbcommon/issues/262
It might be correct lib's behavior, still.

The extra layouts are redundant, so we strip them out from usual usage.

BUG: 440027
2021-10-12 15:41:54 +00:00
Vlad Zahorodnii
e29997bda8 plugins/nightcolor: Remove unused options 2021-10-12 06:38:23 +00:00
Vlad Zahorodnii
d0fd2224bf autotests: Use EffectLoader to list all available effects
EffectLoader is a more generic way to list all available effects.
2021-10-12 06:33:30 +00:00
Vlad Zahorodnii
260b224d3b Drop WaylandServer::dispatch()
There's no any good reason to dispatch events at shutdown.
2021-10-12 06:32:55 +00:00
Vlad Zahorodnii
65e8c0c737 Simplify WaylandServer::initWorkspace()
If kscreenlocker integration is on, the initialized() signal can be
still emitted in WaylandServer::initWorkspace().
2021-10-12 06:32:55 +00:00
Vlad Zahorodnii
d941c97d8e Remove unused includes 2021-10-12 06:32:55 +00:00
l10n daemon script
16e38fe07b 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-10-12 01:19:47 +00:00
Rodney Dawes
886a86ab2b Pass correct argument to Q_UNUSED for disabled features 2021-10-08 13:19:35 -04:00
Martin Flöser
68589fe937 compositor: Merge the OpenGL 2 and 3 backends
This change merges the two OpenGL backends into one making the current
default of GLCore the overall default. It becomes the first context to
try to create. If it fails, it will automatically fall back to the
(previous) OpenGL 2 backend.

Reasoning: the differentiation of OpenGL 2 and 3 is a very technical one
and hard to understand for users. It is not obvious which one is better
or should be used. This results in many user discussions like "Which
backend to use?"

Back when the OpenGL 3 backend was introduced the dedicated feature made
sense. It was a new code base using new driver features. Nowadays the
code base in KWin is robust and mature and so are the drivers. A driver
advertising support for OpenGL 3 will support OpenGL 3. We don't have to
plan for driver breakage in this area any more.

Also our code evolved through the context attribute builder which gives
us the possibility to more easily fall back in case we cannot create the
context. Thus the need to select the backend is not so important as it
used to be when the feature got introduced.

If a user still wants to force OpenGL2, it is still possible by setting
the appropriate environment variables like MESA_GL_VERSION_OVERRIDE.

This change brings the improvement that the backend selection is now
completely removed from the compositing KCM.
2021-10-08 15:26:25 +00:00
Vlad Zahorodnii
4ba7aa62b9 Reset WaylandServer::s_self in destructor
When using KWIN_SINGLETON macros, you still need to reset s_self
manually in the destructor.
2021-10-07 18:26:43 +03:00
Vlad Zahorodnii
5be593d4e4 wayland: Drop internal connection
It's practically unused now.
2021-10-07 13:28:08 +00:00
Benjamin Port
9c4f358a64 NightColor: use config watcher to update state when configs are changed 2021-10-07 13:12:30 +00:00
Alex Richardson
722f092b7a Fix a -Wformat warning on FreeBSD
On FreeBSD we get a long long result so %ld triggers a warning. Cast to
long long and use %lld to make it work on all platforms (including 32-bit).
2021-10-07 08:24:01 +00:00
Xaver Hugl
9f69d4c9c2 platforms/drm: set DPMS property properly 2021-10-07 07:02:50 +00:00
Vlad Zahorodnii
4f3ff4fbb0 wayland: Improve default placement of pointer
Currently, the pointer is moved to the center of the workspace. However,
on a multi-monitor setup, the workspace center may not be the same as
the center of the output it's on. That's the case with my setup -
1920x1080, 1920x1080, 1080x1920 (the monitors are laid out in a row from
left to right).

This change improves the default placement of the pointer by actually
moving it to the center of the screen that contains the workspace center
so the pointer doesn't end up at some "random" position from the user's
point of view.
2021-10-07 05:49:42 +00:00
Andrey Butirsky
c9b41a1682 fix wrong approach geometry of screen edge's effect
Edge geometry has width and height, so we need the correction for
approach geometry of bottom and right corners.
The other edges are fixed as well.

BUG: 442973
2021-10-06 22:57:33 +00:00
Vlad Zahorodnii
e6c77a1ddc Clear should_get_focus in Workspace::focusToNull()
On X11, there are four input models. With some input models, it's okay
if the window manager calls XSetInputFocus(), with others, the wm has to
ask the client to make a XSetInputFocus() request.

If kwin wants a client to take input focus, kwin will add the client
to the should_get_focus list, which contains all the windows that
are about to get input focus. Clients are popped from the list upon
receiving FOCUS_IN events.

A client will be added to the should_get_focus list even if kwin thinks
that the client already has input focus because communication between
the wm and xorg is async, anything can happen with input focus in meanwhile.

On the other hand, the wm may sometimes focus the null window if no
window should contain the input focus. The issue is that the
should_get_focus list is not cleaned up in that case, which can lead to
Workspace::mostRecentlyActivatedClient() returning wrong client and
possibly other async related issues.

We don't have such madness on Wayland as the compositor is in charge of
handling input focus.

This change makes Workspace::focusToNull() clear the should_get_focus,
which is reasonable. We need to deactivate "in-flight" focus requests.

This also fixes the bug where fullscreen Wayland windows don't go above
docks and panels due to Workspace::mostRecentlyActivatedClient() returning
bad client.

BUG: 439405
BUG: 395919
2021-10-05 14:53:20 +00:00
Xaver Hugl
ef894f34eb xdgshellclient: fix initial placement with maximize
BUG: 439986
2021-10-04 09:39:58 +00:00
Xaver Hugl
6a68caef7b Only emit outputDisabled if the output is enabled
CCBUG: 440322
2021-10-04 09:38:40 +00:00
Xaver Hugl
178e69b39b platforms/drm: handle hotplugs with disabled outputs better
If the last enabled output gets removed but we have disabled outputs
still connected, enable the first disabled output to prevent a crash.

BUG: 442990
2021-10-04 09:37:52 +00:00
Méven Car
85fb0e7c43 IdleTimePoller: Fix a crash at shutdown
Currently, kwin crashes at shutdown because the idle poller plugin is unloaded when exit handlers are run, after the waylandServer() is destroyed. This results in null dereferencing.

BUG: 443268
2021-10-04 10:24:23 +02:00
Vlad Zahorodnii
8ac93a59ff scene: Handle Xwayland windows changing surfaces
Xwayland can re-create the wl_surface if the window has been previously
unmapped.

BUG: 442936
BUG: 426069
2021-10-04 05:56:27 +00:00
Vlad Zahorodnii
73162e8fae Store Toplevel surface using QPointer
This makes Toplevel::setSurface() simpler.
2021-10-04 05:56:27 +00:00
Vlad Zahorodnii
52c9dbb487 wayland: Reset Toplevel::surfaceId after surface is created
Xwayland will re-create the wl_surface object if the X11 window is
unmapped and mapped. That, and the fact that the order in which the
WL_SURFACE_ID client message event is received and the wl_surface object
is created is undefined can cause the following bug:

* WL_SURFACE_ID is received
* the old wl_surface object is destroyed, m_surfaceId is reset to 0
* new wl_surface is created but because m_surfaceId is 0, it won't be
  associated with the x11 window

This change ensures that kwin will associate the wl_surface with x11
window by making it not reset cached surface id when the old wl_surface
is destroyed.

However, we cannot leave m_surfaceId as is because wayland aggressively
re-uses object ids so kwin can associate wrong surface with x11 window.

To prevent that, this change also makes Toplevel::setSurface() reset
cached surface id.

CCBUG: 442936
CCBUG: 426069
2021-10-04 05:56:27 +00:00
Vlad Zahorodnii
61eb8ce75b Fix double close()
AbstractDataSource::requestData() takes the ownership of the file
descriptor. So the second close() will close an already closed fd.
2021-10-04 05:41:23 +00:00
Xaver Hugl
d83da1cdac platforms/drm: remove redundant check for placeholder output
It's not necessary, the placeholder output already gets created in DrmBackend::removeOutput
if necessary. More improtantly it's missing the check for shutdown, which
may cause issues if the computer is turned off while no outputs are connected.
2021-10-03 16:33:01 +02:00
Méven Car
8c908c69bc Port src/plugins/idletime/poller.cpp away from the internal connection 2021-10-01 15:01:23 +00:00
Kristen McWilliam
cc06f62749 Fix center snap zone to account for available space 2021-10-01 14:55:12 +00:00
Xaver Hugl
d55011ae86 platforms/drm: handle disabled outputs better
BUG: 442603
2021-10-01 08:53:10 +00:00
Vlad Zahorodnii
6b313268dd Allow passing -1 screenId to Workspace::clientArea() again
Allow passing -1 screen id to clientArea() until the effects are ported
to EffectScreen.
2021-10-01 08:07:51 +00:00
Vlad Zahorodnii
21da7b7ed8 effects/thumbnailaside: Fix crash in clientArea()
clientArea() was changed to forbid "-1" screen ids, but it seems like
the thumbnail aside effect can pass it to refer to the active screen.

This change makes the thumbnail aside effect handle "-1" screen id case
explicitly. It will be also useful for EffectScreen transition.

BUG: 443166
2021-10-01 08:07:51 +00:00
Xaver Hugl
eeb1bd5b38 Fix a few clazy warnings 2021-09-30 12:26:25 +00:00
Xaver Hugl
bcbba62c7c platforms/drm: remove dangling pointer of lease outputs pipeline 2021-09-30 07:16:49 +00:00
Vlad Zahorodnii
66badd905b kcmkwin/rules: Fix suggested values for virtual desktops rule
If the virtual desktops rule is created, only the last virtual desktop
the window is on is going to be checked.

With this, all virtual desktops that the window is currently on will be
checked.

Technically, it's an api breaking change, but the window rules kcm is
the primary user of queryWindowInfo() so I don't think it's a big deal.
2021-09-30 05:40:04 +00:00
Vlad Zahorodnii
31b9f34d9b libinput: Port to AbstractOutput
CCBUG: 443088
2021-09-29 12:03:39 +03:00
Alexander Lohnau
1022ce0036 Fix condition for making themes configurable
KPluginMetaData::findPlugins only returns valid json metdata, the previous
check was accidentally kept for the condition that the plugin provides a theme engine.

BUG: 442978
FIXED-IN: master
2021-09-28 23:08:43 +00:00
Xaver Hugl
6ca530e02b platforms/drm: fix small memory leak 2021-09-28 23:48:36 +02:00
Vlad Zahorodnii
6bbda88ab5 platforms/drm: Avoid making real commits while searching for output config
This change limits the brute force output configuration search routine
to test only commits, it's way more efficient than real commits.

CCBUG: 442603
2021-09-28 11:31:54 -06:00
Vlad Zahorodnii
eb1daa0aad platforms/drm: Avoid re-using blobs
Blobs are not reference counted if used by other drm master, if kwin
re-uses a deleted blob in an atomic commit, it will fail. For example,
on my computer, this happens when kwin starts after xorg.

Besides that, kwin may try to destroy blobs that it doesn't own, which
is not fatal but it's strange to do so.

CCBUG: 442603
CCBUG: 439873
2021-09-28 11:31:54 -06:00
Vlad Zahorodnii
6513c66ca6 wayland: Move ConnectionAdaptor to the same thread as Connection
Connection deletes the ConnectionAdaptor, but they are in different
threads, which is weird.

CCBUG: 442104
2021-09-28 17:29:34 +00:00
Aleix Pol
6cf060223e gbm: Do not create buffers when there is no display 2021-09-28 17:18:34 +00:00
Aleix Pol
9bda050d84 screencasting: Do not crash when the platform cannot provide textures
When using the QPainter backend, we will be getting null textures. Just
ignore these as the backend isn't all that important.

BUG: 442711
2021-09-28 17:18:34 +00:00
Xaver Hugl
de674e087a platforms/drm: make failure of findWorkingCombination less severe
While findWorkingCombination should never fail, in the case it does
KWin should not crash. To achieve that simply restore the old config
in case of failure.

CCBUG: 439873
2021-09-28 16:23:01 +00:00
Vlad Zahorodnii
d7d1c6600a wayland: Move ownership of the libinput thread to InputRedirection
When libinput tears down, it may access the Session object. This change
re-jitters the shut down logic so the Session object is guaranteed to be
valid when libinput stuff gets destroyed.

BUG: 442104
2021-09-28 14:37:47 +00:00
Vlad Zahorodnii
7900068cab wayland: Destroy InputRedirection explicitly
CCBUG: 442104
2021-09-28 14:37:47 +00:00
David Edmundson
ef06b8ed95 [effects] Avoid animating screenlocker backing window
ksmserver provides the backing window (the hidden black one) for the
lockscreen. We don't want to animate this fading out.

It no longer provides the logout prompt since several plasma releases.
2021-09-27 14:34:42 +00:00
David Edmundson
d3318cde15 [effects] Don't animate lockscreen via fadingpopups effects
Whilst unmanaged, it's clearly not a popup.
2021-09-27 14:34:42 +00:00
Xaver Hugl
4aebf0d730 platforms/drm: fix legacy dpms
BUG: 442969
2021-09-27 12:55:15 +00:00
Xaver Hugl
7bca5d737d platforms/drm: fix dpms tracking
DrmGpu::updateOutputs is now changing the state of some drm properties
without changing the fitting output state (namely RenderLoop inhibition)
which can lead to rendering being inhibited indefinitely in some cases
2021-09-27 12:55:15 +00:00
Vlad Zahorodnii
0f6aa1c4a8 scenes/opengl: Fix clipping with transformed screens
Software-based clipping is naive. It maps the clip region from the
global screen coordinates and intersects it with window quads. If the
window is transformed, the quads won't be clipped as expected.

Unfortunately, the OpenGL scene enables software-based geometry clipping
if the screen transformed. It's not clear why it does so, perhaps as a
performance optimization? Either way, this produces incorrect results
when the screen is scaled.

BUG: 440940
2021-09-27 06:52:49 +00:00
Ash Blake
242de43737 tablet: Check if client is supported before sending tool button
BUG: 438010
2021-09-26 09:02:21 +00:00
l10n daemon script
ced2990c8a 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-09-26 01:13:57 +00:00
l10n daemon script
45ee1969c7 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-09-25 01:15:12 +00:00
l10n daemon script
6c1447875e 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-09-24 01:13:57 +00:00
Fabian Vogt
6e1564fc17 gbm_dmabuf: Fix crash if gbm_bo_create fails
And perform proper cleanup if eglCreateImageKHR fails.
2021-09-23 16:09:11 +00:00
Vlad Zahorodnii
c94c2128bd effects/overview: Drop Kompose mode
This makes ExpoLayout easier to maintain. As is, the main issue with it
is the number of layout algorithms.

With this, the ExpoLayout is going to have two layout algorithms - one is
very simple and the other not so.
2021-09-23 16:03:49 +00:00
Xaver Hugl
416f55cea3 platforms/drm: fix hidden cursor
BUG: 438824
2021-09-23 15:54:18 +02:00
Vlad Zahorodnii
966a95e5fd wayland: Set default cursor shape for the root window
Previously, it was done by plasmashell, now it needs to be done by kwin.

BUG: 442539
2021-09-23 13:52:51 +00:00
Vlad Zahorodnii
ca1c72dd16 wayland: Fix cross cursor in Xwayland apps
Startup code in plasmashell was changed so xsetroot is not called
anymore, which is sort of fine.

Unfortunately (or not?), it exposed a bug in kwin. Cursor::x11Cursor()
only works in the standalone X11 session.

On Wayland, Cursor::x11Cursor() will return XCB_NONE which results in
seeing cross cursor when there should be arrow cursor.

This change moves xcb_cursor_t look up code from X11Cursor to the base
Cursor class. In hindsight, I would like to introduce a window manager
class where the xcb cursor and other x11 specific code can be moved in
the future for better encapsulation of platform-specific code.

CCBUG: 442539
2021-09-23 13:52:51 +00:00
Vlad Zahorodnii
29d1b25ad5 effects/desktopgrid: Schedule repaint when toggled
A repaint needs to be scheduled; otherwise the animation may not start
immediately.
2021-09-23 13:39:48 +00:00
Andrey Butirsky
f453cb83e2 fix wrong popups Z-order after applying "Show Desktop" effect
For some reason, layers are change after applying Show Desktop effect, so
we will have AboveLayer for our popups and Desktop, and NotificationLayer
for Dock which hides us.
Also, OSD and critical notifications were always hidden by our popups.

This patch solves both the issues.
Usual notifications will still be hidden, but hopefully it's not a big
issue.

BUG: 442605
2021-09-23 11:54:55 +00:00
Vlad Zahorodnii
67b94586c4 effects/trackmouse: Fix texture check
Both texture and image cannot be not null as they are initialized based
on compositing type.

BUG: 439859
2021-09-23 11:25:46 +00:00
Vlad Zahorodnii
df11acd467 x11: Cast Window to EGLNativeWindowType using a C cast
reinterpret_cast<>() will fail if the types we cast from and to have
mismatching sizes.

Unfortunately, there are platforms that have Window and
EGLNativeWindowType of different size. This results in compilation
errors.

In order to work around those problematic platforms, this change
replaces reinterpret_cast cast with a c style cast.
2021-09-23 09:41:19 +03:00
Amir Maimon
51925567f6 platforms/drm: Fix explicitGpus check
The check for explicitGpus in udev event handler was limited to new
GPUs, and didn't consider changes to the GPU driver, eg. from vfio-pci
to amdgpu
2021-09-23 06:35:28 +00:00
Vlad Zahorodnii
21a17c87db libkwineffects: Simplify EffectQuickView constructors
This simplifies EffectQuickView constructors and ensures that there
won't be a crash if compositing is off.
2021-09-23 06:28:29 +00:00
Vlad Zahorodnii
1b215e6c06 libkwineffects: Avoid accessing effects in EffectQuickView
EffectQuickView is used by Aurorae. As long as Aurorae decorations are
rendered by kwin, it's not a problem. However, kde-gtk-config kded
module can also render them. This creates a problem. If effects object
is not created, accessing any of its getters or setters will result in a
segmentation fault.

This change rewrites the share context check so the effects object is
not accessed anymore.

One could argue that kde-gtk-config has to provide a dummy EffectsHandler
but it doesn't use effects and libkwineffects is not a dependency of
KDecoration2. So, providing a dummy EffectsHandler makes no sense.

In hindsight, we need to revisit the usage of EffectQuickView in Aurorae
as accessing the EffectsHandler in EffectQuickView is a totally valid
usecase and integration of QOpenGLContext.

BUG: 441585
2021-09-23 06:28:29 +00:00
Vlad Zahorodnii
0b95979751 kcm/compositing: Don't reset animation speed to default value when running in plasma
When running in plasma, the animation speed slider is in General
Behavior KCM.

The Defaults button should not reset the animation speed slider because
it's hidden.

BUG: 442600
2021-09-22 15:09:46 +00:00
l10n daemon script
c27e4df375 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-09-22 01:19:05 +00:00
Vlad Zahorodnii
c29c437e58 effects/glide: Adjust the effect to projection matrix changes
With per-screen rendering, the projection matrix is no longer created
with the workspace geometry, i.e. all screen geometries united, so the
center of the workspace geometry may not map to (0, 0) in the clip
coordinates.

GLRenderTarget::virtualScreenGeometry() can be used to query the rect
that was used to create the projection matrix.

BUG: 442770
2021-09-21 12:20:19 +00:00
Xaver Hugl
6d79d855be platforms/drm: waitIdle before updating outputs
KMS can only ever have one frame pending at the moment. If we
update the outputs while a pageflip is still pending on any output
the atomic commit will fail with EBUSY, which both invalidates
the testing for output configuration and makes applying the wanted
configuration fail.

This can be removed again once KMS gains the ability to do mailbox
presentation; that will likely still take a while though.

BUG: 442677
2021-09-21 14:18:16 +02:00
Vlad Zahorodnii
2200febcd6 Restore fbo binding after updating surface texture from EGLStreams
Currently, data from client buffer EGLStream is copied to a surface
texture. An fbo is used for that purpose. The main issue with it is that
it doesn't restore the old framebuffer binding.

The surface texture can be updated in the middle of a compositing cycle.

If the framebuffer binding is not restored, any window that must be
rendered in an offscreen texture won't be rendered to the offscreen
texture.

This change makes EglStreamSurfaceTextureWayland restore the fbo binding
so the DeformEffect and software screen rotation work as expected with
the proprietary NVIDIA driver.

BUG: 442697
2021-09-21 12:41:45 +03:00
Vlad Zahorodnii
595c7a7edc Add NOTIFY signal to closeable property
QML doesn't like that the overview effect uses the closeable property
yet it has no NOTIFY signal.
2021-09-21 05:41:46 +00:00
Nate Graham
095f953847 kcmkwin/kwinscripts: Hide help button
There is no help for this KCM, so don't show the Help button.

BUG: 442460
FIXED-IN: 5.23
2021-09-20 19:52:48 +00:00
Jan Blackquill
b376f8832f Fix desktop grid border activation
BUG: 442518
FIXED-IN: 5.23
2021-09-20 14:34:11 -04:00
Jan-Marek Glogowski
6ead28a6a1 composite: adjust terminal messages (prio + text)
This makes the compositingPossible() output more elaborative,
and adjusts their priorities to qCWarning.

I thought about dropping the "Compositing is not possible"
(qCCritical) message. It's not critical for X11 and Wayland
depends on OpenGL. OTOH it's from a different component. So in
the end I settled for qCWarning again; there is no real way
to know, if the platform will consider this a critical problem
(and eventually abort).

Then I saw X11StandalonePlatform::compositingNotPossibleReason,
which has more user friendly, QT Richtext / HTML encoded output,
but this seems overkill for the terminal; now I would like to
know, where this is actually used...

While at it report "manually" suspended compositing via qCInfo
instead of qCDebug.
2021-09-20 13:18:33 +00:00
Jan-Marek Glogowski
bcdf047018 composite: log when disabled via OpenGLIsUnsafe
After updating my Debian buster to bullseye, I noticed missing
shadows / composite for KDE, which made overlapping windows hard
to recognize.

.xsession-errors just had "kwin_core: Compositing is not possible".
Using the suggested QT_LOGGING_RULES="kwin_*.debug=true" didn't
provide any more clues; nothing I tried did.
Eventually I ended reading the kwin source and found, that
disabled composite via kwinrc :: [Compositing] :: OpenGLIsUnsafe
was not reported.

IMHO all these disabling cases should use qCCritical(KWIN_CORE),
like the "Compositing is not possible" message, but for the time
being, this simply logs the OpenGLIsUnsafe reason, just like all
the others.
2021-09-20 13:18:33 +00:00
Lewis Lakerink
fc860a226e Fix screen edge detection 2021-09-20 13:15:23 +00:00
Kristen McWilliam
5fdf1da808 Add hotkey option to move active window to center 2021-09-20 13:14:24 +00:00
Kristen McWilliam
69417dd5f7 Fix required if statement before switch 2021-09-20 13:12:17 +00:00
Kristen McWilliam
b23f2ab3dd Refactor if-else chain in Placement::place to a switch statement
Was using a long & fragmented if-else chain. A switch statement
is often more performant, as well as being easier to read and modify.
2021-09-20 13:12:17 +00:00
Vlad Zahorodnii
f2b6a6b2f6 scenes/opengl: Fix null dereference in OpenGLWindow::windowTexture()
If the SurfaceItem has no SurfacePixmap, kwin will crash when trying to
access the surface texture.

BUG: 437709
2021-09-20 12:39:28 +00:00
Xaver Hugl
e004f1b7fc platforms/drm: fix buffer re-using
We don't always have explicit modifiers when we're using AMS

CCBUG: 442677
2021-09-20 14:28:58 +02:00
Xaver Hugl
cf7cc0d43e Implement DRM leasing 2021-09-17 23:09:08 +02:00
Vlad Zahorodnii
afcb9fd037 x11: Fix "Move window to next screen" shortcut for maximized windows
With the recent AbstractOutput changes, Workspace::clientArea() overload
that takes only the window and no additional output was changed to

    return clientArea(opt, window, window->output());

prior to that, it had been looking up the output at the center of the
frame geometry.

As it turns out, AbstractOutput::sendToOutput() blocks geometry updates,
which in its turn means that Toplevel::output() will be updated only
after geometry updates are unblocked. For the most part, it's not a big
deal until you need to use Workspace::clientArea(opt, const Toplevel*)

Since the output won't be updated until geometry updates are unblocked,
clientArea(opt, const Toplevel *) may return outdated info.

One could argue that we just simply need to update m_output similar to
m_frameGeometry when geometry updates are blocked, but... it's not going
to work on wayland! On Wayland, GeometryUpdatesBlocker is totally
unnecessary. Even if a window is resized, m_frameGeometry will be left
unchanged until the client repaints the window.

Instead, one need to pass the AbstractOutput to clientArea() if it's
important.

This change makes X11Client::changeMaximize() query the MaximizeArea of
the output containing the center of the move resize geometry, similar to
what the XdgToplevelClient does.

BUG: 442534
2021-09-17 14:02:01 +00:00
Xaver Hugl
ca869e2bc5 platforms/drm: disable explicit modifiers by default
There are some unresolved issues where driving outputs can fail because
of bandwidth constraints. These don't appear to happen with implicit
modifiers, or at least they don't happen as often.
2021-09-17 13:52:07 +00:00
Xaver Hugl
4848964c60 platforms/drm: allow modesets when setting Broadcast RGB
CCBUG: 442520
2021-09-17 15:48:40 +02:00
Aleix Pol
8825c01b15 tablet: Fix disconnecting the tablet while the pen is still in proximity
libinput will send release and proximity out events after the device is
disconnected.
This just takes into account that tablet might be nullptr.

BUG: 442573
2021-09-17 13:33:41 +00:00
Aleix Pol
7ffa7c48e5 wayland inputmethods: If maximized, also restore to the available area
The stored geometry is irrelevant in the window is maximized.
This is especially relevant if we:
* open a virtual keyboard
* rotate the display (then it looks ok as it was already addressed)
* then remove the keyboard.

At that point we want to reset to the available area rather than the
previous.
2021-09-17 13:05:53 +00:00
Alexander Lohnau
08d3ceb024 Port to new KDecoration2::DecorationThemeProvider class
By supporting all the required attributes in the DecorationThemeMetaData class
the custom struct can be dropped.

Task: https://phabricator.kde.org/T14744
2021-09-17 12:45:47 +00:00
Alexander Lohnau
58c71de952 GenericScriptedConfigFactory::create: Do not use plugin keyword to identify which KCM should be loaded
We can just put the parameter in the variant list. Because the method is virtual, the keyword
parameter must exist in the method definition.

Task: https://phabricator.kde.org/T14744
2021-09-17 12:45:47 +00:00
Alexander Lohnau
cd4ef30b21 Emit deprecation warnings for loading KCM using a plugin keyword
Otherwise consumers will not know about the change and this way it is clear that the logic should be removed in the future
2021-09-17 12:45:47 +00:00
Alexander Lohnau
6f110bca1d Deprecate loading of KDecoration2::DecorationButton plugins using the "button" keyword
Task: https://phabricator.kde.org/T14744
2021-09-17 12:45:47 +00:00
Fabian Vogt
e26ea6bf23 Fix build on 32bit platforms
error: invalid cast from type ‘uintptr_t’ {aka ‘unsigned int’} to type ‘EGLNativeWindowType’ {aka ‘long unsigned int’}
2021-09-17 10:59:29 +00:00
Xaver Hugl
a7a515a0af platforms/drm: re-use buffers for testing
b38bb416 introduced flicker when restarting compositing because the
DrmGpu::findWorkingCombination method usually creates new buffers for
the commit, without rendering into them. Instead of that, re-use
existing buffers where possible
2021-09-17 11:56:20 +02:00
Xaver Hugl
d308262d4a platforms/drm: simplify active handling a bit 2021-09-17 11:34:51 +02:00
Xaver Hugl
15da95149d platforms/drm: add a method for setting legacy properties 2021-09-16 18:03:14 +02:00
Xaver Hugl
e88f2501bf platforms/drm: simplify DrmPipeline::checkTestBuffer 2021-09-16 18:03:14 +02:00
Xaver Hugl
3fc74f103a platforms/drm: drop some unused methods 2021-09-16 18:03:14 +02:00
Xaver Hugl
99cd923e4a platforms/drm: simplify format stuff a bit 2021-09-16 18:03:14 +02:00
Xaver Hugl
b3e245b177 platforms/drm: make SRC properties readable
They're 16.16 fixed point. Should make debugging easier
2021-09-16 18:02:36 +02:00
l10n daemon script
b461111130 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-09-16 01:18:13 +00:00
Severin von Wnuck
05af11b4ed qpa: Fix EGL config selection
The configs returned by eglChooseConfig are sorted from highest to lowest buffer sizes.
Filter the configs to find a suitable candidate that matches the requested attributes of the surface.
This fixes the corrupted Aurorae window decorations on Wayland with the proprietary Nvidia driver.
2021-09-16 00:37:19 +02:00
Andreas Sturmlechner
38e24ecd64
Fix build with 32-bit
Follow-up to 839710201c

Tested-by: David Flogeras <dflogeras2@gmail.com>
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2021-09-15 19:06:23 +02:00
Vlad Zahorodnii
f4b504c476 wayland: Fix google chrome fullscreen mode
Conceptually, a configure event inherits its parent's state and adds
some of its own. This allows the compositor to skip intermediate
configure events in ack_configure handler and jump to the last one.

Currently, the only field that XdgSurfaceConfigure objects need to
inherit is flags. The geometry info and window states are filled in by
role commit implementations to their latest values.

XdgSurfaceConfigure::flags indicates if the configure event moves the
window. This flag is important to resolve conflicts between geometry
updates initiated by the user and the ones that are made in response to
acknowledged configure events, e.g. after maximizing the window, etc.
(effectively, if the user moves a window, kwin will cancel scheduled
moves in configure events)

If configure flags are not inherited, we can end up with the following
case:

* configure event A (flags: {position})
* configure event B (flags: {})

If the client acknowledges configure event B, kwin will skip configure
event A, and thus it won't move the window to the right place. This is
the root cause of fullscreen mode misbehaving with apps such as google
chrome.
2021-09-15 16:17:17 +00:00
Vlad Zahorodnii
d58246961e scene: Fix previous pixmap ref'ing
discardPixmap() increases the reference counter, but there's no matching
place where the ref count is decreased, which results in the previous
pixmap not being released even if it's not needed anymore.
2021-09-15 16:16:42 +00:00
l10n daemon script
46a69357a7 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-09-15 01:22:44 +00:00
Andrey Butirsky
987c68f5a5 fix: [Wayland] Context menu opens behind apps launcher and popups
BUG: 437139
2021-09-14 13:28:09 +00:00
Xaver Hugl
b8d69a326c platforms/drm: improve VT switching behavior
Instead of setting pipelines one by one, use DrmGpu::updateOutputs to
set all the outputs on a GPU with a single atomic commit. This makes
the switch both faster, more reliable and in case the other drm master
changes the output configuration, prevents blanking.
2021-09-13 16:58:49 +02:00
Aleix Pol
2bd02f660b wayland platform: Remember to call setTransformInternal() from updateTransform() 2021-09-13 10:11:09 +00:00
Vlad Zahorodnii
839710201c x11: Fix build with EGL_NO_PLATFORM_SPECIFIC_TYPES
eglCreateWindowSurface() wants a Window (unsigned long), but with
EGL_NO_PLATFORM_SPECIFIC_TYPES, EGLNativeWindowType is defined as an
opaque pointer, i.e. void*.

BUG: 440372
2021-09-13 06:37:19 +00:00
Xaver Hugl
e10f2ce06e platforms/drm: correct property blob handling
If a property blob got created by another drm master we can't rely on
re-using it, so create a new blob of our own with the data copied over
when the kernel destroys it.
Also free property blob objects when we don't need them anymore.

BUG: 440294
2021-09-13 01:28:47 +02:00
l10n daemon script
abe6b41534 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-09-11 01:16:54 +00:00
Aleix Pol
050c6ae76b Improve behaviour upon rotation with keyboard on
We make sure our client stays maximised as the screen geometry changes.

Fixes https://invent.kde.org/plasma/plasma-phone-components/-/issues/91
2021-09-10 23:37:55 +00:00
Aleix Pol
883dbfda17 drm: Properly check for the need for transformation
At the moment we were checking for size difference between the buffers
which works for rotation but not for flipped or up-side down screens.

This changes how we check it by comparing the effective transform vs the
supported one in drm to see if they differ.

Fixes https://invent.kde.org/plasma/plasma-phone-components/-/issues/112
2021-09-10 20:11:57 +02:00
Aleix Pol
5f306ae93d Improve debug, no need to show a number when we can show the value 2021-09-10 18:00:53 +02:00
Ismael Asensio
f6796ac860 [effects/overview] Only show close button for closeable windows 2021-09-10 17:25:19 +02:00
Ismael Asensio
07551a4487 Workspace: Better check of registered client shortcuts
Do not discard a shortcut immediately when it is already registered
in KGlobalAccel, because there could be possible dangling shortcuts
if they weren't properly cleaned-up (ex. after a crash).

Instead we delay the check for conflicts with other client shortcuts
to the second loop, which we know is up to date.

BUG: 442215
FIXED-IN: 5.22.80
2021-09-10 13:00:36 +02:00
Vlad Zahorodnii
46e2d51044 scripting: Make thumbnaills use linear filter
QSGImageNode ignores QSGTexture's filter, one has to specify it using
QSGImageNode::setFiltering().

In hindsight, we need to figure out how to integrate the lanczos filter
with window thumbnails and use it instead.

BUG: 441709
2021-09-10 09:16:24 +03:00
l10n daemon script
84426e8082 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-09-10 01:18:40 +00:00
Xaver Hugl
1b504818a3 platforms/drm: improve warning messages in DrmPipeline 2021-09-09 19:52:01 +00:00
Xaver Hugl
a0a98d0b31 platforms/drm: only delete outputs if not pre-existing
When there aren't enough CRTCs to drive all the outputs this could
delete existing outputs.
2021-09-09 19:52:01 +00:00
Xaver Hugl
b89f04943c platforms/drm: only test combinations if there are any
Otherwise we could hit an assert in DrmPipeline
2021-09-09 19:52:01 +00:00
Xaver Hugl
ffc4c12548 platforms/drm: commit pipelines directly instead of testing
The current behavior seems to cause some issues, and this is faster and
more efficient.
2021-09-09 19:52:01 +00:00
Vlad Zahorodnii
748004d81e x11: Avoid discarding the window pixmap for no reason
If the buffer size changes after creating or destroying the decoration,
the surface item will discard the pixmap.

If the buffer size remains the same, we can continue using old pixmap.
2021-09-09 16:55:39 +00:00
Aleix Pol
2ef53e7350 drm: Make hardware rotation opt-in
The current implementation sometimes will leave the screens unusable,
therefore KWIN_DRM_SW_ROTATIONS_ONLY=1 is default.
Use KWIN_DRM_SW_ROTATIONS_ONLY=0 to test hardware DRM operations.
2021-09-09 16:54:35 +00:00
Nate Graham
d11b4c8084 kcmkwin/kwindesktop: disable double-click mouse area while in edit mode
Otherwise the mouse area eats clicks and prevents text selection using
the mouse from working.

BUG: 441963
FIXED-IN: 5.23
2021-09-09 10:51:53 -06:00
Aleix Pol
d5be2232e8 Fix build 2021-09-09 17:10:48 +02:00
Alex Richardson
af3602b48c Fix out-of-bounds copy in xcb_send_event() calls
xcb_send_event always copies 32 bytes, so we have to pad all xcb_*_event_t
to 32 bytes to avoid leaking uninitialized stack memory. I found this
problem while running kwin_x11 on a CHERI-RISC-V system (which has bounded
pointers). The xcb_send_event() implementation has a memcpy() that was
copying 32 bytes but the event passed was a bounded to 28 bytes, so this
resulted in a run-time exception in X11Client::sendClientMessage().
The same problem exists in Selection::sendSelectionNotify(), but this time
we could end up copying up to 8 bytes since xcb_selection_notify_event_t
is only 24 bytes.

This disclosure of uninitialized data could in theory have a security
impact if it leaks a pointer value (e.g. a return address) as part of an
exploit chain that needs to bypass ASLR. However, the selection notify
events go directly to the XServer and you most likely already have a
serious problem if an attacker has full control over the XServer. It is
possible that the configure notify events go directly to an untrusted
client, but even if they do this leak is not directly exploitable.

See also https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/18
2021-09-09 15:03:44 +01:00
David Edmundson
65f168e144 Use a direct connection for X to wayland drags
We already use a direct DataSource object for transfer.

Use of the new public SeatInterface::startDrag allows us to start our drag directly.
2021-09-09 11:13:02 +00:00
David Edmundson
400dd31db6 Drop the internal connection for wayland to X drags
An AbstractDragTarget is introduced. This contains either the DataDevice we are
dragging to or an Xwl bridge.

We set this on Seat along with the active surface.

In future this also allows getting rid of the move filter.
2021-09-09 11:13:02 +00:00
David Edmundson
7f976199b7 Adapt to kwayland-server icon changes
The icon is a property of the active drag which is managed by Seat, the
DataDevice should not cache this.
2021-09-09 11:13:02 +00:00
Vlad Zahorodnii
0aaa57e18e Assign default name if new virtual desktop has no explicit name
If a virtual desktop has empty name, kwin is going to end up in an
infinite cycle where VirtualDesktopManager::save() updates the
_NET_DESKTOP_NAMES property and then in the next event loop cycle,
RootInfoFilter::filter() is going to call VirtualDesktopManager::save()
because the _NET_DESKTOP_NAMES property has been changed.

This regression has showed up just now because some parts of kwin used
to increase virtual desktop count to create new desktops. Recently, that
code was ported to VirtualDesktopManager::createVirtualDesktop().

The main difference between createVirtualDesktop() and setCount() is
that the latter will set the desktop name to "Desktop N", the former
will use user-specified name.

If the user-specified name is empty, the createVirtualDesktop() method
should assign "Desktop N" name to the virtual desktop according to the
docs. However, it's not the case and this change addresses that.
2021-09-09 10:50:16 +03:00
l10n daemon script
16f5ce9361 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-09-08 01:27:17 +00:00
Xaver Hugl
b38bb41698 Test DrmPipelines for outputs
Not all combinations of connectors, crtcs and planes will work
on all hardware, so we need to test the pipelines before using
them.

BUG: 433107
CCBUG: 435265
2021-09-08 02:44:29 +02:00
Xaver Hugl
18a8245ca2 platforms/drm: rename user data in DrmPipeline to output 2021-09-07 23:36:32 +02:00
Xaver Hugl
65b55e2045 platforms/drm: change when to reset the output with eglstreams
In order to accomodate crtc or primary plane changes on outputs we
need to dynamically recreate rendering resources with EglStreams as
the stream is tied to the crtc or plane currently in use.
2021-09-07 23:36:32 +02:00
Xaver Hugl
d057bd41c9 AbstractWaylandOutput: always emit mode change when mode is set
Otherwise there can be situations where the platform sets a mode but
KScreen never gets notified of it.
2021-09-07 21:34:01 +00:00
Xaver Hugl
f82d9f3d23 platforms/drm: remove duplicated warning
The same warning already gets printed in DrmPipeline
2021-09-07 21:34:01 +00:00
Xaver Hugl
e59f50e599 platforms/drm: adjust how transforms are set
Instead of using setTransformInternal directly, have DrmOutput
set it in updateTransform, like with the other setters. Also use
updateTransform instead of setTransformInternal in DrmBackend, so
that hardware rotation can be used where possible.
2021-09-07 21:34:01 +00:00
Xaver Hugl
1af2067f40 platforms/drm: reload m_conn in DrmConnector::updateProperties 2021-09-07 21:34:01 +00:00
Aleix Pol
6d35d63acb Fix build 2021-09-07 13:27:44 +02:00
Kai Uwe Broulik
1f53db1b44 [kcmkwin/kwindecoration] Port last remnants of removed "units"
ButtonGroup was still using it...
2021-09-07 07:41:42 +00:00
Kai Uwe Broulik
8bebf5cee1 Port to function-pointer based QMetaObject::invokeMethod
It's more efficient and compile-time checked
2021-09-07 06:30:39 +00:00
Xaver Hugl
ed2d0979c7 platforms/drm: fix warning 2021-09-07 05:45:51 +00:00
Xaver Hugl
237ef3d47f platforms/drm: fix drmModeSetCursor2 fallback
the return value is -errno, not errno.
2021-09-07 05:45:15 +00:00
l10n daemon script
d63b06d7a5 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-09-07 01:25:46 +00:00
Méven Car
74cb7a5b45 kcm compositing: Hide preview option in Wayland 2021-09-06 12:22:20 +00:00
Aleix Pol
be96741803 Test first desktop file names with the .desktop extension appended
It's the right thing to do, without it's only a fallback for bogus
applications.
2021-09-06 11:48:46 +00:00
Aleix Pol
73279acc63 Fix absolute desktop file names
Qt understands that the spec wants the id without .desktop postfix and
chops it, so we need to add it back if we want to infer the desktop
file.
https://code.qt.io/cgit/qt/qtwayland.git/tree/src/client/qwaylandwindow.cpp?h=5.15#n161

BUG: 425403
2021-09-06 11:48:46 +00:00
Vlad Zahorodnii
935fa6a9e1 Move ownership of Shadow to Toplevel
This decouples the management of Shadow from the scene window and allows
multiple items share the same Shadow.

Currently, kwin has a single scene graph, but it makes sense to create a
scene graph per output as they could have different layers, etc. This
would also allow QtQuick share more textures with kwin, which is worth
doing for optimization purposes in the future.
2021-09-06 10:42:39 +00:00
Vlad Zahorodnii
b40fb76c71 platforms/wayland: Prepend KWayland::Client:: to Surface 2021-09-06 10:42:03 +00:00
Vlad Zahorodnii
1d54231df1 scene: Generate unnormalized shadow texture coords
This makes shadow texture coordinates consistent with surface and
decoration texture coords and allows reusing window quads between
kwin items and qtquick items more easily.
2021-09-06 12:17:44 +03:00
l10n daemon script
9b06492499 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-09-06 01:26:11 +00:00
l10n daemon script
a78a9f3275 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-09-05 01:21:09 +00:00
Guilherme Marçal Silva
06d1d45f24 kcmkwin: Add new keywords to KCMs for finding options more easily 2021-09-04 17:19:32 +00:00
Ismael Asensio
436011e0ec X11Client: emit isCloseableChanged when updated
This allows the decoration buttons to be updated accordingly
when the status changes.

We also need to explicitely update allowed actions when rules
are applied, as `isCloseable` is not a settable property, but
an allowed action

BUG: 424370
FIXED-IN: 5.22.90
2021-09-04 15:51:38 +02:00
Ismael Asensio
bb0f749ee7 xdgshellclient: Fix "noBorder" rule on initialization
The check for this rule was missing on window initialization,
so on Wayland it wasn't being applied until something would
trigger the check again.

BUG: 429171
FIXED-IN: 5.22.90
2021-09-04 12:47:09 +02:00
Aleix Pol
5d73adf780 Fix crash on the debug console
Do not access fields in DataSourceModel::m_data that are not available

0  0x00007f3445a4bd22 in raise () at /usr/lib/libc.so.6
1  0x00007f3445a3590e in abort () at /usr/lib/libc.so.6
2  0x00007f3446362bb1 in qt_message_fatal (message=<synthetic pointer>..., context=...) at /home/apol/devel/frameworks/qt5/qtbase/src/corelib/global/qlogging.cpp:1914
3  QMessageLogger::fatal(char const*, ...) const (this=this@entry=0x7fff288a4ff8, msg=msg@entry=0x7f3446663028 "ASSERT failure in %s: \"%s\", file %s, line %d") at /home/apol/devel/frameworks/qt5/qtbase/src/corelib/global/qlogging.cpp:893
4  0x00007f344636203e in qt_assert_x(char const*, char const*, char const*, int) (where=<optimized out>, what=<optimized out>, file=<optimized out>, line=<optimized out>) at /home/apol/devel/frameworks/qt5/qtbase/src/corelib/global/qglobal.cpp:3366
5  0x00007f344973e118 in QVector<QByteArray>::at(int) const (this=0x55f42c20d338, i=7) at /home/apol/devel/kde5/include/QtCore/qvector.h:449
6  0x00007f34497305df in KWin::DataSourceModel::data(QModelIndex const&, int) const (this=0x55f42c20d320, index=..., role=6) at /home/apol/devel/frameworks/kwin/src/debug_console.cpp:1657
7  0x00007f3447674ed1 in QModelIndex::data(int) const (arole=6, this=0x7fff288a55c0) at ../../include/QtCore/../../../../../devel/frameworks/qt5/qtbase/src/corelib/itemmodels/qabstractitemmodel.h:460
2021-09-03 18:06:50 +00:00
Columbariu s
2fbeb0abc1 screencast/pipewire: Add TODO marks for extending modifier capabilities
no_use_linear: dropping the gbm GBM_BO_USE_LINEAR flag on allocation
explicit_modifiers: moving from the modifier-less api to the modifier
aware one with explicit modifiers
2021-09-03 17:49:37 +00:00
Columbariu s
150ebf0cf7 screencast/pipewire: announce format with modifier 2021-09-03 17:49:37 +00:00
Columbariu s
8a2475da63 screencast/pipewire: Add buildFormat method 2021-09-03 17:49:37 +00:00
Columbariu s
b05900e242 screencast/pipewire: Check for a modifier in the format negotiation via pipewire 2021-09-03 17:49:37 +00:00
David Edmundson
78439fd3e7 Avoid test commit whilst constructing DrmOutput
Otherwise we'll try to render a frame on an output before making the
output, which segfaults.
2021-09-03 16:43:48 +00:00
Xaver Hugl
c48ac020cd platforms/drm: correct cursor dirty handling 2021-09-03 18:26:23 +02:00
Vlad Zahorodnii
8891cdb74f effects/overview: Remove "wip" from description
Removing (WIP) will result in more work for translators. There are other
ways to indicate the effect is not ready for its prime time yet, e.g.
being disabled by default.
2021-09-03 13:00:05 +03:00
David Redondo
1c074d81e2 Add clipboard tab to debug console
Can be useful when investigating clipboard related problems, by checking
which source KWin thinks is the current clipboard. Displays clipboard and
primary selection.
2021-09-03 08:40:07 +00:00
Vlad Zahorodnii
c0bec3e27b effects/overview: Add missing desktop filters 2021-09-03 09:40:39 +03:00
Vlad Zahorodnii
43a50be325 effects/overview: Display window icon and caption
BUG: 441312
2021-09-03 06:38:54 +00:00
Vlad Zahorodnii
79a7cf1aec effects/overview: Allow setting ExpoCell margins 2021-09-03 06:38:54 +00:00
Ismael Asensio
9995f984c3 kwinrules: Use a list of desktop UUIDs to set and store the rules setting
Port the RuleSettings and KCM to store and use a list of virtual desktop
 UUIDs, instead of the previous x11 positional id, continuing the work on
This allows to set a rule with several desktops on Wayland.

On X11 it has no visible change for the user, but internally it uses the
more modern concept, helping to simplify the related code.

The relevant key on kwinrulesrc changes from `desktop` to `desktops`.
A kconf_update script handles the migration.
2021-09-02 22:11:46 +02:00
Xaver Hugl
5da8df39a5 AbstractWaylandOutput: make updateMode use uint32_t 2021-09-02 14:34:07 +02:00
Xaver Hugl
26ad8e194f platforms/drm: support Broadcast_RGB setting
This allows the user to switch between full and limited rgb.

BUG: 375666
BUG: 353689
2021-09-02 13:53:02 +02:00
Xaver Hugl
f096629f89 platforms/drm: refactor drm property enums 2021-09-02 13:48:58 +02:00
Vlad Zahorodnii
dc39745f14 effects/overview: Remove duplicate Qt.Key_Escape 2021-09-02 09:32:59 +00:00
Vlad Zahorodnii
717fae2af5 effects/overview: Improve search user experience
If the window has only one visible window and user presses Enter key,
activate that window.
2021-09-02 09:32:59 +00:00
Vlad Zahorodnii
9bd0eb1074 effects/overview: Add search field
The present windows allows the user to search windows by their caption
or window role. This change brings that functionality to this effect.

BUG: 441302
2021-09-02 09:32:59 +00:00
David Redondo
c562a5c04f DragWlToX: Do not send position before enter
According to the spec, enter has to be send before position.
Sending position first seems to confuse clients, before this
change X windows only seemed to get data when the pointer left and
entered them for a second time. Now it works straight away.
BUG:437406
2021-09-02 11:17:53 +02:00
Janet Blackquill
0042d2d8c1 effects/desktopgrid: port to realtime gestures
This ports the Desktop Grid effect to realtime gestures,
both to have the end-user result, and to demonstrate how
effects can have realtime gestures.
2021-09-01 19:49:21 -04:00
Janet Blackquill
6231699ac1 Lay some groundwork for realtime gestures in Wayland
This lays down some groundwork for realtime gestures in Wayland,
so that gestures that are 1:1 with user motion on a touchpad are
now possible to implement.

Due to earlier commits, this is mostly just glue code to make a
convenient API.

Gestures implemented with this API are four-finger gestures, to
avoid conflicting with apps that may use two or three-finger
gestures.
2021-09-01 19:48:41 -04:00
Tatsuyuki Ishi
81389a6e17 blur: pass projection matrix by const reference
Passing QMatrix4x4 by value can result in copying a non-trivial amount (16)
of floats, so avoid that.
2021-09-01 21:42:56 +00:00
Tatsuyuki Ishi
c193efc962 blur: add noise in perceptual space
The previous implementation added noise in linear space, which resulted in
the effect becoming more pronounced on black backgrounds. This patch
changes the process to be applied in perceptual space, by making the noise
addition pass a separate draw call and disabling GL_FRAMEBUFFER_SRGB during
that.

After this change, noise will look much more suppressed and almost never
grainy. This change also changes the range of the noise from
[-strength..strength) to [0..strength), as blending can only be either
additive or subtractive. As a result, users might need to ramp up their
noise parameter after this change.

v2: Add more explanation around the draw call.
v3: Fix noise not fading out with the fade out effect.
v4: Restore an accidentally removed comment.
v5: Add CCBUG.
v6: Rebase.
v7: Fix a formatting issue.

CCBUG: 409620
2021-09-01 21:42:56 +00:00
Méven Car
0a2c511489 Wayland: Add support for protocol kde-output-device_v2, allow to detect drm mode changes
CCBUG: 407058
2021-09-01 13:37:43 +00:00
Vlad Zahorodnii
03b64331f2 wayland: Remove special input method case in XdgToplevelClient
Input method surfaces have input_panel_surface role, so the special case
for input method windows can be dropped.
2021-09-01 10:26:16 +00:00
Vlad Zahorodnii
99e208e30f wayland: Always setup window management for xdg-shell clients
kscreenlocker uses the layer-shell protocol, so the special lock screen
case can be removed.
2021-09-01 10:26:16 +00:00
Vlad Zahorodnii
1717de8a59 Port XdgToplevelClient::updateShowOnScreenEdge() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
cdd3f96fe1 Port X11Client::fullscreenMonitorsArea() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
26e470b7ff Port screenContainsPos() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
25a6515e05 Port AbstractClient::checkQuickTilingMaximizationZones() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
8b85fdcedf wayland: Setup window management integration on initial commit
Originally, there was ShellClient class that was the predecessor to
WaylandClient subclasses. If the main surface is unmapped, the
corresponding instance of ShellClient would be kept around. That had
been changed with the introduction of XdgToplevelClient and
XdgPopupClient.

Since ShellClient had been kept alive even if the corresponding surface
were unmapped, it did make sense to setup window management integration
when the surface is mapped.

However, this also means that plasma will not know about initially
minimized windows.

Since unmapped windows are handled differently now, we can setup window
management after the client performs the initial commit. If the main
surface is unmapped, the XdgToplevelClient object will be destroyed and
with it, the window management integration.
2021-08-31 23:42:07 +00:00
Carson Black
63b16cdf9d Increased edge margins 2021-09-01 01:33:51 +02:00
Aleix Pol
0b74aa62c9 Support PlasmaWindowInterface::sendToOutput 2021-08-31 21:25:18 +00:00
Xaver Hugl
a3cbaf48dc platforms/drm: fix modifier env variable
Like the name suggests, modifiers were meant to be enabled by default
2021-08-31 16:30:03 +00:00
Vlad Zahorodnii
d70cfadf96 platforms/drm: Fix outputDisabled signal
The outputDisabled() signal must be emitted **after** removing the
output from a list of enabled outputs.
2021-08-31 16:02:19 +00:00
Vlad Zahorodnii
b0c26cc424 effects/overview: Layout window thumbnails in updatePolish()
Currently, ExpoLayout delays layout updates by using a singleshot timer
(primarily due to the author of the effect not being aware of
QQuickItem::polish() and QQuickItem::updatePolish()).

This change makes ExpoLayout schedule layout updates using QtQuick's
native item polish machinery, which gets triggered before rendering and
thus we can batch more geometry updates.

In addition to that, this change simplifies the initialization code in
ScreenView by making the fact that ExpoLayout is arranged right before
rendering internal to the WindowHeap type.
2021-08-31 12:51:29 +00:00