Commit graph

797 commits

Author SHA1 Message Date
Vlad Zahorodnii
93194a6720 autotests: Convert testScreens into an integration test
At the moment, the Screens class is convoluted with ifdefs because of
MockScreens.

The goal of this change is to reduce the number of usages of the
MockScreens class so it is possible to get rid of the ifdefs.
2021-01-04 08:32:57 +00:00
Vlad Zahorodnii
eaf94f465c Re-apply color transforms when session is re-activated
When our session is re-activated, we need to re-apply color transforms
as the current gamma ramps might be outdated.
2020-12-21 20:25:32 +02:00
Vlad Zahorodnii
6adfe3064f Drop Platform::createScreens()
Since the Screens class is a convenience wrapper around AbstractOutput
objects that come from the Platform, it should not be platform-specific.

By dropping createScreens(), output-related code becomes simpler.
2020-12-21 09:20:16 +00:00
Vlad Zahorodnii
c812b1b8d2 Spy on the right signal in KeyboardLayoutTest 2020-12-17 13:47:29 +02:00
Vlad Zahorodnii
a8dd455953 Fix DebugConsoleTest
The debug console now displays window ids as hexidecimal numbers.
2020-12-17 13:15:46 +02:00
Vlad Zahorodnii
267eb0e9fa Fix NightColorTest
Currently, the test crashes because the ColorManager is not created.
2020-12-17 13:03:18 +02:00
Vlad Zahorodnii
533ec39af5 Fix PlasmaSurfaceTest
Opaqueness is not based on the window type.
2020-12-17 13:00:46 +02:00
Vlad Zahorodnii
64ad9a61d8 Introduce ColorManager component
This change introduces a new component - ColorManager that is
responsible for color management stuff.

At the moment, it's very naive. It is useful only for updating gamma
ramps. But in the future, it will be extended with more CMS-related
features.

The ColorManager depends on lcms2 library. This is an optional
dependency. If lcms2 is not installed, the color manager won't be built.

This also fixes the issue where colord and nightcolor overwrite each
other's gamma ramps. With this change, the ColorManager will resolve the
conflict between two.
2020-12-13 23:53:33 +02:00
Vlad Zahorodnii
3cdc97a4e9 Avoid converting socket name between QString and QByteArray back and forth
It only contributes overhead.
2020-12-09 15:07:29 +02:00
David Edmundson
1e2f2a28c7 Port to kwayland-server socket changes 2020-12-09 07:23:40 +00:00
Vlad Zahorodnii
c793d5d619 autotests: Fix PointerInputTest
The "Active screen follows mouse" option may make the test fail. We want
it to pass no matter what the current value of the option is.
2020-12-03 09:55:37 +00:00
Vlad Zahorodnii
919e878d35 autotests: Set initial cursor position in QuickTilingTest
This is to ensure that tests pass no matter what the current value of
the "Active screen follows pointer" option is.
2020-12-03 11:53:40 +02:00
David Edmundson
5e350b0db5 [autotests] Fix mouse between screens
There were multiple other cases of placing the mouse between screens at
the start of tests. It seems to be all copy paste.

Only maximise and pointerConstraints were failing before this, but we
may as well fix all of them.
2020-12-02 15:09:55 +00:00
David Edmundson
d56d4370b2 [autotests] Fix autotests
Since the active screen now follows the mouse, the position is
important.

Between two screens is an overly confusing place for it anyway.
2020-12-01 11:19:55 +00:00
Vlad Zahorodnii
2a8395c7dd Trim trailing whitespace 2020-11-28 11:01:47 +00:00
Vlad Zahorodnii
bdfb946267 Convert Night Color into a plugin
Night Color adjusts the color temperature based on the current time in
your location. It's not a generic color correction module per se.

We need a central component that can be used by both night color and
colord integration to tweak gamma ramps and which will be able to
resolve conflicts between the two. The Night Color manager cannot be
such a thing because of its very specific usecase.

This change converts Night Color into a plugin to prepare some space for
such a component.

The tricky part is that the dbus api of Night Color has "ColorCorrect"
in its name. I'm afraid we cannot do that much about it without breaking
API compatibility.
2020-11-27 18:55:01 +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
Vlad Zahorodnii
3a7bce693e Explicitly destroy plugins
A plugin may need to access kwinApp() or kwinApp()->platform() during
tear down, but the problem is that plugins are destroyed after the
kwinApp() object. The plugin manager must be destroyed explicitly while
the application is still valid to ensure that no crash will occur
during compositor teardown.
2020-11-26 20:51:14 +02:00
Aleix Pol
91064cb26a xdgshellclient: Support set_fullscreen argument
xdgshell allows clients to specify which output should we fill on
set_fullscreen. This change takes this request into consideration
instead of ignoring it.
2020-11-26 02:47:34 +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
Vlad Zahorodnii
70393eec6f Consistently name some KF5 integration plugins 2020-11-23 16:44:42 +00:00
Vlad Zahorodnii
0dd2f787ae wayland: Link statically against KIdleTime integration plugin
The main motivation behind this change is to improve startup time. The
Poller class was renamed to avoid potential name conflicts in the future.
2020-11-23 16:44:42 +00:00
Vlad Zahorodnii
f3a902911a wayland: Link statically KWindowSystem integration plugin
Without the KWindowSystem integration plugin, Wayland experience will be
negatively affected because windows created by kwin itself won't behave
as desired. Therefore it makes little sense to load this plugin at runtime.
2020-11-23 16:44:41 +00:00
Vlad Zahorodnii
49e0b84d84 wayland: Link statically KGlobalAccel integration plugin
Without the KGlobalAccel integration plugin, Wayland experience will be
negatively affected. Therefore it makes little sense to load it at run-
time.
2020-11-23 16:44:41 +00:00
David Edmundson
30f9e2a570 [autotests] Fix decoration input test
QTRY_COMPARE doesn't work well with how we do our wayland event
dispatching.

We know the client hasn't processed any events yet, so we can safely do
a normal wait.
2020-11-22 23:56:44 +00:00
David Edmundson
5e60e64a5d Bundle QPA plugin directly
On wayland, we know we're always going to load our internal QPA. Instead
of shipping a plugin and loading it dynamically we can use Qt static
plugins.

This should result in slightly faster load times, but also reduce the
number of moving pieces for kwin.

This also prevents anyone outside kwin loading our QPA which wouldn't
have made any sense and just crashed.
2020-11-22 17:52:14 +00:00
Bhushan Shah
3429617662 adapt to changes in seat and keyboard interface
Now several methods of keyboard_interface are public and wrappers for
them are removed from the seat_interface.
2020-11-19 06:05:45 +00:00
Vlad Zahorodnii
7cab8cf8bb Make Scene::qpainterRenderBuffer() take a screen id 2020-11-11 07:22:10 +00:00
Vlad Zahorodnii
e398a7cd1a Drop Toplevel::windowId()
A window id generated by WaylandServer may reference an X11 window
with the same id, which can result in undefined behavior.

The main reason why we needed windowId() was because of the task
switcher. However, since tabbox uses internal ids now, the window id
property can be dropped.
2020-11-10 09:58:07 +00:00
Andrey Butirsky
f30ad51bfd fix KeyboardLayoutTest
FAIL!  : KeyboardLayoutTest::testChangeLayoutThroughDBus() '!layoutChangedSpy.wait(1000)' returned FALSE. ()
   Loc: [/home/bam/kde/src/kwin/autotests/integration/keyboard_layout_test.cpp(250)]
2020-10-20 20:50:59 +00:00
Vlad Zahorodnii
41d431de27 Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).

While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.

Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.

Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.

Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 16:11:13 +03:00
Vlad Zahorodnii
a195223a8d wayland: Fix Qt clients not being maximized initially
Currently, Qt clients send two maximize requests separated by the
initial commit. From spec's perspective, this is totally fine, the
client should receive two configure events with "maximized" state.

But because changeMaximize() in XdgToplevelClient and setMaximized()
operate on two different maximize modes, the second maximize request
will trick kwin into thinking that the client should be restored.
2020-10-15 11:35:06 +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
Bhushan Shah
0a3e18e5a6 Fix build 2020-09-30 16:16:45 +05:30
Bhushan Shah
474d0344ca autotests: rename to testInputMethod
Relevant class got renamed, also update the test name

Related: plasma/kwin!302
2020-09-30 16:04:49 +05:30
Bhushan Shah
222b558b04 virtualkeyboard: rename class to InputMethod
VirtualKeyboard class does not implement the relevant VirtualKeyboard
protocol but rather implements the InputMethod protcol and can in theory
be used by other input method like e.g. ibus.

Make class name consistent with what it does to avoid confusion in
future.

For now only rename of main class is done and dbus service is kept as-is
to provide retro-compatibility, when input method protocol is
implemented fully, we can think of what to do wrt the dbus interface
later when we fully implement zwp_input_method_unstable_v1 protocol.
2020-09-29 20:55:24 +05:30
Bhushan Shah
6d433bdfc9 virtualkeyboard: add text-input-v3 support 2020-09-29 10:56:24 +00:00
Andreas Haratzis
6f53f62741 Fix for PlasmaSurfaceTest broken in a3b50500
TestPanelWindowsCanCover now needs to wait for the event queue to process the hover event.
2020-09-24 09:34:29 +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
a1fe70baaa Port some tests away from a deprecated QProcess::start() overload 2020-09-10 10:19:30 +03:00
Vlad Zahorodnii
5a0a86c358 Fix unused variable warnings 2020-09-10 10:10:31 +03:00
Vlad Zahorodnii
b13a74c908 xwayland: Replace criticalError() signal with a less fatal signal
If the Xwayland executable can't be found, the whole session will die
because a criticalError() signal will be emitted.

This change replaces the criticalError() signal with a less severe
signal.

If the errorOccurred() signal has been emitted during the startup
sequence, kwin won't die and will just continue with spawning the
session process.
2020-09-09 15:25:59 +00:00
Vlad Zahorodnii
6dbc060596 autotests: Use new xdg-shell helpers in ToplevelOpenCloseAnimationTest 2020-09-09 15:23:06 +00:00
Vlad Zahorodnii
2691b84c99 autotests: Introduce helper classes for testing xdg-shell clients
After splitting out the server part of KWayland into a separate repo,
all non-core protocol wrappers in KWayland::Client had become obsolete
and using them in new projects is highly discouraged.
2020-09-09 15:23:05 +00:00
Vlad Zahorodnii
3805f212ec autotests: Remove XdgShellSurfaceType enum
Currently, it has only one item - XdgShellStable.
2020-09-09 13:21:57 +03:00
David Edmundson
6acf35e4cc Avoid QPointer in return types of Input methods
QPointer is a really useful way to store a pointer over time.
It doesn't make have any value as a return value used by a short-lived
method.

There isn't a good copy constructor, it's effectively the same as
creating a new QWeakPointer reference that has to be cleaned up.

Testing if something is null is still the same. A new QPointer can be
made by the caller if it actually is needed.

Input handling is a very hot path called many times a frame, so it's
important to keep this light. focus() and at() are called a lot which
added up to slightly over 1% of CPU time when moving the mouse about.
2020-09-08 08:04:13 +00:00
Vlad Zahorodnii
d3cca65d39 Implement the layer-shell v1 protocol
The layer-shell protocol allows wayland clients to create surfaces that
can be used for building desktop environment components such as panels,
notifications, etc.

The support for the plasma-shell protocol will be dropped once plasma in
all its entirety is ported to the layer-shell protocol.
2020-09-03 18:11:44 +00:00
Vlad Zahorodnii
f55ae15788 Remove unused wayland-cursor.h includes 2020-09-02 15:59:36 +03: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
Vlad Zahorodnii
432cfb44c0 xwayland: Restart the Xwayland server after it has crashed
If the Xwayland process has crashed due to some bug, the user should
still be able to start applications in Xwayland mode. There is no reason
to restart the whole session just to be able to launch some application
that doesn't have native support for Wayland.
2020-09-01 06:16:02 +00:00
Vlad Zahorodnii
472b5e7f9e autotests: Fix the license header in a test 2020-08-28 11:11:09 +03:00
Adrien Faveraux
788c65d260 Fix Build Warning 2020-08-26 19:24:02 +02:00
Vlad Zahorodnii
1c61de1990 autotests: Clean up the outputs list when client connection is closed
If the client connection has been closed, the Output::removed() signal
won't be emitted.
2020-08-20 11:56:42 +03: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
707a02071e Add a simple test to check Xwayland dying
The new test verifies that we handle Xwayland crashes gracefully.
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
Vlad Zahorodnii
1330abc93d Provide hotspot in the device independent pixels
Currently, the trend is to get the coordinates of the hotspot and map it
to the device independent pixels at the call site.

This change makes the KXcursorSprite return the coordinates of the hotspot
in the device independent pixels to reduce the amount of duplicated code.
2020-07-27 15:00:13 +00:00
Benjamin Port
9225848fb0 When maximizing a window raise client and gain focus
BUG: 418938 FIXED-IN: 5.20
2020-07-27 09:26:25 +00:00
Vlad Zahorodnii
555885072d Check if we successfully restored input focus
In rare cases, Workspace::restoreFocus() may fail, for example when the
most recently activated client is about to be destroyed or unmapped.

If it happens that we cannot restore the focus, then mark the window in
FocusIn event as active.

CCBUG: 424223
2020-07-22 12:29:41 +00: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
Vlad Zahorodnii
2717252861 Partially revert a0c4a8e766
Unfortunately, a0c4a8e766 has a major bug
where clients that track focus events may get confused by focusToNull().

One such a notable example is Dota 2. It tracks the focus events to
minimize itself after the keyboard focus has been lost as well stop
playing music while it's in background. So, when we call focusToNull(),
Dota 2 will receive a corresponding FocusOut event and ask the window
manager to minimize it. It doesn't really matter that the FocusOut
event is going to be followed by a FocusIn event because when a window
is minimized, kwin will activate the next one in the focus chain.

Since those issues can't be fixed from the window manager's side, this
patch partially reverts a0c4a leaving only the autotest.

BUG: 424223
FIXED-IN: 5.19.4
2020-07-21 12:56:21 +03:00
Andrey Butirsky
0bb05d4b1a make keyboard layout DBus API more reliable
having deferred m_dbusInterface deletion allows to send DBus signal in
more cases.
That addressed in unit tests.
2020-07-17 12:42:28 +00:00
Andrey Butirsky
8e1018de2c save default keyboard layout
Implemented for Global, Virtual Desktop and Application layout policies.
Not implemented for Window policy due separate windows do not preserve
their IDs between sessions (still could be implemented the same way as for Application policy).

Layout saving/restoring happens on Session save/load.
Covered by unit tests
2020-07-17 12:42:28 +00:00
Vlad Zahorodnii
cf27128877 Update input transformation matrix when buffer geometry changes
Currently, we update the input transformation matrix for the focused
pointer surface only when the frameGeometryChanged() signal is emitted.
However, since the input transformation matrix is computed based on the
current position of the upper left corner of the main surface, it is
wrong to do so because the frame geometry is a logical geometry that
doesn't have any direct relationship with the buffer geometry, i.e. the
rect on the screen occupied by the main surface.

If the input transformation matrix gets out of sync, user may notice
that pointer events are "shifted."

This change introduces a new signal that's emitted when the input
transformation matrix has been changed. Input related components in kwin
can connect to it to keep a copy of the input transformation matrix in
SeatInterface in sync. Under the hood, the new signal is just an alias
for the bufferGeometryChanged() signal.
2020-07-17 11:56:22 +00:00
Vlad Zahorodnii
fc839d8b29 Fix testActivities
Currently, the test passes because the activities controller doesn't
have enough time to fetch all activities. So, the test client won't be
placed on the current activity.

Since the Workspace is now created before starting the Xwayland, we now
spin the event loop, which allows the activities controller to fetch the
list of all activities and so the test client will be placed on the
current activity, i.e. client->isOnAllActivities() will no longer return
true.

This change fixes wrong assumptions in the test and makes it robust.
2020-07-17 09:10:51 +00:00
Vlad Zahorodnii
97cf90269a Start accepting client connections after creating workspace
Sub-classes of the AbstractClient class need a valid instance of the
Workspace class to function as desired. We should not create xdg-shell
clients until the workspace is created.
2020-07-17 09:10:51 +00:00
Vlad Zahorodnii
d1b35f306d Introduce started signal in Application
The new signal is emitted when the Application has fully been initialized.

It allows us to change the startup sequence, for example create workspace
before starting the Xwayland server, without making any adjustments in our
test suit.
2020-07-17 09:10:51 +00:00
Aleix Pol
93a08ba947 Fix keyboard layout tests
Don't give the InputConfig a separate config instance. I've seen it
being changed after having initialized the xkb instance which would
break the shared instance.
Using a simple config rather than reading the configuration from
the actual code-path shouldn't make a difference as a test it will be
using ~/.qttest which should be cleaned upp
2020-07-16 17:00:30 +00:00
David Edmundson
3a74be2df6 [autotests] Don't change screens during cleanup
Screens are set during init, to do so at cleanup doesn't bring a lot.

It leads to a potential awkward raciness with xwayland failing the test,
whilst doing something that isn't part of what we're testing here or
likely to happen in real life.
2020-07-14 11:12:18 +00:00
Aleix Pol
e28e4cb189 Move inputConfig away from KWin::Application
We were calling it from tests that were not running a KWin::Application
and not even including the symbols from main.cpp and main.h. The only
reason they linked was that it was static_casting up the QCoreApplication.
2020-07-13 12:54:34 +02:00
Benjamin Port
84b8d866e6 Prevent move/resize event when handling a maximize event 2020-07-07 08:35:12 +00:00
Benjamin Port
2d13bc3aa8 Prevent move/resize event when handling set full screen event
BUG: 421232
2020-07-07 08:35:12 +00:00
Vlad Zahorodnii
fa7fe79825 Merge branch 'Plasma/5.19' 2020-06-25 16:14:12 +03:00
Vlad Zahorodnii
578ede2dd7 Merge branch 'Plasma/5.18' into Plasma/5.19 2020-06-25 16:13:57 +03:00
Vlad Zahorodnii
a0c4a8e766 [x11] Force FocusIn events for already focused windows
Depending on the current focus stealing prevention level, it's possible
for kwin to call XSetInputFocus() on a window that already has the input
focus. In which case, we won't receive the corresponding FocusIn event
and the client will remain inactive from kwin's perspective even though
it isn't.

In order to work around this issue, we can move the input focus to the
null window. By doing so, it's guaranteed that we're going to receive
the matching FocusIn event for the client.

This commit indirectly fixes a bug where fullscreen games are displayed
below panels.
2020-06-25 13:12:44 +00:00
Méven Car
61b55732ae Tests: Add outputmanagement to test helper 2020-06-24 11:17:42 +02:00
David Edmundson
9bc65e8151 [autotests] Update PlasmaSurfaceTest to match recently changed behaviour
0c9e481577 changed the layer of
WindowsGoBelow. The relevant unit test was not updated.
2020-06-19 08:44:29 +00:00
David Edmundson
494b67d610 [autotests] Fix quick tile autotest race condition
We send two async actions via another process
We do a wait for one
We check that we received two events

This is racey. QTRY_COMPARE can allow both events to arrive separately.
2020-06-19 08:28:45 +00:00
Vlad Zahorodnii
cb7a9456c0 [wayland] Rework Xcursor theme loading code
Currently in order to load an Xcursor theme, kwin uses libwayland api,
which looks really awkward because of the way how the compositor talks
to itself via the internal connection.

The main motivation behind this change is to limit the usage of kwayland
client api in kwin.
2020-06-18 07:14:58 +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
78d00f6d69 [autotests] Fix the plasma surface test
Currently the plasma surface test fails because the window placement
policy for OSDs had been changed and the test wasn't adjusted.
2020-06-02 16:23:31 +03:00
Vlad Zahorodnii
71bc60f4bc Fix build 2020-06-01 23:40:38 +03: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
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
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
Méven Car
c483e209fe Autotests: Add a test when relaunching a maximized cliend with BorderlessMaximizedWindows
Test Plan: Test pass

Reviewers: #kwin, zzag, davidedmundson

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29702
2020-05-13 16:41:33 +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
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
David Edmundson
a13ecf8d0e [wayland] Add new XdgOutput properties
Summary:
AbstractOutput::name() behaviour is changed so that it matches the X11
behaviour, showing an identifier like "HDMI-0".

XdgOutput.name is set to this name.

XdgOutput.description is currently set to the manufacturer name and
model, but it's not exposed to Qt so we probably don't care too much.

This should fix plasmashell changing applets when switching between X11
and wayland.

Test Plan:
Relevant unit test
I still need to run it on my laptop.

Reviewers: #kwin, #plasma, zzag

Reviewed By: #kwin, #plasma, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28230
2020-04-08 10:39:59 +01: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
dbac4bce7e Reduce the amount of objects that are compiled several times
Summary:
We build some objects several times which makes it uncomfortable to develop KWin
since every time we modify something a lot of things get rebuilt. This should
help a bit although it doesn't solve all the problems.

Test Plan: Builds, tests pass

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: davidedmundson, zzag, anthonyfieroni, iasensio, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28445
2020-04-02 00:41:55 +02:00
Aleix Pol
745981f4c5 Fix build, pass a QRect instead of its 4 components 2020-03-26 16:51:32 +01:00
Vlad Zahorodnii
9cce7f8686 [wayland] Drop support for legacy xdg-shell-v6 protocol
Summary:
xdg-shell stable has been around for quite a while. A quick analysis
showed that many distros ship GTK and Qt that support both xdg-shell
v6 and stable. Therefore, we can drop support for legacy v6 protocol.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28118
2020-03-18 14:38:58 +02:00
Yuri Chornoivan
39154ad2d6 Fix minor typo: inital -> initial
Summary: inital -> initial

Test Plan: none

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28092
2020-03-17 09:41:12 +02:00
Yuri Chornoivan
c66cde7307 Remove duplicate includes
Summary: The code contains duplicate includes.

Test Plan: Open the files from the patch

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28048
2020-03-14 21:19:14 +02:00
Niccol Venerandi
f9394d83f7 Move from Quad to Cubic
Summary: See https://invent.kde.org/websites/hig-kde-org/-/merge_requests/70

Reviewers: #kwin, ngraham

Reviewed By: ngraham

Subscribers: ngraham, zzag, apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27827
2020-03-04 19:40:35 +01: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
5d580b9fb2 [autotests] Fix failing KeyboardLayoutTest::testNumLock()
Summary:
Since Qt::KeypadModifier is set only for keypad keys and not the NumLock
key, we need to press at least one keypad key to determine whether
numlock is actually on. On the other hand, we know that when numlock is
on, the corresponding LED is also on. So we could check the LED rather
than press two keys.

Test Plan: testKeyboardLayout passes.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27789
2020-03-02 19:03:40 +02:00
Vlad Zahorodnii
fcea0eb218 [autotests] Fix PointerInputTest::testCursorImage()
Summary:
    FAIL!  : KWin::PointerInputTest::testCursorImage() Compared QImages differ in device pixel ratio.
       Actual   (((p->cursorImage()))): 2
       Expected (blueScaled): 1
       Loc: [/home/vlad/Workspace/KDE/src/kde/workspace/kwin/autotests/integration/pointer_input.cpp(1058)]

Test Plan: The test passes.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27725
2020-02-28 19:22:23 +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
Vlad Zahorodnii
e32374abc9 [autotests] Add tests for PMinSize, PMaxSize, and PResizeInc geometry hints
Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27400
2020-02-28 11:42:40 +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
1b528c4020 Merge branch 'Plasma/5.18' 2020-02-14 02:02:12 +02:00
Vlad Zahorodnii
4f9cbe4369 [autotests] Make XWaylandInputTest more robust 2020-02-14 02:02:04 +02:00
Vlad Zahorodnii
6a2fc3d8ce Merge branch 'Plasma/5.18' 2020-02-14 01:50:48 +02:00
Vlad Zahorodnii
1181af2cd1 Provide input geometry and input transformation matrix for Xwayland clients
Summary:
We need to provide the input geometry and the input transformation
matrix for Xwayland clients in order to make sure that input events
are correctly mapped from the global screen coordinates to the
screen-local coordinates.

BUG: 417444
FIXED-IN: 5.18.1

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27375
2020-02-14 01:49:27 +02:00
Vlad Zahorodnii
15af09c70a Introduce Toplevel::frameGeometryChanged signal
Summary:
Currently we have two signals that are emitted when the Toplevel's geometry
changes - geometryShapeChanged() and geometryChanged(). The former signal
is used primarily to invalidate cached window quads and the latter is
sort of emitted when the frame geometry changes. But it's not that easy. We
have a bunch of connects that link those signals together...

The worst part about all of this is that the window quads cache gets
invalidated every time a geometry update occurs, for example when user
moves a window around on the screen.

This change introduces a new signal and deprecates the existing geometryChanged
signal. frameGeometryChanged is similar to geometryChanged except that it is
emitted when an _actual_ geometry change has occurred.

We do still emit geometryShapeChanged signal. However, in long term, we
need to get rid of this signal or come up with something that makes sense
and doesn't require us to waste computational resources.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26863
2020-02-12 10:52:26 +02:00
Vlad Zahorodnii
6dd6bdb57d [wayland] Implement resize_x/resize_y constraint adjustment
Summary:
Since we send the initial configure event after placing xdg-popups, we
can finally implement resize_x and resize_y constraint adjustments.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27049
2020-01-31 12:17:45 +02:00
Vlad Zahorodnii
d079f5daed [wayland] Keep the opposite corner still when resizing a window
Summary:
According to the xdg-shell spec, configure events carry the maximum
window geometry size. If a client wants to enforce aspect ratio, it
may attach a buffer with smaller size. We need to account for that
when determining frame geometry in the commit handler.

I'm targeting 5.18 branch.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26886
2020-01-24 01:05:40 +02:00
Vlad Zahorodnii
55b4912004 Update my email address 2020-01-14 18:17:18 +02:00
David Edmundson
7f587d1147 warnings--
Reviewers: apol, zzag

Reviewed By: apol, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25667
2019-12-02 09:02:51 +00:00
Vlad Zahorodnii
9d4a32596c Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example

    QList<QWeakPointer<TabBoxClient>> TabBoxClientList

in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?

Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.

So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24950
2019-11-27 15:54:08 +02:00
Vlad Zahorodnii
9f7a856d23 [wayland] Implement window geometry more properly
Summary:
So far the window geometry from xdg-shell wasn't implemented as it should
be. A toplevel must have two geometries assigned to it - frame and buffer.
The frame geometry describes bounds of the client excluding server-side
and client-side drop-shadows. The buffer geometry specifies rectangle on
the screen occupied by the main surface.

State and geometry handling in XdgShellClient is still a bit broken. This
change doesn't intend to fix that, it must be done in another patch asap.

Test Plan: New tests pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, romangg, kwin

Tags: #kwin

Maniphest Tasks: T10867

Differential Revision: https://phabricator.kde.org/D24455
2019-11-27 14:12:30 +02:00
Yuri Chornoivan
84244a7cf6 Use URL with transport encryption 2019-11-26 19:39:20 +02:00
Vlad Zahorodnii
69a3517e02 Merge branch 'Plasma/5.17' 2019-10-25 17:50:13 +03:00
Vlad Zahorodnii
a738ecce85 [scripting] Provide conversion functions for AbstractClient
Summary:
If no conversion functions are provided for a QObject-subclass, then
QScriptEngine will use QScriptEngine::newQObject() method without any
special options to convert an instance of that QObject-subclass to a
QScriptValue. However, it's very important that every client object is
wrapped with PreferExistingWrapperObject option. We need that option
because a script may set a property on a client object and that property
must remain until it's deleted by the script.

BUG: 413044
FIXED-IN: 5.17.2

Test Plan: New test.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24944
2019-10-25 17:39:45 +03:00
Marco Martin
10ace126be [wayland] Make sure fullscreen windows aren't repositioned
Summary:
on X11, setFullScreen is always called after Placement::place()
so they always have the correct geometry.
on wayland, the window if is shown directly as fullscren,
is set fullscreen in init() then place() is evecuted, potentially
moving it to a wrong position and potentially even size (which happens
with maximiziong placement strategy)
so instead of place() the client needs to be explicitly set at
fullscreen geometry

Test Plan:
fullscreen windows always appear with the proper geometry
autotests still pass

Reviewers: #kwin, #plasma, davidedmundson

Reviewed By: #kwin, #plasma, davidedmundson

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24542
2019-10-11 10:46:43 +02:00
Vlad Zahorodnii
7d4471eba6 Rename geometry property to frameGeometry
Summary:
In order to properly implement xdg_surface.set_window_geometry we need
two kinds of geometry - frame and buffer. The frame geometry specifies
visible bounds of the client on the screen, excluding client-side drop
shadows. The buffer geometry specifies rectangle on the screen that the
attached buffer or x11 pixmap occupies on the screen.

This change renames the geometry property to frameGeometry in order to
reflect the new meaning assigned to it as well to make it easier to
differentiate between frame geometry and buffer geometry in the future.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24334
2019-10-02 11:46:37 +03:00
Vlad Zahorodnii
f93875535c Update my last name 2019-09-29 17:03:25 +03:00
Vlad Zahorodnii
ffcbe24e2b Rename Client to X11Client
Summary:
Currently each managed X11 client is represented with an instance of
Client class, however the name of that class is very generic and the
only reason why it's called that way is because historically kwin
was created as an x11 window manager, so "Client" was a sensible choice.

With introduction of wayland support, things had changed and therefore
Client needs to be renamed to X11Client in order to better reflect what
that class stands for.

Renaming of Client to X11Client was agreed upon during the last KWin
sprint.

Test Plan: Compiles, the test suite is still green.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24184
2019-09-25 21:11:37 +03:00
Vlad Zahorodnii
79bc955202 [autotests] Enable PopupOpenCloseAnimationTest::testAnimateUserActionsPopup 2019-09-24 10:22:51 +03:00
Vlad Zahorodnii
a4ec797883 [autotests] Gracefully destroy xdg client 2019-09-23 23:02:21 +03:00
Vlad Zagorodniy
168ea98845 Rename ShellClient to XdgShellClient
Summary:
Rename ShellClient to XdgShellClient in order to reflect that it
represents only xdg-shell clients.

Test Plan: Compiles, tests still pass.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23589
2019-09-23 17:28:56 +03:00
Vlad Zagorodniy
665ec0a5de [wayland] Drop xdg-shell v5 support
Summary:
Drop xdg-shell v5 support since this protocol is obsolete and all popular
wayland compositors already did that.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23573
2019-09-23 17:28:56 +03:00
Vlad Zagorodniy
d92d6e77ae [autotests] Don't test wl-shell clients
Summary:
This change removes all traces of wl-shell in the test suite. That's a
prerequisite for dropping wl-shell support in KWin.

Given that wl-shell and xdg-shell are not interchangeable, some tests
were removed and initialization sequence in some tests was adjusted.

The most notable change is ensuring that each plasmashell window sets
its role and initial position before committing the surface. Setting
those properties before the first surface commit is important because
our window placement code needs to know window type in order to
avoid maximizing panels, popups, etc.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23561
2019-09-23 17:28:56 +03:00
Vlad Zagorodniy
bebe81209c Port QPA away from Wayland
Summary:
So far wayland was used by internal clients to submit raster buffers
and position themselves on the screen. While we didn't have issues with
submitting raster buffers, there were some problems with positioning
task switchers. Mostly, because we had effectively two paths that may
alter geometry.

A better approach to deal with internal clients is to let our QPA use
kwin core api directly. This way we can eliminate unnecessary roundtrips
as well make geometry handling much easier and comprehensible.

The last missing piece is shadows. Both Plasma::Dialog and Breeze widget
style use platform-specific APIs to set and unset shadows. We need to
add shadows API to KWindowSystem. Even though some internal clients lack
drop-shadows at the moment, I don't consider it to be a blocker. We can
add shadows back later on.

CCBUG: 386304

Reviewers: #kwin, davidedmundson, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kwin

Tags: #kwin

Maniphest Tasks: T9600

Differential Revision: https://phabricator.kde.org/D22810
2019-09-23 17:28:56 +03:00
Vlad Zahorodnii
0962cc661c [autotests] Stabilize testMoveResize 2019-09-12 20:18:14 +03:00
Vlad Zahorodnii
2b73484976 [autotests] Fix filename of placement test 2019-09-12 19:45:53 +03:00
Vlad Zahorodnii
d74a7c8f7a [autotests] Test more placement policies 2019-09-12 19:43:18 +03:00
Vlad Zagorodniy
9ea29e3891 [autotests] Stabilize pointer input test 2019-09-10 15:09:03 +03:00
Vlad Zagorodniy
9102e41e71 Traverse the stacking order backwards when switching between windows
Summary:
In order to pick the next client to activate we traverse the stacking
order from bottom to top and assign to each client a score. The client
with the best score will be activated next. Function that assigns score
bases its decisions purely on geometry. This may backfire if there are
couple maximized or fullscreen clients on the screen - we'll activate
the bottom-most client.

This change toggles direction we traverse the stacking order. If there
are several clients with an identical score, then prefer the top-most
client, the one that the user most likely sees at the moment.

BUG: 411356
FIXED-IN: 5.17.0

Test Plan: New tests pass.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23521
2019-08-31 13:47:15 +03:00
Vlad Zagorodniy
7f5f64c0c7 [autotests] Fix failing autotests
Summary:
After recent output-related changes testIdleInhibition and
testColorCorrectionNightColor started failing with the following output:

    ❯ dbus-run-session bin/testIdleInhibition
    ********* Start testing of TestIdleInhibition *********
    Config: Using QtTest library 5.13.0, Qt 5.13.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 9.1.0)
    QFATAL : TestIdleInhibition::initTestCase() ASSERT: "mode.size.isValid()" in file /home/vlad/Workspace/KDE/src/frameworks/kwayland/src/server/outputdevice_interface.cpp, line 188
    FAIL!  : TestIdleInhibition::initTestCase() Received a fatal error.
       Loc: [Unknown file(0)]
    Totals: 0 passed, 1 failed, 0 skipped, 0 blacklisted, 13ms
    ********* Finished testing of TestIdleInhibition ********

Apparently, they both don't initialize virtual outputs properly.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23539
2019-08-28 19:20:50 +03:00
Roman Gilg
cd6b69a4d2 [platforms/virtual] Create output devices
Summary:
Create output devices in virtual backend. For that the setVirtualOutputs call
can only come after the Wayland server has been initiliazied such that the
display exists to create the output and output device interfaces. Tests have
been adjusted for that.

Test Plan:
```
98% tests passed, 3 tests failed out of 148

Total Test time (real) = 362.97 sec

The following tests FAILED:
         33 - kwin-testInternalWindow (Failed)
         39 - kwin-testPointerInput (Failed)
        101 - kwin-testMoveResize (Failed)
```
Failing of these tests looks unrelated to the change.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T11459

Differential Revision: https://phabricator.kde.org/D23477
2019-08-27 12:24:49 +02:00
Roman Gilg
1db84a2ba7 Split Compositor class in Wayland and X11 child classes
Summary:
This patch is a first take at splitting up of the Compositor class into
Wayland and X11 child classes.

In this first patch we mostly deal with setup and teardown procedures.
A future goal is to further differentiate the compositing part itself too.

Test Plan: Manually X from VT and Wayland nested. Autotests pass.

Reviewers: #kwin

Subscribers: sbergeron, anthonyfieroni, zzag, kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D22195
2019-08-07 21:06:53 +02:00
Vlad Zagorodniy
4e078b9eaf Revert "wayland: Terminate client connections before Workspace is destroyed"
Commit 826b9742e9 breaks a lot of other
things. Need further investigation before fixing heap-use-after-free.
2019-08-07 11:21:30 +03:00
Vlad Zagorodniy
826b9742e9 wayland: Terminate client connections before Workspace is destroyed
Summary:
When ShellClient tears down, it needs to access RuleBook in order to
discard temporary rules. The problem is that WaylandServer outlives
Workspace and therefore so does ShellClient.

We can't guard against the case when RuleBook::self() is nullptr as it
is vital to discard temporary rules.

This change adjusts termination sequence so all shell clients are
destroyed before Workspace(and thus RuleBook) is gone.

ASAN output:
    ==19922==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000142060 at pc 0x7fbc0fb878bb bp 0x7ffd7d464520 sp 0x7ffd7d464518
    READ of size 8 at 0x606000142060 thread T0
        #0 0x7fbc0fb878ba in QList<KWin::Rules*>::detach() /usr/include/qt5/QtCore/qlist.h:172
        #1 0x7fbc0fb8538d in QList<KWin::Rules*>::begin() /usr/include/qt5/QtCore/qlist.h:324
        #2 0x7fbc0fb808b6 in KWin::RuleBook::discardUsed(KWin::AbstractClient*, bool) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/rules.cpp:1144
        #3 0x7fbc0fe36e32 in KWin::ShellClient::destroyClient() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/shell_client.cpp:435
        #4 0x7fbc0fe7a726 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::ShellClient::*)()>::call(void (KWin::ShellClient::*)(), KWin::ShellClient*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
        #5 0x7fbc0fe784c3 in void QtPrivate::FunctionPointer<void (KWin::ShellClient::*)()>::call<QtPrivate::List<>, void>(void (KWin::ShellClient::*)(), KWin::ShellClient*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
        #6 0x7fbc0fe74de9 in QtPrivate::QSlotObject<void (KWin::ShellClient::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/home/jenkins/install-prefix/lib64/libkwin.so.5+0x1677de9)
        #7 0x7fbc04f27357 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3357)
        #8 0x7fbc074e1970 in KWayland::Server::Resource::unbound() /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/build/src/server/KF5WaylandServer_autogen/EWIEGA46WW/moc_resource.cpp:142
        #9 0x7fbc0766b4b4 in KWayland::Server::Resource::Private::unbind(wl_resource*) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/resource.cpp:68
        #10 0x7fbc00bdc2ae  (/usr/lib64/libwayland-server.so.0+0x92ae)
        #11 0x7fbc00bdc32f in wl_resource_destroy (/usr/lib64/libwayland-server.so.0+0x932f)
        #12 0x7fbc0766b53f in KWayland::Server::Resource::Private::resourceDestroyedCallback(wl_client*, wl_resource*) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/resource.cpp:76
        #13 0x7fbbff481d8c  (/usr/lib64/libffi.so.7+0x6d8c)
        #14 0x7fbbff481179  (/usr/lib64/libffi.so.7+0x6179)
        #15 0x7fbc00bdfa5f  (/usr/lib64/libwayland-server.so.0+0xca5f)
        #16 0x7fbc00bdc6d1  (/usr/lib64/libwayland-server.so.0+0x96d1)
        #17 0x7fbc00bddc71 in wl_event_loop_dispatch (/usr/lib64/libwayland-server.so.0+0xac71)
        #18 0x7fbc07541e50 in KWayland::Server::Display::Private::dispatch() /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/display.cpp:148
        #19 0x7fbc075432de in KWayland::Server::Display::dispatchEvents(int) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/display.cpp:220
        #20 0x7fbc0fe864ca in KWin::WaylandServer::dispatch() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/wayland_server.cpp:616
        #21 0x451ce0 in KWin::WaylandTestApplication::~WaylandTestApplication() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/kwin_wayland_test.cpp:91
        #22 0x42faa1 in main /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/globalshortcuts_test.cpp:381
        #23 0x7fbc04796bca in __libc_start_main (/lib64/libc.so.6+0x26bca)
        #24 0x413ea9 in _start (/home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/bin/testGlobalShortcuts+0x413ea9)

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22821
2019-07-31 20:08:50 +03:00
Vlad Zagorodniy
fda225aa1d autotests: Register Deleted in MoveResizeWindowTest 2019-07-30 22:08:28 +03:00
Vlad Zagorodniy
f395afb9a3 autotests: Rework MoveResizeWindowTest::testResize
ShellClient doesn't send a configure event when a move-resize operation
is finished. The reworked tests exposes the problem.
2019-07-30 22:05:50 +03:00
Vlad Zagorodniy
b6e67869e3 autotests: Port QSignalSpies to new connect syntax 2019-07-29 22:59:12 +03:00
Vlad Zagorodniy
684b4b635e Use more traditional doxygen style
Summary:
So far we were following a bit unique and rare doxygen comment style:

    /**
     * Contents of the comment.
     **/

Doxygen comments with this style look balanced and neat, but many people
that contribute to KWin don't follow this style. Instead, they prefer
more traditional doxygen comment style, i.e.

    /**
     * Contents of the comment.
     */

Reviewing such changes has been a bit frustrating for me (so selfish!)
and for other contributors.

This change switches doxygen comment style in KWin to a more traditional
style. The main reason for doing this is to make code review process easier
for new contributors as well us.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22812
2019-07-29 22:06:19 +03:00
Vlad Zagorodniy
702a4ff688 [wayland] Implement maximize rules
Summary:
There is still one small issue that has to be addressed in the future:
xdg-toplevel doesn't have states like MAXIMIZED_VERT or MAXIMIZED_HORZ,
thus Window Rules KCM should display only single maximize rule(not two)
for wayland clients.

Test Plan: The new tests pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19414
2019-07-29 20:56:30 +03:00
Vlad Zagorodniy
bbe898243a [wayland] Implement size and position window rules
Test Plan: The new tests pass.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19413
2019-07-29 20:56:30 +03:00
Vlad Zagorodniy
8af2fa73dc Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.

The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.

Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.

A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!

The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.

The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, apol, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 20:03:22 +03:00
Vlad Zagorodniy
eafe7aee65 [colorcorrection] Add "Constant" mode
Summary:
Currently, the Night Color manager supports three operation modes:

* Automatic: in this mode, screen color temperature is computed based on
the current position of the Sun. In order to calculate sunrise & sunset
times, the manager needs coordinates of the user, which are provided by
Plasma;

* Location: this mode is very similar to the Automatic, except one minor
detail: user needs to provide his/her/their location. This mode can be
very useful if coordinates provided by Plasma are incorrect;

* Timings: unfortunately we can't compute timings of the Sun for people
living near Earth poles. This mode allows the user to specify timings of
sunrise and sunset as well the transition time.

This change introduces another mode, called Constant. With this mode the
screen color temperature is constant throughout the day. The new mode
can be useful for people wishing constant screen color temperature or
just for people living near Earth's North or South poles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: ngraham, davidedmundson, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D21948
2019-07-22 00:30:39 +03:00
David Edmundson
9b04e0315c [autotests] Test placement strategies
Summary:
The maximise test is moved and a simple test is added for smart
placement and placeCorner.

The class tries to make a framework to make it faster to add future
xdg_toplevel placement tests without having to copy too much
boilerplate.

Test Plan: Passes

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D21996
2019-07-10 18:41:42 +01:00
Vlad Zagorodniy
c7639fd7ed Port away from deprecated headers
Summary: Headers like stdio.h are deprecated in C++.

Test Plan:
Compiles.

clangd no longer spews these warnings

{F6997789, size=full}

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22351
2019-07-09 23:59:07 +03:00
Vlad Zagorodniy
be48d36349 [autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.

CCBUG: 403305

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 15:13:49 +03:00
Roman Gilg
8c047613c5 Partly remove Compositor restart functionality
Summary:
This removes the restart function of the Compositor class and renames the
internal reinitialize function.

Instead of the restart function reinitialize can be called. Reading again
the settings in this case is fine, since it is done rarely. This reduces
the code complexity.

Test Plan: Manually on Wayland and X. 100% autotests pass.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: davidedmundson, zzag, kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D22225
2019-07-04 15:31:40 +02:00
Roman Gilg
bc309929a0 [autotests] Fix debug console test
Summary:
Use QTRY_COMPARE macro to not fail if signal already sent. Also shorten
timeout on expect to fail test for faster test runs.

Test Plan: Debug console test passes again.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22124
2019-06-27 19:19:17 +02:00
Roman Gilg
349560a78c [autotests] In internal window test remove spy waits or guard them
Summary:
The internal window test is failing on CI because the client add spy waits
are not triggered. The signal has been emitted already at this point.

Removing them fixes this (the condition is still checked by subsequent
count verify on the spy) in all but one instance. In this case the wait
needs to be guarded.

Is there a more general approach to it? Always guarding is ugly. Also when
was this test regression introduced? In the past we must have had some
slack until the signal was fired to start the wait call.

Test Plan: Internal window test passes with this patch again.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: davidedmundson, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22119
2019-06-27 18:38:22 +02:00
Roman Gilg
73fa7df1fc [autotests] Fix remaining autotests with failing border calculation
Summary:
As in 2c088894b fix remaining autotests failing since no borders has become
the new default behavior of Breeze.

Autotests should not rely on this default behavior of Breeze though, but be
run with a faked deco such that changes on Breeze does not directly change
the autotests behavior. That's a goal for the future.

Test Plan: 100% tests passed, 0 tests failed out of 147

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D21746
2019-06-27 13:44:03 +02:00
Roman Gilg
2c088894b4 [autotests] Fix decoration input test
Since d51b8dc093 the test fails on CI, apparently because we test with
Breeze default settings, which is no borders now and we can move a bit into
the window geometry and still be on the border if borders exist, otherwise
not.

For now fix it by checking if there are borders or not and then test
accordingly. But long-term we should test both cases and besides not rely on
external decorations for our test, instead use a fake specific for our
integration testing.
2019-06-07 14:48:45 +02:00
Nate Graham
1b9eaa62c2 Revert "Revert "Handle XdgShell window geometry in configure request sizes""
Plasma 5.16 has branched, and support is now in Frameworks with
https://cgit.kde.org/kwayland.git/commit/?id=6da6c7c7e090c024a8288088f9b96ef2bacf38a5,
So this can go into KWin master now.

This reverts commit 24cbe48656.
2019-05-17 08:13:54 -06:00
David Edmundson
24cbe48656 Revert "Handle XdgShell window geometry in configure request sizes"
This reverts commit bc83065ceb.

Turns out the relevant wayland code wasn't merged. This will have to
wait till next plasma for a fix.
2019-05-10 21:43:08 +01:00
David Edmundson
bc83065ceb Handle XdgShell window geometry in configure request sizes
Summary:
The size passed to an XDG shell configure request should match the
window size of the given window, we don't want to include the size of
any shadows that may be drawn by the client.

Kwin has the same concept of geometry for both window management, input
and rendering.

In order to approach this in a way that does not risk any regressions
with kwin's current structure AbstractClient::geometry remains the
canonical source and we handle the window within that internally within
ShellClient treating the windowGeometry as a set of margins from this.

This is part of a much bigger task (T10867). This patch addresses
windows growing when starting a drag based resize.

BUG: 403376

Test Plan:
Unit test
gtk3-demo

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20937
2019-05-10 16:34:43 +01:00
Kai Uwe Broulik
df85907de3 Support CriticalNotification type and place it in a CriticalNotificationLayer
Differential Revision: https://phabricator.kde.org/D20629
2019-05-02 10:29:38 +02:00
Christoph Feck
6a53658d49 Merge remote-tracking branch 'origin/Plasma/5.15' 2019-04-26 10:59:40 +02:00
Christoph Feck
57440d1d6b Fix captions with non-BMP characters
KWin replaces any non-printable character with a space. This check does not
handle surrogate pairs correctly. Additionally, translators sometimes insert
non-printable soft-hyphens into titles, which also cause KWin to display a
space instead.

This code adds the missing surrogate handling, and (to fix both issues), also
removes non-printable characters instead of replacing them with a space.

Also moved the changed test after these changes, so that changes in non-
printable characters do not cause unneeded redraws.

Unit tests adapted by Vlad Zagorodniy.

Test Plan:

kwrite /tmp/Test😣.txt shows correct title. I also tested actual non-printable
characters, such as 0x1A, and these are correctly omitted.

BUG: 376813
FIXED-IN: 5.15.5

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, grasslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19052
2019-04-26 10:52:57 +02:00
Vlad Zagorodniy
abe128818c Use more accurate name for Workspace::getMovingClient method
Summary:
The name of Workspace::getMovingClient() method implies that the
returned value is a client that is currently being moved around
by the user, but this is of course incorrect.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20663
2019-04-22 11:12:22 +03:00
David Edmundson
efc62941ee [wayland] Place all toplevels before the first configure
Summary:
Currently popups get positioned once at the initial configure, to set
the correct size and again when they are mapped.

Toplevels are currently only positioned when they are mapped. This works
for all cases where the the toplevel defines its own size, but not if
the window should have an initial size set by the placement strategy or
window rules. Most notably the maximised placement strategy used on
plasma mobile.

Being out of sync and resizing later currently causes a positioning bug
when plasma mobile is used with XdgShell.

This patch repositions all top levels that don't have a position set
through the plasma interface.

Test Plan: Relevant unit test

Reviewers: #kwin, bshah

Reviewed By: bshah

Subscribers: zzag, bshah, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20241
2019-04-09 11:15:02 +01:00
Vlad Zagorodniy
f10760d8a9 [wayland] Finish active move-resize op when client is destroyed or unmapped
Summary:
It might happen that the moving client gets closed or crashes. In that
case, we have to manually reset Workspace::movingClient, otherwise KWin
will most likely crash later on.

BUG: 405379

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19708
2019-04-09 08:47:31 +03:00
Kai Uwe Broulik
68fca9a613 Merge branch 'Plasma/5.15' 2019-04-01 10:34:45 +02:00
Kai Uwe Broulik
dc552ee2ae Force server-side decoration if no borders are forced by user
Otherwise the client will start drawing its own border now.

BUG: 405385
FIXED-IN: 5.15.4

Differential Revision: https://phabricator.kde.org/D19705
2019-04-01 10:29:45 +02:00
Marco Martin
6bc2ddd56a virtualkeyboard: resize the focused window to make room for the keyboard
Summary:
alternative approach: try to resize the winidow to make room for the keyboard.
the new input wayland protocol doesn't have anymore the overlap rectangle (and it would not be going to work with qwidget apps anyways)

in the future will probably be needed anextension to the input protocol v3 which partially gets back this, tough window resizing is needed regardless

what's missing: the resize should be "temporary" and the window should be restored to its previous geometry when the keyboard closes

Test Plan: tested with test QML code

Reviewers: #plasma, #kwin, bshah, graesslin, romangg, davidedmundson

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

Subscribers: nicolasfella, mart, kwin, davidedmundson, graesslin

Tags: #kwin

Maniphest Tasks: T9815

Differential Revision: https://phabricator.kde.org/D18818
2019-03-20 11:05:06 +01:00
David Edmundson
768e5fb7f4 [autotests] Fix race condition in ShellClient::testUnresponsiveWindow
Summary:
The test executable "kill" freezes itself after 1ms, supposedly after
showing a window.

However showing a window is not syncronous on wayland, it's illegal to
map a buffer before getting a configure event from the server.

This patch removes any potential for a race by having the server tell
our test executable when to freeze.

Test Plan: Test still passed

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19406
2019-02-28 02:09:33 +00:00
David Edmundson
6ddf50a77b [autotests] Fail faster on test which fails anyway
Summary:
The .wait() in this case isn't really time depdenent, we just need to
process the event loop.

Given we know this tests fails, there's no point me waiting 30s.

Test Plan: Test failed, but faster

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19351
2019-02-28 01:41:16 +00:00
David Edmundson
2bad2b48fe [wayland] Finish initialising ShellClient only when commited to the surface
Summary:
Everything on the wl_surface is double buffered.

When we create an XdgShell toplevel or popup we shouldn't treat it as
attached until it's committed to the surface.

A client should commit the surface after it's sent it's initial state of
the Xdg topLevel; minimumSize, title, app_id, etc.

By blocking sending configure events we will have flushed the correct
initial state before sending a single atomic correct event to the
client. It also adds a hook to re-evaluate rules now that all properties
are set.

Arguably this applies to WlShellSurface too, but I've left it unchanged
as it's deprecated and hard to verify real client behaviour.

Test Plan: Ran all unit tests

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18583
2019-02-26 13:51:28 +00:00
David Edmundson
dc7ea09e8d [autotests] Check the configure request sent to popups
Summary:
We currently check the final position kwin knows about.
This patch also checks the position the popup is told that
it's in as well as acking configure requests correctly.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18955
2019-02-26 13:41:00 +00:00
Vlad Zagorodniy
dffd9777c7 [libkwineffects] Make AnimationEffect::AniMap protected
Summary:
We need AniMap only for test purposes so it would be better to make the
typedef protected (and mark as internal as well).

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17833
2019-02-26 11:37:44 +02:00
David Edmundson
5e9023948e [wayland] Keep application startup flow inside main_wayland
Summary:
In a recent patch the newly added xwayland class ended up being
responsible for continuing the startup, calling back into the main app
to spawn the workspace.

It moves the flow of startup about so it's not very readable or
following class structure.

This patch moves the code back into main_wayland and removes the
duplication between xwayland and non-xwayland modes.

There was also a misnaming of methods.

Previously:
continueStartupWithScreens was called after platform screens are created
continueStartupWithScene was called after the scene was created
continueStartupWithXwayland was called before xwayland is created

This was confusing, so the names have been shuffled around to follow a
consistent pattern of what has been done so far.

Test Plan:
Started kwin_wayland in normal and xwayland mode
Ran unit tests (though some failed due to a local unrelated and as yet unindentified bug)

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19232
2019-02-23 12:18:09 +00:00
Sebastian Krzyszkowiak
7bf2c1d73e [wayland] Fix window sizing when restoring a window that was initially fullscreen
Summary: When creating a surface and setting it as fullscreen before
attaching its buffer KWin does not know the original dimensions of the
surface and tries to use an invalid value when unsetting the fullscreen
flag. This patch fixes this by sending a configure with the size of 0,0
- which according to xdg-shell spec means that the client is requested
to set its size by itself.

Test Plan:
1. Create a fullscreen Wayland window.
2. Toggle fullscreen off.
3. KWin should send a configure event with size 0,0 instead of 1,1.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: zzag, graesslin, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16710
2019-02-22 18:58:22 +00:00
Martin Flöser
cbbe94d769 Restrict available supported compositors based on first initialized one
Summary:
On Wayland we cannot switch from OpenGL to QPainter compositor as this
would break any running OpenGL application. KWin registers it's
EGLDisplay to Wayland and without OpenGL this doesn't make sense any
more. We are not able to render OpenGL buffers in the QPainter
compositor.

While it's theoretically possible to switch from QPainter to OpenGL it
doesn't make any sense for the same reason. Any running OpenGL
application would be using llvmpipe and could not be switched to proper
OpenGL.

This change stores the selected compositing type in Platform and the
implementations can use it to restrict the supported compositors. On X11
we don't need this, all other Platforms implement the restriction. Thus
it's no longer possible to switch the backends at runtime.

Test Plan:
Adjusted tests run, no runtime test as gui doesn't support
switching to QPainter anyway.

Reviewers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19084
2019-02-22 16:59:08 +01:00
Roman Gilg
d0422eb79f Remove unnecessary flushs in new buffer size change test 2019-02-21 23:42:47 +01:00
Roman Gilg
06f64d5e56 [autotests] Sub-surface resize test
Summary:
Adds an autotest to show that KWin fails an assertion when a client tries to
resize a sub-surface.

Since it is the first autotest dealing with sub-surfaces explicitly additional
autotest helpers are introduced to allow that.

We also add a new signal in Compositor to spy on to know when the buffer swap
has been completed.

Test Plan:
Test fails as expected:
```
QFATAL : KWin::BufferSizeChangeTest::testShmBufferSizeChangeOnSubSurface() ASSERT: "image.size() == m_size" in file /home/roman/dev/kde/src/kde/workspace/kwin/platformsupport/scenes/opengl/abstract_egl_backend.cpp, line 394
FAIL!  : KWin::BufferSizeChangeTest::testShmBufferSizeChangeOnSubSurface() Received a fatal error.
   Loc: [Unknown file(0)]
Totals: 4 passed, 1 failed, 0 skipped, 0 blacklisted, 367ms
********* Finished testing of KWin::BufferSizeChangeTest *********
```

Reviewers: #kwin, zzag

Subscribers: zzag, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18452
2019-02-21 23:33:32 +01:00
Martin Flöser
9b922f8833 Split out a dedicated InternalClient class
Summary:
Most of the functionality which is special to internal clients is moved
from ShellClient to InternalClient. As KWin's qpa is still bound to the
Wayland protocol InternalClient inherits from ShellClient. Due to that
some aspects in ShellClient are "weird". ShellClient still detects
whether it's an internal client and uses the variable m_internal to
capture the state. This is required as we cannot use the isInternal
method. Most of m_internal usage is in init which is called from
constructor of ShellClient. Thus it's not possible to call into virtual
methods of InternalClient.

Also some of the code is duplicated and some methods are temporarily
marked as virtual.

The next step will be to remove ShmBuffer for internal windows which
should decouple the two implementations further with the long term goal
of having InternalClient inherit AbstractClient directly.

Test Plan:
Run nested KWin, triggered outline (OpenGL case) and debug console (shm case).
InternalWindow unit test still passes.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18569
2019-02-21 18:51:25 +01:00
David Edmundson
3cdea2f77c [wayland] Fix typo in method name
Test Plan: Compile + grep

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19177
2019-02-20 13:19:24 +00:00
Roman Gilg
2776f829ef Remove X clipboard sync helper and rename its autotest
Summary:
With the gneric X selections infrastructure and clipboard support the X
clipboard sync helper utility can be removed. Also rename its autotest as it
tests the inner workings of the new mechanism since this mechanism was
introduced.

Test Plan: Autotest still passes under new name.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15063
2019-02-19 12:30:43 +01:00
Roman Gilg
6e08fb2fa5 [xwl] Generic X selections translation mechanism with Clipboard support
Summary:
In this patch an infrastructure is created to represent generic X selections
in a Wayland session and use them for data transfers between Xwayland windows
and Wayland native clients.

The central manager is the DataBridge class, in which Selection objects can be
created. This is hard-coded and such a Selection object persists until the end
of the session, so no arbitrary selections can be created on the fly. For now
the X Clipboard selection is supported, whose corresponding mechanism in the
Wayland protocol is just called Selection.

A Selection object listens for selection owner changes on the X side and for
similar events into the Wayland server interfaces. If a data provider is
available a selection source object is created by the Selection object. In case
data is requested on the other side, a data transfer is initialized by creating
a Transfer object. A Selection keeps track of all transfers and makes sure that
they are destroyed when they are finished or in case they idle because of
misbehaving clients.

The Clipboard class translates the X Clipboard via a proxy window. Selection
changes on the Wayland side are listened to through a new signal on the active
KWayland seat interface.

The previously used X clipboard syncer helper is disabled. The clipboard sync
autotest is changed to the new mechanism.

BUG: 394765
BUG: 395313

Test Plan: Manually and clipboard sync autotest.

Reviewers: #kwin

Subscribers: zzag, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15061
2019-02-19 12:24:27 +01:00
Roman Gilg
608a89a85b [autotests] Use Xwayland class in WaylandTestApplication
Summary:
By using the new Xwayland class we can reduce code duplication.

An abstract parent class is introduced, that allows interfacing
with the Xwayland class from the test binaries.

Test Plan: Autotests still pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15022
2019-02-19 12:18:33 +01:00
David Edmundson
5fa18646b6 [autotests] Fix typo in autotest name 2019-02-12 12:38:35 +00:00
Vlad Zagorodniy
5ad797d5fe [autotests] Test maximize animation
Test Plan:
    dbus-run-session ctest -R testMaximizeAnimation

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18166
2019-02-01 13:50:40 +02:00
Vlad Zagorodniy
621370d729 [autotests] Test minimize animations
Test Plan:
    dbus-run-session ctest -R testMinimizeAnimation

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18162
2019-02-01 13:50:40 +02:00
Vlad Zagorodniy
872831fb15 [autotests] Test desktop switching animations
Summary:
The new test verifies some common things about desktop switching
animation effects, it doesn't verify what each of one them is doing
because it wouldn't be worth it.

Test Plan:
    dbus-run-session ctest -R testDesktopSwitchingAnimation

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18156
2019-02-01 13:50:40 +02:00
Vlad Zagorodniy
97cf32f916 Drop ShellClient::shellSurface method
Summary:
The only place where this method is used is testMaximize. Though that
usage is not justified. We're checking what KWayland already checks.

Test Plan: Compiles, all tests still pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18635
2019-02-01 12:54:27 +02:00
David Edmundson
18dd0327c2 [autotests] Untangle ShellClient::testMaximizedToFullscreen
Summary:
XdgShell and WlShell behave very differently when it comes to switching
from normal to maximised to fullscreen and back. Under XDGShell they are
2 properties, under WlShell it's a tristate enum.

This test was testing something very specific under WlShell and then
became a horrid mess of if statements doing different things and testing
different things, especially after XdgShell got proper configure
handling.

This patch splits it into two methods.

Test Plan:
Ran test
Passed

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18589
2019-01-29 12:31:06 +00:00
Martin Flöser
02a0561016 Add windowsystem plugin for KWin's qpa
Summary:
KWindowSystem provides a plugin interface to have platform specific
implementations. So far KWin relied on the implementation in
KWayland-integration repository.

This is something I find unsuited, for the following reasons:
 * any test in KWin for functionality set through the plugin would fail
 * it's not clear what's going on where
 * in worst case some code could deadlock
 * KWin shouldn't use KWindowSystem and only a small subset is allowed
to be used

The last point needs some further explanation. KWin internally does not
and cannot use KWindowSystem. KWindowSystem (especially KWindowInfo) is
exposing information which KWin sets. It's more than weird if KWin asks
KWindowSystem for the state of a window it set itself. On X11 it's just
slow, on Wayland it can result in roundtrips to KWin itself which is
dangerous.

But due to using Plasma components we have a few areas where we use
KWindowSystem. E.g. a Plasma::Dialog sets a window type, the slide in
direction, blur and background contrast. This we want to support and
need to support. Other API elements we do not want, like for examples
the available windows. KWin internal windows either have direct access
to KWin or a scripting interface exposed providing (limited) access -
there is just no need to have this in KWindowSystem.

To make it more clear what KWin supports as API of KWindowSystem for
internal windows this change implements a stripped down version of the
kwayland-integration plugin. The main difference is that it does not use
KWayland at all, but a QWindow internal side channel.

To support this EffectWindow provides an accessor for internalWindow and
the three already mentioned effects are adjusted to read from the
internal QWindow and it's dynamic properties.

This change is a first step for a further refactoring. I plan to split
the internal window out of ShellClient into a dedicated class. I think
there are nowadays too many special cases. If it moves out there is the
question whether we really want to use Wayland for the internal windows
or whether this is just historic ballast (after all we used to use
qwayland for that in the beginning).

As the change could introduce regressions I'm targetting 5.16.

Test Plan:
new test case for window type, manual testing using Alt+Tab
for the effects integration. Sliding popups, blur and contrast worked fine.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18228
2019-01-27 08:59:58 +01:00
Vlad Zagorodniy
6740db7a6c [autotests] Use unloadAllEffects
Test Plan: The tests still pass.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18383
2019-01-20 13:52:30 +02:00
Vlad Zagorodniy
8877dff715 [autotests] Update tests to use stable version of xdg-shell
Test Plan: All tests pass.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18292
2019-01-20 13:52:30 +02:00
David Edmundson
2df9d22a08 Add high DPI support to internal KWin windows
Summary:
So far we didn't try to do high DPI on kwin internal windows, such as
the user context menu and tab bars and whatever.

Due to wayland scaling they were the correct phyiscal size but upscaled.
This patch fixes our QPA to enable Qt's high-dpi support.

BUG: 402853

Note icons are still low res. This is because the global
QGuiApplication::devicePixelRatio which is the max of all connected
screens is static for the duration of the app. QIcon uses this when
determining the DPR to use. This will require a Qt change.

Test Plan:
Ran at 2x on my normal DPI screen (as that's easier to see anything)
* User action menu is high DPI
* Window deco tooltips are still fine
* Tab switcher is high DPI
* Overlay in present windows Desktop grid are still ok

Reviewers: #kwin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18042
2019-01-14 13:59:05 +00:00
Martin Flöser
c2c92fab51 Ensure the Compositor does not start during termination
Summary:
The SceneOpenGLES test was starting to randomly crash on my system. On
investigation I observed that there was a graphics reset ("Attempting to
reset compositing.") which triggered a delayed restart of the
compositor. This even was only processed while waiting for XWayland to
terminate. Which resulted in a crash in KWin::getXServerVersion as the
xcb connection broke.

It makes no sense to setup the compositor again during application
shutdown. Thus the dtors set a flag that they are terminating the
application and Compositor::setup is checking for it.

Test Plan: Test no longer crashes, although it goes through the crashing path

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18015
2019-01-12 07:36:55 +01:00
Martin Flöser
99df3c82f3 [autotests] Don't check whether there is a /dev/dri/card0
Summary:
With EGL_MESA_platform_surfaceless we don't need a dri device anymore.
So we don't need to skip the tests if the device is missing. Instead the
tests verify that OpenGL compositing is used if requested.

Test Plan: ctest passes

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18014
2019-01-12 07:36:28 +01:00
Vlad Zagorodniy
2e2a462733 [wayland] Don't honor the idle inhibitor object if the surface is not visible
Summary:
Currently, our implementation of zwp_idle_inhibitor_v1 is not fully
spec-compliant. If the associated surface is not visible, we still
honor the idle inhibitor object.

This change addresses those spec-compliance issues. If a surface is
minimized or it's not on the current virtual desktop, then the
associated inhibitor object won't be honored by KWin.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17343
2019-01-11 15:14:16 +02:00
Vlad Zagorodniy
30b257be08 [autotests] Test popup open/close animations
Summary:
The new test is similar to testToplevelOpenCloseAnimation. The
main purpose of this test is to verify that the Fading Popups effect
animates all sorts of popups, e.g. popup menus, tooltips, etc.

testAnimateUserActionsPopup is skipped for now because stuff
that animates unmapped clients is broken.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17992
2019-01-08 15:48:22 +02:00
Vlad Zagorodniy
3f13a493c8 [autotests] Destroy main window in ToplevelOpenCloseAnimationTest::testDontAnimatePopups
Summary: Be nice and destroy all created windows in testDontAnimatePopups.

Test Plan: The test still passes.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18037
2019-01-07 15:09:22 +02:00
Vlad Zagorodniy
72b9a75cd7 [autotests] Avoid useless waits in testToplevelOpenCloseAnimation
Summary:
Use QTRY_VERIFY instead of qWait + QVERIFY to avoid useless waits.
Effects like scale or glide don't last longer than 200ms.

Test Plan:
Before:
    $ dbus-run-session ctest -R testToplevelOpenCloseAnimation
    Test project /home/vlad/Workspace/KDE/build/kde/workspace/kwin
        Start 123: kwin-testToplevelOpenCloseAnimation
    1/2 Test #123: kwin-testToplevelOpenCloseAnimation ...............   Passed    6.43 sec
        Start 124: kwin-testToplevelOpenCloseAnimation-waylandonly
    2/2 Test #124: kwin-testToplevelOpenCloseAnimation-waylandonly ...   Passed    6.33 sec

    100% tests passed, 0 tests failed out of 2

    Total Test time (real) =  12.76 sec

After:
    $ dbus-run-session ctest -R testToplevelOpenCloseAnimation
    Test project /home/vlad/Workspace/KDE/build/kde/workspace/kwin
        Start 123: kwin-testToplevelOpenCloseAnimation
    1/2 Test #123: kwin-testToplevelOpenCloseAnimation ...............   Passed    2.05 sec
        Start 124: kwin-testToplevelOpenCloseAnimation-waylandonly
    2/2 Test #124: kwin-testToplevelOpenCloseAnimation-waylandonly ...   Passed    2.00 sec

    100% tests passed, 0 tests failed out of 2

    Total Test time (real) =   4.05 sec

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17989
2019-01-05 18:32:14 +02:00
Martin Flöser
6b3e55d6f5 Implement isPopupWindow for internal windows
Summary:
Just accessing Qt::Popup WindowFlag.

BUG: 402852

Test Plan: Not tested for the described problematic case

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17981
2019-01-05 13:45:53 +01:00
David Edmundson
ac45977e9e [wayland] XdgDecoration Support
Summary:
Does something similar to our existing ServerDecoration, but based
around XDG Shell patterns and with a few subtle differneces.

We'll probably still need both in kwin for the forseeable future as GTK3
won't ever change from using the KDE Server Decoration.

Test Plan:
Relevant unit test. It's a bit simpler as spec states
toolkits must follow what the compositor configures if they
bind the interface.

Modified plasma-integration to remove ServerIntegration
(as Qt5.12 has native support) all my windows look and act the same.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17756
2019-01-01 17:53:48 +00:00
Vlad Zagorodniy
48d13379c3 [autotests] Add tests for keep-above and keep-below states
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16252
2019-01-01 17:29:14 +02:00
Vlad Zagorodniy
1ca2aec77f [wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.

To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.

BUG: 370339
FIXED-IN: 5.15

Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin

Reviewed By: #kwin, graesslin

Subscribers: davidedmundson, romangg, graesslin, kwin

Tags: #kwin

Maniphest Tasks: T5714

Differential Revision: https://phabricator.kde.org/D3202
2018-12-31 12:35:01 +02:00
Martin Flöser
792d840455 Honor struts when placing Wayland transients
Summary:
So far transients were placed anywhere on the screen. This behavior was
inspired from X11 where context menus were able to overlap any other
window and use the complete screen area. On X11 context menus and
similar windows are override redirect and thus above all windows managed
by KWin.

On Wayland, though, context menus and similar and windows just like any
other window and thus follow stacking constraints like the parent
window. A context menu is stacked just above it's parent and is
(normally) below any panels. This resulted in problems that context menu
are stacked behind the panel with unreachable options.

This change changes the placement for transients to use the
PlacementArea instead of a screen geometry. Thus the transient does not
render behind the panel. Only in case of a fullscreen the struts are
ignored.

BUG: 389222
FIXED-IN: 5.15

Test Plan: New test case

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17826
2018-12-31 07:58:50 +01:00
Martin Flöser
0b28abeb01 Port window specific rules dialog to DBus
Summary:
The dialog invoked through user actions menu takes the internal uuid as
command line argument which allows to query the required information
from KWin instead of using X11.

This allows to enable the system for Wayland windows.

In order to replace the usage of ClientMachine in the rules dialog the
dbus interface is extended by a value whether the window is on the
localhost. This is exposed through a virtual method on toplevel which is
overridden in ShellClient and there always returning true.

Test Plan: Run a nested Wayland and opened the dialog on a wayland window

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17750
2018-12-31 07:58:12 +01:00
Martin Flöser
feb1d443f1 Try to make TestShellClient::testUnresponsiveWindow more robust
Summary:
When looking at the test results on build.kde.org we see this is the
test which fails most often and it's always at the same line of code.

So I just had a look with the thought: "what's special about this code,
why could it fail?"

Looking at it we start an external process which is supposed to connect
to KWin. We wait for the process to start and then wait for the shell
client added. This assumes that at the time we handle the wait for
started the connection of the window has not happened yet.

Waiting for the process in a blocking way, might make the process fail
to connect to the Wayland session, so this is changed to not block and
instead use a signal.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17748
2018-12-31 07:57:41 +01:00
Martin Flöser
9993c6d674 Add a dbus method getWindowInfo returning same data as queryWindowInfo
Summary:
This dbus method is intended to be used by the kwin rules dialog. KWin
can pass the internal id to the rules dialog through a command line
argument (or similar way) and the dialog can query the information
through the dbus call for the provided id. Thus it's possible to
implement one way to query the information which works on both X11 and
Wayland without any windowing system specific functionality.

Test Plan: See new added integration test

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17433
2018-12-17 18:12:17 +01:00
Vlad Zagorodniy
7a28e0fe9a [wayland] Minimize transients together with parent
Summary:
If a parent window is minimized, then its transients have to be
minimized as well, so the minimize behavior is the same on both
X11 and Wayland.

BUG: 401950
FIXED-IN: 5.15.0

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17570
2018-12-14 21:15:58 +02:00
Vlad Zagorodniy
e86d8461ed [autotests] Test window open/close animations
Summary:
The idea behind this autotest is to verify that different window
open/close animation effects behave similarly.

Currently, we just check whether Fade/Glide/Scale effect tries to animate
the appearing or the disappearing of toplevels. In the future, the
autotest will be extended to verify that there are no conflicts between
those three effects and the Login/Logout effect, etc.

Test Plan: Ran the test, found a bug in the Fade effect, fixed it.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17526
2018-12-14 21:11:42 +02:00
Martin Flöser
3e62f6aabe Remove no longer needed cast to Client in Workspace::sendClientToDesktop
Summary:
This change removes a small difference between X11 and Wayland clients.
It ensures that all transients are sent to the same desktop as the main
window. A similar check is already in AbstractClient::setDesktop, so in
general it already worked. This is just a special case for
sendClientToDesktop which supports sending to the same desktop so that
all transients are sent to that desktop.

Test Plan: New test case which fails without this change

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17546
2018-12-13 19:36:28 +01:00
Martin Flöser
c8ede9a5ff Build platform plugins in correct sub directory of build dir
Summary:
This brings KWin a step closer to be run from build dir without having
to install at all. The integration tests are adjusted so that the
virtual platform is still found which makes the code be closer to what
is used in normal kwin_wayland.

Test Plan: ctest passes, manually verified correct plugin is loaded

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17388
2018-12-13 19:36:28 +01:00
Martin Flöser
a0b482cbab Introduce a command line option to disable any kind of global shortcuts
Summary:
This command line option is useful for KWin in embedded use case. That
is when KWin is just used as a compositor for one application instead of
a complete desktop environment. In such a setup global shortcuts are not
wanted and interfere with the application. E.g. one does not want Alt+F4
to close the window, that would render the system unusable.

This change introduces a command line option and disables the following
event filters and spies:
 * global shortcuts
 * modifier only shortcuts
 * terminate session
 * virtual terminal switching
 * screen edges

KGlobalAccel still gets inited, otherwise the (non-functional) binary
would be launched when KWin registers it's global shortcuts.

Test Plan:
New test added based on existing tests for the global
shortcuts, ctest passes

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17304
2018-12-13 19:36:28 +01:00
Martin Flöser
070b46f455 Hide mouse cursor when interacting with touch screen
Summary:
On touch events the mouse cursor gets hidden, on next mouse event the
mouse cursor is shown again. This IMHO significantly improves the system
interaction if touch is the primary user interface.

Test Plan: Test case added and ctest passes

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17280
2018-12-13 18:55:46 +01:00
Vlad Zagorodniy
3956d6ab4a [autotests] Fix failing of testDontCrashReinitializeCompositor
Summary:
Currently, testDontCrashReinitializeCompositor is unstable because it
doesn't take into account that effects can be loaded asynchronously.

In general, we don't need all default effects in this test, so let's
disable them.

Test Plan: This should fix ASan issues.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17386
2018-12-06 19:42:23 +02:00
Roman Gilg
2e29711323 Rework InputDeviceHandler focus tracking
Summary:
This patch aims at improving the Toplevel, internal window and decoration
focus tracking.

In detail the goals are:
* Clean tracking of beneath and focus Toplevel as well as decoration and
internal windows. Splitting this up in well defined sub routines.
* Minimal find Toplevel operations on window stack.
* Reduce code duplication in pointer and touch child classes.
* Reuse tracking in drag operations.
* Allow direct usage of Wayland input interfaces for decoration and internal
windows in the future.
* Update touch focus on external events like VD switches correctly.

Test Plan: Manually and existing autotests.

Reviewers: #kwin

Subscribers: kwin, zzag

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15595
2018-12-02 21:36:11 +01:00
Vlad Zagorodniy
295138145c Make sure that effect windows outlive effects
Summary:
Compositing is suspended/finished in a very hard way fashion, effect
windows are destroyed without notifying effects about it.

AnimationEffect tries gracefully release deleted windows, but because
in some cases(like when suspending compositing) a deleted window can
be already destroyed, a segmentation fault can happen.

This change adjusts the order in which effect windows and effects are
destroyed, so AnimationEffect (and other effects) cannot access dangling
pointers.

BUG: 400788
FIXED-IN: 5.15.0

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17311
2018-12-02 19:59:53 +02:00
Martin Flöser
3ad9ac7229 Introduce the concept of an internal window system independent id
Summary:
For supporting Wayland windows in the kwin_rules_dialog we need a way to
pass a window id for Wayland windows to the dialog. This id needs to be
sent to the dbus interface to query window information just like the
interactive query. For Wayland windows we don't really have a window id
and it would require to also pass the windowing system to
kwin_rules_dialog and back through the dbus interface.

To not complicate things this change introduces a windowing system
independent id based on UUID. This could in future also be used
internally for areas where it's window id based and used in both
windowing systems.

Test Plan: Adjusted test cases to verify the uuid is generated and passed to Deleted

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16986
2018-12-01 12:17:05 +01:00
Martin Flöser
f8459a71cc Switch lockscreen test to OpenGL
Summary:
Main reason for using QPainter was the fact that build.kde.org did not
support OpenGL back when the test got introduced. As we have vgem
support nowadays we can switch back to OpenGL.

Test Plan:
100% tests passed, 0 tests failed out of 130,
but the test is flaky with and without this change

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16940
2018-12-01 12:14:40 +01:00
Martin Flöser
98ddb93dfe Unset all env variables related to KDE session in integration tests
Summary:
When running ctest in my session a few OpenGL/waylandonly tests crashed
on tear down. This does neither happen on build.kde.org nor when running
ctest in a tty. Comparing the env variables of tty and session pointed
to the session variables. Unsetting those makes the test not crash. This
makes sense as e.g. plasma-integration no longer gets loaded.

As our test suite is intended to test KWin and not plasma-integration or
gnome integration we should have a clean and reproducable environment,
so the variables are unset.

Test Plan: 100% tests passed, 0 tests failed out of 130

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16939
2018-12-01 12:14:10 +01:00
Martin Flöser
260646ed62 Delete kglobalshortcutsrc before executing a test
Summary:
When running the complete test suite the ScriptedEffectsTest::testShortcuts
registers the shortcut meta+shift+y. But GlobalShortcutsTest::testX11ClientShortcut
also tries to use this shortcut for a window shortcut which fails if it
is already registered. So when running the complete test suite it
depends on the order of execution whether the GlobalShortcutsTest passes
or not.

Test should be clean - also the globalshortcuts. As the config is read
from test directory anyway, we can delete the file prior to init of
kglobalaccel.

Test Plan: Run ctest, test did not fail anymore

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16932
2018-12-01 12:13:39 +01:00
David Edmundson
69c7146a73 [autotests] Stabilise colorcorrect test
Summary:
It crashes occasionally as the connection thread is still processing events
when the app is tearing down. These changes bring it in line with the
other tests using WAYLANDTEST_MAIN.

Test Plan:
Relevant test now passes.
Ran repeatedl without a crash

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17254
2018-11-30 11:37:41 +00:00
Vlad Zagorodniy
437d35eee2 [wayland] Check presence of the inhibitor object when a client is registered in IdleInhibition
Summary:
Some applications are not able to inhibit the idle behavior because
each of them creates an inhibitor object before the corresponding
ShellClient object becomes ready for painting.

BUG: 401499
FIXED-IN: 5.15.0

Test Plan: idle-inhibit client (from wlroots/examples) works.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17227
2018-11-29 18:17:34 +02:00
David Edmundson
6c71403281 [autotests] Hopefully stabilise TestShellClient
Summary:
Apparently this test is flaky, based on the output I recieved we had
processed the un-fullscreen but not the un-maximise.

It seems possible the wayland thread could process when there's only one
request in the queue.

Test Plan:
Couldn't reproduce the original issue, it's a blind patch but the
current tests still pass.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16955
2018-11-17 12:50:32 +00:00
Vlad Zagorodniy
396d528075 [scripting] Introduce complete function
Summary:
Effects that prefer to manipulate direction of animations sometimes need
to create animations in some particular state so later on they can be
played backward (swapping from and to is not enough and it would be wrong).

The proposed complete function lets such effects to fast-forward animations to
to the target position so they can be played backwards later on.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16450
2018-11-17 13:44:20 +02:00
Vlad Zagorodniy
5e104fbc12 [scripting] Introduce redirect function
Summary:
Consider current implementation of the Squash effect: if a window was
minimized, an animation will be started; if the window is unminimized
and the animation is still active (that can happen when user clicks on
app's icon really fast), the animation will be stopped and a new one will
be created. Such behavior can lead to rapid jumps in the observed
"animation".

A better approach would be first try to **reverse** the already active
animation, and if that attempt wasn't successful, start a new animation.

This patch introduces a new function to the scripted effects API that
lets JavaScript effects to control direction of animations. The
prototype of the function looks as follows:

    redirect(<animation id(s)>, <direction>, [<termination policy>])

the first argument is an animation id or a list of animation ids, the
second argument specifies the new direction of the animation or
animations if a list of ids was passed as the first argument. The
third argument specifies whether the animation(s) should be terminated
when it(they) reaches the source position, currently it's relevant only
for animations that are created with set() function. The termination
policy argument is optional, by default it's Effect.TerminateAtSource.

We can use this function to fix issues with rapid jumps in the Squash
effect. Also, redirect() lets us to write effects for simple animations
in slightly different style: first, we have to start the main animation
(e.g. for the Dialog Parent effect, it would be dimming of main windows)
and then change direction of the animation depending on external events,
e.g. when the Desktop Cube effect is activated.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, abetts, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16449
2018-11-17 13:44:16 +02:00
Vlad Zagorodniy
ee72569647 [libkwineffects] Port AnimationEffect to TimeLine
Summary:
TimeLine has nice API for controlling its direction that can be re-used
later by AnimationEffect.

Test Plan: The existing tests for scripting effects still pass.

Reviewers: #kwin, davidedmundson, graesslin

Reviewed By: #kwin, davidedmundson, graesslin

Subscribers: davidedmundson, abetts, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16448
2018-11-17 13:43:57 +02:00
David Edmundson
37fbb49bf0 [wayland] Fix maximised test
The existing test after the client was maximised sent a buffer with the
same size. Naturally correctly didn't generate a geometry change.
2018-11-16 12:28:38 +00:00
David Edmundson
1a2c90ea12 [wayland] Fix ShellClientTest
Summary:
When switching from maximised to full screen the geometry as kwin sees
it doesn't necessarily need to change, the test is wrong.

Also we can fix the XDGShell-deco tests.

wlshell-deco test still fails as before.

Test Plan: Tests pass \o/

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16922
2018-11-16 11:59:39 +00:00
Martin Flöser
841750438b Fix KeyboardLayoutTest::testNumLock
Summary:
The layout from previous test leaked into this test if all tests are run
together. This change ensures that a proper layout for this test is set.

Test Plan: Test passes alone and when run together

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16903
2018-11-15 19:01:51 +01:00
Martin Flöser
3cee67f109 Temporarily skip XClipboardSyncTest
Summary:
The test fails for unknown reasons on build.kde.org, but passes when
run on a development setup. As the code is going to be changed with
D15063 anyway, it is better to just disable the test for the time being.

Test Plan: Test gets skipped

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16895
2018-11-15 14:31:38 +01:00
David Edmundson
f521d4bbe1 [wayland] add enter/leave virtual desktop API
Summary:
As setDesktop was changed to "move" this left unSetDesktop non-symetric.

This replaces it with explicit API to enter/leave.

This also moves new API to the new object based API rather than still
using ints.

Where numbers are used it has been tidied up so that desktop IDs are
uint, which should be used when we have a list of desktops.
int is used only when we have either a desktop ID or NET::OnAllDesktops
(-1)

Effects API cleared up to use this and use a set of x11 IDs, which
avoids any potential complications of handling add and removes any
ambiguity with what happens if you leave all desktops and such.

Test Plan:
testVirtualDesktops passes (with pending kwayland patch)
Moving a window in the desktop grid on X11 behaves
Moving a window in the desktop grid on wayland behaves

Reviewers: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16704
2018-11-14 11:08:46 +00:00
Martin Flöser
9f6b0f98b5 Fix the way how we quit kactivitymanagerd from the unit test
Summary:
Kactivitymanagerd is a libexec executable now so we cannot just execute
it and cannot know it's path. We need to stop it as otherwise ctest does
not terminate the testActivities. This change uses dbus to quit the
kactivitymanagerd.

Test Plan: ctest did not timeout on testActivities

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16780
2018-11-09 17:27:07 +01:00
Vlad Zagorodniy
abf6c6927c [autotests] Fix maximize test
Summary:
testMaximizedPassedToDeco was failing because it didn't handle async
maximization.

testBorderlessMaximizedWindow was failing because setNoBorder can modify
geometry, so we end up with a wrong restore geometry.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16755
2018-11-08 14:10:57 +02:00
Martin Flöser
c19627b492 Copy plastik window decoration to build directory
Summary:
This ensures that DontCrashAuroraeDestroyDecoTest can load the plastik
window decoration when run from build directory as it happens on
build.kde.org.

Test Plan: Test passes now when manipulating XDG_DATA_DIRS to hide system install

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16745
2018-11-08 08:31:17 +01:00
David Edmundson
47d87cd94f [autotests] Handle async maximisation in quick tiling test
Summary:
KWin now correctly updates the client maximised state when we have a new
buffer in the new state. The quick tile unit test was unfortunately not
updated.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16739
2018-11-08 01:50:51 +00:00
Martin Flöser
0e839c4dda Unset XKB_DEFAULT_* in tests to make tests better reproducable
Summary:
On one of my systems XKB_DEFAULT_LAYOUT is set to "de". This makes a few
tests fail, e.g. pointer input and modifier only shortcuts.

The reason is that those tests assume the xkb default layout behavior,
that is how xkb functions without any layout being set. So having the
env variable around influences the layout generation.

To prevent this the environment variables are unset and thus a
reproducable environment is created.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16737
2018-11-07 20:10:58 +01:00
Martin Flöser
e637d43211 Remove potential endless loop from XClipboardSyncTest
Summary:
We need to wait till the helper process created the datadevice. For this
we used a while loop. On build.kde.org the test gets stuck in this loop
and times out after 10 minutes.

This change introduces a dedicated signal and we just wait for it. So if
something fails we wait only 5 sec instead of endless. This should help
investigate why the test doesn't work on build.kde.org.

Test Plan: Test works locally

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16741
2018-11-07 20:10:32 +01:00
Martin Flöser
f27f8a267f Fix slidingpopupstest when run without installtion
It tries to load scripted effects, so needs same adjustement.
2018-11-07 10:51:07 +01:00
Martin Flöser
43fc7f1bad Fix FadeTest and TranslucencyTest when started without install
Summary: Search in build dir for the effects.

Reviewers: #kwin

Differential Revision: https://phabricator.kde.org/D16683
2018-11-07 09:34:38 +01:00
Martin Flöser
a04b9da61e Re-evaluate the window rules when the window class of a Client changes
Summary:
So far KWin did not re-evaluate the window rules when the Client's
window class changes. Window class is the main (static) feature the rule
selection is based on. For dynamic changing mapping features like caption
KWin does re-evaluate the rules.

The reason for KWin to not evaluate when the class changes is that KWin
expects the class not to change. From ICCCM section 4.1.2.5:

 > This property must be present when the window leaves the Withdrawn
 > state and may be changed only while the window is in the Withdrawn
 > state. Window managers may examine the property only when they start
 > up and when the window leaves the Withdrawn state, but there should be
 > no need for a client to change its state dynamically.

Unfortunately there are prominent applications such as Spotify which
violate this rule and do change the window class dynamically. While this
is a clear ICCCM violation there is nothing which really forbids it (may
not != must not) and nothing which forbids KWin to react on changes.

As also libtaskmanager started to react on it, it makes sense to also
hook up the required bits for window rules. After all KWin detects
changes to the window class for some time already and has the
functionality to evaluate the rules. So all there is, is one connect
which improves the situation for our users, while at the same time it
should be rather risk free. If a setup window rule breaks after this
change it's due to the client not being ICCCM compliant.

Test Plan:
I don't use any of the affected applications, so it's only
tested with the new added unit test.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16670
2018-11-07 09:33:39 +01:00
Martin Flöser
7c3a851b04 Support enabling numlock on startup
Summary:
This change brings improved num lock support to KWin. The modifier state
is read and also mapped to Qt::KeyboardModifiers. Furthermore the input
config is read and the NumLock key is evaluated. If the requested state
does not match the current num lock state the state is swapped.

BUG: 375708
FIXED-IN: 5.15

Test Plan: New unit test added, no manual test due to lack of hardware

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16428
2018-11-01 17:49:58 +01:00
David Edmundson
7e8facc3fd [wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)

Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)

Test Plan: used a bit a plasma session together with D12820, D13748 and D13746

Reviewers: #plasma, #kwin, graesslin, davidedmundson

Reviewed By: #plasma, #kwin, davidedmundson

Subscribers: hein, zzag, davidedmundson, kwin

Tags: #kwin

Maniphest Tasks: T4457

Differential Revision: https://phabricator.kde.org/D13887
2018-11-01 16:35:29 +01:00
Vlad Zagorodniy
862bf0f153 [effects/scale] Port to JavaScript
Summary:
Now, when the scripting effects API has all required ingredients to port
the Scale effect to JavaScript we finally can do it.

The main rationale for porting this effect to JavaScript is that
scripted effects API lets us focus more on what we want instead of
"how".

Visually, the ported version doesn't deviate from the C++ version.

Test Plan:
* Enable the Scale effect;
* Open/close a window.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16478
2018-10-29 10:17:21 +02:00
Vlad Zagorodniy
8d0554e45a [scripting] Allow effects to grab windows
Summary:
Some JavaScript based effects need to grab particular windows in order
to avoid conflicts with other effects.

Example usage:

```lang=js
effects.windowAdded.connect(function (window) {
    if (effect.grab(window, Effect.WindowAddedGrabRole)) {
        window.coolWindowTypeAnimation = animate({
            ...
        });
    }
});
```

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: romangg, graesslin, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13153
2018-10-29 10:17:21 +02:00
David Edmundson
8ef363cc21 [wayland] XdgPopup Positioning
Summary:
Support XDGShell Positioning. This gives a client a lot more control
over where the popup will be placed as well as control over how to
handle constraints. i.e what to do if the popup doesn't fit.

trasientOffset was replaced with a method on the client as semantically
it's the role of the client to handle constraints.

Both slide and flip constraint adjustments are implemented. Resize
constraint adjustment will be handled in a future patch.

WlShell is handled by treating it as 1x1 sized anchor with slide
constraint adjustment.

Test Plan:
Manual test of a client implementing xdgpopup exists in kwayland
Extensive unit test here

Existing WlShell test passes (after D16314 which fixes the original)
XdgPopup has a new unit test suite against manually calculated values

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16325
2018-10-20 17:17:59 +01:00
David Edmundson
d70c3568e6 [wayland] Fix Placement::placeTransient keeping screens in bound.
Summary:
If a window flows off the left, we move left of the popup to the left
edge of the screen.

Currently if a window flows off the right, we move the window back by
it's own width, leaving it floating at a random point.
For consistency we should be setting it so the right edge of the popup is on the right
edge of the screen.

So in the auto test for the "right border" case:
The screen is 1280 wide, and we open a 10px popup at 1279  the final X
should be 1270.

Test Plan: Unit test

Reviewers: #kwin, zzag, graesslin

Reviewed By: #kwin, zzag, graesslin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16314
2018-10-20 17:17:58 +01:00
Vlad Zagorodniy
fe4d69b653 Keep Deleted transients above old parents
Summary:
If a modal window is closed, usually, it will go behind its parent. The
reason for this is that Workspace::constrainedStackingOrder() puts only
AbstractClient transients above parents, not Deleted transients.

So, if fade/glide/scale effect animates the disappearing of a transient,
unfortunately, one can't see that animation.

BUG: 397448
FIXED-IN: 5.15.0

Test Plan:
=== Closing of a transient and parent window

Before:

https://www.youtube.com/watch?v=XiLq7EAVCp0

After:

https://www.youtube.com/watch?v=cH_Ki-sqY8M

=== Scale effect

Before:

https://www.youtube.com/watch?v=Eb2a3U7R10I

After:

https://www.youtube.com/watch?v=4AKu3fdrnYQ

=== Sheet effect

Before:

https://www.youtube.com/watch?v=xPPSnR5FUU0

After:

https://www.youtube.com/watch?v=o_hxTNT-5Hg

=== Popup menus on Wayland

Before:

https://www.youtube.com/watch?v=5DnrY8p3F5A

After:

https://www.youtube.com/watch?v=7XEo8n_CrCc

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: abetts, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14868
2018-10-16 18:58:17 +03:00