Commit Graph

1086 Commits (b0e24987627f489d225874252e23d713b27ebdc6)

Author SHA1 Message Date
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