Commit graph

20738 commits

Author SHA1 Message Date
Vlad Zahorodnii
6432f29e9f autotests: Remove unused screenedge.h include 2022-01-25 21:16:51 +02:00
Vlad Zahorodnii
5ee8389705 autotests: Remove unused screens.h includes 2022-01-25 21:13:30 +02: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
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
b0af657821 Silence -Wself-assign-overloaded with clang 2022-01-21 12:25:12 +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
David Edmundson
3b80380ba7 [systemd] Fix X11 service file
This file was written before we understood and fixed Wants and After.
See readme in plasma-workspace/startkde/systemd for details. Workspace
was fixed, kwin is in another repoistory and got missed.

This causes potential for things like font DPI to not be exported.
2022-01-20 16:18:48 +00: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
Aleix Pol
2c6821fdca autotests: Fix InputMethodTest
We now will only be getting the input method panel when there's an
enabled surface.
2022-01-19 11:38:03 +00:00
Aleix Pol
f509f34dbd autotests: Update property before updating
This opens an event loop which creates race conditions on m_context if
we receive a deactivate.
2022-01-19 11:38:03 +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