Commit graph

23470 commits

Author SHA1 Message Date
Marco Martin
a0385c330b updateAllowedActions when going in/out fullscreen
when going in/out of fullscreen call updateAllowedActions to notify the
decoration of eventual allowed actions changed. this makes the shade
button reappear as needed

BUG:458844
2022-09-08 19:45:55 +00:00
David Edmundson
7927b17d40 Avoid rounding issues in Surface damage tracking
When a buffer is damaged via damage_buffer we have to map things to
logical space. This mapping can involve floating numbers, most notably
with the X11 override, right now that's via a QRegion which is always
integer. For damage we always want to round outwards to the larger
space, not to the nearest space.
2022-09-08 16:18:12 +01:00
Vlad Zahorodnii
33827bbdbe autotests: Fix internal connection teardown
This might be the root cause of random ASAN errors in testQuickTiling.

From commit 617291c6974d232ee99c4c49e891ce16863e3d6e:

The internal EventQueue is a child of the registry object. This means
that after the registry is destroyed, all proxy objects in that event
queue are going to have invalid reference to it, which is not a problem
as long as the wl_display_dispatch() function is not called.

The wl_display_dispatch() function uses wl_proxy's queue reference to
enqueue incoming events to that queue.

Unfortunately, during teardown, the internal ConnectionThread may
dispatch events right after the registry object has been destroyed,
which can lead to a crash.

In order to fix the crash, we need to destroy all proxy objects and only
after that we can destroy the event queue. It's okay if wayland events
are dispatched in between.

i.e. the EventQueue object must be destroyed last to ensure avoid hitting
dangling pointers.
2022-09-08 10:16:35 +00:00
Vlad Zahorodnii
e40bdc9016 autotests: Simplify tearing down ConnectionThread
It should be enough to call QObject::deleteLater() and wait until the
connection thread stops spinning its event loop.
2022-09-08 10:00:20 +00:00
Kai Uwe Broulik
63258ab076 kcmkwin/kwintabbox: Remove API not supported by KWin core
WindowThumbnailItem in scripting doesn't support any of the
'brightness', 'saturation', 'clipTo' anymore, so it makes
no sense to support it in the KCM's preview.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-09-08 06:43:02 +00:00
Yuri Chornoivan
354c0e350f Fix minor typos 2022-09-08 08:43:44 +03:00
Natalie Clarius
1598cecc8e doc/windowbehavior: improve help page for window behavior kcm
- add missing entries for focus delay and multiscreen behavior
- add missing entries for window placement modes maximized and under mouse
- add missing entries for mouse actions
- remove entry for removed "display window geometry when regeometrizing" option
- reword explanation for window raising
- extend explanations for window placement
- hint at screen edges kcm in movement section
- hint at window rules in advanced section
- add more keywords
- some small wording, typographical and formatting changes
2022-09-07 19:01:28 +00:00
Vlad Zahorodnii
3d1b3c9c66 backends/drm: Store hardware and virtual outputs in two different lists
Currently, we effectively almost everywhere need DrmOutput outputs,
DrmVirtualOutput outputs are needed only in a couple of places. There's
not a lot that we gain from storing real and virtual outputs in one
list, it adds unnecessary casting, etc. Ideally, virtual outputs must
come from a different backend, the current approach is not scalable.
2022-09-07 17:40:51 +00:00
Nate Graham
f73cb8f1e5 effects/windowview: fade Searchfield in and out just like background
The Overview effect manipulates the opacity of the desktop bar and
search field along with that of the blurred background so that they
all fade in and out in sync, but Window View does not, leading to a
discrepancy between them that looks weird.
2022-09-07 13:27:53 +00:00
Marco Martin
31d1f885ce Restore the crossfade effect
This enables again the crossfade between the old window picture and the new one in the maximize and morphingpopup effects.
It does that with the OffScreenEffect redirect() feature.

BUG:439689
BUG:435423
2022-09-07 10:16:36 +00:00
Volker Krause
b7f950a5a6 Don't generate Metal and D3D shaders
Not relevant for KWin.
2022-09-07 07:26:03 +00:00
Vlad Zahorodnii
9c4bcb92c3 backends/drm: Don't sort DrmBackend::m_outputs
This std::sort() function traces its origin back to
cbbd684430. The sort step was necessary to
ensure that we get same configuration hash regardless the order in which
outputs were connected.

On the other hand, our KWinKScreenIntegration code already does that so
it seems excessive to sort outputs the second time.
2022-09-06 17:54:52 +03:00
Vlad Zahorodnii
d8ea87a9ea Add dummy placeholder output type
Placeholder outputs are not rendered so they don't need render data.
Also, this simplifies the control flow when the last real output is
removed. The Platform::screensQueried signal won't be emitted inside a
Platform::screensQueried slot.
2022-09-06 10:36:33 +00:00
Volker Krause
192a57e2e1 Port thumbnail item to use Qt Shader Tools for Qt 6 2022-09-06 10:12:37 +00:00
Vlad Zahorodnii
1b5814c0f2 Remove unused core/platform.h includes 2022-09-06 11:21:40 +03:00
Vlad Zahorodnii
d2fb4147fc Move multi-purpose code in its own directory
Things such as Output, InputDevice and so on are made to be
multi-purpose. In order to make this separation more clear, this change
moves that code in the core directory. Some things still link to the
abstraction level above (kwin), they can be tackled in future refactors.
Ideally code in core/ should depend either on other code in core/ or
system libs.
2022-09-06 11:21:40 +03:00
Vlad Zahorodnii
a295db01d9 autotests: Make mapping between KWin::Output and wl_output more robust
Use wl_output.name to find the wl_output for the given server side
output. This way the order in which wl_output globals are announced
won't matter.
2022-09-06 06:47:43 +00:00
Aleix Pol
64800e72ca buttonrebinds: Refactor to be able to share some more code
This way we detach the infrastructure from QKeySequence so other kind of
actions can be taken.
2022-09-05 20:37:40 +00:00
Aleix Pol
a22546897b tablet: Add support for binding tablet events to keyboard shortcuts
Reuses the infrastructure we have for mice buttons for tablets.
2022-09-05 20:37:40 +00:00
Aleix Pol
0744ee09ed libinput: Include the Pad name in the TabletPadId
It's helpful to identify what pad we are referring to in a cross-session
way where a pointer won't hold.
2022-09-05 20:37:40 +00:00
Aleix Pol
6b4feccadd tablet: Send libinput timestamp as the time
As it should be done, instead of using some different value from the
local system.
2022-09-05 20:37:40 +00:00
Vlad Zahorodnii
e97e520175 Move placement policy enum in KWin namespace
Other policy enums are declared in options.h so let's do the same for
placement policy. Besides consistency, another advantage of moving the
enum in kwin namespace is that the enum could be forward declared.
2022-09-05 14:11:42 +00:00
Vlad Zahorodnii
71c9f16673 Fix a typo
Forgot to specify the resource where to send name & description.
2022-09-05 15:17:52 +03:00
Vlad Zahorodnii
330a02d862 wayland: Implement wl_output version 4
wl_output version 4 adds name and description properties. Those
properties were added in wayland 1.20, which we already require.
2022-09-05 14:37:10 +03:00
Kai Uwe Broulik
a0a472391e effects/blur: Generate noise texture on demand
It is relatively expensive and there is no need to do it unless
there are actually windows that make use of the blur effect.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-09-05 09:25:06 +02:00
Vlad Zahorodnii
8b4ffd5cc9 wayland: Relax conditions in strut edge heuristics
When the output layout changes, it's possible that the bottom panel
will float in the middle of the screen, e.g. left edge of the panel
touches the left screen edge while top and bottom panel edges touch no
screen edge.

In that case, XdgToplevelWindow::strutRect() will erroneously indicate
that the left strut rect is valid, while it's not.

Since the strut area is garbage, Window::checkWorkspacePosition() may
incorrectly move and resize windows during output layout change.

The proposed heuristic will fail with square panels, but those are rare
and the only way to detect the correct strut area would be to use the
layer shell protocol.
2022-09-02 17:54:15 +03:00
Vlad Zahorodnii
82c09653aa Move xcursortheme.{h,cpp} to utils/
utils/ seems like a better place for this helper.
2022-09-02 11:06:49 +00:00
Aleix Pol
4f20e9216f Make it possible to raise windows on top of the lockscreen
Requires clients to have the
X-KDE-Wayland-Interfaces=kde_lockscreenallowed_v1 set in their desktop
file, then they will be able to use the kde_lockscreenallowed_v1
protocol to raise any surface above the lockscreen.
The protocol has only 1 method, raise_surface to do exactly that.

Makes it possible to implement
https://invent.kde.org/teams/plasma-mobile/issues/-/issues/98
2022-09-02 10:48:49 +00:00
Aleix Pol
123549f8f3 Move the lockscreen's layer on wayland
On wayland, we are already restricting the rendering of windows that
aren't supposed to be shown when locked, so we don't need to keep the
lock screen on the unmanaged layer.
2022-09-02 10:48:49 +00:00
Vlad Zahorodnii
a3dcecef7a Fix getting old screen area in Window::sendToOutput()
Workspace::clientArea(clientAreaOpt, Window) uses the current output,
while we need the current move resize output.
2022-09-02 09:29:51 +00:00
David Redondo
2f03d1f940 buttonrebinds: Fix Meta modifier
Devices send evdev keycodes not xkb keycodes.
2022-09-02 08:29:27 +00:00
Vlad Zahorodnii
e22c6160fa Avoid mixing current and next fullscreen states more
Mixing those two can make fullscreen mode behavior undefined.
2022-09-02 07:48:55 +00:00
Vlad Zahorodnii
4a6e416289 Avoid mixing current and next maximize modes more
Mixing those two can make maximize mode behavior undefined.
2022-09-02 07:48:55 +00:00
Fushan Wen
c1b3fe1143 effects/overview: remove unneeded Accessible.name
It's implicitly set by text property.
2022-09-02 07:06:26 +00:00
Vlad Zahorodnii
16d9a08f85 Ensure that Window::output() is always in sync with the frame geometry
plasmashell may see new output layout before kwin_x11 and move desktop
windows accordingly. If that happens, the desktop windows will have old
outputs in Window::output() property because the Workspace doesn't
re-check outputs if the output layout changes.

In order to fix the Window::output() property getting out of sync,
re-check the current output after the output layout changes. It should
also fix a visual glitch in the slide effect caused by
EffectWindow::screen() not being correct.
2022-09-02 06:46:38 +00:00
Vlad Zahorodnii
6cc4b799f4 wayland: Use correct output when sending xdg_toplevel.configure_bounds
We should use the next output rather than the current output.
2022-09-02 06:46:38 +00:00
Vlad Zahorodnii
0be0e8a7b0 Add Window::moveResizeOutput()
The Window::moveResizeOutput() property is used to track the output
where the window is expected to land after the move or resize operation
completes.

This can be used to decouple the current output from the next output,
which allows us to send better xdg_toplevel.configure_bounds events or
make windows stick to outputs while keeping Window::output() in sync
with the current output layout.
2022-09-02 06:46:38 +00:00
Laurent Montel
0ea72e9275 Remove extra ';' 2022-09-02 08:27:52 +02:00
Nate Graham
3cf7737042 effects: add Meta+plus as a default shortcut for Zoom effect
Right now the Zoom effect's "zoom in" action is bound by Meta+Equals,
which makes sense for ANSI US keyboards without numberpads which make
you hit the Shift key before you can get a plus sign, and pressing it
without Shift gets you an Equals sign.

But some ANSI US keyboards have a numberpad with a Plus key, and many
other keyboards without numberpads also have a Plus key, so we should
allow users of those keyboards to trigger "zoom in" as easily as users
of ANSI US keyboards.
2022-09-01 12:21:44 -06:00
Arjen Hiemstra
345736735e Add a fallback path for input when there is no text-input
An application that does not support text-input has no way of
communicating with the input method, so even if you show the input
method the application receives nothing. As a fallback, instead send
fake key events so the application still gets something at least.

The key events are synthesised based on the text string that the
input method sends, which may result in things that do not actually
correspond to real keys. Unfortunately I do not see a way around that.

CCBUG: 439911
2022-09-01 14:41:51 +00:00
Arjen Hiemstra
076203c926 Move keycodeForKeysym from ButtonRebindsFilter into Xkb
So we can use it in other places
2022-09-01 14:41:51 +00:00
Yuri Chornoivan
31cf10a6aa Make the tip consistent with label 2022-09-01 16:53:06 +03:00
Vlad Zahorodnii
207a16f14f backends/drm: Fix software cursor fallback in DrmOutput::renderCursorOpengl()
We need to return if the cursor sprite is bigger than DrmGpu::cursorSize().

BUG: 458036
2022-09-01 13:11:13 +00:00
Vlad Zahorodnii
df79d68309 backends/drm: Port from kwinApp()
kwinApp() lives in abstraction layer above and we can use
QCoreApplication to terminate the application.
2022-09-01 12:49:39 +03:00
Vlad Zahorodnii
2d2f972bff Fix loading xcursor themes with invalid Inherits field
Xcursor loading can get stuck in an infinite recursion if index.theme
file indicates that the theme inherits itself.

In order to prevent that, keep track of the loaded so far themes and
avoid loading already loaded themes.

BUG: 457926
2022-09-01 10:12:17 +03:00
Xaver Hugl
245eb822c7 autotests/xdgshellwindow: remove timeout for outputEnteredSpy
The timeout makes the test fail wrongly sometimes and isn't needed. Instead
assume the window always gets placed on the first output
2022-09-01 06:43:09 +00:00
Xaver Hugl
ba0799974e workspace: restore window position after output changes
BUG: 455066
BUG: 374908
CCBUG: 444082
CCBUG: 454003
CCBUG: 453589
2022-08-31 22:30:13 +02:00
Natalie Clarius
8e8b614500 plugins/nightcolor: add configurable day temperature
BUG: 390021
2022-08-31 18:58:07 +00:00
Natalie Clarius
6b38b03724 Add new option for behavior when window on different desktop is activated
When a window that is on a different virtual desktop than the current one gets
activated, the current behavior is that the active virtual desktop will be switched
to the one the activated window is on. This may seem reasonable for a scenario where
the user explicitly intends to activate an existing window on a different desktop.
However, the following scenario is also (perhaps even more?) common: When an
application responds to a launch command by requesting to activate an existing
instance instead of opening a new one (such as Firefox or KDE System Settings), an
existing window on any desktop will get activated even when what the user had in
mind was opening a new window (on the desktop they are currently in). 

This means that opening an application, such as following a URL or accessing a
system setting, unexpectedly results in the user being teleported to a different
virtual desktop. This can be very irritating. The more expected behavior for these
users would be to have windows always open on the desktop where they are called
from. That's is what this commit adds as a new option.

BUG: 438375
FIXED-IN: 5.26
2022-08-31 18:57:21 +00:00
Xaver Hugl
3973b7401d window: keep positions of windows with special states in checkWorkspacePosition 2022-08-31 11:32:30 +00:00