Commit graph

1258 commits

Author SHA1 Message Date
Vlad Zahorodnii
5eaf46c248 wayland: Don't call updateDecoration() for popups
After lowering the message severity for the KWIN_CORE logging category,
it has been found that the Workspace calls the updateDecoration() method
for every mapped popup surface.

Since the XdgPopupClient doesn't implement that method, a warning message
is printed every time a popup is mapped.

Given that XdgToplevelClient updates the decoration when needed, we can
remove the call to the updateDecoration() method.
2021-01-26 06:53:17 +00:00
Vlad Zahorodnii
69adaf64df wayland: Prevent snapping normal windows to notifications and OSDs
It's annoying.
2021-01-20 14:06:56 +00:00
Vlad Zahorodnii
7a3fa88f02 Drop flag to indicate if swap buffers is blocking
We want the new compositing timing algorithm to be invariant regarding
whether glXSwapBuffers() or eglSwapBuffers() block.
2021-01-06 16:59:29 +00:00
Vlad Zahorodnii
8e060e7218 Prepare kwin for compiling with EGL_NO_PLATFORM_SPECIFIC_TYPES 2020-12-10 10:54:45 +02:00
Vlad Zahorodnii
9236254d5c Schedule a repaint when a window is damaged
Currently, if an X11 or Wayland window is damaged, we will schedule a
repaint. This results in some code duplication that this change intends
to get rid of.
2020-12-02 15:33:08 +00:00
Vlad Zahorodnii
a3cf1b9205 Drop AbstractClient::isInitialPositionSet()
It's the same as AbstractClient::isPlaceable(), which is a more generic
flag to indicate if the window can be placed.
2020-11-27 10:41:13 +02:00
Aleix Pol
440555166f Address window placing problem on rotation
When changing the workspace size, clients will need to reposition
themselves. This leaves a short amount of time where strutted clients
(e.g. panels) will be floating in the wrong place.

This change makes it so when the area could not be properly calculated,
we ignore these clients until they start giving us proper values again.

This is a bit of a workaround though, it would make sense to implement
client placement more synchronously so we didn't have weird moments
where everything is wrong.

It's mostly prominent on the phone but it happens elsewhere when you
rotate.
2020-11-26 02:49:28 +00:00
Vlad Zahorodnii
8f6edea521 Turn krunner integration into a plugin
krunner stuff doesn't really belong in kwin, it has nothing to do with
compositing or any other things that are the domain of compositors.
Given that, being as a plugin suits the krunner integration stuff best.
2020-11-25 09:34:25 +00:00
Vlad Zahorodnii
c766e5da6d Introduce infrastructure for compositor extensions
The scripting api is not suitable for implementing all features that
should not be implemented in libkwin. For example, the krunner
integration or screencasting are the things that don't belong to be
compiled right into kwin and yet we don't have any other choice.

This change introduces a quick and dirty plugin infrastructure that
can be used to implement things such as colord integration, krunner
integration, etc.
2020-11-24 15:50:33 +00:00
Aleix Pol
c59da1f4a5 Remove unnecessary include 2020-11-07 02:57:02 +01:00
Benjamin Port
0faf282694 Fix build without krunner 2020-10-30 16:34:45 +00:00
Benjamin Port
cf4335ca62 Add windows runner
Move windows runner from plasma-workspace to kwin (convert it to dbus runner)

This will allow to interract with windows on wayland too
2020-10-30 10:30:53 +00:00
Vlad Zahorodnii
ae883aaa2d Include cursor theme name and size in support info
It might be useful while triaging cursor related issues.
2020-10-29 06:55:17 +00:00
Vlad Zahorodnii
2093820aba xwayland: Avoid creating a tree query on crash
If Xwayland has crashed, the Workspace will block stacking order updates
and start destroying all X11 clients.

Once stacking order updates are unblocked, the Workspace will mark the X
stacking order as dirty and create a new Xcb::Tree object.

We don't want to create that Xcb::Tree object because accessing it
after the XCB connection has been shut down will lead to a crash.

BUG: 427688
FIXED-IN: 5.20.1
2020-10-14 16:17:42 +00:00
Vlad Zahorodnii
08263b534d Safely remove all internal clients and override-redirect windows
When we destroy all internal clients and override-redirect windows, we
assume that corresponding lists will be implicitly detached.

However, in some cases, that might be not the case. For example, if the
list is not shared, neither begin() nor end() will detach. Therefore, it
is possible to hit invalidated iterators if the list is modified inside
the loop.

This change prevents hitting invalidated iterators by making explicit
list copies.

CCBUG: 427373
2020-10-09 19:33:46 +03:00
Vlad Zahorodnii
a5b811dadb Rename the variable where override-redirect windows are stored
Prepend m_ to unmanaged so no one has to come up with original names if
they want to iterate over a shadow copy of it.
2020-10-09 18:49:32 +03:00
Vlad Zahorodnii
a433fb08a3 x11: Make removal of X11 event filters safe
If an X11 event filter has been activated and it unregisters another X11
event filter, then the window manager may crash because the foreach macro
in Workspace::workspaceEvent() makes a copy of m_genericEventFilters or
m_eventFilters and we can call the event() method for an already defunct
filter.

With this change, X11 event filters can be safely removed and installed
at any particular moment.

BUG: 423319
2020-09-29 08:26:28 +00:00
Vlad Zahorodnii
0c266e760b Replace remaining usages of old connect syntax with new connect syntax
This change replaces the remaining usages of the old connect syntax with
the new connect syntax.

Unfortunately, there are still places where we have to use SIGNAL() and
SLOT() macros, for example the stuff that deals with d-bus business.

Clazy was used to create this change. There were a few cases that needed
manual intervention, the majority of those cases were about resolving
ambiguity caused by overloaded signals.
2020-09-24 09:33:45 +00:00
Vlad Zahorodnii
bc34736534 Use better window placement heuristics for internal clients
Currently, we do some sort of window placement only for decorated
internal windows, which feels hacky.

With this change, all internal clients will go through the window
placement code, unless it's a popup or the BypassWindowManagerHint
flag is set.

If the BypassWindowManagerHint flag is set, the window must have
valid position.

CCBUG: 400675
2020-09-23 14:39:15 +00:00
Vlad Zahorodnii
fe68ddd9ad Initialize fields of the Workspace class in correct order
The compiler doesn't like that fields of the Workspace class are declared
and initialized in different order.
2020-09-09 14:16:02 +00:00
Vlad Zahorodnii
085284921a Introduce a property to indicate if client is placeable
The new property indicates if the client can be placed. It can be used
by input-panel or layer-shell clients to opt out from window placement.
2020-09-03 18:11:44 +00:00
Vlad Zahorodnii
a9fd5ac19f Move struts logic to AbstractClient 2020-09-03 18:11:44 +00:00
Adrien Faveraux
788c65d260 Fix Build Warning 2020-08-26 19:24:02 +02:00
Vlad Zahorodnii
29afd62e9c Evaluate window rules only if they are supported
There is no point for evaluating window rules for popups and internal
clients.
2020-08-21 11:42:17 +00:00
Aleix Pol
3bb829d677 Don't try to reposition the input method client
It already is opinionated about its position.
2020-08-18 10:55:21 +00:00
Vlad Zahorodnii
4ce853e8e4 Prettify license headers 2020-08-07 19:57:56 +00:00
Vlad Zahorodnii
1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00
Vlad Zahorodnii
e7d02ad355 Introduce X11 default screen property in Application
This spares unnecessary looping through all available X11 screens.
2020-08-05 08:48:00 +00:00
Vlad Zahorodnii
19ad172584 Survive Xwayland crashes
If the Xwayland process crashes, it will bring down the entire session
together with itself. Obviously, we don't want that. At least, Wayland
clients should survive the crash.

This change refactors relevant X11 parts to handle Xwayland crashes in a
less fatal way.

In order to handle Xwayland crashes better, a pair of start() and stop()
methods had been introduced in the Xwayland class to allow starting and
stopping the Xwayland process at any moment.

If we detect that the Xwayland process has crashed, we will immediately
stop the Xwayland server, which in its turn will deactivate the socket
notifier and destroy all connected X11 clients. Unfortunately, a couple
of subtle changes in X11Client::releaseWindow() and Unmanaged::release()
had to be made to ensure that we are left with a valid state after the
Xwayland server has been stopped.
2020-08-05 08:48:00 +00:00
Vlad Zahorodnii
a17a86999b Emit clientAdded for wayland clients
Emit the clientAdded() signal also for Wayland clients in order to unify
the API of the Workspace class for different client types.
2020-07-27 15:01:07 +00:00
Aleix Pol
1ef90d9c90 Add API to easily find Toplevels from their internal Id 2020-07-23 13:14:22 +02:00
Aleix Pol
fbbf96751b Workspace::findToplevel should iterate through allClients
Not just x11 ones.
2020-07-23 13:00:26 +02:00
David Edmundson
27ceaf9793 Only call VirtualDesktops::load once
It was called twice once with and without X as our implementation of
setRootInfo() missed some calls.

This was done to avoid a bug as setRootInfo() didn't update everything.
This patch aims to resolve that at the root cause.

I tested the original conditions of the patch with an empty kwinrc and a
file in /etc/xdg/kwinrc setting desktops to 2 and everything loaded
correctly.
2020-07-17 09:02:16 +00:00
Nate Graham
87578bfc15 Allow corner-tiling by quickly combining edge tiling shortcuts
Currently the only way for a uuser to invoke corner-tiling is to
manually set shortcuts for them. This patch adds another option: invoke
the existing shortcuts for edge tiling in a combined manner in quick
succession.

For example, hitting Meta+Left and then Meta+Up within a one-second
period will tile the active window into the top left corner. In practice
you hold down the Meta key and then press Left then Up (or Up and then
Left), and I think it feels very natural. Linux Mint's window manager
has this feature and I always missed it when I left Mint for the KDE
world.

Autotests for existing tiling shortcuts are adjusted to not break, and
additional tests for the new tiling options are added.
2020-06-12 13:50:24 +00:00
Vlad Zahorodnii
df9e36ee68 [wayland] Destroy XdgToplevelClient and XdgPopupClient on unmap
There are several ways to handle unmapping of a wl_surface. The first
one is to destroy the associated AbstractClient instance. The second one
is to transition the AbstractClient in a special state.

The problem with the second approach is that it makes animations such as
fade out more difficult to handle since effects in kwin are geared more
towards the first approach (destroying AbstractClient).
2020-06-01 15:13:03 +03:00
Noah Davis
f474686a58 Change CommandAllKey to Meta
Summary: Alt + Left Click to move windows has a tendency to conflict with creative workflow apps. While Alt can be changed to Meta in KWin's settings, Alt + Left Click shortcuts often cannot be customized in apps. Rather than making every user who runs into this problem change their settings, we should change our default settings to improve KWin's default usability. The fact that Alt + Left Click to move windows is older does not matter. We are trying to use Meta for global/shell shortcuts anyway.

BUG: 399375

Test Plan: The relevant parts of the relevant tests pass. kwin-testInternalWindow fails, but for unrelated reasons that have something to do with XWayland.
2020-05-22 22:39:08 -04:00
Vlad Zahorodnii
fc3b16f892 Store normal clients and desktop clients in the same list
Summary:
On X11, Workspace stores windows in two lists. One with desktop windows
and the other one with all other windows. On Wayland, desktop windows
and normal windows are stored in the same list - m_allClients.

In order to unify scripting on X11 and Wayland, this change makes the
Workspace class store X11 desktop windows and normal X11 windows in the
same list. It's the responsibility of scripts to filter desktop windows.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29522
2020-05-14 16:21:47 +03:00
Vlad Zahorodnii
325b85f8ca Drop Workspace::sendPingToWindow()
Summary:
This change drops Workspace::sendPingToWindow() in order to better
separate X11-specific and more generic code.

Test Plan: Still able to close X11 windows.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29472
2020-05-06 15:05:51 +03:00
Vlad Zahorodnii
76af96bcc9 [x11] Disable synchronized resizing for Xwayland < 1.21
In case Xwayland does not use multiple buffers, the currently attached
buffer is going to be destroyed if the frame window is resized. It may
render the previous and the current window pixmap invalid and thus result
in visual artifacts when an X11 client is being interactively resized.

In order to avoid the visual artifacts, this change disables support for
synchronized resizing for X11 clients if the version of Xwayland is less
than the version in which Xwayland started using multiple buffers, i.e.
1.21.

Differential Revision: https://phabricator.kde.org/D29250
2020-04-29 16:37:31 +03:00
Vlad Zahorodnii
a9d2bad007 [x11] Enable synchronized resizing for Xwayland clients
Given that we now query the current X11 time stamp on Wayland, we can
enable synchronized resizing for Xwayland clients.

Differential Revision: https://phabricator.kde.org/D29250
2020-04-29 16:37:23 +03:00
Kai Uwe Broulik
be31101f12 Remove QSessionManager usage
Summary: Instead, have KSMServer talk to us directly on DBus.

Test Plan: Depends on D28616

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28617
2020-04-06 11:51:47 +02:00
Aleix Pol
6abd23ed02 Make it possible to have a separate cursor for the tablet
Summary:
As is KWin only had 1 Cursor which was a singleton. This made it impossible for
us to properly implement the tablet (as in drawing tablets) support and show where
we're drawing.
This patch makes it possible to have different Cursors in KWin, it makes all the
current code still follow the mouse but the tablet can still render a cursor.

Test Plan: Tests pass, been using it and works as well as before but with beautiful tablet cursors.

Reviewers: #kwin, cblack, davidedmundson

Reviewed By: #kwin, cblack, davidedmundson

Subscribers: davidedmundson, cblack, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28155
2020-04-03 01:16:45 +02:00
Kai Uwe Broulik
5e8038a1a1 [workspace] Use qDeleteAll
Rather than a foreach with questionable indentation

Differential Revision: https://phabricator.kde.org/D28334
2020-03-27 14:25:02 +01:00
David Edmundson
754b90c72f Create screens before screen edges
Summary:
Screens is used in screenEdges in a recent refactor

This didn't affect wayland as main_wayland creates screens earlier
itself. We can't move creation into main_x11 as X11's screens uses an
event filter which relies on workspace existing.

BUG: 419178

Test Plan: Restarted on X11

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28233
2020-03-24 12:40:14 +00:00
Vlad Zahorodnii
861883895d Introduce AbstractClient::destroyClient()
Summary:
The new method provides a generic way for destructing clients. Notice
that we can't just delete clients because we may need to discard
temporary window rules, which is usually done in destroyClient().

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27821
2020-03-04 14:40:57 +02:00
Vlad Zahorodnii
be759b7d33 Use AbstractClient instead of XdgShellClient wherever possible
Summary:
Currently, we have only one shell client type - XdgShellClient. We use
it when we are dealing with Wayland clients. But it isn't really a good
idea because we may need to support shell surfaces other than xdg-shell
ones, for example input panel surfaces.

In order to make kwin more extensible, this change replaces all usages
of the XdgShellClient class with the AbstractClient class.

Test Plan: Existing tests pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27778
2020-03-04 09:57:13 +02:00
Vlad Zahorodnii
fbfd1ac705 Split geometry topic file
Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26644
2020-01-16 12:22:21 +02:00
Roman Gilg
ac05dd01c8 Revert "[platforms/x11] Never block on retrace, always present after paint"
This reverts commit 8d13729031.

See: https://mail.kde.org/pipermail/kwin/2020-January/002999.html
2020-01-16 10:00:08 +01:00
Vlad Zahorodnii
55b4912004 Update my email address 2020-01-14 18:17:18 +02:00
Vlad Zahorodnii
297876e55e Split group.cpp topic file
Test Plan: Compiles.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T12312

Differential Revision: https://phabricator.kde.org/D25713
2019-12-03 19:43:47 +02:00