Commit graph

26622 commits

Author SHA1 Message Date
Vlad Zahorodnii
bf6727b384 Fix the titlebar visibility check for small windows
Consider a window with the size of 50x100 and the titlebar height of 36px.
The maximum number of visible titlebar pixels is 1800, but the
titleBarRect() function reports 3600 instead, which is completely wrong.

Since the reported number of required visible pixels is wrong, the window
geometry constraining logic is mistriggered and it's possible to move the
window only by 1px.
2024-03-18 17:27:07 +00:00
Yifan Zhu
b6d315705b pointer_input: make edgeBarrier behavior consistent on corners
The pointer should cross a corner as soon as the movement in the barrier
zone exceeds barrierWidth. Previously horizontal and vertical movements
were separately considered, which made corners harder to cross compared
to edges even when the separate corner barrier was disabled.

CCBUG: 483651
2024-03-18 16:19:05 +00:00
Vlad Zahorodnii
29135f188f plugins/screencast: Add missing Q_OBJECT 2024-03-18 14:58:13 +00:00
Vlad Zahorodnii
fb7dd07076 plugins/screencast: Avoid closing dmabuf fds twice
dmabuf fds are owned by the GraphicsBuffer, which will be destroyed when
`m_dmabufDataForPwBuffer.remove(buffer);` is executed.
2024-03-18 14:42:13 +00:00
Xaver Hugl
0897dbff75 clang-format: change the indentation of lambdas
Instead of indenting lambdas to the start of the lambda, always indent them to the
start of the line, which is more consistent and easier to read
2024-03-18 14:04:33 +00:00
David Edmundson
e13a30f00f effects: Do not take ownership of QuickEffect::delegate
QuickEffect::setDelegate is exposed QML API.

The lifespan of assigned objects is therefore managed by the QML engine,
and we should be watching for deletion not actually deleting it.
2024-03-18 12:55:51 +00:00
David Edmundson
b2a48d09e7 xwayland: Allow pushing to the clipboard without focus
X11 did not have a requirement that apps needed keyboard focus to update
a clipboard. Apps could copy things on click. With context menus and
grabs there can be no active window at this point.

Kwin tried to retrofit a requirement, which doesn't work in all cases.

Whilst there are security implications of reading a clipboard there are
no security issues about pushing a new clipboard. Gnome also allows X11
apps to push to the clipboard at any point.
2024-03-18 12:40:29 +00:00
Vlad Zahorodnii
22ef6d9ddf autotests: Stabilize X11WindowTest
Make a roundtrip to the x server to ensure that WM_STATE changes have
been propagated. xcb_flush() is not good enough, there's still a race
condition between the wm flushing its connection and the client reading
window properties.
2024-03-18 08:46:11 +00:00
l10n daemon script
0bc3fc18aa GIT_SILENT Sync po/docbooks with svn 2024-03-18 01:39:04 +00:00
Xaver Hugl
5fd96620ed backends: use explicit sync for reusing graphics buffers with EGL
Otherwise there can be glitches on NVidia, and this also makes some future
code changes around multi gpu copies and shadow buffers easier
2024-03-17 18:47:21 +01:00
Xaver Hugl
af3bf939c5 platformsupport/scenes/opengl: don't access std::nullopt 2024-03-17 18:08:36 +01:00
Xaver Hugl
2a13a33040 platformsupport/scenes/opengl: advertise formats unnknown to KWin too
While KWin may not have information about the formats, that doesn't mean KWin
should filter them out - EGL can still import them, so allow clients to use them
2024-03-17 03:01:09 +00:00
l10n daemon script
e5805fbd62 GIT_SILENT Sync po/docbooks with svn 2024-03-17 01:37:21 +00:00
Martin Rys
6b25d95f77 Optimize all PNGs losslessly, sans /po, saves 360KB~
*Second in series after https://invent.kde.org/plasma/plasma-workspace-wallpapers/-/merge_requests/17*

Another patch will follow from the translations SVN, after I figure out how to work with it.  

In kwin repo alone, there's another 4MB in savings with funny files like those:

```
kwin/po/ru/docs/kcontrol/windowspecific/tbird-reminder-info.png
  [oxipng] Reduced by 768.94 KB (-96.42%) from 797.52 KB
```
2024-03-16 23:53:12 +00:00
Vlad Zahorodnii
8cae7f7186 Port more stuff away from Cursor::pos() to interactiveMoveResizeAnchor()
The main benefit from doing this is that kwin is going to handle
maximizing the window by dragging it on touchscreen correctly if the
pointer focus point and touch focus point are on different screens.
2024-03-16 10:52:30 +00:00
Vlad Zahorodnii
e8ae03d799 Make some Window::updateInteractiveMoveResize() code less misleading
The "!isMovable()" code path is needed to handle moving fullscreen windows.
Maximized windows are movable and their geometry is computed in
Window::nextInteractiveMoveGeometry().
2024-03-16 10:38:58 +00:00
Vlad Zahorodnii
f563bade46 autotests: Add desktop tests in X11WindowTest 2024-03-16 10:25:32 +00:00
l10n daemon script
0780c0d96b GIT_SILENT Sync po/docbooks with svn 2024-03-16 01:42:05 +00:00
Harald Sitter
645db7fc90 keyboard_layout: always expose dbus interface
our plasmoid only listens to signals when the interface was found.
also when switching from 2 to 1 layout we'd emit a signal that the
layouts changed but then we'd throw away our interface leaving
the client wondering what happened to us (and consequently
printing warnings because our service wasn't found)

this specifically resulted in the plasmoid not getting layout event
changes when switching from 1 to >1

BUG: 449531
2024-03-15 22:21:08 +00:00
Vlad Zahorodnii
2663756ebf Move code to initiate interactive move by dragging the decoration outside Window::handleInteractiveMoveResize()
The main motivation behind this change is to make the code in
Window::handleInteractiveMoveResize() more reasonable. Almost all of the
code in it will be called after startInteractiveMoveResize(), except
when one drags the decoration to initiate an interactive move operation.

This change moves that code to the places where it makes more sense to
ensure that handleInteractiveMoveResize() has no any hidden pitfalls.
2024-03-15 23:01:30 +02:00
Vlad Zahorodnii
7db47ac2fd autotests: Add a test case for _NET_WM_WINDOW_OPACITY 2024-03-15 21:23:31 +02:00
Vlad Zahorodnii
78e2c123c3 Simplify Window::handleInteractiveMoveResize()
The lambda is not needed, its content can be embedded in the function.
2024-03-15 20:25:31 +02:00
Vlad Zahorodnii
11a5513e78 Avoid moving the window while it's maximized
Unlike X11, on Wayland, the window won't change its maximize mode until
it renders a new buffer. This creates a problem for interactive move
because if it's not careful and moves the window while it's still effectively
maximized, it will look as if the window has leaked to other screens.

This change fixes the problem by making Window::handleInteractiveMoveResize()
avoid move() if the window needs to be unmaximized.

As a bonus, it also allows to unmaximize the windows that are maximized
along only one dimension by dragging them.

Unfortunately, tiling stuff still suffers from the same issue. In order
to fix it, Window::tile() has to be part of double buffered state, like
Window::maximizeMode().

BUG: 449105
BUG: 459218
CCBUG: 482085
2024-03-15 18:00:52 +00:00
Vlad Zahorodnii
3e4c2b3ec8 Introduce Window::interactiveMoveResizeAnchor
This provides the grab point that controls the interactive move resize
operation. It can be used outside Window::handleInteractiveMoveResize()
to position XdgToplevelWindow when a configure event is acked.
2024-03-15 18:00:52 +00:00
Vlad Zahorodnii
5d313fdd7b Document Window::interactiveMoveOffset() 2024-03-15 18:00:52 +00:00
Vlad Zahorodnii
2d5a69b1d2 autotests: Add skip switcher/pager/taskbar tests in X11WindowTest 2024-03-15 17:16:27 +00:00
Méven Car
aa465efa51 wayland: DrmLeaseDevice, use Q_OBJECT macro
BUG: 483008
2024-03-15 17:31:25 +01:00
l10n daemon script
1655d6bbc7 GIT_SILENT Sync po/docbooks with svn 2024-03-15 01:38:30 +00:00
Yifan Zhu
e68ac506af plugins/shakecursor: reset detector on mouse press
A sequence of mouse moves shouldn't trigger the effect if the user
presses any mouse button during the mouse moves.
2024-03-14 21:49:33 +00:00
Aleix Pol
ac9b9a6772 buttonrebinds: Introduce tests
Should help make sure the rebind feature stays working.
2024-03-14 14:39:00 -07:00
Yifan Zhu
b8a59d0bd9 plugins/buttonrebinds: choose keysym based on KeypadModifier status
Use keysyms from the keypad if and only if KeypadModifier is set.
2024-03-14 14:37:19 -07:00
Yifan Zhu
6c4551ff46 plugins/buttonrebinds: remove modifiers before keysym conversion
QXkbCommon::toKeysym can't handle modifiers in key.

CCBUG: 482847
2024-03-14 14:37:19 -07:00
Vlad Zahorodnii
0b4c6f8b3b autotests: Reduce amount of boilerplate code in X11 window test 2024-03-14 21:27:05 +00:00
Xaver Hugl
c7b9376ccc backends/drm: support hardware rotation with direct scanout
This improves latency and power use for fullscreen windows when the output
is rotated
2024-03-14 21:36:16 +01:00
Xaver Hugl
d6ad0bcc20 backends/drm: remove remnants of hardware rotation with compositing 2024-03-14 21:36:16 +01:00
Vlad Zahorodnii
acb4945cd3 autotests: Add more basic X11 window tests 2024-03-14 18:36:41 +00:00
Vlad Zahorodnii
9ee6b57d69 plugins/shakecursor: Fix blocking direct scanout
Effects are active by default.
2024-03-14 01:50:22 +00:00
l10n daemon script
9a0471a6d5 GIT_SILENT Sync po/docbooks with svn 2024-03-14 01:39:36 +00:00
Natalie Clarius
a28676666a doc/windowbehavior: Remove removed "Active screen follows mouse" option
Leftover from commit e7d6e8b2
2024-03-12 23:54:17 +01:00
Vlad Zahorodnii
fa4635e570 x11: Fix interactive move offset
Only the y component has to be divided by height(), not the whole QPointF()
expression.
2024-03-12 23:56:26 +02:00
Xaver Hugl
b2babac3d0 dpmsinputfilter: don't wake up the screen on media or volume key events
It's pretty unexpected that the key press would be ignored and instead the screen
wakes up
2024-03-12 16:11:33 +01:00
l10n daemon script
09049954b9 GIT_SILENT Sync po/docbooks with svn 2024-03-12 01:21:12 +00:00
Xaver Hugl
3a55351211 plugins/screencast: fix the cursor being offset after changing the scale
When the scale of a screen is changed, the cursor parameters have to be
adjusted or the client will render it offset to the actual cursor
2024-03-11 23:46:51 +01:00
Vlad Zahorodnii
2c7301b3ee Make Window::interactiveMoveOffset() relative
Window::interactiveMoveOffset() stores the move offset in pixels, but it
is somewhat annoying to deal with when the window size changes, for example
when the window is unmaximized.

This change makes Window::interactiveMoveOffset() store a ratio where
the move offset can be found. This simplifies the code a bit and fixes
the cursor jumping to the topleft window corner. Although there are other
glitches.

CCBUG: 449105
2024-03-11 20:16:10 +00:00
Xaver Hugl
656313455b backends/drm: work around amdgpu vrr cursor bug differently
Instead of not-delaying cursor updates with adaptive sync, this forces a
software cursor instead. That way, the functionality works the same on all
the vendors.

For testing potential driver fixes, the environment variable
KWIN_DRM_DONT_FORCE_AMD_SW_CURSOR=1 can be used to disable this workaround
2024-03-11 19:56:43 +00:00
Yifan Zhu
380795423d xkb: always update keysym
Previously m_keysym was only updated on key press. This caused issues
when multiple keys are pressed at the same time. E.g., if the user
presses A, presses B, releases A, releases B, the actual events sent by
kwin was A pressed;  B pressed; B released; B released.

Also call xkb_state_update_key after xkb_state_key_get_one_sym, as
recommended by the libxkbcommon documentation
2024-03-11 15:29:02 +00:00
Yifan Zhu
92d29ed7f0 kcms/screenedges: add keywords for edge/corner barriers 2024-03-11 15:11:06 +00:00
Yifan Zhu
681752ada1 xkb: fix testing if on keypad
XKB_KEY_KP_9 is 0xffb9 while XKB_KEY_KP_Equal is 0xffbd and XKB_KEY_F1
is 0xffbe. So XKB_KEY_KP_Equal, instead of XKB_KEY_KP_9, has the maximum
keysym for keypad keys.
2024-03-11 07:47:58 -07:00
Marco Martin
609833e880 Properly intersect the shape with clipRect
That for loop in the end didn't have any effect,
actually compute the final region and return that one
2024-03-11 11:56:21 +00:00
David Edmundson
9302e84b95 wayland: Revert send pointer leave on drag
This was changed to match the behaviour of other compositors.
However what kwin did before is more sensible.

Sending a leave event breaks cursor updates by design. See
https://gitlab.freedesktop.org/wayland/wayland/-/issues/444
2024-03-11 11:32:35 +00:00