Commit Graph

237 Commits (master)

Author SHA1 Message Date
Vlad Zahorodnii 12e59f9af8 Schedule workspace repaint for destroyed clients
We need to schedule a workspace repaint in case no effect is going to
animate the window.

The workspace repaint is issued before creating a Deleted because the
latter takes the owner of the effect window, which means that after an
instance of Deleted has been created, visibleRect() returns the frame
geometry.

CCBUG: 425294
2020-09-29 13:53:30 +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
Marco Martin 97f4712f29 Fix size restore upon keyboard close in XdgSurfaceClient
in XdgSurfaceClient setFrameGeometry is async,
so we can't rely on it having the final value immediately.
make setVirtualKeyboardGeometry a virtual.
in the implementation on setVirtualKeyboardGeometry
use requestedFrameGeometry() instead of frameGeometry()
2020-09-01 08:58:46 +00:00
Laurent Montel 87ff6e4b44 Port away from deprecated Qt::MidButton 2020-09-01 07:14:58 +02:00
Vlad Zahorodnii d97f12c1c6 wayland: Expose tiled state to xdg-shell clients
A client-side decorated window could use this information to improve
management of edges, for example by providing inset resize handles, etc.
2020-08-24 20:49:40 +03:00
Vlad Zahorodnii 3e9b722f8c Explicitly indicate support for window rules
This way it's more difficult to overlook the case where a new client
type unexpectedly advertises that it supports window rules.
2020-08-20 16:18:59 +00:00
Vlad Zahorodnii 9a04442781 Add default handler for screen edge based activation
This change adds a default handle for screen edge based activation in
order to reduce the amount of boilerplate in client sub-classes that do
not support features such as auto-hiding, e.g. popups.
2020-08-20 12:49:59 +03:00
Vlad Zahorodnii b36b3c67d1 Provide default implementation for noborder functionality
This change adds a default implementation for no border functionality
in order to reduce the amount of boilerplate code in client sub-classes
that have no support for server-side decorations.
2020-08-20 12:49:57 +03:00
Vlad Zahorodnii 74da0bb701 Provide default implementation for AbstractClient::updateDecoration()
Not all client types support server-side decorations, for example it's
typically the case for popup windows. This change provides a default
implementation for the updateDecoration() method in order to reduce the
amount of boilerplate code in client types that have no support for ssd.
2020-08-20 12:48:00 +03:00
Vlad Zahorodnii 9e74199e27 Refactor color scheme related code
Currently, we have two functions that update the color scheme for a
client - updateColorScheme(QString) and updateColorScheme(). Even though
they both share the same name, they do different things. The first one
sets the specified color scheme, while the other determines the color
scheme preferred by the client and assigns it.

This change refactors the color scheme initialization code so we no
longer need those two methods. The setColorScheme() method sets the
specified color scheme, and the preferredColorScheme() method returns
the color scheme preferred by the client. Sub-classes of AbstractClient
can override the preferredColorScheme() method in order to add support
for platform-specific color scheme protocols.

The end result: color scheme related code is a bit more comprehensible.
2020-08-19 15:18:50 +00:00
Vlad Zahorodnii eb00a56604 Show a warning message if calling an unimplemented method
It makes easier to spot potential bugs in AbstractClient subclasses.
2020-08-18 21:17:51 +00:00
Aleix Pol 2565e03eb3 Make sure the input methods stay in the unmanaged layer 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
Nate Graham cc862fa674 [focuschain/task switcher] Remove special handling for minimized windows
Right now KWin moves minimized windows to the end of the task switcher's
ordering. However this is a rather confusing and undocumented behavior
that explicitly overrides the user's chosen sort ordering, be it
"Recently used" or "Stacking order". This makes it a hidden magic behavior
of the type that is at risk of being more annoying than useful.

This commit removes the special handling and lets minimized windows live
in the appropriate order in the task switcher.
2020-08-05 14:05:01 +00:00
Aleix Pol 4c267c261e Adapt to changes in the PlasmaWindowManagement interface 2020-07-23 13:14:22 +02:00
Vlad Zahorodnii 80a31ab4b7 Make setFrameGeometry() re-entrant for X and internal clients
If AbstractClient::setFrameGeometry() is called from a slot connected
directly to the frameGeometryChanged() signal, then is there a good
chance that kwin will fall into an infinite recursion. However, that's
the case with only X11 and internal clients.

The root cause of the infinite recursion is that both X11Client and
InternalClient compare the new geometry against the geometry before
update blocking. In order to fix the bug, we simply need to ensure that
updateGeometryBeforeUpdateBlocking() has been called before we start
emitting the frameGeometryChanged() signal.

Furthermore, a couple of tests were added to ensure that we won't hit
this subtle bug again.
2020-07-22 05:51:23 +00:00
Aleix Pol ef81ae3f9f Resize maximised windows upon workspace change
Don't issue a frameGeometry update until we have fully processed which
geometry we want.

BUG: 423596
2020-07-21 12:03:12 +00:00
Vlad Zahorodnii c4c06c4e1f Notify about new client geometry also when moving windows 2020-07-17 11:56:22 +00:00
Vlad Zahorodnii 9c55c01767 Introduce a signal that notifies about new buffer geometry
The new signal can be useful if one wants to watch a toplevel for buffer
geometry updates. This can be especially useful for input related code
because the position of the upper left corner of the main surface is used
to compute the input transformation matrix.
2020-07-17 11:56:22 +00:00
Vlad Zahorodnii 4a6badc22c Ignore setActive() for windows that are being deleted
We may call setActive() on a window that is being deleted. We cannot
guarantee that at that moment the X11 window or the Wayland surface is
still valid. So, the best course of actions is to do nothing.

BUG: 424255
2020-07-16 17:04:09 +03:00
Vlad Zahorodnii cae9828471 Don't perform MouseActivateRaiseAndPassClick for topmost windows
Do nothing if the active window is already most recently raised one.
2020-07-15 12:17:46 +03:00
Vlad Zahorodnii cc3eb54b32 Introduce the client geometry in Toplevel
In most cases, we don't need to react to client geometry changes, but in
code that deals with server-side window decorations, we need to react to
client geometry changes. The problem is that frame and client geometry
updates are not correlated even though there is a connection between the
frame geometry and the client geometry.

This change introduces the client geometry in the Toplevel class in order
to allow monitoring client geometry updates from DecoratedClientImpl.
2020-06-18 07:40:58 +00:00
Nicolás Alvarez 131e8aaa8a Fix comment typo
(Test for IRC notifications)
2020-06-04 15:48:33 -03:00
Vlad Zahorodnii 31ea780d79 [wayland] Rework xdg-shell implementation
Summary:
This change splits the XdgShellClient class to better match existing
abstractions in the xdg-shell protocol and fix a few issues related to
sending configure events.

In the new client classes, configure events are handled differently.
Instead of blocking configure events, we try to send them as late as
possible. Delaying configure events will let us merge changeMaximize()
for X11 clients and Wayland clients and it also fixes the bug where
we don't send the final configure event when user has finished resizing
a window.

Given that configure events are not sent immediately, XdgSurfaceClient
keeps the last requested frame geometry and the last requested client
geometry.

This patch doesn't intend to fix all issues in kwin's implementation of
the xdg-shell protocol. For example, we still handle surface unmapping
very poorly.

Test Plan: Tests pass.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27861
2020-06-01 15:12:59 +03:00
Aleix Pol 5b5a9957a5 Fix TestXdgShellClient::testDesktopFileName
Summary:
Allows AbstractClient::m_desktopFileName be an absolute path, which is
used by tests.

Test Plan: Test passes, other things still work, including telegram.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29758
2020-05-14 17:25:36 +02:00
Aleix Pol 7ea7aa1ee9 Fix org.telegram.desktop identification
Summary:
The code we have that adds .desktop at the end of the resource name did not take
into account that it might be the case that the application ends with .desktop
like it happens on telegram's desktop client

This patch looks for the file instead of just checking the name to account for
it. Otherwise the look up happens in KConfig.

Fixes flathub/org.telegram.desktop#27 on github

Test Plan: Tested locally, works.

Reviewers: #plasma, #kwin, ngraham

Reviewed By: ngraham

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29728
2020-05-14 12:53:10 +02:00
Vlad Zahorodnii d503307858 Merge branch 'Plasma/5.18' 2020-05-11 14:22:05 +03:00
Vlad Zahorodnii 6f8b8efb33 [wayland] Place lockscreen greeter above other windows
Summary: BUG: 420802

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29523
2020-05-11 14:21:21 +03:00
Vlad Zahorodnii 44143ef7ae Move core shade code to AbstractClient
Summary:
In order to allow shading wayland clients, this change moves core shade
code from X11Client to AbstractClient.

Test Plan: Shading still works on X11.

Reviewers: #kwin, cblack

Reviewed By: cblack

Subscribers: cblack, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29512
2020-05-07 22:03:31 +03:00
Aleix Pol 3a9d7a6e9d Port KWin to KWaylandServer
Summary: Away from KWayland::Server and KF5WaylandServer.

Test Plan: Builds, ran nested session

Reviewers: #kwin, #plasma, #frameworks, davidedmundson, zzag

Reviewed By: #kwin, #plasma, davidedmundson, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29278
2020-04-30 12:56:08 +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
Aleix Pol 5eb84af469 Remove overloads on virtual methods
Summary:
Prefer virtual methods that take QRect and QSize rather than multi-int versions.
Makes for clearer API and reduces the amount of code that was taking all of the
components and turn it into a class.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28283
2020-03-26 16:10:10 +01:00
Carson Black 679427da24 Broadcast application menu on PWM interface initiaization
Summary:
By the time AbstractClient::setupWindowManagementInterface() is called,
it's possible for a window to already have an application menu, and not update them
afterwards.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28150
2020-03-20 03:04:36 -04:00
Carson Black 394b5082c2 [wayland] Broadcast application menu events
Summary:
Broadcasts application menu events to
clients listening to the PlasmaWindow interface.
Needs D27464.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27818
2020-03-06 19:48:06 -05:00
Vlad Zahorodnii 4ae6c99c6b Introduce AbstractClient::createDecoration()
Summary:
We have duplicated code in InternalClient and XdgShellClient to create
decorations. In order to get rid of the code duplication, this change
introduces a method that AbstractClient subclasses can call to create
a window decoration.

Test Plan: Tests pass.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27822
2020-03-05 10:25:36 +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 2b120e07ca [wayland] Honor xdg-toplevel size constraints
Summary:
This change ensures that we honor surface size constraints specified by
xdg-toplevel clients.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26830
2020-02-28 17:13:01 +02:00
Vlad Zahorodnii c3abe87f4c Document AbstractClient::minSize() and AbstractClient::maxSize()
Summary:
Clarify that AbstractClient::minSize() and AbstractClient::maxSize()
specify the minimum and the maximum client size.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26829
2020-02-28 17:13:01 +02:00
Vlad Zahorodnii a75fb7f84e Refactor geometry constraints code
Summary:
Currently, there are a couple of issues with sizeForClientSize(). First
of all, we have a method called clientSizeToFrameSize() which does similar
thing except applying geometry constraints and checking window rules. The
other issue is that sizeForClientSize() is doing a bit too much, it checks
window rules, it applies a bunch of geometry constrains. Sometimes it
does not perform conversion between client sizes and frame sizes!

This change attempts to address those issues by replacing sizeForClientSize
with two similar methods and changing semantics of some methods of the
X11Client class.

The most significant difference between sizeForClientSize() and the new
methods is that neither constrainClientSize() nor constrainFrameSize()
check window rules. This is up to users of those methods. In many places,
we don't have to check window rules because we check isResizable(),
which returns false if the frame size is enforced by a window rule.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26828
2020-02-28 17:13:01 +02:00
Nicolas Fella 7159684ced Revert "[kcm/effects] Clip ListView"
Bad merge

This reverts commit b713044216.
2020-02-22 11:53:59 +01:00
Nicolas Fella b713044216 [kcm/effects] Clip ListView
Summary:
Otherwise the content overflows the frame when scrolling.

QQC2 scrollview docs say "ScrollView does not automatically clip its contents. If it is not used as a full-screen item, you should consider setting the clip property to true"

Test Plan:
Before:
{F8121150}

After:
{F8121152}

Reviewers: #kwin, #plasma, ngraham

Reviewed By: ngraham

Subscribers: ngraham, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27558
2020-02-22 11:52:49 +01:00
Nicolas Fella cdc5ea19ab Revert "[kcm/effects] Clip ListView"
Bad merge

This reverts commit 5babf52df4.
2020-02-22 11:50:30 +01:00
Nicolas Fella 5babf52df4 [kcm/effects] Clip ListView
Summary:
Otherwise the content overflows the frame when scrolling.

QQC2 scrollview docs say "ScrollView does not automatically clip its contents. If it is not used as a full-screen item, you should consider setting the clip property to true"

Test Plan:
Before:
{F8121150}

After:
{F8121152}

Reviewers: #kwin, #plasma, ngraham

Reviewed By: ngraham

Subscribers: ngraham, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27558
2020-02-22 11:48:51 +01:00
Vlad Zahorodnii b9cb1d0f1d Merge branch 'Plasma/5.18' 2020-02-21 13:57:14 +02:00
Vlad Zahorodnii 275082ad49 Schedule a workspace repaint in AbstractClient::minimize()
Summary:
We need to schedule a workspace repaint in minimize() to ensure that
there are no ghost windows on Wayland.

Test Plan:
Make sure that window minimization effects are disabled,
minimize a window. Without this patch, you are going to see a ghost
window. With this patch, no ghost window.

Reviewers: #kwin, davidedmundson, apol

Reviewed By: #kwin, davidedmundson, apol

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27516
2020-02-21 13:56:55 +02:00
Vlad Zahorodnii 5af81c1cd7 Make support for the maximized mode partially optional
Summary:
Not all Client classes have support for the maximized mode. Therefore,
it can be made opt-in to reduce the amount of plumbed methods.

Unfortunately, there a few places, which don't have any connection with
the maximized mode, where AbstractClient::geometryRestore() is used, so
it cannot be made 100% optional at the moment.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27169
2020-02-12 11:28:15 +02:00
Vlad Zahorodnii 34df058e54 Make support for the minimized state optional
Summary:
In long term, we want to split XdgShellClient into several classes. One
class for xdg-toplevel clients, and the other one for xdg-popup clients.

xdg-popup clients are much simpler than xdg-toplevel clients, they can't
be maximized or shown in full screen mode, they can't be interactively
moved on the screen, and so on. In the end, we will have to plumb many
pure virtual methods, which looks a bit ugly.

This change makes support for the minimized state in AbstractClient
optional so we don't have to add those no-op methods and keep code more
or less "clean."

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27163
2020-02-12 11:28:15 +02:00
Vlad Zahorodnii 4ec24bc43f Make support for full screen mode optional
Summary:
In long term, we want to split XdgShellClient into several classes. One
class for xdg-toplevel clients, and the other one for xdg-popup clients.

xdg-popup clients are much simpler than xdg-toplevel clients, they can't
be maximized or shown in full screen mode, they can't be interactively
moved on the screen, and so on. In the end, we will have to plumb many
pure virtual methods, which looks a bit ugly.

This change makes support for full screen mode in AbstractClient optional
so we don't have to add those no-op methods and keep code more or less
"clean."

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27162
2020-02-12 11:28:15 +02:00