Commit graph

4886 commits

Author SHA1 Message Date
Vlad Zahorodnii
9371fc8ae9 scripting: Prefer VirtualDesktop objects 2023-02-07 15:41:43 +02:00
Vlad Zahorodnii
0218a8f3ba scripting: Drop deprecated apis 2023-02-07 14:07:03 +02:00
Ismael Asensio
e504c58286 kcms/tabbox: Manage shortcuts via ShortcutSettings
Leverage the standardized ShortcutSettings config object to handle
the shortcuts config for the tabox (setting default values, reading
and saving to KGlobalAccel, etc).

This way, we can remove the extra methods in TabBoxConfigForm and
improve separation between UI and logic.

It also fixes the actions getting stored untranslated when saving
from the KCM (until next restart of KWin)
2023-02-07 07:59:25 +00:00
Vlad Zahorodnii
d6315bebd0 scripting: Flatten source tree
It makes source tree tidier.
2023-02-07 07:08:04 +00:00
Ismael Asensio
9c2224acb3 kcms/tabbox: Expose shortcuts as a KConfigSkeleton
Provide a new KConfigSkeleton (ShortcutSettings) so that the
KCModuleData knows if any of the shortcuts is non-default.

This improves the UX by showing an "orange dot" in system
settings when just a shorcut has been changed.

We also need to implement a new specific KConfigSkeletonItem
(`ShortcutItem`) that uses KGlobalAccel to retrieve and store
the shortcuts, instead of storing them in a config file.
2023-02-06 21:01:35 +01:00
Vlad Zahorodnii
600de787d8 scripting: Drop org.kde.kwin 2.x
It's superseded by 3.x.
2023-02-06 18:59:10 +00:00
David Edmundson
466f2fe8ba Launch xwayland on demand
This installs a socket notifier onto our xwayland socket, when a user
connects we launch xwayland. The client then connections once kwin has
established itself as the compositor.

For a full desktop plasma session this patch effectively does nothing
too useful as we still start kcminit and make xrdb calls on startup
which in turn will launch X, but for the same reason this patch should
be harmless now as we're still processing the xrdb calls before any
clients will connect.
2023-02-06 16:24:01 +00:00
Ismael Asensio
8507e602f3 kcms/tabbox: Handle config directly within the configuration form
By passing the config object to the TabBoxConfigurationForm, we
can handle it directly instead of bouncing information from and
back between the forms and the KCM main class.

Now the user changes in the UI translate to the config objects,
which can directly provide `isSaveNeeded()` and `isDefaults()` info.

This allows to simplify the logic on both classes, reducing the
coupling between them and minimizing the number of exposed public
methods and some boilerplate.
2023-02-06 14:01:14 +01:00
Vlad Zahorodnii
9807c83929 {x11,wayland}: Fix restoring fullscreen windows
If the window has been originally on another output, make sure that the
window will be properly put back on it.

This logic seem to originate from 7d67380205,
but it's not necessary anymore because geometry restore will be updated
if the window is moved to another output by the user.

BUG: 465358
2023-02-06 11:33:35 +00:00
Ismael Asensio
a648553be0 kcms/tabbox: Improve model initialization
- Add the switchers to the model directly, instead of using
  temporal lists and a second loop over them
- Use the same model for main and alternative forms

This makes this code a little more clear and efficient
2023-02-06 09:11:34 +00:00
Joshua Goins
21dbf0f413 kcm/decoration: Change it to the new frameless style
This now matches other modern KCMs and removes the weird titlebar tab view,
moving it to a separate page.
2023-02-05 02:22:14 +00:00
l10n daemon script
71c9b7db87 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"
2023-02-04 02:09:27 +00:00
Vlad Zahorodnii
271de0ccc6 scripts: Port some scripts to org.kde.kwin v3 qml api 2023-02-03 17:22:16 +00:00
Vlad Zahorodnii
d619e0b4d5 tiling: Ensure padding is writen to config
Root tile's padding is not monitored so new padding values are never written to the config.

BUG: 464863
2023-02-03 16:40:41 +00:00
Marco Martin
1332d7de2c Also cancel translucencyMoveResizeAnimations
When a window goes away it was stoppping translucencyWindowTypeAnimation
and translucencyInactiveAnimation but any translucencyMoveResizeAnimations

was hanging there forever, causing ghost windows

BUG:439332
2023-02-03 16:23:05 +01:00
Vlad Zahorodnii
37c4a4536e scene: Sync Window::readyForPainting() to window item visibility
If a window is made ready for painting with some delay, the item won't
schedule an update. To fix that, sync the item visibility state with
Window::readyForPainting(). When the item visibility changes, a repaint
will be scheduled.

BUG: 464955
2023-02-03 14:09:27 +00:00
Vlad Zahorodnii
2babccda04 x11: Fix maximize animation
Window::maximize() used to be split in two halves:

- generic Window::setMaximized() and Window::maximize()
- protocol-specific Window::changeMaximize()

Window::changeMaximize() used to block all geometry updates and
Window::maximize() emit "maximize mode changed" signals. With that,
frameGeometryChanged came always before clientMaximizedStateChanged.

After merging Window::changeMaximize() and Window::maximize(), the order
of the signals has been reversed because of RAII. Unblock geometry
updates explicitly to preserve the old behavior.

BUG: 465157
2023-02-03 10:33:42 +02:00
Xaver Hugl
1746af4b02 gesture: use the global direction enums 2023-02-02 16:21:36 +00:00
Xaver Hugl
a9334cb9c6 unify touchpad gesture APIs
There don't need to be separate functions for real time and not real time
2023-02-02 16:21:36 +00:00
Vlad Zahorodnii
e5901070cc Drop support for _KDE_NET_WM_TEMPORARY_RULES
It's an obscure feature, which perhaps not worth putting an effort to
make it work on wayland and x11.
2023-02-02 15:34:24 +00:00
Vlad Zahorodnii
d18f7efac2 scripting: Remove deprecated properties in WindowThumbnailItem 2023-02-02 15:13:38 +00:00
Vlad Zahorodnii
5de308792f effects/fade: Remove hidden FadeWindows option
Enable/disable the fade effect in system settings instead.
2023-02-02 14:48:12 +00:00
Vlad Zahorodnii
c1fb295cd6 plugins/nightcolor: Drop legacy shortcut with localized key 2023-02-02 13:51:28 +00:00
Vlad Zahorodnii
78e0ff6b97 Avoid resizing the tile until interactive resize is actually active
It's confusing, but handleInteractiveMoveResize() can be called while
interactive move resize is inactive.
2023-02-02 12:07:13 +00:00
Xaver Hugl
6f1b36d3b4 plugins/screencast: make context current later, don't make it current twice 2023-02-02 10:18:38 +00:00
Xaver Hugl
abd59be232 x11window: round framegeometry on moveresize
If this isn't done, the size check in SurfacePixmapX11::create will stop
the window from being updated

BUG: 460934
BUG: 458778
2023-02-02 09:14:50 +00:00
Xaver Hugl
3c059d3a24 scene/surfaceitem_x11: improve size mismatch warning 2023-02-02 09:14:50 +00:00
David Edmundson
c0fa51c784 effects/tileseditor: Drop unused imports
Imports come at a big cost when they're unused.
Also we shouldn't be importing WindowView from a different plugin. If
that effect is disabled it meant tileseditor would fail to load.

BUG: 464970
2023-02-02 09:13:23 +00:00
Natalie Clarius
1b29c5668c point aurorae documentation to develop.kde.org 2023-01-31 00:33:18 +00:00
Xaver Hugl
0ef7d20fde plugins/screencast: fix window recording while no scene rendering happens
This affects direct scanout and when the window isn't triggering desktop
repaints otherwise, like being minimized or on a different virtual desktop
or activity
2023-01-30 14:25:00 +01:00
David Edmundson
99f433641a Add missing includes for KF6
This fixes includes that were implicitly brought in with KF5
2023-01-28 09:16:14 +00:00
David Edmundson
4474f4098a Xwayland: Disable input spy on xwayland teardown
Otherwise we have a potential crash when we send keys to the
non-existent xwayland wayland connection
2023-01-27 16:46:45 +00:00
ivan tkachenko
53591cdfb2
kcms/decoration: Deduplicate event proxying code 2023-01-26 23:04:40 +03:00
ivan tkachenko
5bd748c674
kcms/decoration: Use correct mask to specify that item accepts all buttons 2023-01-26 23:04:40 +03:00
ivan tkachenko
70a2aa644f
kcms/decoration: Don't setFiltersChildMouseEvents when filter method is not overridden 2023-01-26 23:04:40 +03:00
ivan tkachenko
01a7bd14ec
kcms/decoration: Remove suspicious C-style const cast 2023-01-26 23:04:38 +03:00
Vlad Zahorodnii
020b633591 backends/x11: Check whether X server supports shared pixmaps 2023-01-26 15:02:05 +02:00
Vlad Zahorodnii
81b05bd87e Avoid mistriggering quick tiling when using custom tiling
If user has chosen custom tiling, ensure that quick tiling state is
reset.

BUG: 464810
2023-01-26 12:01:46 +02:00
ivan tkachenko
63ff64b094 kcms/decoration: Fix double click behavior over the thumbnail
KDecoration.Decoration eats all the events for the sake of keeping
an illusion of buttons being like the real ones. I didn't find any sane
way to completely turn off event filtering on that level, so instead
let's fix this MouseArea, which is a workaround, but a decent one.

AFAIK this is the last KCM in Plasma to properly support "double-click
to save" behavior. There might be others though: watch out for event
filters inside thumbnail.
2023-01-25 18:05:15 +00:00
Fushan Wen
476509b0fd
effects/windowview: set translation domain for the placeholder text 2023-01-25 21:44:52 +08:00
Vlad Zahorodnii
716f386226 tabbox: Remove unused ShowDelay option
BUG: 420291
2023-01-25 13:48:27 +02:00
Vlad Zahorodnii
671cbcda6b Refactor some custom tiling code
Use already specified global position rather than look it up from the
cursor, which is quite input device specific.
2023-01-25 11:04:44 +02:00
Vlad Zahorodnii
76a039332d Make interactive custom tiling more robust to suboptimal tile configs
If the root tile node contains only one child node, but the child node
has its own children, kwin will fail to show an outline when the user
interactively tiles the window.

On the other hand, there is no reason to have this child count check.
For what it's worth, it also prevents tiling the window if the output
only has one tile, which is odd, but a valid usecase.

BUG: 464379
2023-01-25 07:32:11 +00:00
l10n daemon script
7bd4bd0bf7 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"
2023-01-25 02:03:19 +00:00
Aleix Pol
43586d673a tiles: Don't generate the client area until we know it's necessary 2023-01-24 17:58:26 +01:00
Aleix Pol
96962941e3 QuickTile: register enum to metaobject/QDebug 2023-01-24 17:58:26 +01:00
Xaver Hugl
11327da292 xdgshellwindow: ignore window position rules placing windows outside of all screens
BUG: 464047
2023-01-24 14:40:53 +00:00
Xaver Hugl
9f2ed2083c window: restore special window states on moveresize cancel
BUG: 464507
2023-01-24 11:39:02 +00:00
David Redondo
d6b75907cc Data control: Resend selection when not following through with request
Normal event flow is from a client view is
-> wlr_data_control_device.set_selection
wlr_data_control_device.selection
or
wlr_data_control_source.cancelled
wlr_data_control_device.selection
However when the race mentioned in the comment happens the client
sees
-> wlr_data_control_device.set_selection
wlr_data_control_device.selection
wlr_data_control_source_cancelled
Which can confuse client state thinking the clipboard didn't change
as it associates the selection event with its own request. Resend
the selection event in this case to tell the client the correct
selection.
BUG:464509
FIXED-IN:5.27
2023-01-24 09:35:20 +00:00
Vlad Zahorodnii
e6d2a19857 backends/drm: Fix custom mode generation
maxSizeRefreshRate is uninitialized.

BUG: 463619
2023-01-24 07:15:10 +00:00
l10n daemon script
c8a92f833b 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"
2023-01-24 02:04:53 +00:00
Xaver Hugl
7cb4b51d5e inputpanel: ignore requested output
While there's specific hardware where the IM could benefit from requesting to
be shown on a specific output, it effectively never has enough information to
choose a useful output - and the protocol doesn't allow setting a null output
to indicate that the compositor should do the choice.
To avoid showing the OSK on the wrong output, always put it on the active
output and ignore what the IM client requests.
2023-01-23 22:28:41 +00:00
Vlad Zahorodnii
cc5b917de1 tiling: Forbid overlapping quick tiles
It looks weird and it can break Tile::supportsResizeGravity() logic.
2023-01-23 16:50:31 +02:00
Vlad Zahorodnii
826fb1cb29 Fix a crash that happens when resizing quick tiled window
QuickTile::setRelativeGeometry() and QuickRootTile::setVerticalSplit() or
QuickRootTile::setHorizontalSplit() can hit recursion when size
constraints start taking effect.

This change reworks how other quick tiles are resized. With the proposed
design, when relative geometry changes, QuickRootTile will notice that
and start resizing other tiles.

When QuickRootTile resizes horizontal or vertical split, it is going to
ignore QuickRootTile::relativeGeometryChanged() signals (m_resizedTile).
It prevents hitting the recursion and makes moving h/v splits more
predictable.

I do think that in order to make the tile design more robust to this
kind of bugs, it's worth splitting geometry in two kinds though - the
one that indicates the preferred geometry (implicitWidth/implicitHeight
in qtquick lingua) and the current geometry, the parent node then
monitors the preferred geometries and updates the current geometries.

BUG: 464621
2023-01-23 14:58:09 +02:00
l10n daemon script
19f8a724f1 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"
2023-01-23 01:57:54 +00:00
l10n daemon script
0b291dcb36 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"
2023-01-22 02:01:44 +00:00
David Edmundson
bfe837c918 effects/tileseditor: Set translation domain in QML files
BUG: 464572
2023-01-20 23:21:37 +00:00
Vlad Zahorodnii
0d44092db2 wayland: Fix invisible tablet cursor
A cursor source is created but it's not attached to the cursor.

BUG: 464529
2023-01-20 14:47:54 +02:00
David Edmundson
fef1553b90 xwayland: Set parent on XwlDropHandler
A parent is provded to the XwlDropHandler but it doesn't reach the
QObject superclass
2023-01-20 09:41:01 +00:00
Vlad Zahorodnii
e83af181f7 Remove some code duplication in cursor layer code
Move some generic properties to the OutputLayer class and add a cursor
layer getter in the RenderBackend class. That allows us to get rid of
some code duplication. And we could use this work to move more cursor layer
code from backends to Compositor.
2023-01-20 08:22:18 +00:00
John Brooks
a276e6dc10 wayland: Fix high-res scroll events with low-res clients
Sending an axis event for every high-res scroll wheel movement was
causing excessive scrolling on clients that expect low-res (discrete)
scroll events.

Signed-off-by: John Brooks <john@fastquake.com>
2023-01-19 13:06:51 +00:00
Xaver Hugl
52b4ee3338 input: don't trigger titlebar actions on every event with a touchpad
Instead, accumulate the values and only trigger an action when the user
has scrolled far enough

BUG: 444737
2023-01-18 14:14:28 +01:00
Xaver Hugl
b89009f9e1 plugins/screencast: send frame callbacks if the window is otherwise invisible
If we don't send frame callbacks, the application might stop rendering or
throttle to single digit fps.

BUG: 464217
2023-01-18 08:01:45 +00:00
Vlad Zahorodnii
7c58f169e0 Store shadow elements as QImages
At quick glance, it doesn't seem like there's any benefit from storing
the shadow elements as pixmaps. It saves us some QImage <-> QPixmap
conversions too.
2023-01-18 07:27:40 +00:00
Vlad Zahorodnii
d57be742ff effects/diminactive: Ensure that m_activeWindow is always reset
As the FIXME comment says, a window can be deleted without prior
windowClosed signal.

BUG: 442222
2023-01-17 18:41:07 +00:00
Arjen Hiemstra
361aa053e1 kwinquickeffect: Use an asynchronous incubator for view creation
Creating views is the main thing blocking quick effect activation.
Rather than blocking until everything is created, we can use
QQmlIncubator so we create views asynchronously. This allows KWin to do
other things while views are being created. This is mostly relevant for
multiscreen setups where we create a view per screen.
2023-01-17 10:03:37 +00:00
Arjen Hiemstra
39a3b53bfb windowview: Only create PlaceholderMessage when needed
If there's windows and we're not searching, we don't need the
PlaceholderMessage. So only create it when we actually need it to reduce
the time needed to activate the effect.
2023-01-17 10:03:37 +00:00
Arjen Hiemstra
8242584b6e windowview: Use asynchronous instantiators instead of repeaters
We don't need the features of Repeater here and can instead just use an
Instantiator, which allows us to use asynchronous creation for the
window delegates, reducing the time needed to activate the effect.
2023-01-17 10:03:37 +00:00
Vlad Zahorodnii
cf583aa367 Change default latency policy to "Force smoothest animations"
There are some performance differences between X11 and Wayland. Desktop
systems are mostly unaffected by them, but laptops suffer a bit.

On Wayland, kwin always does double buffering. This is great for
reducing latency and avoiding tearing, but if the gpu can't keep up with
the work, you're going to see stuttering.

Another issue is that in order to reduce latency, we need to have very
good frame stats. At the moment, kwin records only cpu render time, but
we also need to record the gpu time. We've already done some work in
this area, but it's most likely Plasma 6 material. (plasma/kwin!1163)

In the meantime, let's change the default latency policy to "Force
smoother animations." It's going to improve frame rate. If people care
about latency, they can change latency policy in system settings; the
option is still there.

CCBUG: 452119
2023-01-17 04:10:30 +00:00
l10n daemon script
03c407cb7d 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"
2023-01-17 02:03:45 +00:00
Vlad Zahorodnii
d42442b424 effects: Fix a typo in RenderGeometry::appendWindowVertex()
Only the y coord is scaled, but both x and y coords have to be scaled.
2023-01-16 18:52:50 +00:00
Weng Xuetian
ff092b12b0
Add text-input-v1 support
Main reason to support this old interface is because this is the only
protocol chromium (and effectively all electron app) that supports.

The protocol itself very similar to text-input-v2 with some minor difference.
So not hard to support by just duplicate some existing code. There might be
some unclear protocol design issue if kwin need to support multiple SeatInterface,
but for now it should be ok to assume there is only one seat.

Tested using fcitx5 against weston-editor and chromium with flag
--enable-features=UseOzonePlatform --ozone-platform=wayland
--enable-wayland-ime
2023-01-16 10:34:37 -08:00
Vlad Zahorodnii
5963790b21 kcms/rules: Use window class and role with original casing
The window rules kcm uses lower-case window class and role, but kwin can
use window class and role with other casing, which will break the ExactMatch
match rule.

BUG: 464190
2023-01-16 16:52:02 +00:00
Kai Uwe Broulik
ecf3fa9f10 backends/x11: Remove dependency on GLTexture::toImage
It is being phased out. Instead, read the pixels from the
cursor's framebuffer using `glReadPixels`.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2023-01-16 15:06:20 +00:00
Vlad Zahorodnii
dedae9e667 effects/morphingpopups: Fix glitch
There's a visual glitch that looks like a random rectangle in the top
left corner of morphing popup. It appears like it's caused by the blur
effect, it produces wrong results when the window is captured in
CrossFadeEffect::redirect().

Make CrossFadeEffect::redirect() unset blur and contrast force roles, so
the backdrop effects are not included in the captured frame.
2023-01-16 13:43:18 +02:00
Vlad Zahorodnii
d32f8df7c8 effects/{blur,contrast}: Move to the front in the effect chain pos
Backdrop effects such as blur and background contrast have to be in the
front of the effect chain because they need to work with background
before the window is painted on top.

Hopefully it's going to fix panel popup blinking visual artifacts.
2023-01-16 10:23:28 +00:00
Arjen Hiemstra
f95eb71173 Remove WindowQuad::makeArrays and WindowQuad::makeInterleavedArrays
RenderGeometry can do all that these methods do and offers some extra
functionality, in addition to having a more explicit API.
2023-01-16 09:51:28 +00:00
Arjen Hiemstra
3118b48650 Disable vertex snapping for Wobbly Windows and Magic Lamp
The subdivided grid used by these effects doesn't account for pixel
alignment. If we force the generated WindowQuads to be rounded, the
quad's sizes no longer match the texture sizes, which results in blurry
rendering.

BUG: 461283

eeffects
2023-01-16 09:51:28 +00:00
Arjen Hiemstra
3ee51e3f21 Allow overriding the vertex snapping mode for OffscreenEffect
Certain effects need vertices that aren't being rounded to device
coordinates. So allow those to explicitly request that.
2023-01-16 09:51:28 +00:00
Arjen Hiemstra
2bff7c5c71 Port OffscreenEffect to use RenderGeometry for geometry
This makes the code more explicit and allows using some of the new
features of RenderGeometry in OffscreenEffect.
2023-01-16 09:51:28 +00:00
Arjen Hiemstra
622114dfb5 Move texture coordinate post processing into a method of RenderGeometry
This allows us to reuse the code in other places.
2023-01-16 09:51:28 +00:00
Arjen Hiemstra
db7283ee5c Add default global vertex attribute layouts for GLVertex{2,3}D
This avoid some duplication when using GLVertex2D for geometry.
2023-01-16 09:51:28 +00:00
Arjen Hiemstra
c9b32afb1c Add a property to RenderGeometry that determines what vertex snapping mode to use
Currently, only two modes are provided, rounding or not rounding, which
allows explicitly disabling snapping. However, should we have a reason
to add more modes it is now fairly simple to change.
2023-01-16 09:51:28 +00:00
l10n daemon script
60d41538b7 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"
2023-01-16 02:00:47 +00:00
l10n daemon script
3b5ea6e798 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"
2023-01-15 01:55:25 +00:00
l10n daemon script
e12d9c1c6b 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"
2023-01-14 17:31:49 +00:00
Xaver Hugl
9cd52b4060 backends/libinput: don't multiply v120 value by scroll speed
The value is a representation of the discrete steps a mouse wheel can take.
Multiplying that with a scroll speed destroys the whole purpose of the value.
2023-01-14 13:12:22 +00:00
l10n daemon script
31d20fab92 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"
2023-01-14 02:02:24 +00:00
Aleix Pol
a5aaa9e3c4 org.kde.KWin: Expose a window's UUID
Exposes a Window's UUID so that it can be used with other APIs like
window management or screencasting.
2023-01-13 17:51:36 +01:00
Ismael Asensio
fdd585e44c kcms/tabbox: Fix Reset not disabling Apply
Fix the code to get the actual saved shortcuts on KGlobalAccel
when discerning if they have changed.

Amends commit: 76ac4be316
2023-01-13 09:49:15 +00:00
Nicolas Fella
c9691b5855 kcms/tabbox: Don't offer switcher from global themes that don't actually ship a switcher
Some global themes, e.g. Breeze Dark, don't ship a switcher and instead point to the one from the Beeze global theme

They do show up in the selection though, which is confusing and doesn't actually work
2023-01-13 08:49:04 +00:00
l10n daemon script
392379163a 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"
2023-01-13 02:03:45 +00:00
Ismael Asensio
b11416c396 kcms/tabbox: Highlight non-default shortcuts
This sets the property on the shortcut widgets when they
should get highlighted: the option is selected in System
Settings and the shortcut is not the default.

It requires a change in `KXMLGui/KKeyShortcutWidget` to
actually paint the highlihgt ring.
(commit 47572c26, KF103)

CCBUG: 459318
2023-01-12 19:58:08 +01:00
Vlad Zahorodnii
73005fcd72 kcms/compositing: Improve wording of "allow tearing" option
When reading "allow tearing in fullscreen", I expect something after the
word "fullscreen". Either "windows" or "mode".
2023-01-12 13:30:58 +00:00
Ismael Asensio
76ac4be316 kcms/tabbox: Make shortcuts config save on apply
Currently, tabbox shortcuts are directly saved to KGlobalAccel
when they change, which is inconsistent with the rest of the
KCM and leads to confusion regarding Defaults and isSaveNeeded
status.

Let's instead manage the changes internally and just save them
to KGlobalAccel on Apply/Save.

m_actionsCollection is only used as a helpful way to store this
internal configuration, and doesn't really needs saving to
or restoring from config.

BUG: 459325
FIXED-IN: 5.27
2023-01-12 12:15:48 +00:00
l10n daemon script
b3776cef5b 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"
2023-01-12 02:01:58 +00:00
Vlad Zahorodnii
fe1054a52a autotests: Fix a typo in testKeyboardShortcutsInhibitorInterface
We need to monitor whether the inhibitorActive signal gets emitted. It
reduces the test's execution time from about 5 seconds to a couple
milliseconds.
2023-01-11 20:34:27 +00:00
Xaver Hugl
b4e8d44967 remove some macros with questionable usefulness 2023-01-11 19:22:23 +00:00
Nate Graham
d312ee24b8 effects: always use Title Case for user-facing effect titles
Most already did, but these three did not, creating inconsistency.

BUG: 464122
FIXED-IN: 5.27
2023-01-11 12:03:51 -07:00
Aleix Pol
ddd60a0c1b backgroundcontrast: Guard against calling a nullptr
There are cases where GLVertexBuffer::map will return null (as seen in
kwinglutils.cpp:1816) which does happen (as seen in the backtrace of bug
462017)
Make sure we don't call the null map in that case.

BUG: 372305
2023-01-11 14:37:10 +00:00
ivan tkachenko
ea61a6f63a
effects/magiclamp: Fix window suddenly disappearing when reversing minimize animation
In this branch a new animation is being started, so a ref-guard needs
to be the same as in the similar branch for starting minimize animation
in the slot above.
2023-01-11 14:35:20 +03:00
ivan tkachenko
f4c3ae7c20
effects/magiclamp: Fix code style (add {braces} about if body) 2023-01-11 14:32:54 +03:00
Vlad Zahorodnii
301e57169d backends/drm: Fix surface and buffer damage order in qpainter output layers
The prototype of OutputLayer::endFrame() looks as follows

    virtual bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) = 0;

On the other hand, qpainter output layers use a different order in the
header file and the cpp file.
2023-01-11 11:14:59 +02:00
Vlad Zahorodnii
91bef430bf backends/virtual: Move glFlush() to endFrame()
It makes more sense in endFrame() rather than present().
2023-01-11 08:09:19 +00:00
Vlad Zahorodnii
ff53950a6d backends/virtual: Drop KWIN_WAYLAND_VIRTUAL_SCREENSHOTS
Virtual backend is used primarily by tests, there are plans to use it
for virtual outputs too. But in either case we don't need screenshots.

I also can't imagine how it can be useful as a debugging tool. It's more
convenient to spin a windowed kwin instance.

The main motivation behind this change is to get rid of custom code in
virtual output layers and simplify it a bit more.
2023-01-11 08:09:19 +00:00
Kai Uwe Broulik
af99b4e98c backends/x11: Present surface even with empty damage
All the other backends present their surface regardless.
If the surface isn't presented, the scheduled frame is never
finished, and rendering gets stuck indefinitely.

This is also consistent with x11 standalone backend
which forgoes this check.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2023-01-10 15:18:13 +01:00
Vlad Zahorodnii
0bd4851326 effects: Fix projection matrix logic in OffscreenEffect
WindowPaintData contains two projection matrices -
screenProjectionMatrix and projectionMatrix. I'm not sure why we have
two.

screenProjectionMatrix is initialized by the scene. While
projectionMatrix is usually updated by the effects. The two are not in
sync.

On the other hand, OffscreenEffect takes into account only
screenProjectionMatrix. It means that if a window is transformed by two
offscreen effects, the final result is going to be broken because
an OffscreenEffect must use the projection matrix specified by another
OffscreenEffect, which it doesn't.

This change cleans up projection matrix properties in WindowPaintData,
so there's only one projection matrix property. With that, offscreen
effects can be properly nested.

BUG: 462876
2023-01-10 12:05:28 +00:00
Nate Graham
0075f7bd16 Use more user-friendly terminology for border actions everywhere
The window rules KCM calls this "No titlebar and frame", but different
less user-friendly terminology is used for the context menu action and
the global action. Let's unify them using the more user-friendly name.

BUG: 464007
FIXED-IN: 5.27
2023-01-09 15:16:51 -07:00
Niklas Stephanblome
1f1e67f90b effects/overview: Correct size of active virtual desktop highlight outline
The focus outline that highlights the active virtual desktop in the Overview effect, as
well as the half-transparent outlines that are around the other virtual desktops, cover
2 pixels on every side of every virtual desktop thumbnail.

This is because an invisible rectangle is used that has the same size as the thumbnail
and has a colored border, but borders are always drawn on the inside of QML rectangles,
so content in the thumbnail is covered up. Therefore, the width of the rectangle has to
be slightly adjusted to account for the thickness of the border.

BUG: 450963
FIXED-IN: 5.27
2023-01-09 16:29:52 +00:00
l10n daemon script
2f8e2ef689 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"
2023-01-09 02:00:23 +00:00
Xaver Hugl
2525109f1a window: use std::unique_ptr to manage the windowitem 2023-01-07 21:52:10 +01:00
Xaver Hugl
797bcb8bda window: use std::unique_ptr to manage the effectwindow 2023-01-07 21:52:10 +01:00
Xaver Hugl
3c8d2d6f18 window: use std::unique_ptr to manage the shadow 2023-01-07 21:52:10 +01:00
Weng Xuetian
6e87fae7f7 Support XKB_CONTEXT_NO_SECURE_GETENV flag
Since kwin play with CAP_SYS_NICE, secure_getenv will fail for xkbcommon
to load user level xkbmap. This allows kwin to load config under
~/.config/xkb

BUG: 447206
2023-01-07 11:35:42 +00:00
l10n daemon script
97041dab12 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"
2023-01-07 02:06:50 +00:00
Vlad Zahorodnii
b0e452563b kcms/effects: Fix effect loading/unloading order
There are effects that are mutually exclusive, e.g. magnifier and zoom.
They both use the same global shortcuts.

When switching from zoom to magnifier, the zoom effect must be unloaded
first, then the magnifier effect can be loaded. Doing so in the opposite
order will break global shortcuts in the magnifier effect because
zooming shortcuts are still bound by the zoom effect.

BUG: 457800
2023-01-06 13:41:38 +00:00
Nate Graham
6a1552efb6 utils/xcbutils: reduce severity of "precision lost" message a debug
Right now this is marked as critical, but it's not a critical error.
Make it a debug to avoid spamming logs with not-very-actionable
information.

BUG: 463259
FIXED-IN: 5.27
2023-01-05 13:59:43 -07:00
David Edmundson
1651b7d1d7 Include layer postPaint in render loop timings
We need render timings in the journal to be as close as possible to the
entirity of the composite function up until the backend presenting.
2023-01-05 14:41:43 +00:00
Han Young
d57495c8df Remove tablet tool when the tablet device is removed
Explicitly remove the tablet tool device when the corresponding sys event interface is removed.
2023-01-05 14:40:46 +00:00
David Edmundson
0167b7d7b0 libinput: Ignore touch events without outputs
A touch device could have no output object assigned due to the screen
being disabled, queued events or malconfiguration.

Using output would crash. Touch up is guarded so that we have matching
pairs.

BUG: 463385
2023-01-05 08:29:06 +00:00
l10n daemon script
8675ee5939 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"
2023-01-05 02:00:53 +00:00
Nicolas Fella
54e384e68e Enable scripted effects to load config translations from the kpackage
By default translations are loaded from /usr/share/locale. This works fine for builtin effects
since we install our translations there.

However, it doesn't work for third-party scripted effects. They only provide a kpackage and can't
install anything to /usr/share/.

This patch allows them to ship translations in contents/locale/$language/LC_MESSAGES/$domain.mo,
where $domain is the X-KWin-Config-TranslationDomain metadata value

This matches what Plasma does for applets since https://phabricator.kde.org/D5209

CCBUG: 317338
2023-01-04 21:35:59 +01:00
Nicolas Fella
a40dd9a158 Only make startup notification change the virtual desktop if requested
Startup notifications optionally contain the target desktop the app should be launched to.

If present the window is sent to that desktop, if not it is sent to the current desktop.

Later in Workspace::activateWindow we check if the window is on the current desktop, and if not
we either move it to the current desktop or switch to the window's desktop depending on user preference.

However, this is broken because the window was already moved to the current desktop. To avoid this
only move the window if specifically requested by the startup id.

BUG: 462996
2023-01-04 12:12:26 +00:00
Vlad Zahorodnii
b549776b68 scene: Avoid creating SurfaceItem for Xwayland's cursor surfaces
SurfaceInterface::scaleOverride() doesn't scale the bufferScale, so if the
scale override is 2, but the buffer scale specified by the client is 1,
bufferScale() will return 1.

Xwayland cursor surface implicitly relied on this behavior.

Porting cursor to SurfaceItem changed that. Now cursor surfaces honor
the scale override, which makes Xwayland cursors too small.

In order to properly fix, plasma has to scale Xcursor.size in xrdb. The
problem is that plasma also sets XCURSOR_THEME and XCURSOR_SIZE envvars
that take precedence. Plasma must stop setting those envvars, but it's
doable only with Qt 6.5, which got MouseCursorTheme and MouseCursorSize
hints in QPlatformTheme.
2023-01-04 11:10:32 +00:00
Vlad Zahorodnii
c10b35facb backends/wayland: Pass linux-dmabuf buffers for cursor layer
This lets us avoid reading fbo data back.
2023-01-04 09:19:12 +00:00
Vlad Zahorodnii
9f100e8292 core: Make Output::setCursor() take CursorSource
It decouples the contents of the cursor from QImage.
2023-01-04 09:19:12 +00:00
Vlad Zahorodnii
d8e6992512 tiling: Fix invalid sender object in connect()
RootTile is a CustomTile and it has no parent because it's the root.
Therefore the sender object in connect() will be null and it's going to
produce a warning.
2023-01-04 09:00:44 +00:00
Oliver Beard
7b714bdecb plugins/nightcolor: Use Night Color icon for preview OSD 2023-01-04 04:26:40 +00:00
l10n daemon script
824ef8a74e 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"
2023-01-04 02:02:56 +00:00
Xaver Hugl
885e3712fc useractions: add "Move to Activity" entries
This mirrors the menu in the task manager and makes it a lot more convenient
to send windows to the correct Activity

BUG: 440036
2023-01-03 23:12:18 +00:00
Xaver Hugl
6e13e21a08 workspace: take touch and tablet into account for active output follows mouse
While not technically fitting for the name of the option, the behavior is what a user
would expect and it also matches with X11 (where the cursor goes to the touch position).
2023-01-03 20:01:11 +00:00
Vlad Zahorodnii
fb1a6ecd8d backends/drm: Fix buffer centering with active hardware transform
Prior to beb6cca65d, the drm backend used
to specify QRect(0, 0, modeSize.width(), modeSize.height()) CRTC rect,
so we didn't have to care about buffer transforms, but now that we
compute the CRTC rect from the buffer size, we have to take the buffer
transform into account.

It fixes squashed output contents when the output is rotated 90 or 270
degrees and it uses hardware transforms.
2023-01-03 17:36:21 +00:00
Vlad Zahorodnii
88563cbc8e scene: Remove addDamage() in SurfaceItem::discardPixmap()
Scene::Window::discardPixmap() used not to add damage. No idea how it
got in SurfaceItem::discardPixmap(). Perhaps a mishap when introducing
window items.

From logical point of view, adding damage when discard a pixmap is not
necessary too because a new pixmap is going to be created.
2023-01-03 11:55:36 +00:00
Vlad Zahorodnii
3725d67ee1 scene: Introduce cursor item and scene
The cursor scene contains the contents of the cursor. It contains a
CursorItem. The CursorItem either creates a SurfaceItem or an ImageItem
based on the currently attached CursorSource.

The cursor item is rendered by the cursor scene. For now, wherever the
cursor must be rendered, a dummy scene delegate is constructed. It's not
nice but it's a pretty cheap operation. There's a lot of potential for
clean up by moving cursor layer handling from output backends to
compositor. The main reason why there are no persistent scene views is
that it's just easier than tracking when they are actually used, e.g.
after switching between hw and sw cursor.

The software cursor fallback is a bit tricky case. It made to work by
constructing a scratch fbo. The cursor scene is rendered in the scratch
fbo, which is then rendered on the screen. Similar to the case above,
there's space for improvements, but I don't think it has to block the
effort for reusing Items to render the cursor.
2023-01-03 09:33:17 +00:00
Vlad Zahorodnii
dda77f5942 scene: Introduce ImageItem
The ImageItem provides a way to integrate an image in the scene graph.
2023-01-03 09:33:17 +00:00
Oliver Beard
036a66f996 plugins/nightcolor: Use Night Color icon for OSD
This makes the OSD message for Night Colour inhibition use the same icon as the tray applet.

I'm not sure where the original icon `preferences-desktop-display-nightcolor-off` is, but it would seem a good idea to remove it?
2023-01-03 09:00:32 +00:00
Xaver Hugl
d49cb64231 scene: ensure OpenGL texture is updated after direct scanout
While direct scanout happens, the damage of the SurfaceItem is reset, which
can cause the OpenGL texture to not be updated once direct scanout ends,
and leave the texture outdated until the surface is damaged again.
In order to fix that, make sure the texture is always fully updated after
the SurfaceItem has been used in direct scanout.
2023-01-02 12:57:13 +01:00
Steve Leung
501a45a869 scripting: log callDBus errors at warning level
If `callDBus` hits a problem, KWin will log a debug message saying that an error occurred, but it does not log the actual error message.  This makes troubleshooting KWin scripts more difficult.

Since the call failed, log the message at warning level to make it more visible.
2023-01-02 09:25:13 +00:00
Vlad Zahorodnii
58916aac4e tabbox: Remove Xcb::sync()
TabBox::hide() used to contain the following code

    QApplication::syncX();
    XEvent otherEvent;
    while (XCheckTypedEvent(display(), EnterNotify, &otherEvent))
        ;

The purpose of XSync() is to flush any pending requests and wait until
the X server processes them. After that, we can go through event queue
to find relevant events.

Why did tabbox go through the event queue to find the EnterNotify
events? It's unclear. So it was removed in
b4c957b617. However, the XSync() call was
left out. It doesn't make sense on its own. So remove it too.
2023-01-02 08:28:47 +00:00
l10n daemon script
8e140db62e 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"
2023-01-02 02:31:51 +00:00
l10n daemon script
752f565521 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"
2023-01-01 02:21:02 +00:00
Andreas Cord-Landwehr
ee87e8699d Include missing cmath header for std::round
Fixes compilation on Yocto Kirkstone.
2022-12-31 12:18:27 +00:00
Parag W
6352173651 Fix compile failure without XINPUT
Declare and reference m_xinputIntegration only if HAVE_X11_XINPUT is defined and enabled.
2022-12-31 11:19:45 +00:00
Xaver Hugl
beb6cca65d backends/drm: support hardware scaling with direct scanout 2022-12-30 18:16:26 +00:00
Niklas Stephanblome
39612ade13 effects/overview: allow entering spaces in search field
In the Overview effect, pressing the space bar doesn't always insert a
space character into the search field as one would expect; when the text
in the search field matches any windows, it instead activates the
highlighted window. At other times, it does insert a space as expected.

This behavior is unpredictable and unintuitive, so this commit fixes the
issue by intercepting the key input event and inserting a space when the
search field has focus. In this state, the highlighted window can be
activated using the enter/return key. When the search field doesn't have
focus, a press of the space bar will continue to activate the selected
window.
2022-12-30 17:44:48 +00:00
Xaver Hugl
239207c5ee backends/drm: extend connector lifetime to match their outputs
As disconnected outputs outlive DrmGpu::updateOutputs, the DrmConnector
and DrmPipeline must also be kept valid for that time

BUG: 463334
2022-12-30 14:53:45 +00:00
Nicolas Fella
ccaf0210d1 Ignore critical notifications in window heap effects
We filter out regular notifications, but critical notifications are their own window type, so we need to explicitly filter them too

BUG: 463437
2022-12-30 10:47:09 +00:00
l10n daemon script
fddd65deda 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-12-30 02:09:12 +00:00
Joshua Goins
37adc06603 wayland: Send tilt and rotation events, if supported
While tilt is sent on X11, we're currently only sending pressure events and not tilt/rotation events on Wayland. Since Krita is still running in X11, and it's running through XWayland - it's technically a Wayland client and gets no tilt/rotation. This fixes that issue :-)

I saw !3231 which was working on complete Wayland tablet support, but it's been stagnating. I just wanted tilt & rotation support now, so I added a way to query capabilities from the `m_capabilities` variable on the private interface we already fetched.

Tested on Krita using the Tablet Debug Log.
2022-12-30 01:57:25 +00:00
Xaver Hugl
40ca578bd0 workspace: don't make the placeholder output too big
The size is used in NETRootInfo::setDesktopGeometry, which seems to cause
some applications to misbehave or even crash because they attempt to create
a texture larger than what the GPU supports

CCBUG: 461848
2022-12-29 21:19:04 +00:00
Nate Graham
b9612ca0b7 kcms/kwineffects: use new term "Peek at Desktop"
The widget was renamed a while back, but the KCM still used the old
term to refer to it when letting the user choose the visual effect that
it shows the user. Let's change that.

BUG: 463087
FIXED-IN: 5.27
2022-12-29 18:03:02 +00:00
Andrey Butirsky
58e2ce1057 cleanup: get rid of "parent" argument
- The Xkb object is owned by std::unique_ptr
so there is no need in the parent relationship

- Remove unused header
2022-12-29 16:55:33 +00:00
Andrey Butirsky
9bbcc506d3 fix ASAN detected stack-use-after-return error
Fixes: https://invent.kde.org/plasma/kwin/-/issues/129
2022-12-29 16:55:33 +00:00
l10n daemon script
e98282a8a6 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-12-26 02:05:01 +00:00
ivan tkachenko
c735463916 Remove whitespace between "5 %" in actions names 2022-12-23 15:31:06 +00:00
Aleix Pol
ee7f4c47b2 screencast: Do not attempt to render an empty cursor
This will make the system assert upon bind as the image is null and thus
never allocated.
2022-12-23 04:46:43 +01:00
l10n daemon script
ae605bab12 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-12-23 01:55:25 +00:00
Xaver Hugl
e3586f7dbf fix some warnings 2022-12-21 21:42:49 +00:00
Xaver Hugl
1d98333660 effects/tileseditor: don't mix QObject and std::unique_ptr ownership 2022-12-21 21:42:49 +00:00
Xaver Hugl
1a8c796536 backends/fakeinput: fix time 2022-12-21 21:07:15 +01:00
Xaver Hugl
f6b6d3051b use std::chrono::microseconds for time in input events 2022-12-21 21:07:15 +01:00
Xaver Hugl
3390904c19 input: use KeyEvent instead of QKeyEvent 2022-12-21 21:07:15 +01:00
Xaver Hugl
55e55b9b15 input: use WheelEvent instead of QWheelEvent 2022-12-21 21:07:15 +01:00
Xaver Hugl
3d92f5b75f input: use MouseEvent instead of QMouseEvent 2022-12-21 21:07:15 +01:00
Xaver Hugl
0777d076e6 wayland/seatinterface: remove properties
They're not used for anything
2022-12-21 21:07:15 +01:00
Vlad Zahorodnii
bcdb2ff57c Add CursorSource size getter
CursorSource::size() provides a way to get the size of the attached
cursor source without actually looking into its contents.
2022-12-21 18:30:27 +00:00
Asahi Lina
d8da7a4eaa kwinglutils: Restore the default FB when the last FBO is unbound
Fixes GL warnings in GbmSurface::makeContextCurrent() when using
screencasting.
2022-12-21 12:34:24 +00:00
Asahi Lina
a508149882 dmabuf: Create buffers without the SCANOUT flag
gbm_bo_create_with_modifiers implies the GBM_BO_USE_SCANOUT flag, which
disables complex (tiled or compressed) formats that cannot be used for
scanout. This reduces performance. We don't need to scan out buffers
created for sceencasting/etc., so this is suboptimal.

By switching to gbm_bo_create_with_modifiers2, we can explicitly pass
the flags and avoid falling back to lower performance formats. Also add
a config check and fall back to the old version, to retain compatibility
with older mesa versions.
2022-12-21 12:34:24 +00:00
Asahi Lina
f5a80f0d3c screencast: Don't skip the last valid modifier
Since modifiers are listed in preference order, the last one is usually
the most general fallback. If we drop it, we risk winding up with no
usable modifiers.

On Apple GPUs with the Asahi driver, the received modifiers are usually
compressed, twiddled, and linear. Dropping linear means we only request
complex formats. But then gbm_bo_create_with_modifiers always requests
a scanout-capable BO which cannot support complex formats, and we wind
up with nothing. This breaks screencasting on these platforms.
2022-12-21 12:34:24 +00:00
Vlad Zahorodnii
f37acaff54 scene: Split base Scene class from WorkspaceScene class
The main motivation behind this change is to share rendering code
between windows and the cursor, specifically the Item class which
requires a Scene.

Note that Scene subclasses are responsible for issuing
ItemRenderer::renderItem() calls. The main reason for that is the
current architecture of the effects system, specifically we need to call
some effects hooks before and after painting a window.
2022-12-21 12:20:23 +02:00
Vlad Zahorodnii
6c71bfd800 scene: Rename Scene to WorkspaceScene
Currently, the Scene class is used to represent the contents of the
Workspace so rename it to match its usage.
2022-12-21 11:49:07 +02:00
Vlad Zahorodnii
9c0056c96d Make opengl cursor delegate push fbo
This case was overlooked in 8071ade9a8.
2022-12-21 09:16:50 +00:00
Vlad Zahorodnii
ccf5623f34 backends/wayland: Flush rendering commands in endFrame()
eglSwapBuffers() used to flush rendering commands but now that we render
to dmabufs, we need somehow to flush the rendering commands to the dmabuf.

It fixes some of the weird rendering issues that I see sometimes.
2022-12-21 09:16:50 +00:00
l10n daemon script
d11181090c 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-12-21 01:55:00 +00:00
Xaver Hugl
f90ec209d4 core/renderlayerdelegate: remove QObject parent
Managing an object with both std::unique_ptr and a QObject parent at the
same time is unnecessary and potentially dangerous
2022-12-20 23:38:46 +01:00
Vlad Zahorodnii
5553d0e0f4 Introduce SurfaceCursorSource
The contents of the cursor can be either a normal image or a wl_surface.
At the moment, we get an image from the wl_surface. But it's going to be
changed so we use SurfaceItem to render wl_surface cursors.

SurfaceCursorSource provides the way to get the wl_surface handle from
the cursor. In order to provide backwards compatibility, it also provides
a QImage.
2022-12-20 15:17:59 +02:00
Vlad Zahorodnii
877406ba50 wayland: Emit Cursor::changed signal when cursor surface is committed
The damaged signal is wired to the KWaylandServer::Cursor::changed
signal to indicate when the cursor image changes, makes sense.

But it can create issues if you repaint cursor SurfaceItem when the
SurfaceInterface::damaged signal is emitted. There might be other
signals that we need to wait for to invalidate SurfaceItem's state.

The SurfaceInterface::committed is a better signal. When it's emitted,
the surface commit has been completed. Technically, it's different from
the damaged signal, but in practice they are equivalent. GTK and Qt
always damage the cursor surface.
2022-12-20 09:06:19 +00:00
l10n daemon script
6ab6f188cd 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-12-20 01:50:45 +00:00
Vlad Zahorodnii
4e2e9ab78a wayland: Fix updating pixel data from translucent client buffers when using qpainter backend
We must set QPainter::CompositionMode_Source to overwrite the old
contents.
2022-12-19 18:15:00 +00:00
Vlad Zahorodnii
977016b743 scene: Change clear color in ItemRendererQPainter
It makes the behavior of the ItemRendererQPainter compatible with the
behavior of the ItemRendererOpenGL. It is needed to ensure that the
cursor layer is properly cleared too.
2022-12-19 17:02:20 +02:00
Vlad Zahorodnii
09e0fa5eb8 backends/wayland: Request wl_shm_buffers with RGB32 format 2022-12-19 16:40:39 +02:00
Vlad Zahorodnii
fc36affdee backends/wayland: Specify correct format for remapped primary layer buffers
We don't need the alpha channel and WaylandQPainterBufferSlot specifies
RGB32 format in its constructor.
2022-12-19 14:50:40 +02:00
Vlad Zahorodnii
30d856b9cb scene: Pass Scene to Item constructor
This is needed to establish explicit connection between an item and the
scene it belongs to. For now, the scene must be known at the item
construction time. Perhaps it can be improved in the future by items
inheriting their scene from the parent item, but the scene would need to
be refactored more so there's a root item or something like that.
2022-12-19 11:35:26 +00:00
l10n daemon script
0509dec92f 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-12-19 01:54:39 +00:00
Vlad Zahorodnii
2819a3cb4f scene: Decouple Item from Workspace and Output
Currently, Item schedules repaints taking output geometry into account,
but that's going to work poorly for cases other than workspace scene.

Moving from Output to SceneDelegate also allows us to unify some X11 and
Wayland specific code paths in Item.

Furthermore, it ensures that effects->paintScreen() won't remove pending
repaints for the output.
2022-12-18 20:25:40 +00:00
Xaver Hugl
b95c93517b backends/drm: fix VRR detection
The pending value always retains the value initially read and is not updated
when the driver changes the property value.

BUG: 463172
FIXED-IN: 5.26.5
2022-12-18 18:29:32 +01:00
l10n daemon script
3af5bec4ba 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-12-18 02:12:19 +00:00
Vlad Zahorodnii
8071ade9a8 scene: Make ItemRenderer responsible for pushing fbo
It makes more sense for an output layer to return the render target fbo.
The user of the render target will then take appropriate steps to bind
the fbo. It reduces the amount of boilerplate code in output layers too.
2022-12-18 00:44:51 +00:00
Nicolas Fella
a0e3a6e54b Port away from deprecated KService::property overload 2022-12-18 01:19:07 +01:00
Vlad Zahorodnii
f2857d556f scene: Drop SceneOpenGL::openGLPlatformInterfaceExtensions()
It doesn't belong in the Scene, whose sole responsibility is to draw
windows.
2022-12-18 00:05:48 +02:00
Vlad Zahorodnii
23bef7601e core: Move surface texture factory functions to RenderBackend
The goal is to create surface items for things that are not in the
workspace scene. RenderBackend perhaps is not a great place for these
factory functions. On the other hand, this change merely rewires code
from Scene to RenderBackend. I think that in distant future we could
make surface items pick surface texture type on their own, for what it's
worth that's what we would do in QtQuick.
2022-12-17 21:35:40 +00:00
Vlad Zahorodnii
f94b8bfa86 kcms: Simplify directory naming
Remove "kwin", it's repetitive and doesn't add new information. In
addition to that, prefixing commits that change kcms will become more
straightforward. There's more than one scheme people use, some include
"kwin", some don't.
2022-12-17 20:02:16 +00:00
Alexander Lohnau
7a83e4542c kcmkwin/kwineffects: Adjust "Name" in knsrc file
In the QML code we set the text of the KNS button to `i18n("Get New Desktop Effects...")`.
Consequently we should use the same terminology in the knsrc file.

BUG: 463021
2022-12-17 19:46:24 +01:00
Vlad Zahorodnii
1ca263d588 scene: Move OffscreenQuickView painting to EffectsHandlerImpl
There's no any way to integrate OffscreenQuickView into the scene graph.
So make the EffectsHandlerImpl responsible for drawing quick views until
the corresponding item is introduced (requires a lot and a lot of
refactoring in effects) or the design of kwin changes so much that we
don't need this special code path.
2022-12-17 17:14:43 +00:00
Vlad Zahorodnii
4ded856fbf scene: Introduce ItemRenderer
ItemRenderer class provides Item rendering facilities. The main
motivation behind this change is to extract code that can be used to
render both normal windows as well as the cursor.
2022-12-17 17:14:43 +00:00
Xaver Hugl
9078d916c2 backends/drm: fix error in finding the best plane 2022-12-17 15:40:43 +01:00
l10n daemon script
3ea6ed0b60 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-12-17 12:16:25 +00:00
l10n daemon script
59383ef665 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-12-17 01:58:50 +00:00
Xaver Hugl
3204d6ac3c port all headers to pragma once 2022-12-16 20:58:17 +00:00
Xaver Hugl
4a09f97679 openglbackend: reduce timeout for handling graphics resets
With current and broken behavior in Mesa, the timeout will always be
reached. GPU resets don't take anywhere near even a second, making
the user wait for 10s has no use.
2022-12-16 20:04:37 +00:00
Xaver Hugl
3335716d7b backends/drm: reset cursor texture on compositing reset
When a GPU reset happens, the old texture and vbo become invalid
2022-12-16 20:04:37 +00:00
Xaver Hugl
6211654e11 openglbackend: increase severity of GPU reset messages 2022-12-16 20:04:37 +00:00
Xaver Hugl
01bf4f12d3 kwinglutils: don't crash on gpu resets 2022-12-16 20:04:37 +00:00
Vlad Zahorodnii
f7a8635b10 Move scene related bits into src/scene/ directory
We've got quite a few scene related files, move them in a directory to
group related code together.
2022-12-16 19:15:35 +00:00
Vlad Zahorodnii
44439baad2 scene: Move some opengl initialization to Compositor
This kind of code doesn't belong in the SceneOpenGL. Moving it to the
Compositor class allows us to make the Scene class less central and
permit running with more than one scene, e.g. one for the workspace and
the other one for the cursor, etc.
2022-12-16 18:25:15 +00:00
Xaver Hugl
efbc86ef6d wayland/drmlease: invalidate lease requests with invalid connectors 2022-12-16 13:47:48 +00:00
Xaver Hugl
c2150988f2 wayland/drmlease: don't connect with nullptr parameter 2022-12-16 13:47:48 +00:00
Xaver Hugl
2c0091aacf wayland/drmlease: don't leak lease connectors 2022-12-16 13:47:48 +00:00
Vlad Zahorodnii
eec07c477d wayland: Require to reboot computer after changing primary selection option
Not all clients handle well withdrawing the primary selection global at
runtime, so apply the new primary selection option only after a reboot.
2022-12-16 12:47:11 +00:00
Vlad Zahorodnii
da229ebe85 Revert "Disable PrimarySelection in seat setPrimarySelection"
This reverts commit e60f26e0ab.

Cancelling the primary selection breaks text selection in applications
such as gedit. In those apps, you can't select text neither with your
mouse nor keyboard.

BUG: 461498
2022-12-16 12:47:11 +00:00
Yuri Chornoivan
c709511c81 Fix minor typo 2022-12-16 09:02:10 +02:00
Nate Graham
0f693fe087 kcmkwin/xwayland: add an explanation on top
These settings are highly technical, and users are likely to feel
completely lost or intimidated when they see them if they're just
browsing around. Let's add some text to explain what the heck this is
for.
2022-12-15 15:09:34 -07:00
Nate Graham
7a4c2a5caa kcmkwin/xwayland: put radio buttons in a FormLayout
This is the typical way we do this. The result looks the same in a
width-constrained window, but uses the more common FormLayout
appearance for big windows.
2022-12-15 15:07:04 -07:00
Vlad Zahorodnii
07a022de5b Use glGetTexImage() in GLTexture::toImage()
glGetTextureImage() requires OpenGL 4.5+. glGetTexImage() is available
since OpenGL 2.0.
2022-12-15 21:03:18 +00:00
Harald Sitter
8f36c0f66f buttonrebinds: some stylistic polish
- obey rule of 5
- always initialize variables at declaration
- don't be needlessly explicit about things
- prefer std::array over c arrays
- don't else if after return
2022-12-15 20:06:20 +00:00
Vlad Zahorodnii
bf48c3b80d scene: Remove dnd icon hack
Currently, kwin blits the dnd icon onto the cursor image. This doesn't
work on mobile because the cursor is usually hidden there.

As a short term solution, put the dnd icon in the Scene. In the future,
it needs to be put in its own render layer.
2022-12-15 19:19:37 +00:00
Vlad Zahorodnii
2d71eb720b backends/wayland: Allocate buffers with GBM_USE_SCANOUT too
It most likely doesn't matter in real life as many compositors don't use
direct scanout for windowed surfaces, but it won't hurt.
2022-12-15 17:53:07 +00:00
Vlad Zahorodnii
a14998b790 backends/wayland: Port away from gbm_bo_create_with_modifiers2()
gbm_bo_create_with_modifiers2() is quite new and there are still distros
that ship 21.2 and older.
2022-12-15 17:53:07 +00:00
Aleix Pol
fc2447071e Xwayland: Allow users to optionally let Xwayland eavesdrop on certain modes
It's somewhat popular for voice communication applications to support
Push-to-Talk. This means that the process itself expects to get all of
the system input. This behaviour albeit sound does not work on Wayland
systems.

This commit adds an option to let legacy X11 applications that assume
they will be getting all information to do so until these apps are
properly ported to the XDP GlobalShortcuts.
2022-12-15 16:35:37 +00:00
Aleix Pol
245859637f kwaylandserver: avoid creating unnecessary containers just to iterate 2022-12-15 16:35:37 +00:00
Xaver Hugl
096351cff7 wayland/outputmanagement: ignore non-desktop outputs
Otherwise, applying all output configurations fails when you have a VR
headset connected
2022-12-15 13:58:58 +00:00
Arjen Hiemstra
63ba8e0eaf scenes/opengl: Use hardware clipping for clearing the background
Right now, when `paintBackground()` is called to clear the background,
we use custom geometry and render that when the damage region isn't
infinite. Rather than using geometry, we can instead use `glScissor()`
to set the area that needs to be cleared and then use `glClear()` to
clear it.

In addition, if we have only one rect in the damage region and that rect
matches the render target rect, we can completely skip all that setup
and use `glClear()` directly.
2022-12-15 12:12:32 +00:00
Vlad Zahorodnii
f8fb0feab8 scene: Decouple SurfaceItem from Window
The main motivation is to allow SurfaceItem used to be to present non
window contents.
2022-12-15 11:15:21 +00:00
Vlad Zahorodnii
93f053b514 Remove QRegion argument in Window::damaged() signal
In most places, it's actually not needed and we actually provide wrong
damage region at the moment anyway. In long term, it would be great to
drop the Window::damaged signal.
2022-12-15 11:15:21 +00:00
Philipp Sieweck
b095f51035 window: Fix potential freeze during resize
The loop in `Window::handleInteractiveMoveResize` "bruteforces" the
value for `nextMoveResizeGeom` such that the area of
`nextMoveResizeGeom` contains at least `requiredPixels`. In each loop
iteration, one or more attributes (left, right, top, bottom) of
`nextMoveResizeGeom` are selected to be moved +/-1.0 towards the value of
`currentMoveResizeGeom`. The loop terminates if either the area of
`nextMoveResizeGeom` is large enough or `nextMoveResizeGeom ==
currentMoveResizeGeom`.

The problem is that the variables compared and adjusted here are floating
point variables, and their difference may not be a whole number. Using
+/-1.0 adjustments can make the loop oscillate indefinitely around the
target value.

This commit ensures loop termination by using `qFuzzyCompare` to compare
floating point values and correctly handles the cases where adjustments
smaller than 1.0 are needed to reach the target value.
2022-12-15 10:10:56 +00:00
Xaver Hugl
0efb8d01db wayland: implement output order interface
Only thing missing is the kscreen integration bit, but that can't be done before kscreen actually stores the output order somewhere.

Depends on https://invent.kde.org/libraries/plasma-wayland-protocols/-/merge_requests/52
2022-12-15 10:08:36 +00:00
Vlad Zahorodnii
d740fca68c backends/x11: Port to SHM
The main motivation behind this change is to let kwin use the PRESENT
extension to present output contents when using QPainter backend, so we
get PresentCompleteNotify events.

Besides that, we could potentially make X11 windowed backend forward
wl_shm_buffers to Xorg.
2022-12-15 08:09:22 +00:00
Vlad Zahorodnii
ae4c3c1a65 backends/x11: Use PRESENT extension to get notified about frame completion
Currently, we use a timer to get notified when a frame is presented, but
there's a better way using PRESENT extension's PresentCompleteNotify events.

Note that we implicitly rely on the fact that EGL implementation uses
the PRESENT extension to present pixmaps, which is usually the case.
QPainter backend needs some adjustments.
2022-12-15 08:09:22 +00:00
Harald Sitter
80ef6295b7 wayland: offer opt out from permission checks
we need this because our paths in CI contexts are mutable and as such
the regular permission logic must not be applied
2022-12-14 21:56:46 +00:00
Thenujan Sandramohan
b34a5a4b4b kcmkwin/kwindesktop: Make new virtual desktops have numbered names
BUG: 410366
FIXED-IN: 5.27
2022-12-14 21:24:21 +00:00
Vlad Zahorodnii
5555ed2836 scene: Fix a typo in WindowItem::updateShadowItem()
Hopefully it's going to fix warnings about bad reference item in
Item::stackBefore().
2022-12-14 18:15:52 +00:00
Xaver Hugl
2a6e3b7ad8 core/outputconfiguration: use std::weak_ptr for storing the mode
Otherwise an unplugged output can cause use-after-free problems on OutputChangeSet
destruction
2022-12-14 15:33:02 +01:00
Xaver Hugl
3c2f0e626b workspace: match KScreen when computing the hash without an edid 2022-12-14 11:04:58 +00:00
Xaver Hugl
892393ffa1 workspace: handle duplicate output hashes correctly
Some outputs have the same EDID, which results in two connected outputs
having the same hash. To find out which config values need to be used,
also check the connector name.
2022-12-14 11:04:58 +00:00
Vlad Zahorodnii
77570c0667 backends/{x11,wayland}: Avoid painting null cursor image
GLTexture(QImage()) may construct an invalid texture, which is going to
make GLTexture::bind() and other requests fail.
2022-12-14 09:03:05 +00:00
David Edmundson
c4b134da8d Implement wp-fractional-scale-v1
This allows clients to provide buffers at native resolutions when
fractional scaling is used.

Virtual backend is adjusted to support scales as floats
2022-12-12 12:16:18 +00:00
l10n daemon script
14b48796ee 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-12-12 01:56:33 +00:00
Xaver Hugl
ffad2dd7ad backends/drm: don't break crtc<->plane connections
The kernel rejects such commits without the crtc being completely turned
off first.

BUG: 462214
2022-12-11 15:01:28 +00:00
l10n daemon script
f2bca662da 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-12-11 01:54:54 +00:00
Ismael Asensio
e8545fdb37 kcms/rules: Notify when a window does not provide a class
Some applications do not provide a window class according to
the spec (WM_CLASS on X11, appId on Wayland), so KWin cannot
"detect" this property.

In those cases, notify the user that this is a bug within the
application (so it is not confused for a KWin misbehavior)
and also prevent setting a wrong description.

BUG: 462644
FIXED-IN: 5.27
2022-12-10 23:24:50 +01:00
Ismael Asensio
bee2c65918 kcms/rules: Use Kirigami.Dialog for error messages 2022-12-10 23:24:50 +01:00
Ismael Asensio
1d5b3a3c89 kcms/rules: Set a title for error messages 2022-12-10 23:24:50 +01:00
Xaver Hugl
d8dc46856e effects/blendchanges: ignore fullscreen windows
Fullscreen windows are most likely games or videos, where the blend effect is an
annoyance that freezes the screen for a moment when a accent color change is triggered
in the background.
2022-12-10 16:28:43 +01:00
Vlad Zahorodnii
555c208b87 backends/x11: Drop X11WindowedBackend::window() 2022-12-10 12:22:58 +00:00
Vlad Zahorodnii
a10193ab4d backends/x11: Drop X11WindowedBackend::windowForScreen() 2022-12-10 12:22:58 +00:00
Vlad Zahorodnii
bb83d66508 backends/x11: Move some method implementations to cpp files 2022-12-10 12:22:58 +00:00
Vlad Zahorodnii
39607a7457 backends/x11: Drop unused X11WindowedBackend::sizeChanged signal 2022-12-10 12:22:58 +00:00
l10n daemon script
fedadf706a 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-12-10 01:48:43 +00:00
Xaver Hugl
20b94c9025 wayland/outputmanagement: reject configurations if outputs change
The meaning of the request is questionable after an output gets added
or removed, and it's an easy way to prevent dangling pointers.

BUG: 460953
2022-12-10 00:39:19 +01:00
Vlad Zahorodnii
e37fd13bb3 backends/wayland: Remove more unused stuff 2022-12-09 20:01:38 +02:00