Commit graph

3216 commits

Author SHA1 Message Date
Arjen Hiemstra
03a3ae666c Use the minimum of workspace area size and panel size for input method placement
Rather than assuming the input panel to always be less than or equal to
the maximized area, ensure it is. This ensures that the input panel gets
placed correctly when there maximized area is smaller, like when there's
a panel on the side.

Additionally, don't skip the entire positioning code when "m_output" is
empty, to avoid the placement not happening when Kickoff is open.
2022-02-17 14:50:24 +00:00
David Edmundson
aab395f07b Check lockscreen status for fullscreen effects
Whilst global shortcuts are blocked by grabbing the keyboard, user set
up manual scripts can still invoke a global action.

Given we already have code to deactivate when locking it makes sense to
also prevent activation.

BUG: 450331
2022-02-17 13:01:57 +00:00
Vlad Zahorodnii
1b4f3960fd effects/contrast: Use QGuiApplication::instance() instead of qApp
qApp is defined differently depending on whether QCoreApplication,
QGuiApplication, or QApplication is included.

Use QGuiApplication::instance() to improve code readability.

CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
9cca0a6f85 effects/blur: Use QGuiApplication::instance() instead of qApp
qApp is defined differently depending on whether QCoreApplication,
QGuiApplication, or QApplication is included.

Use QGuiApplication::instance() to improve code readability.

CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
4acae79d54 effects/startupfeedback: Add Qt::Widgets dependency
BUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
2ff9093604 effects/desktopgrid: Port to QStyleHints
Let's us avoid making the desktop grid effect depend on qtwidgets.

CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
d6b3b57ba1 effects/zoom: Remove QApplication include
CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
81d6631733 effects/presentwindows: Remove QApplication include
CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
7ba68fde8c effects/slidingpopups: Avoid using QApplication
CCBUG: 450359
2022-02-17 07:22:25 +00:00
l10n daemon script
9d33190d0d 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"
2022-02-17 01:53:20 +00:00
Kai Uwe Broulik
53473d72e6 kwinglutils: Assert glFenceSync
This really should not fail unless we did something seriously wrong
on our end, such as changing GL context during paintScreen.

If we add an invalid `GLSync` to the queue it can lead to very hard
to debug crashes in seemingly unrelated parts of the rendering
process, when the queue is drained, potentially seconds after the
actual failure that occurred here.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-16 19:06:15 +00:00
Kai Uwe Broulik
2d56154fe8 kwineffects: Support setting opacity on OffscreenQuickView
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-16 17:29:06 +00:00
Vlad Zahorodnii
c2e3496888 effects/contrast: Remove paint area tracking
Unlike the blur effect, neighbor pixels don't affect the results of the
contrast effect so it doesn't have to extend the painted area.
2022-02-16 16:22:02 +00:00
Vlad Zahorodnii
d06746fa5c scene: Set render target rect in Scene::paintScreen()
This ensures that the render target rect is set when using qpainter
render backend.
2022-02-16 16:04:29 +00:00
Vlad Zahorodnii
2091cb060f effects/highlightwindow: Fix crash
If a window appears on the screen, the highlight window effect will try
to fast-forward animation to the target state by setting the animation
duration to 0. However, TimeLine doesn't like that because it will
eventually lead to division by zero.

This change makes the highlight window effect fast-forward the
transition to highlight or ghost state by using the complete() function.

BUG: 450323
2022-02-16 15:42:55 +00:00
Vlad Zahorodnii
f59a4d6090 Remove dead code in Platform
Software cursor logic has been moved to Scene.
2022-02-16 13:28:33 +00:00
Kai Uwe Broulik
6ab7119d89 Introduce SharedQmlEngine class
Allows to drop the direct dependency on KDeclarative only used
for `QmlObjectSharedEngine` outside of `KCModuleQML`

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-16 12:05:38 +00:00
Vlad Zahorodnii
0c3a8e6f29 scene: Make paintScreen() clip the damage region
paintScreen() already tries to ensure that the damage region doesn't go
outside the scene geometry. With this change, it will try to clip the
damage region to the render target rect, which saves us an extra region
intersection and simplifies code that calls paintScreen().
2022-02-16 07:49:47 +00:00
l10n daemon script
648b2a5bf3 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"
2022-02-16 01:49:32 +00:00
Vlad Zahorodnii
a3b5266175 Drop Platform::renderLoop()
Having a render loop in the Platform has always been awkward. Another
way to interpret the platform not supporting per screen rendering would
be that all outputs share the same render loop.

On X11, Scene::painted_screen is going to correspond to the primary
screen, we should not rely on this assumption though!
2022-02-15 18:23:52 +02:00
Vlad Zahorodnii
ba000d5a4e scene: Compute projection matrix based on the render target rect
Neither SceneQPainter nor SceneOpenGL have to compute the projection
matrix by themselves. It can be done by the Scene when setting the
projection matrix. The main benefit behind this change is that it
reduces the amount of custom setup code around paintScreen(), which
makes us one step closer to getting rid of graphics-specific paint()
function and just calling paintScreen().
2022-02-15 14:31:28 +00:00
David Redondo
5caa28c1a3 xwayland: Guard against offers arriving after leaving surface
If the XdndEnter message is handled after leaving the current
wayland surface m_visit will be null.
BUG:449644
2022-02-15 12:28:17 +00:00
Vlad Zahorodnii
7a06ae733c kwinglutils: Drop GLRenderTarget::isRenderTargetBound()
Check whether GLRenderTarget::currentRenderTarget() returns non-null
value instead.
2022-02-15 13:31:10 +02:00
Vlad Zahorodnii
f4f83848b0 kwinglutils: Make GLRenderTarget not store GLTexture reference
This allows us to make the GLRenderTarget a bit nicer when using it to
wrap the default fbo as we don't know what the color attachment texture
is besides its size.

This means that the responsibility of ensuring that the color attachment
outlives the fbo is now up to the caller. However, most of kwin code
has been written that way, so it's not an issue.
2022-02-15 13:30:39 +02:00
Vlad Zahorodnii
dcd1e3b87a kwinglutils: Drop GLRenderTarget::setTextureDirty()
It's effectively unused and removing it allows us to get rid of
GLTexture field, which is very useful for abstracting the concept of a
"render target" across OpenGL and QPainter backends.
2022-02-15 13:02:57 +02:00
Vlad Zahorodnii
436187762e kwinglutils: Deprecate GLTexture dirty state tracking
It's currently being used only by the X11 standalone backend. We should
either port the X11 backend to manual dirty state tracking or waiting
until it gets dropped. The main motivation for getting rid of the dirty
state tracking in the GLTexture is that it keeps kwin open for
alternative opengl wrappers, e.g. QOpenGL, and it simplifies GLTexture
code.
2022-02-15 12:58:43 +02:00
Vlad Zahorodnii
e9af67af3e kwineffects: Add GLTexture::render() overload that takes no scissor region
In many cases, we don't care about the scissor region. This change adds
a relevant overload to make code easier to read.
2022-02-15 12:17:59 +02:00
Vlad Zahorodnii
52beb213e7 kwineffects: Make GLRenderTarget and GLVertexBuffer work without global coords and scale
Because the GLRenderTarget and the GLVertexBuffer use the global
coordinate system, they are not ergonomic in render layers.

Assigning the device pixel ratio to GLRenderTarget and GLVertexBuffer is
an interesting api design choice too. Scaling is a window system
abstraction, which is absent in OpenGL or Vulkan. For example, it's not
possible to create an OpenGL texture with a scale factor of 2. It only
works with device pixels.

This change makes the GLRenderTarget and the GLVertexBuffer more
ergonomic for usages other than rendering the workspace by removing all
the global coordinate system and scaling stuff. That's the
responsibility of the users of those two classes.
2022-02-15 12:17:56 +02:00
Vlad Zahorodnii
d92afc849e kwineffects: Forbid most of operations with invalid render targets
This simplifies a lot of things.
2022-02-15 12:06:50 +02:00
Vlad Zahorodnii
383a5cee0b kwineffects: Remove GLRenderTarget::{attachTexture,detachTexture}
They're unused and immutable render targets are easier to handle.
2022-02-15 12:06:50 +02:00
Vlad Zahorodnii
eea94660dc utils: Extract DamageJournal in its own file 2022-02-15 11:38:51 +02:00
Xaver Hugl
dece547a75 backends/drm: refactor surface handling
In order to support layered rendering and tiled outputs KWin needs to be
able to split rendering of outputs into multiple surfaces. This commit
prepares the drm backend for that, by moving most of the code in EglGbmBackend
out to a EglGbmSurface class, which will later be used for overlay surfaces
and rendering to multiple connectors side by side.

In doing that, this commit also cleans up the code a bit, removes a lot of
now unnecessary multi-gpu stuff and potentially makes modesets a little
bit more efficient by re-using resources more often.
2022-02-15 09:12:23 +00:00
Xaver Hugl
9dc4c7309e backends/drm: move damage tracking into DumbSwapchain 2022-02-15 09:12:23 +00:00
Xaver Hugl
5d317641a4 backends/drm: move damage tracking into GbmSurface 2022-02-15 09:12:23 +00:00
Xaver Hugl
cfdb303012 backends/drm: inline renderFramebufferToSurface
And also remove an unnecessary makeContextCurrent
2022-02-15 09:12:23 +00:00
Xaver Hugl
c498d31aa7 backends/drm: move makeContextCurrent into GbmSurface 2022-02-15 09:12:23 +00:00
Xaver Hugl
4d0998cfed backends/drm: fix legacy dpms 2022-02-15 08:17:17 +00:00
Vlad Zahorodnii
76dbe9e590 effects/desktopgrid: Remove unused include 2022-02-15 07:21:28 +00:00
Vlad Zahorodnii
e1024d38d1 cmake: Specify link libraries per effect target
This allows to track per effect dependencies more precisely. The main
problem with a library and a comment next to it saying who needs it is
that the comment can get easily outdated.
2022-02-15 07:21:28 +00:00
John Zimmermann
9c65d61b98 utils/serviceutils: compare executablePath against canonical path of exec fields in .desktops
/proc/%/exec always points to the canonical/real path of a binary,
the exec field of a .desktop might contain a symlink and therefore
differ from canonical path.
Explicitely canonicalizing the path in exec prevents this mismatch.
2022-02-14 15:50:24 +01:00
Vlad Zahorodnii
8e05732670 x11: Fix shrinking window size after toggling no border multiple times
The first move() in X11Client::createDecoration() will alter the client
size, which will result in the subsequent resize() incorrectly resizing
to a smaller window size.

In order to fix that issue, this change makes X11Client adjust the
frame geometry atomically after creating or destroying window decoration.

BUG: 449988
2022-02-14 14:00:14 +00:00
Vlad Zahorodnii
c76855520c wayland: Fix maximize mode propagation to decoration
If the window is initially maximized, there won't be any current
decoration when XdgToplevelClient changes the maximize mode, we need to
use m_nextDecoration.

BUG: 450053
2022-02-14 13:41:39 +00:00
Albert Astals Cid
5ddd43958d HighlightWindowEffect: Use the duration parameter 2022-02-14 13:51:02 +01:00
Kai Uwe Broulik
4c0c2cebe6 effects/overview: Add translation domain 2022-02-14 11:36:51 +00:00
Kai Uwe Broulik
2fbc821899 effects: Extract messages from QML files 2022-02-14 11:36:51 +00:00
Vlad Zahorodnii
6182744a2b Add support for xdg_toplevel.configure_bounds()
With the xdg_toplevel.configure_bounds event, the compositor will be
able to indicate the client the maximum desired surface size.

It can be used to prevent mapping too big application windows, etc.
2022-02-14 10:42:32 +00:00
Kai Uwe Broulik
88e36d0b04 Fix build without Qt session manager
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-14 07:58:47 +00:00
Kai Uwe Broulik
7beb3f6ec6 Fix build without tabbox
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-14 07:58:47 +00:00
Vlad Zahorodnii
3da9e017a0 cmake: Use target-based ecm_qt_declare_logging_category()
This makes CMakeLists.txt code depend less on variables.
2022-02-14 07:29:15 +00:00
l10n daemon script
ead073b0cc 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"
2022-02-14 01:42:49 +00:00
Aleix Pol
ad0a35882e inputmethod: Also open the inputm method panel with a pen
BUG: 449888
2022-02-14 00:24:30 +00:00
Nicolas Fella
a2ebad760f Implement services in our QPA
This is required for QDesktopServices to work.

Use QGenericUnixServices like the xcb and wayland QPA

BUG: 446144
2022-02-13 00:41:10 +01:00
Nicolas Fella
77ec43d5e1 Don't force QT_QPA_PLATFORM=wayland
We're setting this env variable because earlier we used it to force kwin to use its special QPA so we need to change that back to something sensible.

However setting it to Wayland breaks apps that ship their own Qt with missing or broken Wayland support.

Set it to be empty instead. Well-behaved Qt apps will use Wayland regardless because of XDG_SESSION_TYPE.

BUG: 450000
2022-02-12 13:57:19 +00:00
Vlad Zahorodnii
9e25fd0468 Add support for xdg_toplevel.configure_bounds()
xdg_toplevel.configure_bounds() allows to indicate the client the
maximum surface size bounds.

wayland-protocols: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/41
2022-02-12 14:14:24 +02:00
Vlad Zahorodnii
a4bb3896bf Schedule workspace repaint when window leaves current desktop
When a window leaves the current virtual desktop, we need to schedule a
workspace repaint so the compositor repaints the old region of the
window on the current desktop.

In hindsight, the scene graph must schedule a repaint, but it's not
doable with the current effects api, it will be changed with future
refactoring changes.

BUG: 444172
2022-02-12 12:06:00 +00:00
l10n daemon script
d7ee3f1221 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"
2022-02-12 01:43:02 +00:00
Aleix Pol
c9715a828d Initialize the KSldApp after we connect
In some cases, initialize() will emit an aboutToLock() signal that we
need to catch. Otherwise LockOnStart finds its m_waylandFd=-1
2022-02-11 16:35:17 +00:00
Alexander Lohnau
e70ec569e3 Fix loading of effect if plugin defined X-KDE-Library
Otherwise we get the filename to the library and not the KPackage.

The plugin having this set is most likely a leftover, because KPackage plugins
to not need to define a library.

BUG: 449881
2022-02-11 15:40:42 +00:00
Vlad Zahorodnii
712dbc4122 wayland: Fix mispositioned decoration tooltips
QPlatformScreen::virtualSiblings() must return a list of screens on the
virtual desktop, otherwise QToolTip will use
QGuiApplication::primaryScreen() instead of looking up the screen where
the decoration tooltip must be shown using QDesktopWidget::screenNumber().

BUG: 432860
2022-02-11 10:08:19 +00:00
David Edmundson
12427932de Make openGL context current when recording frame triggered by cursor move
recordFrame requires an openGL context. This is typically done after a
frame is rendered, but when we send a frame after a cursor move this is
not guaranteed.

BUG: 448162
2022-02-11 09:24:12 +00:00
Jan Blackquill
c0cb349cb8 effects/DesktopGrid: use delta, not absolute time for MotionManager
Despite the argument naming, the input for WindowMotionManager::calculate is supposed to be a
delta, not an absolute time. Giving it a delta fixes the PresentWindows in the DesktopGrid.

BUG: 443971
2022-02-11 09:04:30 +00:00
Julius Zint
43bcd57853 Fix window decoration quads in OpenGL scene
The quads for the left and right window decorations were broken in
3b4d55837. The problem is only visible for window decorations with more
than one color.
2022-02-11 08:15:37 +00:00
l10n daemon script
97dde989c3 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"
2022-02-11 01:45:31 +00:00
Aleix Pol
725d61877c screencast: have our streams provide SPA_META_Header
It can be useful for clients to know what's going on in a specific
stream.
2022-02-10 23:57:09 +00:00
Vlad Zahorodnii
0574a7534a wayland: Make the launcher not restart kwin_wayland if it crashes at shutdown
Currently, if kwin_wayland crashes at shutdown, the launcher can
potentially spawn it again. This change addresses that issue by making
the wrapper ignore the QProcess::finished() signal.
2022-02-10 12:29:54 +00:00
Tobias C. Berner
feffa184fb Add missing errno.h include 2022-02-10 10:14:02 +01:00
Vlad Zahorodnii
c54937b2ad Avoid mixing current and next state
Mixing of current and next state can create all sorts of undefined
behavior, e.g. windows not moving to the desired location or
experiencing issues when tiling a maximized window.

BUG: 449541
2022-02-10 08:43:17 +00:00
Vlad Zahorodnii
3fb6901646 effects/overview: Hide selection rect during dnd
BUG: 448573
2022-02-10 08:15:00 +00:00
Tobias C. Berner
17fc13f100 Add missing errno.h include 2022-02-10 09:11:31 +01:00
Vlad Zahorodnii
ed670377c8 effects/overview: Don't show minimized windows in desktop thumbnails
BUG: 448850
2022-02-10 07:23:30 +00:00
Vlad Zahorodnii
0ad239a92d Fix mouse pointer disappearing after using zoom effect on X11
Currently, the Cursors::currentCursorChanged signal is wired to the
updateCursor() function which calls xcb_xfixes_hide_cursor() or
xcb_xfixes_show_cursor() depending if the cursor is hidden. However, the
currentCursorChanged signal can be emitted if the cursor changed, e.g. a
new pixmap attached, or its visibility status changes.

The zoom effect hides the pointer, but when user hovers ui elements, it
will most likely change and result in more than one xcb_xfixes_hide_cursor()
calls.

It appears like xcb_xfixes_hide_cursor() is implemented as a reference
counter, i.e. if xcb_xfixes_hide_cursor() is called two times, then you
must call xcb_xfixes_show_cursor() two times as well.

This change adds a dedicated signal to indicate whether the cursor is
hidden to avoid calling xcb_xfixes_hide_cursor() multiple times while
the screen is scaled.

BUG: 448537
2022-02-10 07:07:03 +00:00
Michail Vourlakos
bc145b614c support kdecoration2 blurregion
--use kdecoration2 blurred regions to adjust blur effect appropriately when
needed

CCBUG:395725

Requires: https://invent.kde.org/plasma/kdecoration/-/merge_requests/17
2022-02-09 21:00:07 +00:00
Vlad Zahorodnii
c0d0fab049 x11: Prefer kwinApp()->x11RootWindow() over rootWindow() 2022-02-09 19:10:58 +00:00
Vlad Zahorodnii
ec7198ee33 x11: Prefer kwinApp()->x11Connection() over connection()
With connection(), we will look up the x11 connection property on
kwinApp() object, which is less efficient than just calling a method on
the app object.
2022-02-09 19:10:58 +00:00
Vlad Zahorodnii
b62630c8ac Allow applying output changes to disabled outputs in base Platform::applyOutputChanges()
Since the base Platform::applyOutputChanges() implementation only
applies changes to enabled outputs, it's not possible to re-enable a
previously disabled output.
2022-02-09 15:47:35 +00:00
Vlad Zahorodnii
e419faee39 effects/fallapart: Avoid animating windows while there's a fullscreen effect
While there's a fullscreen effect, the fall apart effect should avoid
animating windows as it can corrupt or interfere with the active full
screen effect. This matches behavior of many other animation effects in
kwin.

BUG: 449844
2022-02-09 15:09:58 +02:00
Vlad Zahorodnii
20399e0c42 effects/scale: Make it not grab open and close roles
Otherwise the fall apart effect will refuse to work; the fade effect
already works like that.

BUG: 449832
2022-02-09 11:49:00 +02:00
Xaver Hugl
d0c12ac54d backends/drm: ignore modifier env var if modifiers are not supported
Otherwise we might crash
2022-02-08 20:09:08 +01:00
Vlad Zahorodnii
11175cb05e kcm/screenedge: Fix default value for TabBox.BorderActivate option
The TabBox does not reserve the left screen edge by default.

BUG: 449720
2022-02-08 08:09:25 +00:00
l10n daemon script
1386c4325c 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"
2022-02-08 01:45:25 +00:00
Vlad Zahorodnii
bb935aa5de Fix decoration rendering with scale factor < 1
QPainter won't let paint with a device pixel ratio less than 1. There
are used to be workarounds to force a device pixel ratio of 1, but they
were removed with fractional scaling corner fix.

This change makes sure that the decoration renderer forces a device
pixel ratio of 1 if the output's scale factor is less than 1 so
calculated texture coordinates match where window borders are rendered
in the texture atlas.

BUG: 449681
2022-02-07 11:45:31 +00:00
Ben Cooksley
a428630ea4 Purge all references to download.kde.org, replacing them with the correct endpoint of autoconfig.kde.org.
CCMAIL: plasma-devel@kde.org
CCMAIL: distributions@kde.org
2022-02-07 06:12:40 +13:00
Xaver Hugl
569a994644 backends/drm: don't log addFB failure for direct scanout
It can spam the log and isn't really useful

BUG: 449556
FIXED-IN: 5.24
2022-02-06 00:10:14 +00:00
Vlad Zahorodnii
6a0430eaa0 Fix builtin effects not loading
The api of kcoreaddons_target_static_plugins() has changed so static
plugins must be linked with kwin_x11 and kwin_wayland directly.
2022-02-06 01:29:41 +02:00
Xaver Hugl
e8eb55ad2e backends/drm: port away from mode indices
They're error prone and don't really work for changing modes. Having
a current mode in DrmConnector also doesn't work well together with
the transactional style of how DrmPipeline operates
2022-02-05 14:16:18 +00:00
Vlad Zahorodnii
03efdabf26 Unset electric border after interactive move
AbstractClient::setQuickTileMode() no longer updates electric border
mode, which can leave AbstractClient::electricBorderMode() with an old
value at the next interactive move and potentially result in quick
tiling not work if the user decides to untile and then tile the window
again while still holding left button.
2022-02-03 21:51:01 +02:00
Vlad Zahorodnii
185395caab wayland: Simplify xdg-shell's maximize mode implementation
XdgToplevelClient::changeMaximize() will unset quick tile mode after
maximizing the window.
2022-02-03 18:38:25 +00:00
Vlad Zahorodnii
6e26494b4e Compute tile geometry without relying on electric border mode
Quick tiling allows you tile a window so it covers one half or a quarter
of the screen. Electric border is basically interactive flavor of quick
tiling, i.e. it allows you to drag a window to the top screen edge to
maximize it.

Currently, it's confusing that tile geometry is computed based on the
electric border mode.

This change converts electricBorderMaximizeGeometry() in a helper that's
used to compute the tile geometry given the desired mode and output
containing the specified QPoint. With that, setQuickTileMode() won't
need to set electric border anymore, which makes tiling code more
comprehensible, but by not a lot unfortunately.
2022-02-03 18:58:47 +02:00
Vlad Zahorodnii
5cfa4bae77 wayland: Simplify xdg-shell's fullscreen mode implementation
XdgToplevelClient::setFullScreen() won't change the geometry
immediately, so workspace()->updateFocusMousePosition() can be removed.

Also, input handling code takes care of updating the cached mouse
position in the workspace.
2022-02-03 16:23:34 +00:00
Vlad Zahorodnii
77f712d3a7 Fix tracking of geometry restore with electric maximize
If the user wants to move a tiled window, but changes their mind and
tiles the window back to the previous position, the geometryRestore()
will be corrupted because initialMoveResizeGeometry() is the same as the
geometry of the window in the tiled mode.

This change fixes tracking of the geometry restore by precomputing the
geometry restore when starting interactive move. That way, if the window
is untiled and tiled again without release left pointer button, the
geometry restore will be set to the correct value in setQuickTileMode().

This change also adjusts the test suite so such a subtle case won't be
broken again without noticing it.
2022-02-03 16:01:45 +00:00
David Redondo
b1d0928c8e xwayland: Handle drag being cancelled
There was no handling for the drop being cancelled at all, leading to
leaked WlVisit and XtoWlDrag objects. X clients could also be confused
about the state of the drag and for example not being able to start another
drag.
BUG:449362
2022-02-03 14:01:14 +00:00
Xaver Hugl
843cee3d66 Scene: set painted_screen in paintScreen
If it's not set but used by EffectsScreen that can cause crashes
2022-02-03 05:12:24 +01:00
Ismael Asensio
3f29ad6b22 effects/overview: Prevent undesired dragging of desktops bar
Flickable by default allows swiping via click-and-drag or
scrolling with the mousewheel, which is weird when the content
is smaller than the available space.

Inhibit this behavior unless there's a need for scrolling.
2022-02-02 21:22:16 +01:00
Vlad Zahorodnii
4b97bc481e effects/presentwindows: Fix crash
The present windows effect can crash because a null (0) EffectScreen can
be passed to EffectsHandler::clientArea(), which is a bug.

Use EffectsHandler::virtualScreenGeometry() to get the bounding geometry
of all outputs.

BUG: 449508
2022-02-02 19:00:50 +02:00
Vlad Zahorodnii
749cf798ce wayland: Fix spectacle not covering fullscreen windows
The most recently activated window can be an overlay window that covers
all screens. If its center is not at an output with the fullscreen
window, then the fullscreen window's stack position won't be lowered. In
order to fix that, this change makes isActiveFullscreen() use
Toplevel::isOnOutput(), which uses geometry info, to check if both windows
are on the same output.
2022-02-01 19:18:13 +00:00
Severin von Wnuck
5fe9fd13ad Add timestamp to window decoration mouse events
Since 4881dd63 replaced the double click timer for OffscreenQuickView
with a time check, we need to make sure the timestamp from
XInput/libinput is passed on to the actual QMouseEvent.

BUG: 448477
2022-01-31 17:54:28 +00:00
Xaver Hugl
e6fb6ff5d3 backends/x11/standalone: only use sRGB configurations with depth 24
Credit goes to Mario Kleiner, who bisected this issue.

BUG: 423014
2022-01-31 16:23:16 +00:00
Vlad Zahorodnii
fde0e243d9 wayland: Let user set "no border" property in more cases
It can also be applied to client-side decorations. As long as the
compositor can ask the client to use some specific decoration mode, the
"no border" property can be set.
2022-01-31 15:55:25 +00:00
l10n daemon script
f1974db5c9 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"
2022-01-31 01:43:23 +00:00
Vlad Zahorodnii
aebe1ab3a4 backends/drm: Detect more connector types 2022-01-28 14:41:16 +00:00
Xaver Hugl
bbc5952f19 backends/drm: don't assume we shouldn't use modifiers without IN_FORMATS
Instead, use a linear modifier
2022-01-27 20:46:30 +00:00
Xaver Hugl
216d0d6c45 backends/drm: only accept xrgb with legacy
xrgb is effectively universally supported, other formats may not be.
In order to make sure things work everywhere, assume only xrgb is supported.
2022-01-27 20:46:30 +00:00
Xaver Hugl
83275c3f31 backends/drm: add warning if no matching mode can be found 2022-01-27 18:40:00 +00:00
Xaver Hugl
74b1fb0ab5 backends/drm: round refresh rate values from KScreen configs
The implicit cast effectively rounds the value down, which make the
refresh rate be different from what KScreen actually wrote.
A better fix would be to use integers instead of floating point numbers
but that needs to happen in KScreen.

BUG: 448778
2022-01-27 18:40:00 +00:00
Xaver Hugl
b0173c236c backends/drm: don't read configuration of zero outputs
Doesn't make any sense and can cause crashes
2022-01-27 18:40:00 +00:00
Xaver Hugl
d67a0b006a backends/drm: guard against wrong KScreen configs 2022-01-27 18:40:00 +00:00
Aleix Pol
d1698e1270 Fix xrandr primary when the new screen is the connected one
We'd trigger updatePrimary before Xwayland had reacted to the new output
so we wouldn't end up calling xcb_randr_set_output_primary() as
necessary.

BUG: 449099
2022-01-27 11:31:11 +00:00
Arjen Hiemstra
e6c1ccbd3b Fix drag and drop with touch between different windows
When dragging from one window to another, we may end up in a data_device
that didn't get "data_device_start_drag". In that case, the internal
touch point serial will be incorrect and we need to update it to the
serial from the seat. The serial stored in the seat is changed to
std::optional so we can properly check if it is set.
2022-01-27 10:44:58 +00:00
David Edmundson
b3abe7526b Fix OpenGLSafePoint guard
qScopeGuard runs the method when the function goes out of scope. Without
a local variable this is immediately.
2022-01-26 22:19:31 +00:00
Vlad Zahorodnii
09fa095039 Drop unused Screens::intersecting() 2022-01-25 17:56:40 +00:00
Vlad Zahorodnii
7120348932 Make checkWorkspacePosition() work without client geometry
A good portion of geometry handling code was written during the X11
times. The main difference between X11 and Wayland is that kwin doesn't
know where a window will exactly be after resize() or moveResize().

In order to handle Wayland specifics, every window has a bounding
geometry that is being manipulated by move(), resize(), and moveResize().
The frameGeometry(), the clientGeometry(), and the bufferGeometry() are
not manipulated by move(), resize(), and moveResize() directly. Almost
everything that manipulates geometry should use moveResizeGeometry().

This creates a problem though, since the clientGeometry() will be
updated only after the client provides a new buffer, kwin has absolutely
no idea what the client geometry for a given move resize geometry will
be.

Another side of the coin is that decoration updates are performed
asynchronously on wayland, meaning that you cannot use border properties
for anything related to geometry handling and you should avoid using
borderLeft(), borderTop(), borderRight(), and borderBottom() in general.

clientGeometry(), bufferGeometry(), and border*() are good only if you
want to forward an event or render something. They can't be used for
manipulating the geometry.

Unfortunately, AbstractClient::checkWorkspacePosition() needs both,
which is a bit of a problem. To add more oil to the fire, contents
of a decorated window can be snapped to a screen edge. This goes against
the nature of geometry updates on wayland, where we try to indicate
the bounds of the frame geometry and avoid using client and buffer
geometries.

In order to make geometry handling more correct on wayland, this change
removes the ability to snap the contents of a decorated window to a
screen edge. This allows to avoid using the client geometry in
checkWorkspacePosition(), which is a very important function that ensures
the window is inside the workspace.

There is nothing wrong with snapping the frame rather than its contents
and that's what kwin used to do. It was changed with the removal of
"Display borders on maximized windows" option, the relevant commit
didn't provide any reasoning behind the change.
2022-01-25 17:56:40 +00:00
Vlad Zahorodnii
e2a393ce2d Move utils.h file to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
8dd1d86310 Move SubSurfaceMonitor to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
0e1d65d5a2 Move opengl context attribute builders to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
293b2244ac Move xcbutils to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
e1d47b5946 effects/startupfeedback: Use clamp to edge wrap mode
The dpi of bouncing icon may not match the dpi of the screen, which
can make the linear filter sample texels from the opposite edge when
using the default wrap mode.

BUG: 448947
2022-01-25 15:43:08 +00:00
David Redondo
91632639b1 xwayland: Do not remove X11Source while drag is going on
setWlSource will delete the X11Source while XToWlDrag did not
finish leading to potential crashes. Since it's only set when
creating a WlToXDrag, only remove it in this case.
We can also replace the virtual with a type check if we have to do
it anyways which also makes it clearer what is going on.
2022-01-25 12:21:55 +01:00
David Redondo
3f7133a022 Apply timeout to startfeedback for xdg activation
Since xdg activation startups do not time out automatically
run a timer for each start up in the effect.
BUG:438622
FIXED-IN:5.24
2022-01-25 10:15:12 +00:00
David Redondo
6b1ccb8bf8 xwayland: Fix out of bounds write
Detected using ASAN, declaration of the type is:
typedef union xcb_client_message_data_t {
    uint8_t  data8[20];
    uint16_t data16[10];
    uint32_t data32[5];
} xcb_client_message_data_t;
2022-01-25 09:07:26 +00:00
Vlad Zahorodnii
6a0fd1d608 xwayland: Emit AbstractDataSource::aboutToBeDestroyed() signal
The seat needs the AbstractDataSource::aboutToBeDestroyed() signal to
properly clean up its tracked primary selection.

BUG: 449101
2022-01-25 08:32:09 +00:00
Vlad Zahorodnii
c793dd93d2 Make data source objects "parentless"
The SeatInterface cleans up currentSelection and currentPrimarySelection
when the AbstractDataSource::aboutToBeDestroyed() signal is emitted, but
since the data source and primary data source have parent objects, they
can be potentially destroyed without emitting the aboutToBeDestroyed()
signal and thus leaving dangling pointers in SeatInterface.

CCBUG: 449101
2022-01-25 09:59:59 +02:00
Alexander Lohnau
c4bcfd0b8c Utilize KCModuleLoader::loadModule for loading KCMs
This will take care of showing user-visible error messages in case the
plugin does not exist.

While we get a log message from KCoreAddons with the change of 728b449891,
the user does not get prompted. Especially if the kcmshell/systemsettings
was not opened from the command line, spotting those error messages is more difficult.
2022-01-25 05:26:43 +00:00
David Edmundson
fdea6d151e Fix xwayland DND crash
Drag and drop objects slightly outlive wayland's DND concept as we have
to cancel the client and wait for a response.

This normally is fine, except in the case that the drag ended because
the sender quit.

Calling setWlSource on drag ends creates a matching pair with
Dnd::startDrag where we first set the source and has parralels with
clipboard.

Selection::handleSelectionRequest checks for the presence of a source.

I could not reproduce the original bug.

BUG: 448920
2022-01-24 20:43:00 +00:00
Xaver Hugl
db1f7414b7 backends/drm: add additional check for direct scanout buffers
While in principle Mesa should already check if the buffer can be scanned
out, this may not always work. If we can't create a framebuffer object for
the buffer, fall back to compositing.

CCBUG: 448818
2022-01-24 21:23:05 +01:00
Xaver Hugl
c952c3a3ae backends/drm: add environment variable KWIN_DRM_NO_DIRECT_SCANOUT
Can be useful for debugging
2022-01-24 21:23:03 +01:00
Vlad Zahorodnii
52bc46069e plugins/screencast: Always clear bitmap cursor
Otherwise the contents of the bitmap can be undefined if the cursor
image is null.
2022-01-24 19:39:09 +00:00
Vlad Zahorodnii
d2867fc4a0 plugins/screencast: Hard-code the maximum cursor size to (256, 256)
XCURSOR_SIZE * scale factor is not the way to compute the current cursor
size. For example, with breeze cursor theme at an output with a scale of
2 and cursor size 24, cursor images will have the effective size of (64, 64).

Also, the cursor can change when passing over user interface elements.

In order to accommodate for all of that, this change makes kwin reserve
enough of space for a cursor of size 256x256. "256" is a magical number
that comes from DRM. With many drivers, the maximum cursor size is 256.

BUG: 448840
2022-01-24 19:39:09 +00:00
Vlad Zahorodnii
edb1a41148 plugins/screencast: Provide hidpi cursor bitmaps 2022-01-24 19:39:09 +00:00
Vlad Zahorodnii
b9b7357086 wayland: Fix getting the last configure event
If there's only one configure event that changes the position of the
window and it gets acknowledged but no buffer is attached yet, and a new
configure is sent, then the ConfigurePosition flag won't be inherited
by the new configure event and the window will be misplaced.

In order to fix that, this change makes XdgSurfaceClient pop the last
acknowledged configure event from the m_configureEvents list only when
it's about to be applied for sure.

BUG: 448856
2022-01-24 18:55:25 +00:00
Vlad Zahorodnii
8f941e5250 build: Use target based apis to populate kwin target's sources
Almost all kwin target sources are populated using target-based API,
except the dbus stuff. The upstream still requires using variables.
2022-01-24 11:29:36 +00:00
Vlad Zahorodnii
fccbfd8654 wayland: Simplify borderless maximized window handling
setNoBorder() checks window rules and it doesn't have an immediate
effect on the geometry.
2022-01-24 09:50:30 +00:00
Xaver Hugl
b5d2b0fb3b backends/drm: do current crtc check without detachments 2022-01-24 09:13:08 +00:00
Xaver Hugl
ca6fcbb2a1 backends/drm: make finding connector<->crtc combinations more efficient
Encoders are not really relevant for the test result, except that one of
the encoders for the connector must be compatible with the crtc.
The kernel usually exposes only a single encoder per connector for this
reason, but if a driver exposes multiple then that means KWin will do a
lot more tests than is necessary.
In order to prevent that from happening, do fewer syscalls and simplify
code, only check supported encoders once per connector.
2022-01-24 09:13:08 +00:00
l10n daemon script
32bdf28868 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"
2022-01-24 01:42:58 +00:00
l10n daemon script
4dc7560c9c 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"
2022-01-23 01:47:48 +00:00
Ismael Asensio
58a8358636 kcm/screenedges: Fix default indicator for corner ratio
When setting the default value for `ElectricCornerRatio` in the UI form
we also need to update the default indicator for this field.

*Default value for this setting is 25%*
| BEFORE | AFTER |
|---|---|
|![screenedges_25_before](/uploads/2e9f21627cc05cd12fd45ec1a019b89e/screenedges_25_before.png)|![screenedges_25_after](/uploads/7106341983e4cce0a4fb26000fb8583f/screenedges_25_after.png)|

BUG: 448886
FIXED-IN: 5.24
2022-01-21 20:21:40 +00:00
Vlad Zahorodnii
b572aadfd5 wayland: Allow setting "no border" flag even without xdg decoration
Historically, noBorder() was used for two things:

* as a substitute for AbstractClient::isDecorated()
* to determine whether the AbstractClient should have a decoration

With async decoration updates refactoring, a few things around
noBorder() have changed, which exposed an existing bug in the handling
of borderless maximized windows.

It's possible to have a case where an initially maximized window makes
an xdg_toplevel.set_maximized request before the initial commit, but
creates the decoration object after the initial commit.

Since XdgToplevelClient::userCanSetNoBorder() would return false when
maximize() is called in XdgToplevelClient::initialize(), m_userNoBorder
won't be updated and therefore the window can end up having a server
side decoration.

Previously, it wasn't the case because kwin would do nothing if the
decoration is installed and its preferred mode changes after the initial
commit but before the surface is mapped. With async decoration fixes,
kwin would react as expected, which unfortunately has exposed the bug.

The root cause of the problem is the fact that noBorder() is overloaded,
which makes it error-prone.

This patch changes how the noBorder property is treated. Now, it only
indicates whether the compositor wants the window to have no borders. If
noBorder() is true, it means that the compositor doesn't want the window
to have a server-side decoration; on the other hand, if noBorder() is
false, it doesn't imply that the window should have a decoration.

BUG: 448740
2022-01-21 14:59:42 +00:00
Vlad Zahorodnii
151be4584c Prefer isDecorated() over noBorder() when checking if window is decorated 2022-01-21 14:59:42 +00:00
Vlad Zahorodnii
87f2f9001d x11: Don't create decoration input extent window when running on Wayland
Input redirection takes care of handling resize only borders and
relevant event handling code in X11Client has been disabled for a while.
2022-01-21 14:37:02 +00:00
Vlad Zahorodnii
e10cf2a658 x11: Make X11Client not grab pointer when starting interactive move or resize
X11Client can grab pointer when starting interactive move or resize so
all pointer events go to it and kwin can update the move resize geometry
based on the current interactive move-resize mode.

However, on Wayland, X11Client::motionNotifyEvent() is disabled and
pointer events go through a code path that requires no X11 pointer grab.
2022-01-21 14:03:28 +00:00
David Edmundson
f2d3c5289f Only consider the screen lock shown after the screen window is mapped
This signal is sent back to the ksldapp after the greeter has registered
a window with the compositor. Only once ksldapp gets this signal does it
release the lock delaying suspend.

With xdgshell/layershell we have a roundtrip of configuring before the
window is even exposed, so we move to a different signal. This also
helps encapsulate lockscreen code.

Ideally we want to add code tracking frame rendering per screen tracked
too, but that would be based off this change.

CCBUG: 316734
2022-01-21 13:36:39 +00:00
Alexander Lohnau
32785ec1f3 KWin decorations: Fix KCM not refreshing after clicking "Use"-button in KNS dialog
CCBUG: 448749
2022-01-21 13:06:49 +00:00
Vlad Zahorodnii
59b21a0130 Fix -Wreorder-ctor 2022-01-21 11:33:42 +00:00
Vlad Zahorodnii
45c560ea06 Fix typo 2022-01-21 13:28:19 +02:00
Vlad Zahorodnii
85c07df3b3 Port away from KGlobalAccel::getGlobalShortcutsByKey()
KGlobalAccel::getGlobalShortcutsByKey() has been deprecated in favor of
KGlobalAccel::globalShortcutsByKey().
2022-01-21 12:02:40 +02:00
Vlad Zahorodnii
813d861ea6 Fix -Wunused-variable 2022-01-21 11:57:21 +02:00
Aleix Pol
354857e9f1 mouseclick: Also decorate tablet events
BUG: 426584
2022-01-21 09:33:13 +00:00
Aleix Pol
324b172a26 Also redirect tablet events to the effects infrastructure 2022-01-21 09:33:13 +00:00
Mouse Zhang
184cddda4c effects/eyeonscreen: When there are multiple screens, all desktops will be zoomed. 2022-01-21 10:58:00 +02:00
David Edmundson
67205c9133 [Xwayland] Avoid syncing cursor shape during move resize operations
On wayland cursors are managed by kwin. During a move resize operation
kwin updates its own cursors  in pointer_input. There is no need to sync
any cursor changes back to the X server as we end up setting it twice.
2022-01-21 10:53:33 +02:00
Weng Xuetian
e64f60ce08
Fix force xrgb 8888
19c471405e7eb4b6026db24d776d205125dbc013 introduced a regression if
there are two gbm backend and the backend fail to choose drm format.

This fix does two things:
1. Current buffer format should not be reset after create new buffer,
   otherwise current.format may just be empty after resetOutput.
2. force xrgb 8888 need to be set on the primary backend.

BUG: 448790
2022-01-19 15:46:38 -08:00
Niklas Stephanblome
f81e84412e effects/presentwindows: Do not highlight windows based on mouse if user is currently typing
If the user is currently typing, do not highlight windows based on the mouse position. If the user types a window title before the effect opening animation is finished, he ends up in a situation where only one window is on the screen but it is deselected (because the mouse is not on the window) or another window is selected because of the mouse. With this change, the mouse input does not overwrite the window highlighting based on the search entered **if the user is currently typing.**
2022-01-19 14:45:41 +00:00
Xaver Hugl
5b86afa6f0 effecst: disable launch feedback effect if cursor is hidden
Gets annoying with touch
2022-01-19 12:36:29 +00:00
Xaver Hugl
50c167c94b backends/drm: fix reallocation check
When no modifiers are used at all, we shouldn't check them.

BUG: 448557
2022-01-19 10:31:33 +00:00
Xaver Hugl
e0a8fa778e backends/drm: fix output changes with the placeholder output
As the placeholder output gets added or removed in response to other outputs
getting enabled or disabled, the output list may change while iterating over
them and applying changes.

BUG: 448454
BUG: 448474
CCBUG: 448697
FIXED-IN: 5.24
2022-01-18 21:36:23 +00:00
Vlad Zahorodnii
2cf6fc82c4 Make AbstractOutput::sendToOutput() do nothing if the window is on the given new output
Currently, finishInteractiveMoveResize() relies on a hidden behavior
in the sendToOutput() function that makes it treat fullscreen windows
differently, which is confusing.

With this change, finishInteractiveMoveResize() will use the
checkWorkspacePosition() function to make sure that the geometry of the
fullscreen window is adjusted to the new monitor. It allows to make
sendToOutput() more straightforward.

It also fixes checkWorkspacePosition() using wrong geometry type in the
fullscreen window path.
2022-01-18 10:00:10 +02:00
Vlad Zahorodnii
17445d19d0 wayland: Delete X11 unix socket left after previous compositor
If the previous compositor has crashed, the unix socket will be kept
around and listen_helper() will fail.
2022-01-18 07:26:41 +00:00
Vlad Zahorodnii
fcb4df96e1 Avoid updating geometry restore after finishing move or resize
A while ago, geometryRestore() had to have a sane value even if the
window is not maximized because checkWorkspacePosition() used it.

Since checkWorkspacePosition() doesn't use geometryRestore() anymore, we
can stop updating the geometry restore.
2022-01-17 17:08:34 +02:00
Vlad Zahorodnii
ab824959f6 Fix geometryRestore() handling with maximize quick tile mode
geometryRestore() is no longer updated after mapping the window, so
setQuickTileMode() has to update geometryRestore() explicitly to the
correct value.

With this change, geometryRestore() will be updated as follows:

* if the window is tiled, geometryRestore() is valid, nothing to do
* the window has been dragged to the top edge, set geometryRestore() to
  the geometry that the window had when starting move
* otherwise, use the current move resize geometry
2022-01-17 13:02:48 +00:00
Vlad Zahorodnii
fce4b635fb wayland: Remove StackingUpdatesBlocker in XdgToplevelClient::changeMaximize()
The maximized state doesn't affect the window's stack layer.
2022-01-17 12:40:48 +00:00
Vlad Zahorodnii
df913bdc50 Remove some unintuitive code in AbstractClient::setQuickTileMode()
After calling setMaximize(), the window should cover the maximize area.
The commit message of 516ea86341 doesn't
explain why only the y coordinate is enforced or why the x coordinate is
not enforced.

In order to make some sense of the code, this change removes the semi-
random enforcement of the y coordinate.
2022-01-17 12:22:14 +02:00
Vlad Zahorodnii
3ba316e6bf wayland: Don't raise window when entering fullscreen mode
If the window is inactive and it enters fullscreen mode for some reason,
it can create a situation where keyboard goes to a window occluded by
the fullscreen window.

This change makes XdgToplevelClient::setFullScreen() not raise the
window. It's the responsibility of whoever requested the fullscreen mode
change.

If the configure event is acknowledged, the window's stack layer will be
invalidated and recomputed. If the window is active, it will be promoted
to the ActiveLayer, otherwise its stack position won't change.
2022-01-17 11:45:06 +02:00
Xaver Hugl
85cd40c49a backends/drm: remove unused variable 2022-01-17 08:56:41 +00:00
Xaver Hugl
090b687126 backends/drm: prevent some detachments 2022-01-17 08:56:41 +00:00
Vlad Zahorodnii
0c78da0e3a wayland: Make fullscreen and maximize mode not affect interactive resize
dontInteractiveMoveResize() was added to workaround kwin sending bad
configure events when double clicking mpv to make it fullscreen.

With async geometry updates fixed, dontInteractiveMoveResize() can be
finally removed.

Another reason to remove dontInteractiveMoveResize() is that it can make
kwin crash with a debug build. For example, if you enable resizing
maximized windows in breeze decoration settings and resize a maximized
window, kwin would eventually crash in
the AbstractClient::handleInteractiveMoveResize() function because neither
isInteractiveMove() nor isInteractiveResize() return true.
2022-01-17 08:38:03 +00:00
Xaver Hugl
b2d401cddb backends/drm: re-add KWIN_FORCE_SW_CURSOR
It was accidentally dropped
2022-01-16 18:19:04 +01:00
Weng Xuetian
791b0bb296 Do not remove WAYLAND_DISPLAY environment variable for input method.
Based on the implementation of wl_display_connect, WAYLAND_SOCKET is
always preferred over WAYLAND_DISPLAY, which means it is OK to have both
of them set. This allows subprocess of input method to have the correct
WAYLAND_DISPLAY variable set.
2022-01-15 19:36:40 +00:00
Xaver Hugl
de7b429528 backends/drm: remove the now unnecessary check for supported formats
As formats are per output and also checked on crtc changes, there
is no reason to restrict used formats to those that are supported
by all primary planes anymore.
2022-01-14 20:09:03 +01:00
Xaver Hugl
fe9a3f45c0 backends/drm: ensure correct format+modifiers pairs for surfaces
When the crtcs get switched around between outputs, their primary
planes and thus the supported formats also get switched around. In
order to make sure that doesn't cause any problems, always check
whether or not the format+modifiers used are supported.
2022-01-14 20:06:05 +01:00
Arjen Hiemstra
bd3dd7ce36 Export all scritable contents for VirtualKeyboardDBus
Instead of only the signals, which ends up not exporting the new
willShowOnActive method.
2022-01-14 16:28:58 +00:00
Xaver Hugl
fd3a7c3c99 linuxdmabuf: remove unnecessary fallback
DRM_FORMAT_MOD_INVALID is now explicitly included in KWin where needed
2022-01-14 17:07:07 +01:00
Xaver Hugl
0ecfbb0d1c backends/drm: if multi-gpu copy fails, disable deep color
The format XRGB8888 is effectively universally supported. If everything
else fails, try to fall back to that
2022-01-14 15:44:53 +00:00
Xaver Hugl
0a3922e29d backends/drm: use the correct format for CPU copy
BUG: 448376
2022-01-14 15:44:53 +00:00
Vlad Zahorodnii
f027b979bc Mark cursor as rendered after finishing compositing cycle
Otherwise animated cursors won't work. Hopefully, this will fix pointer
input test.

It would be great to refactor cursor handling so it's simpler, it can be
done later.
2022-01-14 12:08:57 +00:00
Xaver Hugl
802d855785 backends/drm: support link-status
Userspace is expected to do a modeset and set link-status to good again,
if link-status gets bad. This is needed to prevent some black screen situations.

BUG: 448177
2022-01-14 10:31:32 +00:00
Xaver Hugl
031bb305e3 egldmabuf: if modifiers are not supported, send DRM_FORMAT_MOD_INVALID
An empty modifier list will get ignored and does not mean implicit
modifiers are allowed

CCBUG: 448284
2022-01-14 09:27:16 +00:00
Vlad Zahorodnii
e20f09666b scenes/qpainter: Fix software cursor check in paintCursor()
Hopefully this will fix SceneQPainterTest.
2022-01-14 08:33:37 +00:00
Xaver Hugl
4b8b8b7652 egldmabuf: add some logging about supported formats
May help diagnose some bugs

CCBUG: 448284
2022-01-13 23:43:15 +00:00
Alexander Lohnau
ddf2c89206 Remove plugin loading using keywords
This was deprecated in during the 5.24 development period. All KDE
consumers are ported away from it. Third parties will get meaningful
runtime messages which instruct them to register the plugins without keywords.

The create overloads which take keywords were already deprecated in KPluginFactory.
2022-01-13 19:51:48 +00:00
Kai Uwe Broulik
b696bf7dec x11client: Consider _GTK_APPLICATION_ID for matching desktop files 2022-01-13 14:41:41 +00:00
Vlad Zahorodnii
b656a43c90 Remove service_utils.cpp
It's empty so remove it.
2022-01-13 14:44:56 +02:00
Vlad Zahorodnii
6494db75e9 scenes/opengl: Port lanczos filter to ShaderManager::generateShaderFromFile() 2022-01-13 12:04:37 +00:00
Vlad Zahorodnii
35e0abb089 kwineffects: Rename generateShaderFromResources() to generateShaderFromFile()
It works both with resource files and normal files.
2022-01-13 12:04:37 +00:00
Vlad Zahorodnii
754e0d8f6e effects: Fix resource file reading for builtin effects
Currently, the invert effect doesn't work because it can't load its
fragment shader because builtin effects are static libs. We need
Q_INIT_RESOURCE() before reading shader code.

This modularizes builtin effects more, which makes easier to add and
remove builtin effects, as well as allows to have per effect resources.

Technically, changing the inner workings of the ShaderManager is an
API incompatible change, but ShaderManager::generateShaderFromResources()
can be used only by builtin effects so it's okay.

ShaderManager::generateShaderFromResources() had to be changed because
two resource files can't share the same prefix. Appending "_core" was
inspired by QtQuick.
2022-01-13 12:04:37 +00:00
l10n daemon script
dcb04308ee 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"
2022-01-13 01:44:19 +00:00
Xaver Hugl
2564886f7f backends/drm: fix legacy crash
CCBUG: 447680
2022-01-12 21:23:37 +00:00
Alexander Lohnau
88b908a27e KWin decorations KCM: Fix broken AdoptionCommand for KNewStuff
We need CMAKE_INSTALL_FULL_LIBEXECDIR, otherwise `lib/x86_64-linux-gnu/libexec/kwin-applywindowdecoration`
will be the resulting path, which does not contains the cmake install prefix.
Consequently KNS would fail to find it at runtime.

BUG: 447284
FIXED-IN: 5.24.0
2022-01-12 20:29:13 +01:00
Vlad Zahorodnii
e8e15a72f4 Drop UrgencyHint helper
It's unused.
2022-01-12 16:00:21 +02:00
Vlad Zahorodnii
58081c5bf8 wayland: Fix resizing of windows with aspect ratio
After finishing interactive resize, the window needs to be gravitated.
However, it won't be gravitated because isInteractiveMoveResize() will
return false.

In order to fix that, every configure event needs to carry the gravity,
that way the window can be gravitated even after leaving interactive
resize.
2022-01-12 13:12:41 +00:00
Vlad Zahorodnii
907c440e22 Introduce concept of interactive resize gravity
The gravity concept is a generic way to describe how a window must be
positioned during interactive resize. It works both when resizing the
window using a pointer or touch.
2022-01-12 13:12:41 +00:00
Vlad Zahorodnii
b15681fd9c wayland: Port to XdgToplevelInterface::ResizeAnchor 2022-01-12 13:12:41 +00:00
Vlad Zahorodnii
f06e83f241 Replace resize edges flag with an enum
It's more typesafe.
2022-01-12 14:59:06 +02:00
Vlad Zahorodnii
9a4a960886 x11: Handle late sync request
X11Client implicitly relied on the finishInteractiveMoveResize() function
to call moveResize() to synchronize the move resize geometry with the
server geometry. However, after removing that moveResize(), X11Client
got slightly broken.

A resize sync request may arrive shortly after finishing resize. In
order to properly handle it, this change makes X11Client handle late
sync requests.

It also makes handling interactive resize on x11 similar to how it's
done on wayland.

The main problem with not letting X11Client finish interactive resize
is that the Toplevel::bufferGeometry() may end up with an outdated value
and SurfacePixmapX11 will fail to create due to a mismatch between
Toplevel::bufferGeometry() and the server side geometry of the frame
window.
2022-01-12 12:00:41 +00:00
Vlad Zahorodnii
b4f2bc3898 Use correct glGetGraphicsResetStatus()
KWin loads glGetGraphicsResetStatus() on its own to handle ARB and EXT
extensions. After moving graphics reset handling to the RenderBackend,
kwin doesn't use its own glGetGraphicsResetStatus() function, but instead
uses the one provided by libepoxy, which panics if
glGetGraphicsResetStatus() is not in core spec. This change makes the
OpenGLBackend use kwin's glGetGraphicsResetStatus() function instead of
the one provided by libepoxy to avoid a crash.
2022-01-12 09:39:02 +00:00
l10n daemon script
d6002c2631 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"
2022-01-12 01:48:09 +00:00
Arjen Hiemstra
352e92e32f Support global defaults for input devices
This adds support for reading values from a "Libinput/Defaults" group in
the input config file. This allows specifying global defaults for
devices, that are preferred over the libinput defaults. Because of the
cascading mechanisms of KConfig, this then allows distributions and
hardware vendors to supply system-wide defaults for devices.
2022-01-11 12:24:01 +00:00
Arjen Hiemstra
0319a66ead Refactor libinput::Device::ConfigData
Rather than an awkward combination of template functions, function
pointers and multiple calls to almost-the-same-but-not-entirely
functions, make ConfigData itself a template and use type erasure to
store them in the config map. This makes the data object aware of its
type and allows us to specialise the reading of config values through
template specialisation. It also removes the need for multiple
constructors and setters in the ConfigData object.
2022-01-11 12:24:01 +00:00
Vlad Zahorodnii
8e8f55b18a Drop Process helper
Direct session is long time gone and SIGUSR1 and SIGUSR2 are not used
anywhere so drop the Process helper.
2022-01-11 08:01:10 +00:00
Vlad Zahorodnii
2979a850fa Drop ClearablePoint
It's unused.
2022-01-11 08:01:10 +00:00
Fabian Vogt
677f5fcb6e wayland: Move m_layoutList assignment out of Xkb::applyEnvironmentRules
Xkb::applyEnvironmentRules is meant to do just that, move the unrelated
code outside.
2022-01-10 19:54:58 +00:00
Weng Xuetian
cfa463c0ef Also forward key to input method for popup surface.
Popup may also want to use input method. If there is a keygrab, it also
need to forward input method instead of directly passing to wayland server.
2022-01-10 17:16:14 +00:00
Jan Grulich
9f44013fb5 Screencast: update PW buffer with only mouse cursor metadata on cursor change
As of now, we update cursor metadata only when the screen content changes, but
this results into not having smooth cursor movement. We can update only mouse
cursor location when it changes and send an empty buffer with mouse cursor
metadata so clients can have update mouse location.
2022-01-10 12:41:19 +00:00
Vlad Zahorodnii
861eac9205 Clean up Workspace::activeOutput()
Having both "active_client" and "client" is leftover after the active
output property being in the Screens class.
2022-01-10 11:23:55 +00:00
Vlad Zahorodnii
ee1ea077ba Store surface object in tablet cursor using QPointer
The SurfaceInterface can get destroyed and TabletCursorV2 may return a
dangling pointer.

BUG: 446255
2022-01-10 13:17:32 +02:00
l10n daemon script
a2774e26a9 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"
2022-01-09 01:50:30 +00:00
Nicolas Fella
21212a71ec [kwin_rules_dialog] Add desktop file
This is needed for correct taskbar indentification
2022-01-08 20:16:34 +01:00
Vlad Zahorodnii
49aadee2a9 Use correct "natural" surface size when computing surface-to-buffer matrix
If the source rectangle is not set, we need to use the surface size
given by the attached buffer. It's computed as buffer size / scale, but
the buffer can also be transformed. In other words, we need to compute
the natural surface size as follows - buffer size / scale and transpose
the result if the buffer is rotated 90 or 270 degrees.
2022-01-08 15:15:14 +02:00
Ismael Asensio
72c0974a06 DesktopGridEffect: Fix crash when closing the effect
If the first condition would match (for instance after moving a window),
`windowMove` would be `nullptr`, triggering the crash later.

By the looks of it, it was maybe a typo.

BUG: 445335
FIXED-IN: 5.24

CC: @nicolasfella
2022-01-07 21:16:04 +00:00
Ismael Asensio
d13c39bec6 kcm/kwinrules: Fix header in properties list
This provides a better fix for the header positioning bug in
the properties list sheet, instead of the previous workaround
(which wasn't enough in some situations)

Upstream bugfix (in the Kirigami component) is not advisable as
it could cause unintended consequencies in other uses/apps

See also: https://bugs.kde.org/show_bug.cgi?id=422289

BUG: 421583
FIXED-IN: 5.24
2022-01-07 11:04:42 +00:00
Fabian Vogt
bd1fab3458 wayland: Honour default Xkb options
Currently KWin always uses the Options configured in kxkbrc because
QByteArray::constData() is never nullptr. This means that the system
default is ignored completely. Read ResetOldOptions to distinguish
between explicitly setting no options and using the system default.
2022-01-06 08:12:32 +00:00
Vlad Zahorodnii
81f9da17fd Drop resize effect
After recent refactor changes to improve resizing of xdg-toplevel
surfaces with an aspect ratio, the resize effect got really broken. The
resize effect has always been a problem child on wayland.

Unlike X11, geometry updates are performed asynchronously on Wayland.
It's not possible to have a smooth transition after finishing
interactive resize from the resized state to the normal state, geometry
will jump from last moveResizeGeometry() to the current frameGeometry()
and when the client repaints the window, the window size will jump back
to the move resize geometry size. There are no ways to fix that without
contradicting to how the effect is advertised to work, e.g. sending
configure events behind the back. Keeping the frame geometry out of sync
with the xdg_surface window geometry size is also not the option,
geometry updates are already too complex (due to being async).

Another wayland related issue with the resize effect is that the
compositor doesn't know about aspect ratio or any other size
constraints, except min and max size. The client can provide a smaller
buffer to account for various geometry constraints. It will be confusing
to have a mismatch between resize outline and the final real geometry.
Aspect ratio or other geometry constraints won't be exposed to the
compositor, it's a common decision of many wayland devs (including KDE).

To some extent, the wayland issues can be addressed by performing content
updates, with active feedback, the mismatch between outline and the
final geometry would become less severe, but it won't be any different
than resizing without the effect.

Given the wayland issues and in part maintenance costs, this change
drops the resize effect. Note that it can be still reimplemented without
kwin core changes, but it would still suffer from the aforementioned
issues.

BUG: 443434
2022-01-05 19:00:22 +02:00
Xaver Hugl
d18e631d47 backends/drm: hide cursor again
Before 6a99bfd2, the DrmBackend took care of checking this. Now it
needs to be explicitly checked in DrmOutput
2022-01-05 16:39:56 +01:00
Vlad Zahorodnii
dfe69a6784 effects: Enable the scale effect by default
It looks fancier than the fade effect.
2022-01-05 08:26:36 +00:00
Alexander Lohnau
1322b52b03 kwin scripts: No longer copy videowall metadata file in kservices folder
We load the KCM by path now and don't use KServiceTypeTrader
2022-01-05 08:13:09 +01:00
Alexander Lohnau
ab2ac07e2a Define X-KDE-ConfigModule for videowall KCM
This way we do not need to go through KServiceTypeTrader for the querying
2022-01-05 08:12:13 +01:00
Alexander Lohnau
a1340a9815 Rework determining of scripted effect config
Currently the plugin needs to set a property in oder to be considered configurable.

In kpackage we have the concept of optional and required files, based on the existence of those
optional files we can define different behavior. For example in Plasma the applets can optionally have a config ui.

Because here we don not use The KPackage:Package class, it is simpler to check the existence of the files on disk.
2022-01-05 08:12:13 +01:00
Alexander Lohnau
f2dd50e1f9 Clean up legacy configmodule querying
In KWin we are allowed to break compat and here all first party consumers
have already been ported for quite a while.

Also the querying is very inefficient, because for every plugin where the
X-KDE-ConfigModule property is not defined all available KCMs have to be opened and
their metadata parsed.

This way we also get rid of the deprecation warning for KPluginMetaData::readStringList.
2022-01-05 08:12:13 +01:00
Alexander Lohnau
32f9ba0caf Do not embed json metadata in KCMs that get loaded by path
Doe to 1a0031c08a3b41458eb5bf2097b4cd6452ba3d09 we no longer require json metadata to be embedded.
Also we did not use the metadata anywhere, except for finding the correct plugin.
2022-01-05 08:12:13 +01:00
Alexander Lohnau
728b449891 Effectsmodel: Load KCM by path instead of searching for plugin by id
This way we do not need to embed json metadata in the plugins
and can consequently drop the metadata files entirely.

The resulting metadata object might still be invalid, however KCoreAddons
can handle such cases. See https://phabricator.kde.org/T15094 regarding
create better KCoreAddons API for such cases.
2022-01-05 08:12:13 +01:00
Xaver Hugl
81905dbfaa backends/drm: properly handle pending transformations
AbstractWaylandOutput::pixelSize returns the size with already set transformation
applied but the render backends need the pending transformation
2022-01-04 22:22:57 +00:00
Xaver Hugl
b06ec13ead backends/drm: test crtc+connector combinations with hardware rotation
This should enable KWin to use hardware rotation in more situations. As
a fallback all hardware rotation is disabled and the test is done again
2022-01-04 22:22:57 +00:00
Xaver Hugl
dc5cddd33f backends/drm: ensure hardware transforms are properly applied and tested
Testing only the pipeline that this output uses is not enough and can
cause breakage on multi-monitor setups.
2022-01-04 22:22:57 +00:00
Xaver Hugl
2af3f46357 backends/drm: adjust logging verbosity 2022-01-04 22:22:57 +00:00
Ismael Asensio
088e870d54 TabBox: Add SwitcherItem to declarative API 3.0
Not sure if this was left out on purpose as a kind of deprecation.

It would be necessary to allow port the tabbox switchers to the newer 3.0 API and use their components (such as `Workspace`)

Probably for `Plasma/5.25` now.
2022-01-04 20:07:45 +00:00
Weng Xuetian
5475751c7b Fix testTextInputV3Interface
Put EnableEmitter in the anonymous namespace to avoid it to be linked to the
wrong implementation.
2022-01-04 11:24:45 -08:00
Vlad Zahorodnii
457e9faaa1 Avoid sending a configure event when starting interactive move
There's nothing to configure that needs an acknowledgement from the
client.
2022-01-04 18:28:54 +02:00
Vlad Zahorodnii
feaebcf81d Rename XdgToplevelClient::m_requestedStates to m_nextStates
It's consistent with m_nextDecoration and m_requestedStates contains
both requested and "not requested" states (i.e. the ones set by kwin
without waiting for acknowledged from the client, e.g. activated).
2022-01-04 18:28:54 +02:00
Vlad Zahorodnii
5420e11bd4 Make AbstractClient::titlebarPosition() return Qt::Edge
Conceptually, it's an edge, the titlebar can't be in a window corner.
2022-01-04 15:57:42 +00:00
Xaver Hugl
a011fe74b2 linuxdmabuf: fix sending default tranches
Only the first one was getting sent
2022-01-04 15:22:27 +00:00
Fabian Vogt
63a2a88e6c Allow starting kwin_wayland as root
Running a Plasma Wayland session as root is not insecure, it is in fact the
opposite. There is no way for other users to somehow influence this session
due to the user separation and the user is more likely to only use this for
administrative actions. This is in contrast to regular user sessions, which
most likely start a mix of unprivileged programs next to privileged windows
like some with authorized kauth helpers or even just sudo in a konsole tab.
2022-01-04 16:01:57 +01:00
Laurent Montel
9521ca1e56 Use const'ref here 2022-01-04 14:00:41 +01:00
Vlad Zahorodnii
5f83f2a781 Replace abort() with Q_ASSERT and Q_UNREACHABLE
This change replaces abort() with Q_ASSERT and Q_UNREACHABLE() macros to
make kwin code base consistent. Besides that, Q_UNREACHABLE may
potentially provide the compiler more info that can be used to generate
more efficient machine code.
2022-01-04 10:28:42 +02:00
Vlad Zahorodnii
dde3010353 Move X11-specific code from interactive move resize handler to X11Client
When moving or resizing a window on X11, the window based screen edges
won't receive pointer input, so handleInteractiveMoveResize() explicitly
pokes the ScreenEdges to check if there's any approached screen edge.

On Wayland, it's not an issue. This change moves X11-specific code to
X11Client to avoid checking screen edges twice.
2022-01-04 07:36:42 +00:00
Vlad Zahorodnii
d85ab218ee Avoid changing geometry when finishing interactive move resize
When finishing interactive resize operation, the move resize geometry is
already good and the client should have sent the corresponding configure
event. So, this moveResize() call is redundant.

This change moves code that is responsible for quitting maximized
horizontally or vertically mode to the start of the interactive resize
operation. It makes handling of MaximizeFull mode consistent, and it
kills one moveResize() call at the end of the interactive resize
operation, which is good because it makes simpler handling of resizing
aspect ratio aware windows on wayland.

However, in order to make resizing of aspect ratio aware windows good
for real, we will need to augment configure events with gravity info.
2022-01-04 07:36:42 +00:00
Vlad Zahorodnii
dbee0573c4 Lock clientStepUserMovedResized to move resize geometry changes
On Wayland, the move resize geometry and the frame geometry are
completely out of sync.

This change synchronizes emitting of the clientStepUserMovedResized
signal to the move resize geometry changes.

It simplifies code of InternalClient and XdgSurfaceClient, and makes
adding support for other shell surface protocols easier as there's less
boilerplate stuff that you would need to take care of.
2022-01-04 07:36:42 +00:00
Vlad Zahorodnii
dd7972ce46 wayland: Avoid repetitive move() and resize() calls during interactive move/resize
With internal clients and xdg-shell clients, geometry updates occur in
asynchronous fashion when interactively resizing the window.

As is, performInteractiveMoveResize() will call resize() if the move
resize geometry is different from the current frame geometry. This can
result in kwin sending excessive configure events.

With this change, kwin will send less configure events during
interactive resize.
2022-01-04 07:36:42 +00:00
Vlad Zahorodnii
fcf0b4796f Drop geometry tip
It's not practical, regular users don't care about window geometry. One
could argue that it can be useful for creating window rules, but window
rules kcm pulls relevant properties from kwin.

If needed, one can reimplement this feature as a QtQuick script that creates
an overlay window positioned above the window that is being interactively
moved or resized.
2022-01-04 07:36:42 +00:00
Weng Xuetian
6cc0c204fd
Fix tests by checking if InputMethod::self() is null.
Only integration test has InputMethod instance.
2022-01-03 18:34:53 -08:00
Méven Car
d81b106c15 Apply the rgbrange read from Kscreen configuration on startup
CCBUG: 442520
2022-01-03 15:40:52 +00:00
Xaver Hugl
93d5127014 backends/drm: improve dmabuf feedback
Instead of only allowing the current format, send the default tranches modified
to only contain formats and modifiers suitable for scanout.
In order to not fail when we can't do direct scanout with a given format
(because that may require a modeset, which we don't allow), keep a blacklist
of attempted formats and modifiers for the current client.
2022-01-03 10:45:44 +00:00
Xaver Hugl
0ba2c35e1a dmabuf feedback: limit modifiers to those supported by egl 2022-01-03 10:45:44 +00:00
Xaver Hugl
5a6f1e42c1 backends/drm: make the placeholder screen as big as the last screen
The fixed size of 1080p makes windows change their size and place. To
prevent that from happening, make the placeholder screen the same size
as the last disconnected screen.
This is not a bullet proof solution, only a fast one. Ideally KWin
should remember the window layout on a given monitor setup and restore
it when reconnected.

BUG: 447419
FIXED-IN: 5.24
2022-01-03 11:17:50 +01:00
Vlad Zahorodnii
bc3d80db2a Use default member initialization in Compositor consistently 2022-01-03 10:51:21 +02:00
Vlad Zahorodnii
e81a360194 Bump libepoxy to 1.3
1.3 has been released in 2015 which is sufficiently old enough.
2022-01-02 22:30:06 +02:00
Vlad Zahorodnii
9e97c06758 Move graphics reset handling to RenderBackend
This makes the Scene less overloaded and it's needed for things such as
render layers.

In hindsight, it would be great to merge checkGraphicsReset() and
beginFrame(), e.g. make beginFrame() return the status like in QRhi or
VkSwapchain. If it's OUT_OF_DATE or something, reinitialize the
compositor.
2022-01-02 22:29:36 +02:00
Weng Xuetian
ca7298a325 Ensure modifier change is forwarded after the key sending to input method.
Same as real hardware wl_keyboard, key should be sent before modifier
change. For example, Left Ctrl press and release should produce
key events in the order of Control_L and Control+Control_L.
2022-01-02 03:26:23 +00:00
l10n daemon script
db55e463f0 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"
2022-01-02 02:01:24 +00:00
Xaver Hugl
5e75d2a095 backends/drm: fix cursor crash 2022-01-01 13:22:20 +00:00
l10n daemon script
1d6de6a3a9 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"
2022-01-01 01:43:48 +00:00
l10n daemon script
5e5752b8c4 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-31 01:42:54 +00:00
Julius Zint
3b4d558371 Improve window decorations in OpenGL scene
When creating the texture containing the window decorations, the drawing
code now directly handles the rotation for the left and right
decoration, instead of rotating the image after it has been drawn.

The padding, to prevent texture bleeding, is now a fixed value instead
of being scaled. With this change, there are no longer visual artifacts
for window decorations with rounded corners, when the scaling value is
fractional.
2021-12-30 09:07:42 +00:00
Vlad Zahorodnii
84690a0de6 scenes/opengl: Move copying front buffer to back buffer to X11 specific code
On X11, if buffer age is unsupported, kwin can do some quirks like
copying parts of the front buffer to back buffer to avoid repainting the
whole screen.

Currently, the copying is performed in the opengl scene, which is not
perfect because it makes the scene responsible not only for painting the
scene but also some low level platform specific shenanigans.

This change moves the copying step to the glx and egl backends. It
simplifies the opengl scene, makes it less overloaded and more open to
changes, but it also duplicates code, which is not ideal. However, given
the de-facto deprecated state of the X11 platform, it's sort of acceptable
as the main focus is now on wayland session and the things that are
needed to make it fly as expected.
2021-12-29 15:11:40 +00:00
Weng Xuetian
afc2a1c0aa Clean up the focus handling for text input.
Usually, a client will only use text input v2/v3. Do not return the focused
surface for text input if it has no relevant text input resource.
If text-input object is created after surface get the focus, send
enter to this text input object. Ensure sendEnter and sendLeave always
appear in pair.

Also, use the same technique in text-input-v2 for text-input-v3 to
handle per resource's enable/disable state, and only send update to
enabled text-input-v3 object.
2021-12-29 00:38:48 +00:00
Aleix Pol
13b85d77fc inputmethod: Expose VirtualKeyboard.willShowOnActive on dbus
It can help clients predict how KWin will react. Sometimes, the noise of
seeing a virtual keyboard pop up is reason enough not to focus an input
field.
2021-12-28 23:53:08 +00:00
Xaver Hugl
6a99bfd2f4 make software cursors work per output 2021-12-28 18:42:29 +00:00
Weng Xuetian
8a2f64fbe1
Do not call setActive(true) when request input panel to show
Observed in kdevelop, that isEnabled() could be false when switching
between different tabs with Ctrl+Tab. But Qt may still call show()
if you click on the texteditor widget. This leads to isEnabled == false but
setActive(true) is called. This causes kdevelop in a usable state because
keyboard grab will be created and no key event will reach application
because isEnabled == false. Under normal circumstances, key will reach
widget first and triggers another text_input_v2 enable to make input
method work properly.
2021-12-27 21:34:06 -08:00
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
Xaver Hugl
f2bf7fb1f8 linuxdmabuf: allow setting the default tranches 2021-12-23 00:24:48 +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
3ef4f994fa Implemnt preedit_styling for text input v2. 2021-12-19 04:09:48 -08: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
a711f90a69 Include linux/input.h without performing any checks
Currently drag-and-drop doesn't work on FreeBSD because relevant input
parts of kwayland-server are not compiled there.

HAVE_LINUX_INPUT_H is set to 0 on FreeBSD because linux/input.h is in
/usr/local/include and check_include_file() doesn't look there.

Regardless of that, as FreeBSD developers pointed out, including
linux/input.h is the recommended way to get input event codes so let's
make it a hard dependency.
2021-12-17 13:12:31 +02: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
Vlad Zahorodnii
6cdf056047 autotests: Remove unrelated client-side wrapper tests
They belong in KWayland::Client.
2021-12-17 06:56:41 +00:00
Tobias C. Berner
1bc7afe8aa Add helpers to read the executable path for a given PID 2021-12-17 06:54:53 +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
Weng Xuetian
2da3276a95 Fix the wrong argument order for send_modifiers. 2021-12-12 23:49:44 -08: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
47897e249f Add ServerDecorationInterface::preferredMode()
This change adds the preferred decoration mode similar to what
XdgToplevelDecorationV1Interface has. It's needed to clean up some kwin
code.
2021-12-08 21:31:17 +02:00
Vlad Zahorodnii
1e84a56df8 Introduce fake None xdg-decoration mode
This is intended for borderless maximized windows. They should be
neither client-side nor server-side decorated.
2021-12-08 21:31:16 +02: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
Xaver Hugl
db91050fb5 dmabuf-feedback: fix crash
BUG: 446502
2021-12-05 13:46:52 +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
53064d9af3 linuxdmabuf: implement dmabuf-feedback
dmabuf-feedback allows the compositor to give the client feedback on what
formats and modifiers are best to use, and for which devices it needs to
allocate its buffers, which improves performance and efficiency.
2021-11-30 10:22:31 +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
Xaver Hugl
43ccc5910b linuxdmabuf: split out declarations for private classes
The cpp file is getting too long and unwieldy
2021-11-28 13:48:14 +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
Arjen Hiemstra
8af2a010c7 Implement drag surface transformation for touch events
Reusing the pointer transformation causes drag with touch to send
completely incorrect coordinates. So implement the "TODO" item about
surface transformation for touch, so we send correct drag events for
touch.
2021-11-17 13:32:00 +00:00
Arjen Hiemstra
1bd496f42b DataDevice: Send enter event with a correct position if we're using touch
It used to send the pointer position, which may be somewhere completely
different when we're using touch.
2021-11-17 13:32:00 +00:00
Arjen Hiemstra
10eb1aa0b9 SeatInterface: Expose firstTouchPointPosition
This exposes "globalTouch.focus.firstTouchPos" so other things can use
it in place of "pointerPos" when touch is being used.
2021-11-17 13:32:00 +00:00