Commit graph

1311 commits

Author SHA1 Message Date
Vlad Zahorodnii
7d3bce21a1 plugins/idletime: Fix processing of user activity
Currently, idle timers are not restarted on user input which triggers
the lockscreen even though the user is active at computer.

This change fixes that by making sure that idle timers are restarted
whenever SeatInterface's timestamp changes, i.e. user moves the pointer
or presses a key, etc.
2021-10-19 09:55:22 +00:00
Vlad Zahorodnii
7d692fd2a4 plugins/idletime: Remove m_started boolean flag 2021-10-19 09:55:22 +00:00
Vlad Zahorodnii
a3de9bc93b kcmkwin: Load builtin effects from metadata files
Linking builtin effects against KCMs is really awkward. This change
decouples builtin effects from KCMs that use EffectsModel.

In order to discover builtin effects, metadata files are installed in
kwin's data dir, which will be subsequently read by EffectsModel.
2021-10-19 09:12:15 +00:00
Vlad Zahorodnii
141947d2e8 effects: Link builtin effects with executables
The main motivation behind this change is to prepare kwin for importing
kwayland-server code in libkwin.

As is, builtin effects are linked with libkwin. Some builtin effects
have wayland specific code. If we move wayland stuff in libkwin, there's
going to be a circular dependency between kwin4_effect_builtins and
libkwin targets.

This change intends to break that dependency by linking builtin effects
to kwin executable.

The main issue with that is that EffectLoader would need to discover the
effects indirectly. QStaticPlugin is used for that purpose.

Besides breaking the cyclic dependency, it makes builtin effects use the
same plugin infrastructure in libkwineffects that external effects use.

Metadata in src/effects/effect_builtins.cpp was converted in a list of
python dictionaries, which was fed to a python script that generated
main.cpp and metadata.json files.
2021-10-19 09:12:15 +00:00
Vlad Zahorodnii
2019dcd0fe Add support for static effect plugins
With static effect plugins, builtin effects can be linked to
executables. It also makes libkwin one step closer to being more
reusable.
2021-10-19 09:12:15 +00:00
Xaver Hugl
1763139834 platforms/drm: fix disabled outputs with legacy drivers
m_primaryBuffer could be nullptr when a pipeline was inactive before, causing
a crash
2021-10-19 07:37:50 +00:00
Ömer Fadıl USTA
3ec6dab5d0 Add other missing includes to fix bsd build 2021-10-19 06:18:27 +03:00
Ömer Fadıl USTA
a2a012be26 Add missing include to fix bsd compile problems 2021-10-19 06:03:49 +03:00
l10n daemon script
d154da1e0b 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"
2021-10-19 01:17:26 +00:00
Xaver Hugl
fbb5c95cc4 platforms/drm: tie primary planes to crtcs 2021-10-18 20:05:34 +00:00
Xaver Hugl
3a9491ca6d platforms/drm: Move legacy cursor handling into DrmCrtc
Makes things easier for tiling and reduces the complexity of DrmPipeline
2021-10-18 20:05:34 +00:00
Xaver Hugl
a70321c592 platforms/drm: split DrmObject::Property out in its own files 2021-10-18 20:05:34 +00:00
Xaver Hugl
307b5ce3ca platforms/drm: prettify some headers
Makes them much more readable
2021-10-18 20:05:34 +00:00
Xaver Hugl
72af309317 platforms/drm: reverse output creation order
This was inverted from 5.22, which switches plasma layouts and the default
Xwayland primary screen.
2021-10-18 19:32:59 +00:00
Vlad Zahorodnii
4dafacc00b kwineffects: Stop linking kwayland-server
As is, libkwineffects doesn't use any specific apis in kwayland-server,
it simply "forwards" wayland display and surfaces from libkwin. Given
that, there is no need to link libkwineffects with kwayland-server. If
an effect needs to access wayland specific stuff, it can link explicitly
against kwayland-server.

The main motivation behind this change is to further loosen up
dependencies between various kwin components and kwayland-server so the
latter can be moved back to kwin.
2021-10-18 16:03:30 +00:00
Vlad Zahorodnii
a5a2deef60 kwineffects: Remove effectively unused surface_interface.h include
SurfaceInterface can be an opaque pointer.
2021-10-18 11:34:15 +00:00
Vlad Zahorodnii
85f8a53360 x11: Properly unredirect windows if compositing is not possible
Before attempting to create scenes, kwin will redirect windows but if
the opengl scene can't be created, it won't unredirect windows, which
seems to cause issues on aarch64.

BUG: 443953
2021-10-18 13:20:35 +03:00
Vlad Zahorodnii
dda0c24187 wayland: Remove absolute position from processMotion() that handles relative moves
API-wise it's odd to require absolute position with relative pointer
moves.

This cleans up some of InputRedirection code by making it simply forward
pointer input events from input devices to the pointer input device
handler, which knows better what to do with the delta value.

The pointer input device handler will compute the absolute position based
on the specified delta value, but it could also do something else, e.g.
not move the pointer at all if it's locked, etc.
2021-10-18 08:47:21 +00:00
Alexander Lohnau
8adfd2f244 Use enum value for KAuthorized::authorize
Task: https://phabricator.kde.org/T11948
2021-10-18 07:03:50 +00:00
Vlad Zahorodnii
6d5fc9fd30 Restore old behavior of Workspace::clientArea(clientOpt, Toplevel)
When geometry updates are blocked, the output doesn't get updated. This
breaks Workspace::clientArea() overload that takes only the window.

Previously, clientArea() would look up the output where the window is
every time it's called, so the fact that the screen id or AbstractOutput
is unsynchronized with the frame geometry was irrelevant.

This change restores the old behavior as 5.23 is affected by the
output() being out of sync with the frameGeometry(). Specifically, when
kwin starts managing an X11 window, it will block geometry updates,
setup the window, e.g. make it fullscreen, and unblock geometry updates.

Since Workspace::clientArea(clientArea, Toplevel) uses the output(),
X11Client::setFullScreen() will most likely put the X11 window at a
wrong output if it's called inside X11Client::manage().

BUG: 443787
2021-10-18 05:25:06 +00:00
Vlad Zahorodnii
23e5039918 Fix build on Gentoo
AbstractEglBackend includes option.h, which includes main.h, which
includes QApplication. Since SceneOpenGLBackend doesn't link against
Qt::Widgets, kwin fails to build on Gentoo, but not on other distros
for some reason...
2021-10-17 15:49:57 +00:00
Aleix Pol
ff618e9f41 Do not ask for decoration settings without guarding
Otherwise we crash when no decoration is set (e.g. Plasma Mobile)
2021-10-17 14:41:34 +00:00
ivan tkachenko
aaa060d6c1 KCM: Implement better layout
Text labels without extra margins on the left looked mis-positioned.
2021-10-16 03:27:08 +00:00
Rodney Dawes
518c75a042 InputMethod: Use new API to pass modifiers map along to clients 2021-10-15 16:47:06 -04:00
Rodney Dawes
9818f4a4e5 InputMethod: Update for kwayland-server API change with keysym events
To avoid needless conversion of modifiers in kwayland-server, we needed
to break API so that the modifiers are simply passed through.
2021-10-15 16:47:06 -04:00
Vlad Zahorodnii
cc98001d4c Use move resize geometry in AbstractClient::applyWindowRules()
Abstract clients tolerate passing the shaded window geometry to
moveResize().

But the main issue with applyWindowRules() is that it uses the current
frame geometry even though it calls moveResize(). It's not a big deal
but it's error prone.

This change ports applyWindowRules() to the move resize geometry, which
makes code more straightforward and ensures that kwin uses right
geometry type with moveResize().
2021-10-15 20:19:20 +03:00
Vlad Zahorodnii
368bbde1ff Make geometry updates blocker pass last move resize geometry
X11Client tolerates passing shaded geometry to moveResize() and in many
cases kwin already does that.

Another issue is that this doesn't align well with new async geometry
handling abstractions. pos() can't be used because it corresponds to the
current frame position.

We can safely pass the last move resize geometry. It simplifies code a
bit and makes sure that everything works as expected with the move
resize geometry.
2021-10-15 20:18:59 +03:00
Vlad Zahorodnii
b90975b7a2 Replace AbstractClient::adjustedSize() with a simpler alternative
Currently, adjustedSize() does two things - it computes and constrains
the natural size of the window.

In many places where adjustedSize() is used, the natural size doesn't
need to be constrained and in some it's actually undesired because
AbstractClient::constrainClientSize() doesn't allow the client size to
be 0x0, which can happen when dealing with a client that has no buffer
committed yet.

This change replaces adjustedSize() with implicitSize(), which simply
calculates the natural frame size based on the current client size.

If the frame size needs to be constrained, for example during
interactive move-resize, use constrainFrameSize() or if you need to
constrain the client size - constrainClientSize().
2021-10-15 17:16:11 +00:00
Vlad Zahorodnii
a195290600 Simplify AbstractClient::applyWindowRules()
Trying to reconstrain the geometry after applying rules is unnecessary
because if the geometry is forced using a rule, resizeWithChecks()
should not change it; if the window is maximized or has entered fullscreen
mode, window gravity is irrelevant. If the window is shaded, this
resizeWithChecks() is not needed.

This change simplifies AbstractClient::applyWindowRules(), which allows
to split adjustedSize() to further simplify geometry handling.
2021-10-15 17:16:11 +00:00
Aleix Pol
3e77907d21 inputmethod: Use touch events to decide if the panel is shown not the state
Prefer hiding/showing the panel (i.e. the window) when not a touch event
than stopping to make the inputmethod active.
This way we remain compatible with non-virtualkeyboard inputmethods.
2021-10-15 15:41:35 +00:00
Xaver Hugl
5b9deafa14 InputMethod: only activate virtual keyboard when used with touch 2021-10-15 15:41:35 +00:00
Vlad Zahorodnii
f1e99e971f scripting: Guard against nullptr m_client in WindowThumbnailItem
BUG: 443765
2021-10-15 07:59:55 +00:00
Vlad Zahorodnii
59a4a908f9 Properly update parent item's bounding rect when moving item
The bounding rect of an item is in the item-local coordinate space. If
the item is moved, its bounding rect won't change, but the parent's
bounding rect, may change.

BUG: 443756
2021-10-15 10:30:49 +03:00
Vlad Zahorodnii
ff3465a80e Fix AbstractClient::adjustedSize() for wayland windows with no committed buffer
AbstractClient::constrainClientSize() forces the minimum client size of
1x1.

If AbstractClient::adjustedSize() is called before the XdgToplevelClient
is mapped, it will return 1x1 rather than 0x0 as expected, which will
confuse

    QSize s = adjustedSize();
    if (s != size() && s.isValid())
        resizeWithChecks(s);

in AbstractClient::applyWindowRules(). Since 1x1 is different from 0x0,
the xdg-toplevel surface is going to be resized to 1x1.

BUG: 443705
2021-10-15 05:38:54 +00:00
Vlad Zahorodnii
b4a4e8a45d Drop WaylandServer::terminateClientConnections()
Display will destroy all client connections before getting destroyed.
2021-10-14 10:02:50 +00:00
Vlad Zahorodnii
e550480c43 Rework input method teardown logic
Explicitly destroy input method rather than wait for the input method
connection to be destroyed by WaylandServer, it's less error prone.

BUG: 443603
2021-10-14 10:02:50 +00:00
Vlad Zahorodnii
4f46da46fc wayland: Move relative pointer extension instantiation to WaylandServer
Whether relative pointers are supported doesn't depend on the input
backend. This change moves the instantiation of the extension to the
WaylandServer class to make code more consistent.
2021-10-14 06:41:01 +00:00
Aleix Pol
3da0725404 Fix build
We forgot to remove the subdirectory when moving builtin plugins into
separate targets.
2021-10-14 02:44:29 +02:00
Vlad Zahorodnii
6b015d1e6e libinput: Drop mm position in Connection::pointerMotionAbsolute()
The position in millimeters is unused and it can't be applied to virtual
input devices.
2021-10-13 20:52:45 +03:00
Vlad Zahorodnii
bf620fbe04 Move Xkb::LEDs enum to KWin namespace
With the LEDs enum being defined in kwinglobals.h, wayland_server.h
won't need to include keyboard_input.h, which is good for compilation
times and wayland_server.h will drag less stuff, e.g. QtWidgets (input.h
includes QAction)
2021-10-13 17:49:19 +00:00
Vlad Zahorodnii
9cdd363fa1 effects: Pass full name to kwin4_add_effect
This way, it's more clear what target name is.
2021-10-13 17:05:06 +00:00
Vlad Zahorodnii
10b56bd43d effects: Modularize builtin effects build
Currently, cpp source files are included partially in effect sub-folders
and src/effects/CMakeLists.txt, which is really confusing and hard to
follow.

With this change, effect targets will be defined in their own subfolders.
This makes build files more straightforward.

Effect sub-targets are eventually merged into a monolithic
kwin4_effect_builtins target.

Another reason for modularizing builtin effects is that no two effects
can generate moc files with the same name atm even though they are in
different sub-folders. This can be potentially useful in the future, e.g.
making effects static plugins in order to decouple builtin effects from
libkwin (every effect subfolder would need a main.cpp or plugin.cpp file,
which will include the associated moc file).
2021-10-13 17:05:06 +00:00
Vlad Zahorodnii
ec6e6fa63c effects/showfps: Add destructor
The GLTexture class is forward declared and the ShowFpsEffect class has
a QScopedPointer<GLTexture> field. We either need to include the
kwinglutils.h header file or add a destructor that does nothing and
define it in the cpp file, where kwinglutils.h is included.
2021-10-13 17:05:06 +00:00
Aleix Pol
c07182490d pipewire: Fix downloading software-rotated textures
At the moment we'll be setting the YInverted setting, but in practice
that won't have any effect as it only changes the render matrix and
we'll end up streaming inverted textures.
This change addresses it by rendering it into another texture first to
resolve this situation and then download that new texture instead.
2021-10-13 17:16:15 +02:00
Aleix Pol
67ec16c335 pipewire: No need to create a QRect when we just need its size 2021-10-13 17:14:53 +02:00
Nate Graham
c1fb405b8d Rename "pack" actions for clarity
The English word "pack" is not really the correct word for these
actions, and does not succeed in communicating what they will do. Since
the actions simply move the active window as far as it will go in the
specified direction, the actions can be renamed to say that instead.

Also rename the action names in the code to match their new UI text for
clarity.
2021-10-13 14:28:23 +00:00
Méven Car
cc5b47ee30 abstract_client: convert some Q_FOREACH 2021-10-13 15:44:39 +02:00
Andrey Butirsky
59143eeef9 [wayland] fix crash on startup with lv3:ralt_alt XKB option
With lv3:ralt_alt ("Right Alt never chooses 3rd level") option set, we
get more layouts from libxkbcommon than it was configured, see:
https://github.com/xkbcommon/libxkbcommon/issues/262
It might be correct lib's behavior, still.

The extra layouts are redundant, so we strip them out from usual usage.

BUG: 440027
2021-10-12 15:41:54 +00:00
Vlad Zahorodnii
e29997bda8 plugins/nightcolor: Remove unused options 2021-10-12 06:38:23 +00:00
Vlad Zahorodnii
d0fd2224bf autotests: Use EffectLoader to list all available effects
EffectLoader is a more generic way to list all available effects.
2021-10-12 06:33:30 +00:00
Vlad Zahorodnii
260b224d3b Drop WaylandServer::dispatch()
There's no any good reason to dispatch events at shutdown.
2021-10-12 06:32:55 +00:00
Vlad Zahorodnii
65e8c0c737 Simplify WaylandServer::initWorkspace()
If kscreenlocker integration is on, the initialized() signal can be
still emitted in WaylandServer::initWorkspace().
2021-10-12 06:32:55 +00:00
Vlad Zahorodnii
d941c97d8e Remove unused includes 2021-10-12 06:32:55 +00:00
l10n daemon script
16e38fe07b 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"
2021-10-12 01:19:47 +00:00
Rodney Dawes
886a86ab2b Pass correct argument to Q_UNUSED for disabled features 2021-10-08 13:19:35 -04:00
Martin Flöser
68589fe937 compositor: Merge the OpenGL 2 and 3 backends
This change merges the two OpenGL backends into one making the current
default of GLCore the overall default. It becomes the first context to
try to create. If it fails, it will automatically fall back to the
(previous) OpenGL 2 backend.

Reasoning: the differentiation of OpenGL 2 and 3 is a very technical one
and hard to understand for users. It is not obvious which one is better
or should be used. This results in many user discussions like "Which
backend to use?"

Back when the OpenGL 3 backend was introduced the dedicated feature made
sense. It was a new code base using new driver features. Nowadays the
code base in KWin is robust and mature and so are the drivers. A driver
advertising support for OpenGL 3 will support OpenGL 3. We don't have to
plan for driver breakage in this area any more.

Also our code evolved through the context attribute builder which gives
us the possibility to more easily fall back in case we cannot create the
context. Thus the need to select the backend is not so important as it
used to be when the feature got introduced.

If a user still wants to force OpenGL2, it is still possible by setting
the appropriate environment variables like MESA_GL_VERSION_OVERRIDE.

This change brings the improvement that the backend selection is now
completely removed from the compositing KCM.
2021-10-08 15:26:25 +00:00
Vlad Zahorodnii
4ba7aa62b9 Reset WaylandServer::s_self in destructor
When using KWIN_SINGLETON macros, you still need to reset s_self
manually in the destructor.
2021-10-07 18:26:43 +03:00
Vlad Zahorodnii
5be593d4e4 wayland: Drop internal connection
It's practically unused now.
2021-10-07 13:28:08 +00:00
Benjamin Port
9c4f358a64 NightColor: use config watcher to update state when configs are changed 2021-10-07 13:12:30 +00:00
Alex Richardson
722f092b7a Fix a -Wformat warning on FreeBSD
On FreeBSD we get a long long result so %ld triggers a warning. Cast to
long long and use %lld to make it work on all platforms (including 32-bit).
2021-10-07 08:24:01 +00:00
Xaver Hugl
9f69d4c9c2 platforms/drm: set DPMS property properly 2021-10-07 07:02:50 +00:00
Vlad Zahorodnii
4f3ff4fbb0 wayland: Improve default placement of pointer
Currently, the pointer is moved to the center of the workspace. However,
on a multi-monitor setup, the workspace center may not be the same as
the center of the output it's on. That's the case with my setup -
1920x1080, 1920x1080, 1080x1920 (the monitors are laid out in a row from
left to right).

This change improves the default placement of the pointer by actually
moving it to the center of the screen that contains the workspace center
so the pointer doesn't end up at some "random" position from the user's
point of view.
2021-10-07 05:49:42 +00:00
Andrey Butirsky
c9b41a1682 fix wrong approach geometry of screen edge's effect
Edge geometry has width and height, so we need the correction for
approach geometry of bottom and right corners.
The other edges are fixed as well.

BUG: 442973
2021-10-06 22:57:33 +00:00
Vlad Zahorodnii
e6c77a1ddc Clear should_get_focus in Workspace::focusToNull()
On X11, there are four input models. With some input models, it's okay
if the window manager calls XSetInputFocus(), with others, the wm has to
ask the client to make a XSetInputFocus() request.

If kwin wants a client to take input focus, kwin will add the client
to the should_get_focus list, which contains all the windows that
are about to get input focus. Clients are popped from the list upon
receiving FOCUS_IN events.

A client will be added to the should_get_focus list even if kwin thinks
that the client already has input focus because communication between
the wm and xorg is async, anything can happen with input focus in meanwhile.

On the other hand, the wm may sometimes focus the null window if no
window should contain the input focus. The issue is that the
should_get_focus list is not cleaned up in that case, which can lead to
Workspace::mostRecentlyActivatedClient() returning wrong client and
possibly other async related issues.

We don't have such madness on Wayland as the compositor is in charge of
handling input focus.

This change makes Workspace::focusToNull() clear the should_get_focus,
which is reasonable. We need to deactivate "in-flight" focus requests.

This also fixes the bug where fullscreen Wayland windows don't go above
docks and panels due to Workspace::mostRecentlyActivatedClient() returning
bad client.

BUG: 439405
BUG: 395919
2021-10-05 14:53:20 +00:00
Xaver Hugl
ef894f34eb xdgshellclient: fix initial placement with maximize
BUG: 439986
2021-10-04 09:39:58 +00:00
Xaver Hugl
6a68caef7b Only emit outputDisabled if the output is enabled
CCBUG: 440322
2021-10-04 09:38:40 +00:00
Xaver Hugl
178e69b39b platforms/drm: handle hotplugs with disabled outputs better
If the last enabled output gets removed but we have disabled outputs
still connected, enable the first disabled output to prevent a crash.

BUG: 442990
2021-10-04 09:37:52 +00:00
Méven Car
85fb0e7c43 IdleTimePoller: Fix a crash at shutdown
Currently, kwin crashes at shutdown because the idle poller plugin is unloaded when exit handlers are run, after the waylandServer() is destroyed. This results in null dereferencing.

BUG: 443268
2021-10-04 10:24:23 +02:00
Vlad Zahorodnii
8ac93a59ff scene: Handle Xwayland windows changing surfaces
Xwayland can re-create the wl_surface if the window has been previously
unmapped.

BUG: 442936
BUG: 426069
2021-10-04 05:56:27 +00:00
Vlad Zahorodnii
73162e8fae Store Toplevel surface using QPointer
This makes Toplevel::setSurface() simpler.
2021-10-04 05:56:27 +00:00
Vlad Zahorodnii
52c9dbb487 wayland: Reset Toplevel::surfaceId after surface is created
Xwayland will re-create the wl_surface object if the X11 window is
unmapped and mapped. That, and the fact that the order in which the
WL_SURFACE_ID client message event is received and the wl_surface object
is created is undefined can cause the following bug:

* WL_SURFACE_ID is received
* the old wl_surface object is destroyed, m_surfaceId is reset to 0
* new wl_surface is created but because m_surfaceId is 0, it won't be
  associated with the x11 window

This change ensures that kwin will associate the wl_surface with x11
window by making it not reset cached surface id when the old wl_surface
is destroyed.

However, we cannot leave m_surfaceId as is because wayland aggressively
re-uses object ids so kwin can associate wrong surface with x11 window.

To prevent that, this change also makes Toplevel::setSurface() reset
cached surface id.

CCBUG: 442936
CCBUG: 426069
2021-10-04 05:56:27 +00:00
Vlad Zahorodnii
61eb8ce75b Fix double close()
AbstractDataSource::requestData() takes the ownership of the file
descriptor. So the second close() will close an already closed fd.
2021-10-04 05:41:23 +00:00
Xaver Hugl
d83da1cdac platforms/drm: remove redundant check for placeholder output
It's not necessary, the placeholder output already gets created in DrmBackend::removeOutput
if necessary. More improtantly it's missing the check for shutdown, which
may cause issues if the computer is turned off while no outputs are connected.
2021-10-03 16:33:01 +02:00
Méven Car
8c908c69bc Port src/plugins/idletime/poller.cpp away from the internal connection 2021-10-01 15:01:23 +00:00
Kristen McWilliam
cc06f62749 Fix center snap zone to account for available space 2021-10-01 14:55:12 +00:00
Xaver Hugl
d55011ae86 platforms/drm: handle disabled outputs better
BUG: 442603
2021-10-01 08:53:10 +00:00
Vlad Zahorodnii
6b313268dd Allow passing -1 screenId to Workspace::clientArea() again
Allow passing -1 screen id to clientArea() until the effects are ported
to EffectScreen.
2021-10-01 08:07:51 +00:00
Vlad Zahorodnii
21da7b7ed8 effects/thumbnailaside: Fix crash in clientArea()
clientArea() was changed to forbid "-1" screen ids, but it seems like
the thumbnail aside effect can pass it to refer to the active screen.

This change makes the thumbnail aside effect handle "-1" screen id case
explicitly. It will be also useful for EffectScreen transition.

BUG: 443166
2021-10-01 08:07:51 +00:00
Xaver Hugl
eeb1bd5b38 Fix a few clazy warnings 2021-09-30 12:26:25 +00:00
Xaver Hugl
bcbba62c7c platforms/drm: remove dangling pointer of lease outputs pipeline 2021-09-30 07:16:49 +00:00
Vlad Zahorodnii
66badd905b kcmkwin/rules: Fix suggested values for virtual desktops rule
If the virtual desktops rule is created, only the last virtual desktop
the window is on is going to be checked.

With this, all virtual desktops that the window is currently on will be
checked.

Technically, it's an api breaking change, but the window rules kcm is
the primary user of queryWindowInfo() so I don't think it's a big deal.
2021-09-30 05:40:04 +00:00
Vlad Zahorodnii
31b9f34d9b libinput: Port to AbstractOutput
CCBUG: 443088
2021-09-29 12:03:39 +03:00
Alexander Lohnau
1022ce0036 Fix condition for making themes configurable
KPluginMetaData::findPlugins only returns valid json metdata, the previous
check was accidentally kept for the condition that the plugin provides a theme engine.

BUG: 442978
FIXED-IN: master
2021-09-28 23:08:43 +00:00
Xaver Hugl
6ca530e02b platforms/drm: fix small memory leak 2021-09-28 23:48:36 +02:00
Vlad Zahorodnii
6bbda88ab5 platforms/drm: Avoid making real commits while searching for output config
This change limits the brute force output configuration search routine
to test only commits, it's way more efficient than real commits.

CCBUG: 442603
2021-09-28 11:31:54 -06:00
Vlad Zahorodnii
eb1daa0aad platforms/drm: Avoid re-using blobs
Blobs are not reference counted if used by other drm master, if kwin
re-uses a deleted blob in an atomic commit, it will fail. For example,
on my computer, this happens when kwin starts after xorg.

Besides that, kwin may try to destroy blobs that it doesn't own, which
is not fatal but it's strange to do so.

CCBUG: 442603
CCBUG: 439873
2021-09-28 11:31:54 -06:00
Vlad Zahorodnii
6513c66ca6 wayland: Move ConnectionAdaptor to the same thread as Connection
Connection deletes the ConnectionAdaptor, but they are in different
threads, which is weird.

CCBUG: 442104
2021-09-28 17:29:34 +00:00
Aleix Pol
6cf060223e gbm: Do not create buffers when there is no display 2021-09-28 17:18:34 +00:00
Aleix Pol
9bda050d84 screencasting: Do not crash when the platform cannot provide textures
When using the QPainter backend, we will be getting null textures. Just
ignore these as the backend isn't all that important.

BUG: 442711
2021-09-28 17:18:34 +00:00
Xaver Hugl
de674e087a platforms/drm: make failure of findWorkingCombination less severe
While findWorkingCombination should never fail, in the case it does
KWin should not crash. To achieve that simply restore the old config
in case of failure.

CCBUG: 439873
2021-09-28 16:23:01 +00:00
Vlad Zahorodnii
d7d1c6600a wayland: Move ownership of the libinput thread to InputRedirection
When libinput tears down, it may access the Session object. This change
re-jitters the shut down logic so the Session object is guaranteed to be
valid when libinput stuff gets destroyed.

BUG: 442104
2021-09-28 14:37:47 +00:00
Vlad Zahorodnii
7900068cab wayland: Destroy InputRedirection explicitly
CCBUG: 442104
2021-09-28 14:37:47 +00:00
David Edmundson
ef06b8ed95 [effects] Avoid animating screenlocker backing window
ksmserver provides the backing window (the hidden black one) for the
lockscreen. We don't want to animate this fading out.

It no longer provides the logout prompt since several plasma releases.
2021-09-27 14:34:42 +00:00
David Edmundson
d3318cde15 [effects] Don't animate lockscreen via fadingpopups effects
Whilst unmanaged, it's clearly not a popup.
2021-09-27 14:34:42 +00:00
Xaver Hugl
4aebf0d730 platforms/drm: fix legacy dpms
BUG: 442969
2021-09-27 12:55:15 +00:00
Xaver Hugl
7bca5d737d platforms/drm: fix dpms tracking
DrmGpu::updateOutputs is now changing the state of some drm properties
without changing the fitting output state (namely RenderLoop inhibition)
which can lead to rendering being inhibited indefinitely in some cases
2021-09-27 12:55:15 +00:00
Vlad Zahorodnii
0f6aa1c4a8 scenes/opengl: Fix clipping with transformed screens
Software-based clipping is naive. It maps the clip region from the
global screen coordinates and intersects it with window quads. If the
window is transformed, the quads won't be clipped as expected.

Unfortunately, the OpenGL scene enables software-based geometry clipping
if the screen transformed. It's not clear why it does so, perhaps as a
performance optimization? Either way, this produces incorrect results
when the screen is scaled.

BUG: 440940
2021-09-27 06:52:49 +00:00
Ash Blake
242de43737 tablet: Check if client is supported before sending tool button
BUG: 438010
2021-09-26 09:02:21 +00:00
l10n daemon script
ced2990c8a 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"
2021-09-26 01:13:57 +00:00
l10n daemon script
45ee1969c7 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"
2021-09-25 01:15:12 +00:00
l10n daemon script
6c1447875e 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"
2021-09-24 01:13:57 +00:00
Fabian Vogt
6e1564fc17 gbm_dmabuf: Fix crash if gbm_bo_create fails
And perform proper cleanup if eglCreateImageKHR fails.
2021-09-23 16:09:11 +00:00
Vlad Zahorodnii
c94c2128bd effects/overview: Drop Kompose mode
This makes ExpoLayout easier to maintain. As is, the main issue with it
is the number of layout algorithms.

With this, the ExpoLayout is going to have two layout algorithms - one is
very simple and the other not so.
2021-09-23 16:03:49 +00:00
Xaver Hugl
416f55cea3 platforms/drm: fix hidden cursor
BUG: 438824
2021-09-23 15:54:18 +02:00
Vlad Zahorodnii
966a95e5fd wayland: Set default cursor shape for the root window
Previously, it was done by plasmashell, now it needs to be done by kwin.

BUG: 442539
2021-09-23 13:52:51 +00:00
Vlad Zahorodnii
ca1c72dd16 wayland: Fix cross cursor in Xwayland apps
Startup code in plasmashell was changed so xsetroot is not called
anymore, which is sort of fine.

Unfortunately (or not?), it exposed a bug in kwin. Cursor::x11Cursor()
only works in the standalone X11 session.

On Wayland, Cursor::x11Cursor() will return XCB_NONE which results in
seeing cross cursor when there should be arrow cursor.

This change moves xcb_cursor_t look up code from X11Cursor to the base
Cursor class. In hindsight, I would like to introduce a window manager
class where the xcb cursor and other x11 specific code can be moved in
the future for better encapsulation of platform-specific code.

CCBUG: 442539
2021-09-23 13:52:51 +00:00
Vlad Zahorodnii
29d1b25ad5 effects/desktopgrid: Schedule repaint when toggled
A repaint needs to be scheduled; otherwise the animation may not start
immediately.
2021-09-23 13:39:48 +00:00
Andrey Butirsky
f453cb83e2 fix wrong popups Z-order after applying "Show Desktop" effect
For some reason, layers are change after applying Show Desktop effect, so
we will have AboveLayer for our popups and Desktop, and NotificationLayer
for Dock which hides us.
Also, OSD and critical notifications were always hidden by our popups.

This patch solves both the issues.
Usual notifications will still be hidden, but hopefully it's not a big
issue.

BUG: 442605
2021-09-23 11:54:55 +00:00
Vlad Zahorodnii
67b94586c4 effects/trackmouse: Fix texture check
Both texture and image cannot be not null as they are initialized based
on compositing type.

BUG: 439859
2021-09-23 11:25:46 +00:00
Vlad Zahorodnii
df11acd467 x11: Cast Window to EGLNativeWindowType using a C cast
reinterpret_cast<>() will fail if the types we cast from and to have
mismatching sizes.

Unfortunately, there are platforms that have Window and
EGLNativeWindowType of different size. This results in compilation
errors.

In order to work around those problematic platforms, this change
replaces reinterpret_cast cast with a c style cast.
2021-09-23 09:41:19 +03:00
Amir Maimon
51925567f6 platforms/drm: Fix explicitGpus check
The check for explicitGpus in udev event handler was limited to new
GPUs, and didn't consider changes to the GPU driver, eg. from vfio-pci
to amdgpu
2021-09-23 06:35:28 +00:00
Vlad Zahorodnii
21a17c87db libkwineffects: Simplify EffectQuickView constructors
This simplifies EffectQuickView constructors and ensures that there
won't be a crash if compositing is off.
2021-09-23 06:28:29 +00:00
Vlad Zahorodnii
1b215e6c06 libkwineffects: Avoid accessing effects in EffectQuickView
EffectQuickView is used by Aurorae. As long as Aurorae decorations are
rendered by kwin, it's not a problem. However, kde-gtk-config kded
module can also render them. This creates a problem. If effects object
is not created, accessing any of its getters or setters will result in a
segmentation fault.

This change rewrites the share context check so the effects object is
not accessed anymore.

One could argue that kde-gtk-config has to provide a dummy EffectsHandler
but it doesn't use effects and libkwineffects is not a dependency of
KDecoration2. So, providing a dummy EffectsHandler makes no sense.

In hindsight, we need to revisit the usage of EffectQuickView in Aurorae
as accessing the EffectsHandler in EffectQuickView is a totally valid
usecase and integration of QOpenGLContext.

BUG: 441585
2021-09-23 06:28:29 +00:00
Vlad Zahorodnii
0b95979751 kcm/compositing: Don't reset animation speed to default value when running in plasma
When running in plasma, the animation speed slider is in General
Behavior KCM.

The Defaults button should not reset the animation speed slider because
it's hidden.

BUG: 442600
2021-09-22 15:09:46 +00:00
l10n daemon script
c27e4df375 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"
2021-09-22 01:19:05 +00:00
Vlad Zahorodnii
c29c437e58 effects/glide: Adjust the effect to projection matrix changes
With per-screen rendering, the projection matrix is no longer created
with the workspace geometry, i.e. all screen geometries united, so the
center of the workspace geometry may not map to (0, 0) in the clip
coordinates.

GLRenderTarget::virtualScreenGeometry() can be used to query the rect
that was used to create the projection matrix.

BUG: 442770
2021-09-21 12:20:19 +00:00
Xaver Hugl
6d79d855be platforms/drm: waitIdle before updating outputs
KMS can only ever have one frame pending at the moment. If we
update the outputs while a pageflip is still pending on any output
the atomic commit will fail with EBUSY, which both invalidates
the testing for output configuration and makes applying the wanted
configuration fail.

This can be removed again once KMS gains the ability to do mailbox
presentation; that will likely still take a while though.

BUG: 442677
2021-09-21 14:18:16 +02:00
Vlad Zahorodnii
2200febcd6 Restore fbo binding after updating surface texture from EGLStreams
Currently, data from client buffer EGLStream is copied to a surface
texture. An fbo is used for that purpose. The main issue with it is that
it doesn't restore the old framebuffer binding.

The surface texture can be updated in the middle of a compositing cycle.

If the framebuffer binding is not restored, any window that must be
rendered in an offscreen texture won't be rendered to the offscreen
texture.

This change makes EglStreamSurfaceTextureWayland restore the fbo binding
so the DeformEffect and software screen rotation work as expected with
the proprietary NVIDIA driver.

BUG: 442697
2021-09-21 12:41:45 +03:00
Vlad Zahorodnii
595c7a7edc Add NOTIFY signal to closeable property
QML doesn't like that the overview effect uses the closeable property
yet it has no NOTIFY signal.
2021-09-21 05:41:46 +00:00
Nate Graham
095f953847 kcmkwin/kwinscripts: Hide help button
There is no help for this KCM, so don't show the Help button.

BUG: 442460
FIXED-IN: 5.23
2021-09-20 19:52:48 +00:00
Jan Blackquill
b376f8832f Fix desktop grid border activation
BUG: 442518
FIXED-IN: 5.23
2021-09-20 14:34:11 -04:00
Jan-Marek Glogowski
6ead28a6a1 composite: adjust terminal messages (prio + text)
This makes the compositingPossible() output more elaborative,
and adjusts their priorities to qCWarning.

I thought about dropping the "Compositing is not possible"
(qCCritical) message. It's not critical for X11 and Wayland
depends on OpenGL. OTOH it's from a different component. So in
the end I settled for qCWarning again; there is no real way
to know, if the platform will consider this a critical problem
(and eventually abort).

Then I saw X11StandalonePlatform::compositingNotPossibleReason,
which has more user friendly, QT Richtext / HTML encoded output,
but this seems overkill for the terminal; now I would like to
know, where this is actually used...

While at it report "manually" suspended compositing via qCInfo
instead of qCDebug.
2021-09-20 13:18:33 +00:00
Jan-Marek Glogowski
bcdf047018 composite: log when disabled via OpenGLIsUnsafe
After updating my Debian buster to bullseye, I noticed missing
shadows / composite for KDE, which made overlapping windows hard
to recognize.

.xsession-errors just had "kwin_core: Compositing is not possible".
Using the suggested QT_LOGGING_RULES="kwin_*.debug=true" didn't
provide any more clues; nothing I tried did.
Eventually I ended reading the kwin source and found, that
disabled composite via kwinrc :: [Compositing] :: OpenGLIsUnsafe
was not reported.

IMHO all these disabling cases should use qCCritical(KWIN_CORE),
like the "Compositing is not possible" message, but for the time
being, this simply logs the OpenGLIsUnsafe reason, just like all
the others.
2021-09-20 13:18:33 +00:00
Lewis Lakerink
fc860a226e Fix screen edge detection 2021-09-20 13:15:23 +00:00
Kristen McWilliam
5fdf1da808 Add hotkey option to move active window to center 2021-09-20 13:14:24 +00:00
Kristen McWilliam
69417dd5f7 Fix required if statement before switch 2021-09-20 13:12:17 +00:00
Kristen McWilliam
b23f2ab3dd Refactor if-else chain in Placement::place to a switch statement
Was using a long & fragmented if-else chain. A switch statement
is often more performant, as well as being easier to read and modify.
2021-09-20 13:12:17 +00:00
Vlad Zahorodnii
f2b6a6b2f6 scenes/opengl: Fix null dereference in OpenGLWindow::windowTexture()
If the SurfaceItem has no SurfacePixmap, kwin will crash when trying to
access the surface texture.

BUG: 437709
2021-09-20 12:39:28 +00:00
Xaver Hugl
e004f1b7fc platforms/drm: fix buffer re-using
We don't always have explicit modifiers when we're using AMS

CCBUG: 442677
2021-09-20 14:28:58 +02:00
Xaver Hugl
cf7cc0d43e Implement DRM leasing 2021-09-17 23:09:08 +02:00
Vlad Zahorodnii
afcb9fd037 x11: Fix "Move window to next screen" shortcut for maximized windows
With the recent AbstractOutput changes, Workspace::clientArea() overload
that takes only the window and no additional output was changed to

    return clientArea(opt, window, window->output());

prior to that, it had been looking up the output at the center of the
frame geometry.

As it turns out, AbstractOutput::sendToOutput() blocks geometry updates,
which in its turn means that Toplevel::output() will be updated only
after geometry updates are unblocked. For the most part, it's not a big
deal until you need to use Workspace::clientArea(opt, const Toplevel*)

Since the output won't be updated until geometry updates are unblocked,
clientArea(opt, const Toplevel *) may return outdated info.

One could argue that we just simply need to update m_output similar to
m_frameGeometry when geometry updates are blocked, but... it's not going
to work on wayland! On Wayland, GeometryUpdatesBlocker is totally
unnecessary. Even if a window is resized, m_frameGeometry will be left
unchanged until the client repaints the window.

Instead, one need to pass the AbstractOutput to clientArea() if it's
important.

This change makes X11Client::changeMaximize() query the MaximizeArea of
the output containing the center of the move resize geometry, similar to
what the XdgToplevelClient does.

BUG: 442534
2021-09-17 14:02:01 +00:00
Xaver Hugl
ca869e2bc5 platforms/drm: disable explicit modifiers by default
There are some unresolved issues where driving outputs can fail because
of bandwidth constraints. These don't appear to happen with implicit
modifiers, or at least they don't happen as often.
2021-09-17 13:52:07 +00:00
Xaver Hugl
4848964c60 platforms/drm: allow modesets when setting Broadcast RGB
CCBUG: 442520
2021-09-17 15:48:40 +02:00
Aleix Pol
8825c01b15 tablet: Fix disconnecting the tablet while the pen is still in proximity
libinput will send release and proximity out events after the device is
disconnected.
This just takes into account that tablet might be nullptr.

BUG: 442573
2021-09-17 13:33:41 +00:00
Aleix Pol
7ffa7c48e5 wayland inputmethods: If maximized, also restore to the available area
The stored geometry is irrelevant in the window is maximized.
This is especially relevant if we:
* open a virtual keyboard
* rotate the display (then it looks ok as it was already addressed)
* then remove the keyboard.

At that point we want to reset to the available area rather than the
previous.
2021-09-17 13:05:53 +00:00
Alexander Lohnau
08d3ceb024 Port to new KDecoration2::DecorationThemeProvider class
By supporting all the required attributes in the DecorationThemeMetaData class
the custom struct can be dropped.

Task: https://phabricator.kde.org/T14744
2021-09-17 12:45:47 +00:00
Alexander Lohnau
58c71de952 GenericScriptedConfigFactory::create: Do not use plugin keyword to identify which KCM should be loaded
We can just put the parameter in the variant list. Because the method is virtual, the keyword
parameter must exist in the method definition.

Task: https://phabricator.kde.org/T14744
2021-09-17 12:45:47 +00:00
Alexander Lohnau
cd4ef30b21 Emit deprecation warnings for loading KCM using a plugin keyword
Otherwise consumers will not know about the change and this way it is clear that the logic should be removed in the future
2021-09-17 12:45:47 +00:00
Alexander Lohnau
6f110bca1d Deprecate loading of KDecoration2::DecorationButton plugins using the "button" keyword
Task: https://phabricator.kde.org/T14744
2021-09-17 12:45:47 +00:00
Fabian Vogt
e26ea6bf23 Fix build on 32bit platforms
error: invalid cast from type ‘uintptr_t’ {aka ‘unsigned int’} to type ‘EGLNativeWindowType’ {aka ‘long unsigned int’}
2021-09-17 10:59:29 +00:00
Xaver Hugl
a7a515a0af platforms/drm: re-use buffers for testing
b38bb416 introduced flicker when restarting compositing because the
DrmGpu::findWorkingCombination method usually creates new buffers for
the commit, without rendering into them. Instead of that, re-use
existing buffers where possible
2021-09-17 11:56:20 +02:00
Xaver Hugl
d308262d4a platforms/drm: simplify active handling a bit 2021-09-17 11:34:51 +02:00
Xaver Hugl
15da95149d platforms/drm: add a method for setting legacy properties 2021-09-16 18:03:14 +02:00
Xaver Hugl
e88f2501bf platforms/drm: simplify DrmPipeline::checkTestBuffer 2021-09-16 18:03:14 +02:00
Xaver Hugl
3fc74f103a platforms/drm: drop some unused methods 2021-09-16 18:03:14 +02:00
Xaver Hugl
99cd923e4a platforms/drm: simplify format stuff a bit 2021-09-16 18:03:14 +02:00
Xaver Hugl
b3e245b177 platforms/drm: make SRC properties readable
They're 16.16 fixed point. Should make debugging easier
2021-09-16 18:02:36 +02:00
l10n daemon script
b461111130 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"
2021-09-16 01:18:13 +00:00
Severin von Wnuck
05af11b4ed qpa: Fix EGL config selection
The configs returned by eglChooseConfig are sorted from highest to lowest buffer sizes.
Filter the configs to find a suitable candidate that matches the requested attributes of the surface.
This fixes the corrupted Aurorae window decorations on Wayland with the proprietary Nvidia driver.
2021-09-16 00:37:19 +02:00
Andreas Sturmlechner
38e24ecd64
Fix build with 32-bit
Follow-up to 839710201c

Tested-by: David Flogeras <dflogeras2@gmail.com>
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2021-09-15 19:06:23 +02:00
Vlad Zahorodnii
f4b504c476 wayland: Fix google chrome fullscreen mode
Conceptually, a configure event inherits its parent's state and adds
some of its own. This allows the compositor to skip intermediate
configure events in ack_configure handler and jump to the last one.

Currently, the only field that XdgSurfaceConfigure objects need to
inherit is flags. The geometry info and window states are filled in by
role commit implementations to their latest values.

XdgSurfaceConfigure::flags indicates if the configure event moves the
window. This flag is important to resolve conflicts between geometry
updates initiated by the user and the ones that are made in response to
acknowledged configure events, e.g. after maximizing the window, etc.
(effectively, if the user moves a window, kwin will cancel scheduled
moves in configure events)

If configure flags are not inherited, we can end up with the following
case:

* configure event A (flags: {position})
* configure event B (flags: {})

If the client acknowledges configure event B, kwin will skip configure
event A, and thus it won't move the window to the right place. This is
the root cause of fullscreen mode misbehaving with apps such as google
chrome.
2021-09-15 16:17:17 +00:00
Vlad Zahorodnii
d58246961e scene: Fix previous pixmap ref'ing
discardPixmap() increases the reference counter, but there's no matching
place where the ref count is decreased, which results in the previous
pixmap not being released even if it's not needed anymore.
2021-09-15 16:16:42 +00:00
l10n daemon script
46a69357a7 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"
2021-09-15 01:22:44 +00:00
Andrey Butirsky
987c68f5a5 fix: [Wayland] Context menu opens behind apps launcher and popups
BUG: 437139
2021-09-14 13:28:09 +00:00
Xaver Hugl
b8d69a326c platforms/drm: improve VT switching behavior
Instead of setting pipelines one by one, use DrmGpu::updateOutputs to
set all the outputs on a GPU with a single atomic commit. This makes
the switch both faster, more reliable and in case the other drm master
changes the output configuration, prevents blanking.
2021-09-13 16:58:49 +02:00
Aleix Pol
2bd02f660b wayland platform: Remember to call setTransformInternal() from updateTransform() 2021-09-13 10:11:09 +00:00
Vlad Zahorodnii
839710201c x11: Fix build with EGL_NO_PLATFORM_SPECIFIC_TYPES
eglCreateWindowSurface() wants a Window (unsigned long), but with
EGL_NO_PLATFORM_SPECIFIC_TYPES, EGLNativeWindowType is defined as an
opaque pointer, i.e. void*.

BUG: 440372
2021-09-13 06:37:19 +00:00
Xaver Hugl
e10f2ce06e platforms/drm: correct property blob handling
If a property blob got created by another drm master we can't rely on
re-using it, so create a new blob of our own with the data copied over
when the kernel destroys it.
Also free property blob objects when we don't need them anymore.

BUG: 440294
2021-09-13 01:28:47 +02:00
l10n daemon script
abe6b41534 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"
2021-09-11 01:16:54 +00:00
Aleix Pol
050c6ae76b Improve behaviour upon rotation with keyboard on
We make sure our client stays maximised as the screen geometry changes.

Fixes https://invent.kde.org/plasma/plasma-phone-components/-/issues/91
2021-09-10 23:37:55 +00:00
Aleix Pol
883dbfda17 drm: Properly check for the need for transformation
At the moment we were checking for size difference between the buffers
which works for rotation but not for flipped or up-side down screens.

This changes how we check it by comparing the effective transform vs the
supported one in drm to see if they differ.

Fixes https://invent.kde.org/plasma/plasma-phone-components/-/issues/112
2021-09-10 20:11:57 +02:00
Aleix Pol
5f306ae93d Improve debug, no need to show a number when we can show the value 2021-09-10 18:00:53 +02:00
Ismael Asensio
f6796ac860 [effects/overview] Only show close button for closeable windows 2021-09-10 17:25:19 +02:00
Ismael Asensio
07551a4487 Workspace: Better check of registered client shortcuts
Do not discard a shortcut immediately when it is already registered
in KGlobalAccel, because there could be possible dangling shortcuts
if they weren't properly cleaned-up (ex. after a crash).

Instead we delay the check for conflicts with other client shortcuts
to the second loop, which we know is up to date.

BUG: 442215
FIXED-IN: 5.22.80
2021-09-10 13:00:36 +02:00
Vlad Zahorodnii
46e2d51044 scripting: Make thumbnaills use linear filter
QSGImageNode ignores QSGTexture's filter, one has to specify it using
QSGImageNode::setFiltering().

In hindsight, we need to figure out how to integrate the lanczos filter
with window thumbnails and use it instead.

BUG: 441709
2021-09-10 09:16:24 +03:00
l10n daemon script
84426e8082 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"
2021-09-10 01:18:40 +00:00
Xaver Hugl
1b504818a3 platforms/drm: improve warning messages in DrmPipeline 2021-09-09 19:52:01 +00:00
Xaver Hugl
a0a98d0b31 platforms/drm: only delete outputs if not pre-existing
When there aren't enough CRTCs to drive all the outputs this could
delete existing outputs.
2021-09-09 19:52:01 +00:00
Xaver Hugl
b89f04943c platforms/drm: only test combinations if there are any
Otherwise we could hit an assert in DrmPipeline
2021-09-09 19:52:01 +00:00
Xaver Hugl
ffc4c12548 platforms/drm: commit pipelines directly instead of testing
The current behavior seems to cause some issues, and this is faster and
more efficient.
2021-09-09 19:52:01 +00:00
Vlad Zahorodnii
748004d81e x11: Avoid discarding the window pixmap for no reason
If the buffer size changes after creating or destroying the decoration,
the surface item will discard the pixmap.

If the buffer size remains the same, we can continue using old pixmap.
2021-09-09 16:55:39 +00:00
Aleix Pol
2ef53e7350 drm: Make hardware rotation opt-in
The current implementation sometimes will leave the screens unusable,
therefore KWIN_DRM_SW_ROTATIONS_ONLY=1 is default.
Use KWIN_DRM_SW_ROTATIONS_ONLY=0 to test hardware DRM operations.
2021-09-09 16:54:35 +00:00
Nate Graham
d11b4c8084 kcmkwin/kwindesktop: disable double-click mouse area while in edit mode
Otherwise the mouse area eats clicks and prevents text selection using
the mouse from working.

BUG: 441963
FIXED-IN: 5.23
2021-09-09 10:51:53 -06:00
Aleix Pol
d5be2232e8 Fix build 2021-09-09 17:10:48 +02:00
Alex Richardson
af3602b48c Fix out-of-bounds copy in xcb_send_event() calls
xcb_send_event always copies 32 bytes, so we have to pad all xcb_*_event_t
to 32 bytes to avoid leaking uninitialized stack memory. I found this
problem while running kwin_x11 on a CHERI-RISC-V system (which has bounded
pointers). The xcb_send_event() implementation has a memcpy() that was
copying 32 bytes but the event passed was a bounded to 28 bytes, so this
resulted in a run-time exception in X11Client::sendClientMessage().
The same problem exists in Selection::sendSelectionNotify(), but this time
we could end up copying up to 8 bytes since xcb_selection_notify_event_t
is only 24 bytes.

This disclosure of uninitialized data could in theory have a security
impact if it leaks a pointer value (e.g. a return address) as part of an
exploit chain that needs to bypass ASLR. However, the selection notify
events go directly to the XServer and you most likely already have a
serious problem if an attacker has full control over the XServer. It is
possible that the configure notify events go directly to an untrusted
client, but even if they do this leak is not directly exploitable.

See also https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/18
2021-09-09 15:03:44 +01:00
David Edmundson
65f168e144 Use a direct connection for X to wayland drags
We already use a direct DataSource object for transfer.

Use of the new public SeatInterface::startDrag allows us to start our drag directly.
2021-09-09 11:13:02 +00:00
David Edmundson
400dd31db6 Drop the internal connection for wayland to X drags
An AbstractDragTarget is introduced. This contains either the DataDevice we are
dragging to or an Xwl bridge.

We set this on Seat along with the active surface.

In future this also allows getting rid of the move filter.
2021-09-09 11:13:02 +00:00
David Edmundson
7f976199b7 Adapt to kwayland-server icon changes
The icon is a property of the active drag which is managed by Seat, the
DataDevice should not cache this.
2021-09-09 11:13:02 +00:00
Vlad Zahorodnii
0aaa57e18e Assign default name if new virtual desktop has no explicit name
If a virtual desktop has empty name, kwin is going to end up in an
infinite cycle where VirtualDesktopManager::save() updates the
_NET_DESKTOP_NAMES property and then in the next event loop cycle,
RootInfoFilter::filter() is going to call VirtualDesktopManager::save()
because the _NET_DESKTOP_NAMES property has been changed.

This regression has showed up just now because some parts of kwin used
to increase virtual desktop count to create new desktops. Recently, that
code was ported to VirtualDesktopManager::createVirtualDesktop().

The main difference between createVirtualDesktop() and setCount() is
that the latter will set the desktop name to "Desktop N", the former
will use user-specified name.

If the user-specified name is empty, the createVirtualDesktop() method
should assign "Desktop N" name to the virtual desktop according to the
docs. However, it's not the case and this change addresses that.
2021-09-09 10:50:16 +03:00
l10n daemon script
16f5ce9361 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"
2021-09-08 01:27:17 +00:00
Xaver Hugl
b38bb41698 Test DrmPipelines for outputs
Not all combinations of connectors, crtcs and planes will work
on all hardware, so we need to test the pipelines before using
them.

BUG: 433107
CCBUG: 435265
2021-09-08 02:44:29 +02:00
Xaver Hugl
18a8245ca2 platforms/drm: rename user data in DrmPipeline to output 2021-09-07 23:36:32 +02:00
Xaver Hugl
65b55e2045 platforms/drm: change when to reset the output with eglstreams
In order to accomodate crtc or primary plane changes on outputs we
need to dynamically recreate rendering resources with EglStreams as
the stream is tied to the crtc or plane currently in use.
2021-09-07 23:36:32 +02:00
Xaver Hugl
d057bd41c9 AbstractWaylandOutput: always emit mode change when mode is set
Otherwise there can be situations where the platform sets a mode but
KScreen never gets notified of it.
2021-09-07 21:34:01 +00:00
Xaver Hugl
f82d9f3d23 platforms/drm: remove duplicated warning
The same warning already gets printed in DrmPipeline
2021-09-07 21:34:01 +00:00
Xaver Hugl
e59f50e599 platforms/drm: adjust how transforms are set
Instead of using setTransformInternal directly, have DrmOutput
set it in updateTransform, like with the other setters. Also use
updateTransform instead of setTransformInternal in DrmBackend, so
that hardware rotation can be used where possible.
2021-09-07 21:34:01 +00:00
Xaver Hugl
1af2067f40 platforms/drm: reload m_conn in DrmConnector::updateProperties 2021-09-07 21:34:01 +00:00
Aleix Pol
6d35d63acb Fix build 2021-09-07 13:27:44 +02:00
Kai Uwe Broulik
1f53db1b44 [kcmkwin/kwindecoration] Port last remnants of removed "units"
ButtonGroup was still using it...
2021-09-07 07:41:42 +00:00
Kai Uwe Broulik
8bebf5cee1 Port to function-pointer based QMetaObject::invokeMethod
It's more efficient and compile-time checked
2021-09-07 06:30:39 +00:00
Xaver Hugl
ed2d0979c7 platforms/drm: fix warning 2021-09-07 05:45:51 +00:00
Xaver Hugl
237ef3d47f platforms/drm: fix drmModeSetCursor2 fallback
the return value is -errno, not errno.
2021-09-07 05:45:15 +00:00
l10n daemon script
d63b06d7a5 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"
2021-09-07 01:25:46 +00:00
Méven Car
74cb7a5b45 kcm compositing: Hide preview option in Wayland 2021-09-06 12:22:20 +00:00
Aleix Pol
be96741803 Test first desktop file names with the .desktop extension appended
It's the right thing to do, without it's only a fallback for bogus
applications.
2021-09-06 11:48:46 +00:00
Aleix Pol
73279acc63 Fix absolute desktop file names
Qt understands that the spec wants the id without .desktop postfix and
chops it, so we need to add it back if we want to infer the desktop
file.
https://code.qt.io/cgit/qt/qtwayland.git/tree/src/client/qwaylandwindow.cpp?h=5.15#n161

BUG: 425403
2021-09-06 11:48:46 +00:00
Vlad Zahorodnii
935fa6a9e1 Move ownership of Shadow to Toplevel
This decouples the management of Shadow from the scene window and allows
multiple items share the same Shadow.

Currently, kwin has a single scene graph, but it makes sense to create a
scene graph per output as they could have different layers, etc. This
would also allow QtQuick share more textures with kwin, which is worth
doing for optimization purposes in the future.
2021-09-06 10:42:39 +00:00
Vlad Zahorodnii
b40fb76c71 platforms/wayland: Prepend KWayland::Client:: to Surface 2021-09-06 10:42:03 +00:00
Vlad Zahorodnii
1d54231df1 scene: Generate unnormalized shadow texture coords
This makes shadow texture coordinates consistent with surface and
decoration texture coords and allows reusing window quads between
kwin items and qtquick items more easily.
2021-09-06 12:17:44 +03:00
l10n daemon script
9b06492499 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"
2021-09-06 01:26:11 +00:00
l10n daemon script
a78a9f3275 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"
2021-09-05 01:21:09 +00:00
Guilherme Marçal Silva
06d1d45f24 kcmkwin: Add new keywords to KCMs for finding options more easily 2021-09-04 17:19:32 +00:00
Ismael Asensio
436011e0ec X11Client: emit isCloseableChanged when updated
This allows the decoration buttons to be updated accordingly
when the status changes.

We also need to explicitely update allowed actions when rules
are applied, as `isCloseable` is not a settable property, but
an allowed action

BUG: 424370
FIXED-IN: 5.22.90
2021-09-04 15:51:38 +02:00
Ismael Asensio
bb0f749ee7 xdgshellclient: Fix "noBorder" rule on initialization
The check for this rule was missing on window initialization,
so on Wayland it wasn't being applied until something would
trigger the check again.

BUG: 429171
FIXED-IN: 5.22.90
2021-09-04 12:47:09 +02:00
Aleix Pol
5d73adf780 Fix crash on the debug console
Do not access fields in DataSourceModel::m_data that are not available

0  0x00007f3445a4bd22 in raise () at /usr/lib/libc.so.6
1  0x00007f3445a3590e in abort () at /usr/lib/libc.so.6
2  0x00007f3446362bb1 in qt_message_fatal (message=<synthetic pointer>..., context=...) at /home/apol/devel/frameworks/qt5/qtbase/src/corelib/global/qlogging.cpp:1914
3  QMessageLogger::fatal(char const*, ...) const (this=this@entry=0x7fff288a4ff8, msg=msg@entry=0x7f3446663028 "ASSERT failure in %s: \"%s\", file %s, line %d") at /home/apol/devel/frameworks/qt5/qtbase/src/corelib/global/qlogging.cpp:893
4  0x00007f344636203e in qt_assert_x(char const*, char const*, char const*, int) (where=<optimized out>, what=<optimized out>, file=<optimized out>, line=<optimized out>) at /home/apol/devel/frameworks/qt5/qtbase/src/corelib/global/qglobal.cpp:3366
5  0x00007f344973e118 in QVector<QByteArray>::at(int) const (this=0x55f42c20d338, i=7) at /home/apol/devel/kde5/include/QtCore/qvector.h:449
6  0x00007f34497305df in KWin::DataSourceModel::data(QModelIndex const&, int) const (this=0x55f42c20d320, index=..., role=6) at /home/apol/devel/frameworks/kwin/src/debug_console.cpp:1657
7  0x00007f3447674ed1 in QModelIndex::data(int) const (arole=6, this=0x7fff288a55c0) at ../../include/QtCore/../../../../../devel/frameworks/qt5/qtbase/src/corelib/itemmodels/qabstractitemmodel.h:460
2021-09-03 18:06:50 +00:00
Columbariu s
2fbeb0abc1 screencast/pipewire: Add TODO marks for extending modifier capabilities
no_use_linear: dropping the gbm GBM_BO_USE_LINEAR flag on allocation
explicit_modifiers: moving from the modifier-less api to the modifier
aware one with explicit modifiers
2021-09-03 17:49:37 +00:00
Columbariu s
150ebf0cf7 screencast/pipewire: announce format with modifier 2021-09-03 17:49:37 +00:00
Columbariu s
8a2475da63 screencast/pipewire: Add buildFormat method 2021-09-03 17:49:37 +00:00
Columbariu s
b05900e242 screencast/pipewire: Check for a modifier in the format negotiation via pipewire 2021-09-03 17:49:37 +00:00
David Edmundson
78439fd3e7 Avoid test commit whilst constructing DrmOutput
Otherwise we'll try to render a frame on an output before making the
output, which segfaults.
2021-09-03 16:43:48 +00:00
Xaver Hugl
c48ac020cd platforms/drm: correct cursor dirty handling 2021-09-03 18:26:23 +02:00
Vlad Zahorodnii
8891cdb74f effects/overview: Remove "wip" from description
Removing (WIP) will result in more work for translators. There are other
ways to indicate the effect is not ready for its prime time yet, e.g.
being disabled by default.
2021-09-03 13:00:05 +03:00
David Redondo
1c074d81e2 Add clipboard tab to debug console
Can be useful when investigating clipboard related problems, by checking
which source KWin thinks is the current clipboard. Displays clipboard and
primary selection.
2021-09-03 08:40:07 +00:00
Vlad Zahorodnii
c0bec3e27b effects/overview: Add missing desktop filters 2021-09-03 09:40:39 +03:00
Vlad Zahorodnii
43a50be325 effects/overview: Display window icon and caption
BUG: 441312
2021-09-03 06:38:54 +00:00
Vlad Zahorodnii
79a7cf1aec effects/overview: Allow setting ExpoCell margins 2021-09-03 06:38:54 +00:00
Ismael Asensio
9995f984c3 kwinrules: Use a list of desktop UUIDs to set and store the rules setting
Port the RuleSettings and KCM to store and use a list of virtual desktop
 UUIDs, instead of the previous x11 positional id, continuing the work on
This allows to set a rule with several desktops on Wayland.

On X11 it has no visible change for the user, but internally it uses the
more modern concept, helping to simplify the related code.

The relevant key on kwinrulesrc changes from `desktop` to `desktops`.
A kconf_update script handles the migration.
2021-09-02 22:11:46 +02:00
Xaver Hugl
5da8df39a5 AbstractWaylandOutput: make updateMode use uint32_t 2021-09-02 14:34:07 +02:00
Xaver Hugl
26ad8e194f platforms/drm: support Broadcast_RGB setting
This allows the user to switch between full and limited rgb.

BUG: 375666
BUG: 353689
2021-09-02 13:53:02 +02:00
Xaver Hugl
f096629f89 platforms/drm: refactor drm property enums 2021-09-02 13:48:58 +02:00
Vlad Zahorodnii
dc39745f14 effects/overview: Remove duplicate Qt.Key_Escape 2021-09-02 09:32:59 +00:00
Vlad Zahorodnii
717fae2af5 effects/overview: Improve search user experience
If the window has only one visible window and user presses Enter key,
activate that window.
2021-09-02 09:32:59 +00:00
Vlad Zahorodnii
9bd0eb1074 effects/overview: Add search field
The present windows allows the user to search windows by their caption
or window role. This change brings that functionality to this effect.

BUG: 441302
2021-09-02 09:32:59 +00:00
David Redondo
c562a5c04f DragWlToX: Do not send position before enter
According to the spec, enter has to be send before position.
Sending position first seems to confuse clients, before this
change X windows only seemed to get data when the pointer left and
entered them for a second time. Now it works straight away.
BUG:437406
2021-09-02 11:17:53 +02:00
Janet Blackquill
0042d2d8c1 effects/desktopgrid: port to realtime gestures
This ports the Desktop Grid effect to realtime gestures,
both to have the end-user result, and to demonstrate how
effects can have realtime gestures.
2021-09-01 19:49:21 -04:00
Janet Blackquill
6231699ac1 Lay some groundwork for realtime gestures in Wayland
This lays down some groundwork for realtime gestures in Wayland,
so that gestures that are 1:1 with user motion on a touchpad are
now possible to implement.

Due to earlier commits, this is mostly just glue code to make a
convenient API.

Gestures implemented with this API are four-finger gestures, to
avoid conflicting with apps that may use two or three-finger
gestures.
2021-09-01 19:48:41 -04:00
Tatsuyuki Ishi
81389a6e17 blur: pass projection matrix by const reference
Passing QMatrix4x4 by value can result in copying a non-trivial amount (16)
of floats, so avoid that.
2021-09-01 21:42:56 +00:00
Tatsuyuki Ishi
c193efc962 blur: add noise in perceptual space
The previous implementation added noise in linear space, which resulted in
the effect becoming more pronounced on black backgrounds. This patch
changes the process to be applied in perceptual space, by making the noise
addition pass a separate draw call and disabling GL_FRAMEBUFFER_SRGB during
that.

After this change, noise will look much more suppressed and almost never
grainy. This change also changes the range of the noise from
[-strength..strength) to [0..strength), as blending can only be either
additive or subtractive. As a result, users might need to ramp up their
noise parameter after this change.

v2: Add more explanation around the draw call.
v3: Fix noise not fading out with the fade out effect.
v4: Restore an accidentally removed comment.
v5: Add CCBUG.
v6: Rebase.
v7: Fix a formatting issue.

CCBUG: 409620
2021-09-01 21:42:56 +00:00
Méven Car
0a2c511489 Wayland: Add support for protocol kde-output-device_v2, allow to detect drm mode changes
CCBUG: 407058
2021-09-01 13:37:43 +00:00
Vlad Zahorodnii
03b64331f2 wayland: Remove special input method case in XdgToplevelClient
Input method surfaces have input_panel_surface role, so the special case
for input method windows can be dropped.
2021-09-01 10:26:16 +00:00
Vlad Zahorodnii
99e208e30f wayland: Always setup window management for xdg-shell clients
kscreenlocker uses the layer-shell protocol, so the special lock screen
case can be removed.
2021-09-01 10:26:16 +00:00
Vlad Zahorodnii
1717de8a59 Port XdgToplevelClient::updateShowOnScreenEdge() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
cdd3f96fe1 Port X11Client::fullscreenMonitorsArea() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
26e470b7ff Port screenContainsPos() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
25a6515e05 Port AbstractClient::checkQuickTilingMaximizationZones() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
8b85fdcedf wayland: Setup window management integration on initial commit
Originally, there was ShellClient class that was the predecessor to
WaylandClient subclasses. If the main surface is unmapped, the
corresponding instance of ShellClient would be kept around. That had
been changed with the introduction of XdgToplevelClient and
XdgPopupClient.

Since ShellClient had been kept alive even if the corresponding surface
were unmapped, it did make sense to setup window management integration
when the surface is mapped.

However, this also means that plasma will not know about initially
minimized windows.

Since unmapped windows are handled differently now, we can setup window
management after the client performs the initial commit. If the main
surface is unmapped, the XdgToplevelClient object will be destroyed and
with it, the window management integration.
2021-08-31 23:42:07 +00:00
Carson Black
63b16cdf9d Increased edge margins 2021-09-01 01:33:51 +02:00
Aleix Pol
0b74aa62c9 Support PlasmaWindowInterface::sendToOutput 2021-08-31 21:25:18 +00:00
Xaver Hugl
a3cbaf48dc platforms/drm: fix modifier env variable
Like the name suggests, modifiers were meant to be enabled by default
2021-08-31 16:30:03 +00:00
Vlad Zahorodnii
d70cfadf96 platforms/drm: Fix outputDisabled signal
The outputDisabled() signal must be emitted **after** removing the
output from a list of enabled outputs.
2021-08-31 16:02:19 +00:00
Vlad Zahorodnii
b0c26cc424 effects/overview: Layout window thumbnails in updatePolish()
Currently, ExpoLayout delays layout updates by using a singleshot timer
(primarily due to the author of the effect not being aware of
QQuickItem::polish() and QQuickItem::updatePolish()).

This change makes ExpoLayout schedule layout updates using QtQuick's
native item polish machinery, which gets triggered before rendering and
thus we can batch more geometry updates.

In addition to that, this change simplifies the initialization code in
ScreenView by making the fact that ExpoLayout is arranged right before
rendering internal to the WindowHeap type.
2021-08-31 12:51:29 +00:00
Vlad Zahorodnii
683bf20168 Port ScreenEdges away from Screens 2021-08-31 11:17:46 +03:00
Vlad Zahorodnii
cbaf39e270 Port the remaining usages of Screens::geometry(i) in Workspace to AbstractOutput 2021-08-31 09:45:20 +03:00
Vlad Zahorodnii
9bf6e2bd68 Port Workspace::supportInformation() to AbstractOutput 2021-08-31 09:41:22 +03:00
Vlad Zahorodnii
1b2e8437ac Use precomputed workspace geometry in Workspace::initializeX11()
When initializeX11() is called, the workspace geometry is known, so it
doesn't need to be computed again.
2021-08-31 09:35:27 +03:00
Vlad Zahorodnii
e198727e15 Drop Toplevel::isOnScreen()
It's unused. Its replacement is Toplevel::isOnOutput().
2021-08-31 05:45:55 +00:00
l10n daemon script
96c6f964e6 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"
2021-08-31 01:29:11 +00:00
Xaver Hugl
85a6dc3cad platforms/drm: correct multi-gpu mistake
As all outputs from secondary GPUs are in the same map as the ones from
the primary GPU, EglMultiBackend::findBackend always returned the
primary backend. To fix that, search in secondary backends first
2021-08-30 23:00:19 +02:00
Vlad Zahorodnii
89d49b4d5d platforms/virtual: Add new outputs before removing old outputs
This is to prevent hitting the case where there are no any outputs.
Ideally, it shouldn't matter in which order outputs are added or
removed, but the Workspace and AbstractClient subclasses don't work
with true headless mode. If there are no outputs, kwin can crash.
2021-08-30 15:08:52 +00:00
Vlad Zahorodnii
f8ad513648 Unvirtualize property getters in Screens
MockScreens is gone so property getters in Screens can be regular
methods now.
2021-08-30 14:46:00 +00:00