Commit Graph

1171 Commits (9995f984c3e43de7b1a6b327c592bff37f8b7c1a)

Author SHA1 Message Date
Vlad Zahorodnii 9a7ab8a62e Rework async geometry updates
Window management features were written with synchronous geometry
updates in mind. Currently, this poses a big problem on Wayland because
geometry updates are done in asynchronous fashion there.

At the moment, geometry is updated in a so called pseudo-asynchronous
fashion, meaning that the frame geometry will be reset to the old value
once geometry updates are unblocked. The main drawback of this approach
is that it is too error prone, the data flow is hard to comprehend, etc.

It is worth noting that there is already a machinery to perform async
geometry which is used during interactive move/resize operations.

This change extends the move/resize geometry usage beyond interactive
move/resize to make asynchronous geometry updates less error prone and
easier to comprehend.

With the proposed solution, all geometry updates must be done on the
move/resize geometry first. After that, the new geometry is passed on to
the Client-specific implementation of moveResizeInternal().

To be more specific, the frameGeometry() returns the current frame
geometry, it is primarily useful only to the scene. If you want to move
or resize a window, you need to use moveResizeGeometry() because it
corresponds to the last requested frame geometry.

It is worth noting that the moveResizeGeometry() returns the desired
bounding geometry. The client may commit the xdg_toplevel surface with a
slightly smaller window geometry, for example to enforce a specific
aspect ratio. The client is not allowed to resize beyond the size as
indicated in moveResizeGeometry().

The data flow is very simple: moveResize() updates the move/resize
geometry and calls the client-specific implementation of the
moveResizeInternal() method. Based on whether a configure event is
needed, moveResizeInternal() will update the frameGeometry() either
immediately or after the client commits a new buffer.

Unfortunately, both the compositor and xdg-shell clients try to update
the window geometry. It means that it's possible to have conflicts
between the two. With this change, the compositor's move resize geometry
will be synced only if there are no pending configure events, meaning
that the user doesn't try to resize the window.
2021-05-25 06:17:41 +00:00
Vlad Zahorodnii e4ec955d88 Remove shadow related bits in Scene::Window 2021-05-19 14:13:47 +03:00
Vlad Zahorodnii edb7867ee9 Prepend "Interactive" to interactive move resize methods
This is to improve code readability and make it easier to differentiate
between methods that are used during interactive move-resize and normal
move-resize methods in the future.
2021-05-16 13:50:25 +03:00
Vlad Zahorodnii 4ba249eee5 wayland: Signal about finished move/resize in destroyClient()
We need to emit the clientFinishUserMovedResized signal to notify
effects such as translucency that the interactive move-resize is
finished. Otherwise, the set() animation won't be cancelled and the
window will get stuck frozen.

BUG: 409376
2021-05-16 10:46:57 +00:00
Vlad Zahorodnii 07c4057180 autotests: Stabilize tests that create Xwayland windows
The order in which Xwayland surfaces are associated with X11 windows is
undefined, meaning that we cannot assume that a newly created X11 window
won't have a surface associated with it already.
2021-05-15 16:16:48 +00:00
Vlad Zahorodnii b6dd7c5860 autotests: Introduce own idle inhibit v1 helpers
Non-core wrappers in kwayland are deprecated. qtwaylandscanner needs to
be used instead for generating client-side wrappers.
2021-05-14 05:36:08 +00:00
Vlad Zahorodnii 7d0cad07fb autotests: Fix XwaylandInputTest
For some reason, Xwayland doesn't like starting without outputs. If
outputs are added later, it sends bogus EnterNotify and LeaveNotify
events.
2021-05-13 11:44:41 +00:00
Aleix Pol b7389c6f1a libinput tests: Fix new-delete-type-mismatch error when using ASAN 2021-05-13 06:53:13 +00:00
Vlad Zahorodnii 7475385c82 Make scale and glide effect ignore lockscreen greeter
On X11, the lockscreen greeter is an override-redirect window so the
scale and the glide effect ignore it.

On Wayland, the lockscreen greeter is a regular window so both effects
try to animate it upon the screen being unlocked, which looks bad.
2021-05-13 05:46:30 +00:00
Vlad Zahorodnii 0f60cc68a9 autotests: Prefer stackingOrder() over xStackingOrder()
This reduces the number of usages of xStackingOrder(), which simplifies
the reasoning about when it can be marked as dirty.

Since internal windows are now in the regular stack, InternalWindowTest
can use stackingOrder().

As for X11ClientTest, there's no specific reason why it uses the x stack
instead of the regular one.
2021-05-13 04:58:45 +00:00
Vlad Zahorodnii d78d686690 autotests: Stabilize ActivationTest::testSwitchToWindowMaximized 2021-05-12 20:44:28 +03:00
Vlad Zahorodnii c9ee2f06db autotests: Fix testActivation
Currently there's a race condition with regards to the first configure
event with the activated state.
2021-05-12 19:21:38 +03:00
Aleix Pol 69b7b523f8 Make MoveResizeWindowTest::testGrowShrink more reliable
We need to make sure that the information from
toplevelConfigureRequestedSpy is in place to be used, otherwise we get
an empty size and it doesn't work.
2021-05-12 10:43:28 +00:00
Aleix Pol f6c2861b73 strutstest: fix top panel/ivnalid strut 2
The client area is detected as invalid and ignored by
Workspace::updateClientArea.
2021-05-12 10:43:03 +00:00
Aleix Pol 35970686e1 Implement ping on tests
Otherwise there's no pong and we get unnecessary noise.
2021-05-12 10:42:34 +00:00
Aleix Pol 92e0357fef InputMethodTest: provide a process to launch when we need a virtual keyboard
Otherwise it never claims to be active.
2021-05-11 12:47:41 +02:00
Aleix Pol 341ec55c9e InputMethodTest: Use InputMethod::isActive as a way to check if it's activated
Instead of looking for a client, which is a bit more of a hit and miss,
since the client doesn't need to be registered when the test expects it
to.
2021-05-11 12:47:27 +02:00
Aleix Pol c8a1f48151 GlobalShortcutsTest: No need to make the test longer than it needs to be 2021-05-11 12:38:00 +02:00
Aleix Pol 8cbc03b3be GlobalShortcutsTest: Support running the test without xwayland 2021-05-11 12:38:00 +02:00
Aleix Pol a977ba3311 GlobalShortcutsTest: Fix testNonLatinLayout
Have it switch back from the Russian layout, otherwise the rest of tests
are run with this one and fail as they produce weird shortcuts.
2021-05-11 12:38:00 +02:00
Vlad Zahorodnii 282e0d1c4d autotests: Port the tests to new xdg-shell helpers 2021-05-11 05:26:51 +00:00
Aleix Pol 8cfa30803b Fix InternalWindowTest::testDismissPopup
We were expecting a tooltip to be closed when clicking its
transientParent, but it's explicitly not something we are after. We
close popups when we click either other clients or the actual client on
the decoration.

This change makes it so we end up clicking another window instead of the
parent one that is unrelated.
2021-05-11 00:05:37 +00:00
Aleix Pol a3d32fa836 Ensure we start our tests with wayland already initialised
When debugging modifier_only_shortcut_test in _waylandonly mode I saw
that it was failing, among other things, because some aspects were not
initialised.

This changes every test we have to run the new
Test::initWaylandWorkspace() that calls waylandServer()->initWorkspace()
but also makes sure that WaylandServer::initialized is emitted before we
proceed.
2021-05-10 12:33:43 +00:00
Vlad Zahorodnii 5739603145 autotests: Fix kglobalaccel integration
Starting with 48c3376927e5e9c13377bf3cfc8b0c411783e7f3 in kglobalaccel,
KGlobalAccel won't work in desktop environments other than Plasma.

We need to set XDG_CURRENT_DESKTOP=KDE to ensure that global shortcuts
still work.
2021-05-05 09:16:58 +03:00
Vlad Zahorodnii a0fc0277a7 wayland: Make fullscreen mode updates async
Currently, the fullscreen state is update synchronously, but it needs to
be done in asynchronous fashion.

This change removes some tests as they don't add any value, testFullscreen()
covers them all.
2021-05-05 06:11:42 +00:00
Vlad Zahorodnii 403a04fe24 wayland: Fix loading of HiDPI cursors
Xcursors don't support hidpi so if a hidpi cursor is needed, kwin will
scale the desired size by the scale factor and ask Xcursor helpers to
load a theme with the given name and the size.

However, the theme loading code doesn't take into account that Xcursor
theme loading helpers may not return cursor sprites of size size * scale
if the theme has no such a size.

For example, if the cursor theme only provides 24, 36, and 48 sizes and
kwin attempts to load cursors of size 48 with a scale factor of 2, we
will get cursors of size 48 instead of 96. Unfortunately, this will
result in the issue where the cursor shrinks when hovering decorations
because kwin doesn't know that the effective scale factor (1) is
different from the requested scale factor (2).

In order to fix loading of HiDPI cursors, we need to approximate the
effective scale factor of every cursor sprite as we load it.
2021-05-03 10:52:25 +03:00
Aleix Pol 050ce24247 inputmethod: Move the input method process into the InputMethod class
Use the control this gives us for stopping the input method process when
we disable.
2021-04-29 11:04:19 +00:00
Vlad Zahorodnii ac3c09ba75 Remove Platform::areOutputsEnabled()
This flag is redundant. If an output is disabled, the compositor won't
attempt to perform compositing on it.
2021-04-29 10:47:41 +00:00
Xaver Hugl 2aae299eba Fix testScreens 2021-04-26 19:25:50 +00:00
Vlad Zahorodnii 6a57fa286e autotests: Fix a few typos in kwinglplatformtest 2021-04-26 13:26:05 +03:00
Tomasz Paweł Gajc e9fcd9584e effects: add support Panfrost Mali driver 2021-04-24 16:04:44 +02:00
Vlad Zahorodnii 9ad83dafe6 autotests: Fix InputMethodTest
Currently, the test fails because the d-bus api was changed recently.
Use InputMethod::setEnabled() method to enable input method support.
2021-04-23 22:08:29 +03:00
Vlad Zahorodnii c894956bba autotests: Fix testVirtualKeyboardDBus 2021-04-23 21:40:04 +03:00
Vlad Zahorodnii 9fe53ee062 autotests: Fix DontCrashCursorPhysicalSizeEmpty 2021-04-23 09:55:04 +03:00
Aleix Pol f1a779d916 tests: clean outputManagement when cleaning interfaces
Otherwise we get crashes trying to access unexisting objects.
2021-04-22 10:16:36 +00:00
Vlad Zahorodnii ab58171ed8 wayland: Check workspace position after creating decoration
If a decoration is created for an already mapped maximized window, check
the workspace position to ensure that the window still fits the maximize
area.

BUG: 432326
2021-04-07 20:38:05 +00:00
Andrey Butirsky 91f47c9092 fix global shortcuts for non-Latin symbols
Re-use Qt's implementation of handling non-Latin layouts here
For full ASCII range support (Alt+`, etc.) Qt needs to be patched still,
see QTBUG-90611

BUG: 375518
2021-04-05 19:39:06 +00:00
Xaver Hugl c0c3ec09af Refactor DrmObject 2021-03-31 10:19:42 +00:00
Vlad Zahorodnii ade861d6de Refactor session code
At the moment, the session code is far from being extensible. If we
decide to add support for libseatd, it will be a challenging task with
the current design of session management code. The goal of this
refactoring is to fix that.

Another motivation behind this change is to prepare session related code
for upstreaming to kwayland-server where it belongs.
2021-03-23 08:01:19 +00:00
Vlad Zahorodnii f6217be2ad Drop testLibinputContext 2021-03-23 08:01:19 +00:00
Vlad Zahorodnii 00fcc3a423 wayland: Adjust kwin to SeatInterface changes 2021-03-11 07:36:31 +00:00
Vlad Zahorodnii 83388295c8 wayland: Adjust kwin to PointerInterface changes 2021-03-10 14:10:16 +00:00
Vlad Zahorodnii 38996d9725 libkwineffects: Introduce EffectScreen
This provides the compositor a way to indicate what output is being
rendered. The effects such as the screenshot can check the provided
screen object in order to function as expected.
2021-03-09 08:58:22 +00:00
Vlad Zahorodnii e7a5726c8b cmake: Use versionless Qt::Qml imported target
While resolving merge conflicts in a patch that ported kwin away from
QtScriptEngine to QJSEngine, I forgot to switch to versionless imported
targets.
2021-03-04 15:22:47 +02:00
Aleix Pol 4638f2f309 inputmethod: Refactor VirtualKeyboardDBus to have its own InputMethpd
This way we can have it call methods directly instead of connecting to
its signals.
2021-03-02 13:55:35 +00:00
Aleix Pol 63a7b25801 inputmethod: Provide DBus API so the shell can integrate with it
It makes it possible to show if the virtual keyboard is being shown and
if it is to hide it.
2021-03-02 13:55:35 +00:00
Aleix Pol b409f523f0 Revert "cmake: Get XKB information directly from PkgConfig"
This reverts commit 3c97cecdb0.

It seems to break on the CI and I don't understand why.
2021-03-02 02:14:39 +01:00
Aleix Pol 3c97cecdb0 cmake: Get XKB information directly from PkgConfig
Rather than having it abstracted in a local FindXKB package.
Makes the code more standard and removes a custom finder we ultimately
don't need.
2021-03-01 20:33:38 +01:00
Aleix Pol 3b2b9e01f2 Fix GlobalShortcutsTest::testWaylandClientShortcut() 2021-03-01 14:21:15 +00:00
Vlad Zahorodnii 6c9e0781cd Simplify code that destroys plugins and color manager
This reduces some code duplication and ensures that plugins and the
color manager are destroyed while Platform is still valid.
2021-02-24 09:38:56 +00:00
Vlad Zahorodnii bd4d17b3a1 Drop QtScript dependency
QtScript is not used anywhere anymore plus it's dropped in Qt 6.
2021-02-23 07:47:01 +00:00
David Edmundson ae6e6dc63c [scripting] Port ScriptedEffects to QJSEngine
Summary:
QScriptEngine is deprecated for years and suffers bitrot.
Plasma hit one super major bug with it in 5.11.0 and has now ported
away.

Main porting notes:
- creating low level functions no longer exists
The old global functions are exposed on the ScriptedEffect instance
and then the QJSValue wrappers of the globalObject are modified to
trampoline the methods at a wrapper level.

- We can then use QJSEngine to automatically do argument error checking
rather than unmarshalling a QJSValue manually which significantly
reduces a lot of code.

- We can't make FPX2 a native type, so these are QJSValue args and
unboxed there.

Long term I want overloads for animate that take int/QSize/QPoint which
are native JS types, but that might be an API break.

Test Plan:
Hopefully comprehensive unit test which passes
Tested fade/fadeDesktop manually.

It's a very invasive change, so I expect some things will be broke
please help test any JS effects.

Reviewers: #kwin, mart, fvogt

Subscribers: fvogt, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14536
2021-02-23 07:47:01 +00:00
Vlad Zahorodnii 566d4aa27b scripting: Port Script to QJSEngine
QtScript is not well maintained and deprecated in favor of QJSEngine.
2021-02-23 07:47:01 +00:00
Vlad Zahorodnii 94b63c16f2 autotests: Register virtual keyboard service
Otherwise the input method test seems to fail with the following error

"The name org.kde.kwin.testvirtualkeyboard was not provided by any
.service files"
2021-02-22 16:08:14 +00:00
Vlad Zahorodnii ea4acb5763 autotests: Make PointerInputTest more robust
According to the spec, when the pointer enters a surface, the contents
of the cursor becomes undefined. The client should call set_cursor() to
make sure that the cursor image is correct.
2021-02-22 15:49:48 +02:00
Vlad Zahorodnii 378ecbc88c wayland: Implement maximized horizontal/vertical states
BUG: 407793
2021-02-17 14:39:24 +00:00
Vlad Zahorodnii d23dab7be9 wayland: Fix handling of synthetic touch cancel events
In case the compositor wants to cancel a touch sequence, we need to
ignore subsequent touch motion and touch up events until a new sequence
is initiated by the user.

Previously, it was implicitly handled by clearing the mapping table
between the touch slots and touch ids generated by kwayland-server.
2021-02-16 17:53:30 +00:00
Vlad Zahorodnii 90c6ba20ed autotests: Fix TouchInputTest::testCancel()
If a TOUCH_UP event is received after a TOUCH_CANCEL event, this is
most likely a libinput bug. TOUCH_CANCEL events act as TOUCH_UP events.
2021-02-16 12:56:05 +02:00
Vlad Zahorodnii 2df429ce5e autotests: Drop TestLibinputTouchEvent::testNoAssignedSlot()
We've switched to libinput_event_get_seat_slot(), which returns a
non-negative number to indicate the slot.
2021-02-16 12:52:08 +02:00
Xaver Hugl 995437f57c decouple DRM planes from DrmOutput 2021-02-15 17:28:58 +00:00
Vlad Zahorodnii 93e0265e4e Move source code to src/ directory
Once in a while, we receive complaints from other fellow KDE developers
about the file organization of kwin. This change addresses some of those
complaints by moving all of source code in a separate directory, src/,
thus making the project structure more traditional. Things such as tests
are kept in their own toplevel directories.

This change may wreak havoc on merge requests that add new files to kwin,
but if a patch modifies an already existing file, git should be smart
enough to figure out that the file has been relocated.

We may potentially split the src/ directory further to make navigating
the source code easier, but hopefully this is good enough already.
2021-02-10 15:31:43 +00:00
Vlad Zahorodnii 68c675d00d Make source code more relocatable
Occasionally, I see complaints about the file organization of kwin,
which is fair enough.

This change makes the source code more relocatable by removing relative
paths from includes.

CMAKE_CURRENT_SOURCE_DIR was added to the interface include directories
of kwin library. This means that as long as you link against kwin target,
the real location of the source code of the library doesn't matter.

With autotests, things are not as convenient as with kwin target. Some
tests use cpp files from kwin core. If we move all source code in a src/
directory, they will need to be adjusted, but mostly only in build
scripts.
2021-02-10 15:31:42 +00:00
Nicolas Fella a110231f68 Use imported target for QtGui private headers
It's nicer
2021-02-09 19:59:51 +01:00
Vlad Zahorodnii 335d9c4192 xwayland: Generate Xauthority file
This allows running Xwayland apps as root. Xwayland started with an
empty Xauthority file. After kwin has received the display number, the
file is updated with an actual authority entry.

BUG: 432625
2021-02-09 00:14:31 +02:00
Vlad Zahorodnii cfb212e470 Detect more Intel GPUs
This allows detecting Intel GPUs up to Xe graphics.
2021-02-02 15:17:24 +00:00
Vlad Zahorodnii f5925e2f17 wayland: Introduce internal popup event filter
The event filter allows dismissing the user actions menu by clicking
anywhere outside of it.

BUG: 428408
2021-02-02 14:09:44 +00:00
Vlad Zahorodnii 230b560ffc autotests: Fix TestXdgShellClient 2021-02-01 09:59:02 +02:00
Vlad Zahorodnii 21eee7de18 autotests: Fix TestDbusInterface
Activities had been exposed via the dbus interface in
6eda92a0fd.
2021-02-01 09:30:58 +02:00
Nicolas Fella 99947c8bd8 Use versionless Qt cmake target
This makes it easier to build against both Qt5 and Qt6

GIT_SILENT
2021-01-30 17:18:21 +01:00
Vlad Zahorodnii 3788a8285d Remove QPointer from function prototypes in some input code
As it was pointed out in 6acf35e4cc, it is
better to return raw pointers than qpointers because returning a qpointer
is equivalent to constructing a new one.
2021-01-28 16:49:29 +02:00
Méven Car b7539d06b9 Add TestOutputManagement::testOutputDeviceRemoved
Test the mock VirtualBackend
2021-01-27 08:18:57 +00:00
Xaver Hugl 9f4a1433e4 Also initialize properties when not using AMS
BUG: 431981
2021-01-26 21:23:52 +01:00
Vlad Zahorodnii 3305089ab3 kwineffects: Fix detection of Radeon GPUs 2021-01-25 17:55:08 +02:00
Vlad Zahorodnii 44176c6a8c Lower default severity of logging categories
Warning messages are not the kind of messages that should be ignored,
they indicate that something is off or wrong.

Also, this makes triaging bugs easier as we no longer have to ask people
to run kwin with the QT_LOGGING_RULES environment variable set.
2021-01-25 14:03:14 +02:00
David Edmundson 154a38adf5 Test fullscreen in conjuction with sendToScreen 2021-01-22 09:50:52 +00:00
Andrey Butirsky 071920418d fix: KeyboardLayoutTest fails on updated DBus API
Adress changes in methods:
- setLayout()
- layoutNames()
- layoutChanged() signal
2021-01-20 16:39:32 +03:00
Xaver Hugl 93ee2f6815 Add test for TouchInputRedirection::m_touches 2021-01-18 17:00:47 +00:00
Xaver Hugl a4fb852a94 Replace per-device touch slot with global slot
With multiple touch devices the slots could interfere
2021-01-18 17:00:47 +00:00
Vlad Zahorodnii 15d6be5c0c cmake: Drop Qt5::Sensors dependency
QOrientationSensor is no longer used by kwin.
2021-01-15 23:27:32 +02:00
David Edmundson 85d04cf60d Add ftrace markers
This logs to a tracefs filesystem which can be viewed in tools such as
gpuvis to see precise timings of activities in relation to other trace
markers in X or graphic drivers.

This patch is loosely based on D23114. Though modified with thread
safety, support for string building, and a RAII pattern for durations.
Ultimately that expanded it somewhat.
2021-01-14 09:31:59 +00:00
Méven Car 4f744d1bb6 Add TestOutputManagement::testOutputDeviceDisabled test
Allow VirtualBackend to supports Output changes.
2021-01-14 08:21:59 +00:00
Andrey Butirsky 8d84fe4b6a fix: KeyboardLayoutTest fails
********* Start testing of KeyboardLayoutTest *********
Config: Using QtTest library 5.15.2, Qt 5.15.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 10.2.1 20201016 (Red Hat 10.2.1-6)), fedora 33
PASS   : KeyboardLayoutTest::initTestCase()
PASS   : KeyboardLayoutTest::testReconfigure()
FAIL!  : KeyboardLayoutTest::testChangeLayoutThroughDBus() 'layoutChangedSpy.wait()' returned FALSE. ()
   Loc: [/home/bam/kde/src/kwin/autotests/integration/keyboard_layout_test.cpp(218)]
FAIL!  : KeyboardLayoutTest::testPerLayoutShortcut() 'layoutChangedSpy.wait()' returned FALSE. ()
   Loc: [/home/bam/kde/src/kwin/autotests/integration/keyboard_layout_test.cpp(286)]
PASS   : KeyboardLayoutTest::testDBusServiceExport()
PASS   : KeyboardLayoutTest::testVirtualDesktopPolicy()
PASS   : KeyboardLayoutTest::testWindowPolicy()
FAIL!  : KeyboardLayoutTest::testApplicationPolicy() 'layoutChangedSpy.wait()' returned FALSE. ()
   Loc: [/home/bam/kde/src/kwin/autotests/integration/keyboard_layout_test.cpp(465)]
PASS   : KeyboardLayoutTest::testNumLock()
PASS   : KeyboardLayoutTest::cleanupTestCase()
Totals: 7 passed, 3 failed, 0 skipped, 0 blacklisted, 16447ms
********* Finished testing of KeyboardLayoutTest *********

- currentLayoutChanged signal has changed to layoutChanged
- per cfcf2baae7, the signal is now emitted
  on every layout change
2021-01-11 11:50:34 +00:00
Vlad Zahorodnii 3dc00de812 platformsupport: Set PUBLIC include directories
This makes using platform support libs easier.
2021-01-07 09:49:26 +00:00
Aleix Pol 199860a007 Fix tests build, provide mocks for libinput functions 2021-01-07 02:56:19 +01:00
Vlad Zahorodnii b8a70e62d5 Introduce RenderLoop
At the moment, our frame scheduling infrastructure is still heavily
based on Xinerama-style rendering. Specifically, we assume that painting
is driven by a single timer, etc.

This change introduces a new type - RenderLoop. Its main purpose is to
drive compositing on a specific output, or in case of X11, on the
overlay window.

With RenderLoop, compositing is synchronized to vblank events. It
exposes the last and the next estimated presentation timestamp. The
expected presentation timestamp can be used by effects to ensure that
animations are synchronized with the upcoming vblank event.

On Wayland, every outputs has its own render loop. On X11, per screen
rendering is not possible, therefore the platform exposes the render
loop for the overlay window. Ideally, the Scene has to expose the
RenderLoop, but as the first step towards better compositing scheduling
it's good as is for the time being.

The RenderLoop tries to minimize the latency by delaying compositing as
close as possible to the next vblank event. One tricky thing about it is
that if compositing is too close to the next vblank event, animations
may become a little bit choppy. However, increasing the latency reduces
the choppiness.

Given that, there is no any "silver bullet" solution for the choppiness
issue, a new option has been added in the Compositing KCM to specify the
amount of latency. By default, it's "Medium," but if a user is not
satisfied with the upstream default, they can tweak it.
2021-01-06 16:59:29 +00:00
Jan Blackquill a92b465f8f Implement xdgshell v3 2021-01-06 01:08:25 +00:00
Vlad Zahorodnii 26b249061e cmake: Remove FindUDev.cmake
It's in extra-cmake-modules now.
2021-01-05 23:08:47 +02:00
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 ccfaf1a1d6 cmake: Rework how tabbox is conditionally compiled into libkwin
In modern CMake code, it is highly advised to avoid using variables. One
should instead try to use targets and properties more extensively.
2020-12-31 11:00:27 +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 79ca5ccd26 Merge OutputScreens into Screens
Since all platforms have been ported to AbstractOutput, OutputScreens
can be merged into Screens. This simplifies the class hierarchy.
2020-12-17 13:36:30 +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 9f2cb0ae1b Provide expected presentation time to effects
Effects are given the interval between two consecutive frames. The main
flaw of this approach is that if the Compositor transitions from the idle
state to "active" state, i.e. when there is something to repaint,
effects may see a very large interval between the last painted frame and
the current. In order to address this issue, the Scene invalidates the
timer that is used to measure time between consecutive frames before the
Compositor is about to become idle.

While this works perfectly fine with Xinerama-style rendering, with per
screen rendering, determining whether the compositor is about to idle is
rather a tedious task mostly because a single output can't be used for
the test.

Furthermore, since the Compositor schedules pointless repaints just to
ensure that it's idle, it might take several attempts to figure out
whether the scene timer must be invalidated if you use (true) per screen
rendering.

Ideally, all effects should use a timeline helper that is aware of the
underlying render loop and its timings. However, this option is off the
table because it will involve a lot of work to implement it.

Alternative and much simpler option is to pass the expected presentation
time to effects rather than time between consecutive frames. This means
that effects are responsible for determining how much animation timelines
have to be advanced. Typically, an effect would have to store the
presentation timestamp provided in either prePaint{Screen,Window} and
use it in the subsequent prePaint{Screen,Window} call to estimate the
amount of time passed between the next and the last frames.

Unfortunately, this is an API incompatible change. However, it shouldn't
take a lot of work to port third-party binary effects, which don't use the
AnimationEffect class, to the new API. On the bright side, we no longer
need to be concerned about the Compositor getting idle.

We do still try to determine whether the Compositor is about to idle,
primarily, because the OpenGL render backend swaps buffers on present,
but that will change with the ongoing compositing timing rework.
2020-12-10 07:14:42 +00: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