Commit graph

239 commits

Author SHA1 Message Date
Xaver Hugl
18f1092728 scene/item: add ItemEffect
Right now it's just a helper to mark items as being affected by some effect,
to prevent direct scanout of the relevant item without needing to block direct
scanout for the whole screen
2024-08-12 12:13:31 +00:00
Xaver Hugl
de8bd8f126 plugins/fadingpopups: don't block direct scanout
The effect only modifies the opacity of individual windows that
WorkspaceScene::scanoutCandidate will reject anyways, so there's no reason
for it to block direct scanout.
Once a more proper solution for blocking direct scanout on individual items
is in place, this can be removed again

BUG: 487780
2024-07-11 16:54:25 +02:00
Aleix Pol Gonzalez
2601d06f5b Fix !KWIN_BUILD_GLOBALSHORTCUTS builds
Makes it so the GlobalShortucts object gets built and its KGlobalAccelD
parts get disabled.

Addresses the TODO in GestureHandler.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2024-06-25 11:21:56 +02:00
Vlad Zahorodnii
44ea9ee959 scripting: Add a temporary workaround to fix build without global shortcuts 2024-06-25 07:29:48 +00:00
Vlad Zahorodnii
059f66af9a scripting: Port gesture handlers to native gesture apis
If a SwipeGesture or a PinchGesture is cancelled, the associated QAction
is going to be triggered. It is against the expectations of the gesture
handlers.

In order to address that, this ports the gesture handlers to the native
gesture apis, which expose whether the gesture has been started or cancelled
better.
2024-06-25 07:29:48 +00:00
Aleix Pol Gonzalez
b202ecf711 aaaa 2024-06-10 17:32:28 +02:00
Aleix Pol Gonzalez
3c857a3375 scripting: Do not crash when calling workspace.clientArea() without an output
Just set a default one, one way less a script can crash kwin.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2024-06-10 17:23:43 +02:00
Xaver Hugl
bffae41983 remove Workspace::sendWindowToOutput
It just calls Window::sendToOutput...

BUG: 329980
2024-06-07 00:44:24 +00:00
Łukasz Patron
ce57af62ec scripting: Filter out windows with isClient=false in WindowModel
These windows render as empty boxes and opening them crashes the KWin.
Also, the same check is present in TabBox.

BUG: 486182
2024-05-29 10:45:14 +00:00
Yifan Zhu
1a4606d990 scripting/windowmodel: match screen closest to center for filter
When filtering windows by screen, match the screen closest to the window
center, instead of testing whether the window is visible on the current
screen. The new method guarantees that when filtering by screen, the
window appears for exactly one screen. Previously windows spanning
multiple screens appear on all of them, and off-screen windows are not
shown in any screen.

BUG: 480028
BUG: 485337

FIXED-IN: 6.0.4
2024-04-11 09:36:26 -07:00
David Redondo
1573d04b5a Mark windows for offsceen rendering in WindowThumbnailSource
This way if an effect wants to show such  window  that is for example
on a different virtual desktop it is updated live.
BUG:456280
FIXED-IN:6.0.4
2024-04-10 13:50:57 +00:00
Kristen McWilliam
0bfe7e150a scripting/workspace_wrapper: improve readability
Adds whitespace between documented members of the header file.

Currently the members are all bunched together, making it difficult to
read as one flows directly into the next. This change adds a newline
between each member, making it easier to read.
2024-03-10 01:17:17 +00:00
Aleix Pol
1d57c9a5af effects: Use chrono to specify the animation times
Makes both the API and its uses explicit in terms of what unit the times
are on.
2024-03-06 10:19:55 +00:00
Aleix Pol Gonzalez
bf1ce85474 Make it possible to build KWin without libxcb
Now that we have Wayland around, there's a whole branch of dependencies
that shouldn't be necessary anymore.
This allows to build KWin without all of it, allowing us to have a much
more compact alignment for cases where all the legacy software isn't
necessary anymore.

Bundle KWindowSystem X11-specific headers into it too, since it's part
of the same process.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2024-02-28 16:03:50 +00:00
Aleix Pol Gonzalez
94121c2a42 Unify the format for #include "config.h" 2024-02-28 16:03:50 +00:00
Vlad Zahorodnii
693cd16b12 effect: Drop WindowPaintData::projectionMatrix() 2024-02-27 17:47:39 +00:00
Vlad Zahorodnii
8f7f97148c plugins/desktopchangeosd: Fix previous desktop indicator
BUG: 480630
2024-02-05 17:17:20 +00:00
David Redondo
203c4998bc Make sure window thumbnails and Qt Quick resources are destroyed properly
Drops the doneCurrent as it was preventing proper cleanUp
because no context was current when textures were deleted.
Also avoid manipulating the context when Qt has the current
one, as various Qt classes have guards around their cleanup
handlers which rely on a current Qt context.
Despite the comment the order of render control and view destruction
needs to be switched as the QQuickWindow destructor calls into
the render control to notify if of window destruction.
BUG:478770
BUG:479846
FIXED-IN:6.0
2024-01-16 13:45:52 +01:00
Vlad Zahorodnii
4f8c941bff scripting: Fix a crash in useGlThumbnails() when compositing is off
BUG: 479791
2024-01-15 14:07:51 +00:00
Alexander Lohnau
7d1db53f6b Remove unneeded includes from headers and cpp files 2024-01-13 11:34:45 +01:00
Vlad Zahorodnii
f1ff706b3b scripting: Cache WindowThumbnail textures
Effects like overview can create more than one thumbnail for the same
window. For example, if you have 4 virtual desktops, the overview is
going to create 9 window thumbnails for the desktop background, which in
its turn means that each thumbnail is going to have its own texture.
That's not great.

WindowThumbnailItem.sourceSize has been dropped because it's unused and
will complicate texture caching.

CCBUG: 455780
2023-12-08 10:21:20 +00:00
Vlad Zahorodnii
1cd1047eba scripting: Don't block client until acquire fence is signaled in WindowThumbnailItem
We just need to ensure that qtquick rendering commands don't use the
window thumbnail until it's ready. The CPU can continue executing its
commands.
2023-12-07 12:29:37 +02:00
Vlad Zahorodnii
784d48ef52 Port away from deprecated KConfigBase::group() api 2023-11-28 10:02:03 +00:00
Vlad Zahorodnii
4faad8bd49 effects.h -> effecthandler.h 2023-11-20 15:47:36 +00:00
Vlad Zahorodnii
433b753360 Drop EffectWindowList
Use `QList<EffectWindow *>` instead.
2023-11-20 13:45:36 +00:00
Vlad Zahorodnii
961bd00919 Move WindowVertex,WindowQuad,RenderGeometry out of effects.h
These are core scene abstractions and don't belong in effects.h.
2023-11-20 14:05:52 +02:00
Vlad Zahorodnii
86084d118c libkwineffects/ -> effect/ 2023-11-20 11:32:43 +00:00
Vlad Zahorodnii
36021b12a7 Drop redundant "kwin" prefix in some filenames 2023-11-16 13:37:50 +00:00
Vlad Zahorodnii
15b47ce7fc Merge EffectsHandlerImpl and EffectsHandler 2023-11-15 15:21:50 +02:00
Xaver Hugl
ee146d33b9 libkwineffects: move files out to more fitting places 2023-11-14 17:03:40 +01:00
Vlad Zahorodnii
22efedc09c Rename VirtualDesktopManager::desktopCreated signal
Rename it to desktopAdded to match activityAdded, windowAdded, etc.
2023-10-26 07:21:49 +00:00
Vlad Zahorodnii
b3b2e96148 libkwineffects: Replace EffectScreen with Output 2023-10-25 15:13:14 +00:00
Vlad Zahorodnii
d7b1661e08 Merge libkwineffects into libkwin
libkwineffects was introduced when kwin used to be an executable. It
provided an api to implement effects and shielded from the technical
quirks in kwin.

Over the time, kwin internals had been split and abstractions were
refactored so they can be consumed in scripts or plugins. Besides that,
new ways to implement extensions have been introduced, which use
kwin's internal abstractions.

On the other hand, effects continue using libkwineffects specific apis.
This has a few issues: qtquick effects use both apis and it bites us,
duplicating same apis.

The best solution so far is to merge libkwineffects with libkwin, and
replace libkwineffects abstractions with libkwin abstractions, e.g.
EffectScreen -> Output, etc. This change takes care of adjusting libs.

Obviously, the main disadvantage of doing so is that binary effects
have to be recompiled every time new libkwin is released. But it's
already the case with libkwineffects too.
2023-10-25 12:46:12 +00:00
Vlad Zahorodnii
509b9e8e3f scripting: Reload SceneEffect configuration when effect is reconfigured
This ensures that the SceneEffect uses new settings when KCM changes
them.
2023-10-19 15:09:47 +00:00
Laurent Montel
bc6116c5a7 There's no QVector anymore, QList is the QVector in Qt6 2023-10-19 13:43:53 +00:00
Vlad Zahorodnii
264ebe6377 scripting: Add qml effect bindings
This allows creating third party qtquick scene effects without linking
to libkwineffects and thus rebuilding the effect every kwin release.
2023-10-18 16:03:20 +00:00
Vlad Zahorodnii
793a0e72bf scripting: Add gesture handlers 2023-10-18 16:03:20 +00:00
Marco Martin
e67847d43f Use itemChange instead of a connect to windowChanged
with itemChange watching SceneChange is more efficient than connecting
to the windowChanged signal, also this won't arrive during teardown,
aoiding the "destructor already ran" assert.
2023-10-18 14:39:58 +02:00
Alexander Lohnau
30600a064b Make X-KDE-Ordering in plugin metadata a proper int value
This makes the intention more clear and avoids unneeded string -> int conversion at runtime
2023-10-16 16:12:43 +00:00
Alexander Lohnau
43174a9771 Remove X-Plasma-MainScript from C++ codepaths 2023-10-16 16:12:43 +00:00
Fushan Wen
5fc009d64a
scripting: add isEffectActive to query effect active state 2023-09-29 18:37:48 +08:00
Vlad Zahorodnii
14ab38b596 composite.h -> compositor.h 2023-09-08 09:48:59 +03:00
Xaver Hugl
27f90476b4 libkwineffects: rename kwingl* files to gl* 2023-09-07 16:41:22 +02:00
Mike Noe
010a8a1e13 scripting: Add localized context to the shared QML engine 2023-08-23 08:42:43 -04:00
Vlad Zahorodnii
2814030fef Drop {client,window}DemandsAttentionChanged
There are no its users. Also same can be achieved by listening to
Window::demandsAttentionChanged signal.
2023-08-23 11:58:08 +00:00
Vlad Zahorodnii
ceac574a68 scripting: Rename Workspace.clientList 2023-08-23 11:30:30 +00:00
Vlad Zahorodnii
52604c5d73 scripting: Rename Workspace.{clientAdded,clientRemoved} signals 2023-08-23 11:30:30 +00:00
Vlad Zahorodnii
b39ca36d21 scripting: Rename Workspace.activeClient to activeWindow
Rename activeClient to activeWindow to make the property name more
accurate.
2023-08-23 11:30:30 +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
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