Commit graph

349 commits

Author SHA1 Message Date
Xaver Hugl
f8012f580b plugins/colorpicker: convert picked color to sRGB
The API doesn't have any colorspace data, so we need to make sure we're
sending sRGB

BUG: 387757
2023-10-14 11:55:18 +00:00
Vlad Zahorodnii
9e10394db1 Move window specific signals from EffectsHandler to EffectWindow
This makes the api of EffectWindow more similar to the api of Window. It
also makes more sense to keep such signals in EffectWindow. In the future,
the effect window can be dropped in favor of the window.
2023-10-06 07:05:37 +00:00
Niccolò Venerandi
028dd552cf Merge desktop grid and overview together with a new three-state design
Merges the desktop grid and overview effects together in a new three-state one;
you can switch between them with a certain shortcut or gesture, and you can also
still access either the desktop grid or overview directly.

Default shortcuts are also updated to be Meta+G for Grid, Meta+W for Overview,
Meta+Tab to switch between the three states and Meta+Shift+Tab to cycle in the
opposite direction.

BUG: 474044
BUG: 460661
BUG: 460774
BUG: 456572
BUG: 449601
BUG: 450262
BUG: 449801
BUG: 461510
BUG: 463886
BUG: 459754
BUG: 459749
BUG: 459748
BUG: 459467
FIXED-IN: 6.0
2023-09-25 11:14:37 +00:00
Vlad Zahorodnii
de36fe82e8 wayland: Integrate KWaylandServer classes into KWin namespace 2023-09-15 16:31:15 +03:00
Marco Martin
3a95c20279 Fix touch on PointerHandlers
The events we forward to the offscreen QML view are with our own
QPointingDevice instance, which has a devicetype of touch but a null pointerType.

In Qt5 this was enough, but pointerhandlers in qt6 refuse events with an undefined
pointertype, so we have to explicitly set it to finger

BUG:473541
2023-09-13 13:25:57 +00:00
Xaver Hugl
32ae9dd7d1 libkwineffects: rename major and minor methods
There's "major" and "minor" defines that can get implicitly included, for
example with musl libc. To prevent that from breaking compilation, rename
the methods
2023-09-09 14:44:53 +00:00
Xaver Hugl
c0e44378ca libkwineffects: move render time query check to OpenGlContext 2023-09-07 21:13:16 +02:00
Xaver Hugl
e401f3ff11 libkwineffects: drop gallium detection
It's not used anywhere
2023-09-07 21:13:16 +02:00
Xaver Hugl
6d35a27f90 libkwineffects: drop checks for GLSL and NPOT
Instead, creating contexts that miss these features should fail directly,
making KWin fall back to software rendering.
While this commit also drops workarounds for broken drivers that do software
emulation for features we need, such workarounds belong into these drivers and
the user can still manually turn off compositing if needed.
2023-09-07 21:13:16 +02:00
Xaver Hugl
0a58bd04d5 libkwineffects: don't query OpenGL extensions twice 2023-09-07 21:13:16 +02:00
Xaver Hugl
ed02051a4a libkwineffects: move x server version query to xcb utils 2023-09-07 21:13:16 +02:00
Xaver Hugl
05a389c3b3 libkwineffects: move version to string functions to the Version class 2023-09-07 21:13:16 +02:00
Xaver Hugl
a5df88b0de libkwineffects: move linux kernel version query out of GLPlatform
It has nothing to do with OpenGL
2023-09-07 21:13:15 +02:00
Xaver Hugl
e0c7878357 libkwineffects: move version into its own files 2023-09-07 21:11:11 +02:00
Xaver Hugl
5ce02c6811 libkwineffects: drop limited glsl detection
It's not actually used anywhere
2023-09-07 16:41:22 +02:00
Xaver Hugl
f2dd1b3471 libkwineffects: align variable naming to the rest of KWin 2023-09-07 16:41:22 +02:00
Xaver Hugl
27f90476b4 libkwineffects: rename kwingl* files to gl* 2023-09-07 16:41:22 +02:00
Xaver Hugl
e9d3d228bb libkwineffects/kwinglutils: always enable error message printing
It makes no sense to lock that behind an env var. If there's errors those
should always be printed so that we know about them without further investigation
2023-09-05 13:23:36 +00:00
Xaver Hugl
69187e86ab libkwineffects/glvertexbuffer: remove color handling
It's a remnant of OpenGL 1 times. If some piece of code wants a specific
color, it should set the uniform of the used shader itself
2023-09-05 13:23:36 +00:00
Xaver Hugl
43cbd2834c libkwineffects/glvertexbuffer: don't crash if mapping fails 2023-09-05 13:23:36 +00:00
Xaver Hugl
ab3e517d8a libkwineffects/glvertexbuffer: simplify setAttribLayout 2023-09-05 13:23:36 +00:00
Xaver Hugl
617f3b9000 libkwineffects/glvertexbuffer: add a better helper for uploading vertices 2023-09-05 13:23:36 +00:00
Xaver Hugl
cbe8d21f07 libkwineffects: split kwinglutils into multiple files
A single 2000+ line file isn't great to work with
2023-09-05 13:23:36 +00:00
Xaver Hugl
43b9dc7eee libkwineffects/kwinglutils: use std::bitset instead of a custom implementation 2023-09-05 13:23:36 +00:00
Xaver Hugl
e5f9e54944 libkwineffects/kwinglutils: simplify index buffer implementation 2023-09-05 13:23:36 +00:00
Xaver Hugl
02b996cf9c platformsupport/scenes/opengl: add opengl render query class 2023-08-23 10:51:19 +00:00
Vlad Zahorodnii
36960d8572 plugins/blur: Rewrite it
Given how the blur effect works, if a pixel changes, the surrounding
pixels may have to be repainted as well. Currently, it's achieved by
expanding the damage in the BlurEffect::prePaintWindow() function.
However, it means that the blur effect should see both surface and
buffer damage in the pre paint pass.

Unfortunately, after refactoring surface and buffer damage tracking,
kwin no longer provides the buffer damage in the pre paint pass (it does
so for good reasons). This broke the blur effect. As an example, you may
see visual glitches when moving the software cursor over blurred areas
of a window.

In order to fix this issue, the blur effect has to cache background
behind every window to avoid blurring already blurred areas.

This change implements a background cache. Unfortunately, since the
blur effect's code has become very difficult to change over the years,
this change rewrites the relevant parts of the blur effect.

With the proposed design, the blur effect is going to maintain cached
background for every window + offscreen render targets. It may have
issues with animated windows, however in practice, it seems to behave
good enough. However, if it becomes pressing matter, we can move from
simplistic design in this patch to somewhat more sophisticated design
that involves textures with rounded up size.

BUG: 455526
2023-08-18 13:08:48 +00:00
Xaver Hugl
74f10d0cdf port most uses of the reset(new ...) pattern to std::make_unique 2023-08-11 15:58:15 +02:00
Vlad Zahorodnii
9911b6b54c libkwineffects: Add support for depth/stencil attachments
It's needed so we can allocate fbos suitable for qtquick.
2023-08-07 13:17:18 +00:00
Xaver Hugl
53c2b8c68b port most remaining uses of EGLDisplay and EGLContext to their wrappers 2023-07-29 22:07:46 +00:00
Laurent Montel
8c51619c1e Remove extra ; 2023-07-18 11:51:09 +00:00
Laurent Montel
b823747c3b Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
2023-07-15 08:40:49 +00:00
Aleix Pol Gonzalez
49a76ea772 Install KWaylandServer headers
There are use cases for the headers to be used, e.g. when implementing
wayland-specific workflows from an Effect.
In order to be able to use these, we also need to expose libkwin to be
imported as it carries the interfaces' symbols.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2023-07-04 08:22:43 +00:00
David Edmundson
ced95f536c Adapt offscreenquickview to Qt6 changes
Qt6 documentation states:

"Note: When using this window in combination with QQuickRenderControl,
the result of this function is an empty image, unless the software
backend is in use. "

We support a mode of using openGL rendering but then exporting as pixmap
images for Aurorae. In this case we should simply grab data from our
FBO.

BUG: 471041
2023-07-01 12:47:32 +01:00
Laurent Montel
c7ccf91d92 We use Qt6/kf6 only 2023-06-27 04:45:01 +00:00
Xaver Hugl
d8e57f7886 backends/drm: improve multi gpu performance with NVidia as secondary GPU
With the Nvidia driver, linear textures are external_only, so additional
measures need to be taken to make the egl import path work

CCBUG: 452219
2023-06-20 09:59:42 +02:00
David Edmundson
c5a29b4b66 effects: Make OpenGL context current before deleting framebuffer
When we delete a window we unredirect, when we unredirect, we delete the
framebuffer which requires an openGL context.

handleWindowDeleted is the entry point from workspace events to effects
code, so it's made current here.

BUG: 444665
BUG: 471139
2023-06-17 13:12:30 +00:00
Vlad Zahorodnii
a43ffb8182 Advance window animations in prePaintWindow()
This will ensure that the window animation is advanced only if the
window is painted. I'd like to rely on this to allow effects schedule
animations as soon as Workspace::windowAdded signal is emitted.

As is, the issue with delaying EffectsHandler::windowAdded is that we
don't filter out all "not ready" windows, which breaks some effects
because EffectWindows are leaked in some properties but no
EffectsHandler::windowRemoved signal is emitted so those effects can
perform cleanup. Fixing that by the means of ensuring that only renderable
EffectWindows are exposed is hard too, and it would also mean that
effects need to use their own api, which I would like to avoid and port
the effects to kwin core apis instead.
2023-06-16 06:41:12 +00:00
Xaver Hugl
debe76733c libkwineffects/kwinglutils: handle alpha better with colormanagement
Alpha from clients is encoded in electrical values, and some of our code also relies
on compositing results being encoded in electrical values. To take care of this, we
need to undo the premultiplication of rgb values, convert to or from linear, and then
re-do the premultiplication. This doesn't result in exactly the same blending behavior
with linear blending, but it's close enough
2023-06-14 13:23:43 +00:00
Vlad Zahorodnii
b9da04bf45 libkwineffects: Make OffscreenEffect render window with its output's scale
Render the window at its output's scale to make the window less blurry.

BUG: 470607
2023-06-12 16:09:51 +00:00
Vlad Zahorodnii
eea8200479 scene: Don't hide closed windows
If a closed window is kept alive, it means that somebody needs to
animate it and therefore it should be visible. Otherwise the window
would be destroyed and its item would be removed from the scene.

This change makes the WindowItem not change its visibility if the
associated window is closed. If the window had been invisible before
it was closed, the item would be invisible; if the window had been
visible before it was closed, the item would be visible.
2023-06-06 14:13:57 +00:00
Vlad Zahorodnii
d22cc67df9 libkwineffects: Drop EffectsHandler::windowGeometryShapeChanged
It's very X11-specific and it's unused.
2023-06-02 07:41:10 +00:00
Vlad Zahorodnii
a7f41f26bb Make show desktop mode hide windows
After porting the desktop background window to the layer-shell protocol,
the desktop window is not raised up in the stack anymore when the
showing desktop window is activated. The main reason to avoid this is to
avoid fighting and overriding layer shell logic.

As another way to implement the show desktop mode, this change makes the
workspace hide windows that don't belong to desktop.

It's a better solution for a couple of reasons: "keep above" and other
overlay windows will be properly hidden and it lets us avoid touching
the stacking order.

BUG: 387593
BUG: 406101
BUG: 469827
2023-06-01 08:59:51 +00:00
Xaver Hugl
242fce56b6 libkwineffects/kwinglutils: replace random eotf integers with named constants 2023-05-29 08:26:35 +00:00
Xaver Hugl
6272d1d9f3 libkwineffects/kwinglutils: fix saturation calculation with wide color gamut and document it 2023-05-29 08:26:35 +00:00
Xaver Hugl
84ce4751d9 libkwineffects/kwinglutils: replace output string with a temporary variable
Dragging the output string through the whole shader is annoying. The use
of a temporary variable makes the shader code more readable
2023-05-29 08:26:35 +00:00
Xaver Hugl
4cb4be2e64 libkwineffects/kwingltexture: clarify ownership and remove immutability 2023-05-25 19:21:26 +02:00
Xaver Hugl
20b4f26045 libkwineffects: simplify gltexture
Instead of using custom private classes for taking care of backend specific
stuff, store that directly in the GLTexture subclasses
2023-05-25 19:16:02 +02:00
Xaver Hugl
16fb2848ed libkwineffects: handle GLTexture upload failures
This is required for properly dealing with GPU resets
2023-05-25 19:13:52 +02:00
Xaver Hugl
572bc75de4 libkwineffects: handle GLTexture allocation failures
This is required for properly dealing with GPU resets
2023-05-25 18:46:45 +02:00