19165 Commits (2894913f9362a8b5bb826532de032132711e4a9c)
 

Author SHA1 Message Date
Vlad Zahorodnii 33ba2974eb effects: Properly copy previous geometry
In QJSEngine, QRect is an Object, which is correct. This means that we
cannot use simple assignment operator to copy geometries, we need to use
standard ways to copy Objects, such as Object.assign() or the spread
operator, which is not available in QJSEngine yet.
4 years ago
Vlad Zahorodnii bd4d17b3a1 Drop QtScript dependency
QtScript is not used anywhere anymore plus it's dropped in Qt 6.
4 years ago
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
4 years ago
Vlad Zahorodnii 566d4aa27b scripting: Port Script to QJSEngine
QtScript is not well maintained and deprecated in favor of QJSEngine.
4 years ago
Bhushan Shah 28d2650f24 [platforms/drm] include missing errno.h include
CCMAIL: Xaver Hugl <xaver.hugl@gmail.com>
4 years ago
Xaver Hugl 6703bc9d24 Improve teardown of DrmGpu 4 years ago
Bhushan Shah ae8e69b4bb [platforms/drm] accept both keypress and keyrelease event in filter
We don't want to pass out either of key press or release event to other
filters.
4 years ago
Vlad Zahorodnii 58bee8e38a Fix build 4 years ago
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"
4 years ago
Bhushan Shah b24fc72969 [platforms/drm] only enable output on key press not release
Otherwise if powerdevil for example is configured to turn screen off on
the power key press, we will turn it right back on when we get key
release event.

Suggested-by: David Edmundson <kde@davidedmundson.co.uk>
4 years ago
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.
4 years ago
Vlad Zahorodnii 4061cbc97d Create Xcursor sprites with correct format
"ARGB32" is a typo, it needs to be "ARGB32_Premultiplied."
4 years ago
l10n daemon script 553b6d39c6 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
4 years ago
Vlad Zahorodnii 33e3b92946 effects/wobblywindows: Allow model geometry and real geometry get out of sync
Currently, the wobbly windows effect assumes that the window data will
be updated on every repaint. However, there are legit cases when the
time diff between frames can be 0, for example when per screen rendering
is on.

If we are unlucky enough and the geometry of the window changes in that
very short moment, the mapping between window quads and the bezier
patch will be wrong. The window will most likely bounce back and forth.

In order to improve handling of that tricky case, this change makes the
computeBezierPoint() function take the "uv" coordinates rather than the
absolute "xy" coordinates of window vertices. This loosens the
connection between the real geometry of the window and the cached bezier
patch, and overall makes the effect's timing code more robust.

This can be also useful if the wobbly windows effect starts accumulating
time diffs and performing the integration step every N msecs with the
purpose of maintaining uniform "wobbliness" across different refresh rates.

BUG: 433187
4 years ago
Vlad Zahorodnii 823692abc1 effects/wobblywindows: Refactor the update loop
This way, the code is more tidier.
4 years ago
Vlad Zahorodnii 45979ed460 x11: Introduce an envvar to force software vsync
This can be useful for debugging purposes and for people wishing to ramp
up the refresh rate on their setups with different refresh rates.

BUG: 433094
4 years ago
Vlad Zahorodnii fb93037ca7 x11: Introduce an envvar to prevent sync'ing to vblanks
This can be useful if you want to ensure that the buffer swap operation
won't block.

CCBUG: 433094
4 years ago
Vlad Zahorodnii e179fb697d platforms/drm: Refactor event dispatching code
There are a couple of reasons not to use the lambda:

* It is unnecessary. The DrmGpu has the DRM file descriptor
* If a crash occurs somewhere in the lambda, the backtrace will be hard
  to read
* Instead of processing events in the destructor of the DrmBackend
  class, we should keep dispatching events without involving
  QCoreApplication::processEvents() until all page flips are completed.
4 years ago
Aleix Pol d8cb48e6b7 inputmethod: honour SNI disabled state
At the moment we were sending activation signals even if it's disabled.
4 years ago
Xaver Hugl 79ccfaddf0 Properly clean up DrmGpu
CCBUG: 433145
4 years ago
Vlad Zahorodnii 6053bbd2d0 Sprinkle static keywords
There is no need to query the environment variables every time kwin
tries to determine the current compositing refresh rate.
4 years ago
David Faure abab1660aa Define -DQT_NO_CAST_TO_ASCII and fix compilation 4 years ago
Jan Blackquill c6b638267a Fix crash on pasting too soon after copying from XWayland
There seems to be an interval between when you copy something from a Wayland
client and when you attempt to paste it into an X client where m_chunks.first().first
is empty, and trying to access its .data() will cause an assertion. While we can't
really gracefully handle this situation, we can at least terminate the function early
and turn the paste operation into a noop instead of a crash.
4 years ago
Aleix Pol 04465e996c Prevent layershell from crashing when rearranging when we shouldn't
Here's the backtrace that prompted the MR:
```
0  QVector<KWin::VirtualDesktop*>::count() const (this=0x10) at
/home/apol/devel/kde5/include/QtCore/qvector.h:241
1  KWin::VirtualDesktopManager::count() const (this=0x0) at
/home/apol/devel/frameworks/kwin/src/virtualdesktops.h:687
2  KWin::Workspace::updateClientArea(bool) (this=0x0, force=false) at
/home/apol/devel/frameworks/kwin/src/workspace.cpp:2089
3  0x00007fef12a180b3 in KWin::LayerShellV1Integration::rearrange()
(this=<optimized out>) at
/home/apol/devel/frameworks/kwin/src/layershellv1integration.cpp:208
4  0x00007fef13094806 in QtPrivate::QSlotObjectBase::call(QObject*,
void**) (a=0x7ffcf9674f70, r=0x5569d2981a40, this=0x5569d2981e50) at
../../include/QtCore/../../../../../devel/frameworks/qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:398
5  doActivate<false>(QObject*, int, void**) (sender=0x5569d2981dc0,
signal_index=3, argv=argv@entry=0x7ffcf9674f70) at
/home/apol/devel/frameworks/qt5/qtbase/src/corelib/kernel/qobject.cpp:3886
6  0x00007fef1308db60 in QMetaObject::activate(QObject*, QMetaObject
const*, int, void**) (sender=<optimized out>, m=m@entry=0x7fef1332d280
<QTimer::staticMetaObject>,
local_signal_index=local_signal_index@entry=0,
argv=argv@entry=0x7ffcf9674f70) at
/home/apol/devel/frameworks/qt5/qtbase/src/corelib/kernel/qobject.cpp:3946
7  0x00007fef1309871a in QTimer::timeout(QTimer::QPrivateSignal)
(this=<optimized out>, _t1=...) at .moc/moc_qtimer.cpp:205
```
4 years ago
Aleix Pol 4fb2493826 --warning: Don't try to connect to a null object
It happens when running without libinput.
4 years ago
Aleix Pol 8950b78121 pipewire: Don't crash if we're passed a null spa_data
I just had that crash, this is what coredumpctl suggested it was
happening.
We don't need to make sure we're in dmabuf mode to remove the buffer.
Worst case scenario it won't remove anything. Check the spa_data before
querying in case it's null.
4 years ago
Méven Car 11c3ada121 DrmGpu fix atomicModeSetting try 4 years ago
Vlad Zahorodnii cf2486d643 x11: Properly detect whether swap events have to disabled
qEnvironmentVariableIntValue() will return 0 if the specified variable
is not set.

This means that swap events will be disabled on AMD GPUs unless the env
var is set explicitly to 1.
4 years ago
Bhushan Shah 892b8cf6cb inputmethod: toggle the inputmethod if we get second show request
This is in a way working around bad protocol, input-method-unstable-v1
and also input-method-unstable-v2 does not have a way for input-method
to mark itself as "deactivated". This can happen when e.g. user closes
the virtual keyboard using swiping down or "close keyboard" button in
keyboard.

When this happens, the state between compositor, text_input and
input_method gets out of sync, compositor does not know that input
method got deactivated and hence it will continue sending various events
to it. The quick way around it is to change focus, which makes
compositor send deactivate request to input-method, that puts compositor
and input-method in sync again.

This patch aims to solve this by tracking the last state of input
method, If we know that input method is active and text input sends us
the show event, we toggle the input-method.

I will re-iterate that this is in no way proper solution, ideally
input-method-unstable-v3 or input-method-unstable-v2 even (since it is
not upstream anyway) gains the new request which essentially allows
input-method to sync enabled/disabled state with compositor.
4 years ago
Vlad Zahorodnii 378ecbc88c wayland: Implement maximized horizontal/vertical states
BUG: 407793
4 years ago
Vlad Zahorodnii dd1b45d828 x11: Simplify X11Client::damageNotifyEvent()
The contents of the if branch is identical to the implementation of the
Toplevel::damageNotifyEvent() function and setReadyForPainting() will
never be called because m_syncRequest.isPending can be true only if the
window supports sync counters.
4 years ago
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.
4 years ago
Vlad Zahorodnii 8f2520e00e x11: Emit missing geometry changed signals for Unmanaged
Otherwise the scene might miss some geometry updates and render override
redirect windows distorted.
4 years ago
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.
4 years ago
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.
4 years ago
Vlad Zahorodnii 242544a056 core: Drop Toplevel::bufferMargins()
It can be expressed via other means.
4 years ago
Vlad Zahorodnii 10a8ef2969 Unvirtualize Toplevel::visibleGeometry() 4 years ago
Vlad Zahorodnii 8570b64384 Rename visibleRect to visibleGeometry
"rect"s have their origin at the top-left corner of the frame. However,
visibleRect() returns a QRect that's in the global coordinates.
4 years ago
Vlad Zahorodnii 311a370d77 wayland: Port kwin to SeatInterface::touchDown() changes 4 years ago
Vlad Zahorodnii 22d386cdd8 xwayland: Improve handling of Xwayland restarts
At the moment, the display name might change between Xwayland restarts.
It is a problem because the session process (plasma) may have an
outdated value of the DISPLAY environment variable after a restart.

With this change, it is guaranteed that the DISPLAY and the Xauthority
file stay the same until the server is stopped explicitly.
4 years ago
Xaver Hugl 995437f57c decouple DRM planes from DrmOutput 4 years ago
Méven Car 7c2c213f52 QPA Integration: Save enabled screens
Since QWindowSystemInterface::handleScreenRemoved would not be called in Integration::handleScreenDisabled, Qt apps would still reference disabled screens resulting in crashes.
4 years ago
Ismael Asensio 3b87c6ea2d kcm/kwinrules: Update values on text edit
Previously the text values were updated to the model after
`onEditingFinished()`, that is after losing focus, to prevent
erroneus updates.

This was making also the `needsSaving` signal fire only after
a focus change, which is not consistent with the behavior of
other KCMs.

Use `onTextEdit()` instead, so the model is updated as the user
types.

BUG: 431211
4 years ago
Cyril Rossi 12e0376fea KCM KWin VirtualDesktop highlight settings
Currently the highlight is only for the items. KCModuleData will come in another MR.
This is more simple implementation than the one I previously made.

Some default value are hardcoded in the KCM such as Rows count (2) and the number
of virtual desktop, on revert to default, it keeps only the first one.
4 years ago
Vlad Zahorodnii c5e91b94c4 xwayland: Refuse to create connection sockets if sockets dir doesn't exist
Since kwin runs as a normal user, it cannot create the X11 connection
socket directory because any user process can easily compromise the
security of the system by unsetting the sticky bit.

In order to guarantee the security of the system, the socket directory
must be created by root and have the sticky bit on.
4 years ago
Vlad Zahorodnii 118b817134 xwayland: Reserve enough space for sun_path
We also need to reserve space for the final null terminator.
4 years ago
Dan Leinir Turthra Jensen df498d9be4 Add CLI tool to set window decorations, and use for KNS adoptions
This adds a command line tool which allows the user to set the window
decoration, and then that tool is used in the two knsrc files to allow
the user to switch window decoration directly from either a KNS dialog,
or from Discover.
4 years ago
Vlad Zahorodnii 93d5901c85 Fix build on FreeBSD 4 years ago
Vlad Zahorodnii a2c7c66d8a xwayland: Emit Xwayland::started() after WM_S0 is claimed
Xwayland starts listening to -listenfd file descriptors after the WM_S0
selection is claimed. At the moment, it is claimed asynchronously by
kwin. First, we create a dummy window and change one of its properties
to get the timestamp. After the timestamp has been received, we actually
call xcb_set_selection_owner().
4 years ago
Vlad Zahorodnii 9f0f452702 xwayland: Manually create sockets
This provides kwin greater control over how X11 sockets are created for
Xwayland. For example, it can be used to ensure that the DISPLAY remains
the same across Xwayland server restarts or launching Xwayland on
demand.

Even though -listen <fd> option is deprecated, we still pass it because
older versions of Xwayland may not have the -listenfd option.
4 years ago