Commit graph

18262 commits

Author SHA1 Message Date
Aleix Pol
ff65bec92c Introduce a GLTexture::toImage helper class 2020-07-23 13:14:22 +02:00
Aleix Pol
1ef90d9c90 Add API to easily find Toplevels from their internal Id 2020-07-23 13:14:22 +02:00
Aleix Pol
fbbf96751b Workspace::findToplevel should iterate through allClients
Not just x11 ones.
2020-07-23 13:00:26 +02:00
l10n daemon script
a1c0d43deb 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"
2020-07-23 06:10:20 +02: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
4921acf45a Grab all possible keyboard modifiers for window commands
BUG: 424272
FIXED-IN: 5.19.4
2020-07-22 12:28:22 +00:00
Cyril Rossi
3609a029ea KCM KWin Options setting ActiveMouseScreen set proper default value
Fix regression that was introduced by a mismatch in the default value of
ActiveMouseScreen option between kwin.kcfg and kwinoptions_settings.kcfg

BUG: 424389


(cherry picked from commit c853f8313a213a0f7d0f98f662f7e98849d547ca)
2020-07-22 10:37:30 +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
Aleix Pol
ef81ae3f9f Resize maximised windows upon workspace change
Don't issue a frameGeometry update until we have fully processed which
geometry we want.

BUG: 423596
2020-07-21 12:03:12 +00:00
Aleix Pol
7f1abd5dad Allow testing transformations on windowed KWin 2020-07-21 12:03:12 +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
Cyril Rossi
0fad9cc86c KCM KWin Options : propagate defaultsIndicatorVisibleChanged to children KCModule 2020-07-20 15:36:01 +02: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
c4c06c4e1f Notify about new client geometry also when moving windows 2020-07-17 11:56:22 +00:00
Vlad Zahorodnii
9c55c01767 Introduce a signal that notifies about new buffer geometry
The new signal can be useful if one wants to watch a toplevel for buffer
geometry updates. This can be especially useful for input related code
because the position of the upper left corner of the main surface is used
to compute the input transformation matrix.
2020-07-17 11:56:22 +00:00
Vlad Zahorodnii
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
5dbb52de64 Handle delayed start of Xwayland
KWin is supposed to properly handle delayed start of Xwayland, but in
reality it does poor job of that.
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
David Edmundson
27ceaf9793 Only call VirtualDesktops::load once
It was called twice once with and without X as our implementation of
setRootInfo() missed some calls.

This was done to avoid a bug as setRootInfo() didn't update everything.
This patch aims to resolve that at the root cause.

I tested the original conditions of the patch with an empty kwinrc and a
file in /etc/xdg/kwinrc setting desktops to 2 and everything loaded
correctly.
2020-07-17 09:02:16 +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
Vlad Zahorodnii
4a6badc22c Ignore setActive() for windows that are being deleted
We may call setActive() on a window that is being deleted. We cannot
guarantee that at that moment the X11 window or the Wayland surface is
still valid. So, the best course of actions is to do nothing.

BUG: 424255
2020-07-16 17:04:09 +03:00
Vlad Zahorodnii
6139ea7874 Destroy xdg shell clients when surface is still alive
Destroy xdg shell clients when the aboutToBeDestroyed() signal has been
emitted in order to ensure that no NULL surface is going to be accessed.
2020-07-16 17:04:09 +03:00
Vlad Zahorodnii
036ad759e0 [wayland] Adapt to SurfaceInterface changes 2020-07-15 12:46:28 +00:00
Vlad Zahorodnii
cae9828471 Don't perform MouseActivateRaiseAndPassClick for topmost windows
Do nothing if the active window is already most recently raised one.
2020-07-15 12:17:46 +03:00
Adrien Faveraux
6f640ece79 Adapt Contrast to new KWaylandServer 2020-07-14 18:25:38 +00:00
Adrien Faveraux
ae12cf9784 adapt Decoration Server to KwaylandServer Change 2020-07-14 18:23:03 +00:00
Andrey Butirsky
3cdfdeb982 deprecate --libinput option
seems do not needed any more
2020-07-14 16:20:45 +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
Adrien Faveraux
bb138d7668 Adapt EglStream to KwaylandServer 2020-07-14 10:09:43 +00:00
Bhushan Shah
28d5a4e73b [virtualkeyboard] Fix the qtvirtualkeyboard with Qt 5.15
On 5.15, the VirtualKeyboard did not have a correct z-order which caused
the virtualkeyboard to hide as soon as key was pressed, upon
investigation it seems that upstream Qt changed behavior in following
changes.

https://codereview.qt-project.org/c/qt/qtvirtualkeyboard/+/292472
https://codereview.qt-project.org/c/qt/qtvirtualkeyboard/+/292674

Now when desktop-integration is used (i.e non-application embedded mode)
one need to set property desktopPanel to true so that it have correct
z-ordering and does not miss input events.

This is used in Component.onCompleted to avoid breaking it for the Qt
5.14.x qtvirtualkeyboard. When we switch to 5.15 property assignment can
be moved to InputPanel declaration.
2020-07-14 14:40:11 +05:30
Vlad Zahorodnii
5463a5427d [wayland] Drop pointless xwayland connection check
Xwayland can operate in two modes - rootless and rootful. When Xwayland
operates in the rootful mode, a container window is created where all
native X11 clients are placed. The container window is an xdg-toplevel
surface. Most compositors are not interested in rootful mode.

When Xwayland operates in the rootless mode, every X11 window is going
to be represented with a Wayland surface that has no role assigned to it.
In order to associate a wayland surface with an X11 window, Xwayland
will send a client message of type WL_SURFACE_ID.

Since we want Xwayland operate only in rootless mode, the check that
verifies that a newly created xdg-toplevel surface belongs to Xwayland
is pointless. We are never going to hit that case.
2020-07-13 15:37:34 +00:00
Adrien Faveraux
8d861b475d adapt Decoration Server palettes to KWaylandServer Changes 2020-07-13 15:36:22 +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
Bernie Innocenti
0c67eb983c [decorations] Fix rendering for depth 30 (10bpc)
When the display is set to 30-bit depth (10-bit per color component),
decorations of some clients appear garbled when compositing is disabled.
This is because the pixel format of the QImage in which the decorations
were rendered differed from the the X pixmap into which the pixels were
being copied by means of xcb_put_image().

For lack of a more robust way, this change guesses A2RGB30 for depth=30,
and keeps using ARGB32 as before for any other depth. I don't expect
anything other to 32bpp to be supported by KWin anyway.

Tested on amdgpu with KWIN_OPENGL_INTERFACE=egl.

BUG: 406302
FIXED-IN: 5.19.4
2020-07-10 13:08:53 +00:00
Konstantinos Smanis
72cd67cbf6 [scripts/videowall] Reenable the config dialog
Install the .desktop file of the videowall script in the services
directory, otherwise the configuration dialog is inaccessible.
2020-07-09 09:47:08 +00:00
Aleix Pol
89fca06bdb Make sure tablet coordinates take decorations into account
Fixes a small awkward offset on some applicaitons.

BUG: 423833


(cherry picked from commit 311094ad8be4c76df2a4655fe71e7085fa9c4e14)
2020-07-08 15:20:35 +00:00
Andreas Haratzis
6c9026628c Fix DrmOutput sometimes being freed with a pending pageflip, often when waking from sleep.
It is possible for updateOutputs to be called when a pageflip is pending.
Freeing a DrmOutput with a pending pageflip is not allowed (see ~DrmOutput assert - the page flip handler will be called on the freed memory, possibly leading to use-after-free).
This works around the problem by delaying the destruction with teardown().

BUG: 422460
2020-07-07 18:33:28 -07:00
David Edmundson
9e1bb1f130 [autotests] Fix warning
DrmOutput is a class
2020-07-07 09:24:03 +00: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
Chaojiang Luo
0ef5ddfd47 [drm] Do not blank crtc in atomic mode
In atomic setting mode, when external display tears down, it will blank
crtc with dump buffer by legacy api, then re-plug the external display,
the blank can not be removed. We think the blank is not needed in atomic
mode setting.

Signed-off-by: Chaojiang Luo <chaojiangluo@163.com>
2020-07-03 12:09:34 +08:00
Vlad Zahorodnii
617650d440 [scene] Discard pixmaps on buffer size change
The surface size is a logical size, which renders it unsuitable for
deciding whether the window pixmap needs to be discarded.

We need to discard window pixmaps when the buffer size changes. That
has a drawback though, discarding textures is kind of an overkill with
linux-dmabuf. However, fixing that would involve changes in kwayland
server that are far from being trivial.

BUG: 422459
2020-07-01 09:43:27 +00:00
Vlad Zahorodnii
f7a67e0edc [wayland] Ignore decoration updates if initial state isn't committed yet
or else we might send an unexpected configure event.
2020-07-01 09:18:29 +00:00
Vlad Zahorodnii
1013ee1bd0 [wayland] Queue maximize and fullscreen requests if initial state isn't committed yet
In order to ensure that no configure events will be sent before the full
initial state is committed, we need to queue maximize and full screen
requests or else the client may receive an "unexpected" configure event
and we miss to call initialize().
2020-07-01 09:18:29 +00:00
David Edmundson
1b4c725d10 Update clientGeometry for Unmanaged windows
It was udpated when we received a configure event but not in the initial
track.

The symptom of this being missed out was that blur would not be applied
to the window.

BUG: 423405
CCBUG: 423297
2020-06-30 14:59:54 +01:00
David Edmundson
38691aa0e7 [xwl] Fix xcb to wayland clipboard
A seemingly unrelated change to cursors broke xwayland's clipboard
syncing, presumably because of a change in how startup is ordered with
regards to syncing between our internal wayland connection causing a
crash.

It was fixed with a flush, but ultimately guarding things coming up in
the natural order works better.

Long term plans are to finish removing the internal connection.

See xwayland_selections_test in autotests.
2020-06-29 15:06:33 +01:00
Nicolas Fella
fdbca44d3e Use monochrome icon for keyboard layout sni
All SNIs use monochrome icons, except for this one
2020-06-28 19:12:32 +00:00