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.
When the xwayland connection gets destroyed, it doesn't get deleted immediately. If the
xwayland scale changes in between WaylandServer::destroyXWaylandConnection and the actual
destruction of the connection, KWin would crash
Instead of an external service (like KScreen) storing and restoring output configurations,
with this commit KWin takes over that responsibility. This allows it to, among other things,
generate appropriate configs for new sets of outputs immediately, and take KWin-internal information
about outputs into account when generating them.
CCBUG: 474021
CCBUG: 469653
CCBUG: 466342
CCBUG: 470863
CCBUG: 466556
BUG: 466208
BUG: 455082
BUG: 457430
This is a companion to
c01b583e53
that enables the above functionality on Wayland. For Xorg, the
functionality is implemented in plasma-desktop in the above commit.
This is useful for the few cases where wheel events are not for
scrolling. For example adjusting the volume in the tray.
In this case having the metadata that the delta is backwards is
important. From a kwin POV it's just proxying the libinput
isNaturalScroll setting to clients.
Tested against "qtbase/examples/widgets/widgets/mousebuttons" with
modified Qt and changing the setting in the UI.
Not mergable until upstream lands.
Relevant link:
https://gitlab.freedesktop.org/whot/wayland/-/merge_requests/1 /
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/183
CCBUG: 442789
With value semantics, the destructor can be called more often than actually
desired, so this commit ports the DrmEglLayerSurface to use unique pointers to
store surface data instead
In order to destroy resources from a context on the secondary GPU, that
context needs to be current. We also want to destroy the context once it's
no longer used, if the GPU is unplugged etc, so this commit uses shared
and weak pointers to manage the lifetime of the contexts
When some displays go to sleep, that can be wrongly detected as a temporary
hotunplug by the driver. In order to not wrongly wake up the system with
such a display, detect that scenario and set the 'new' output to dpms off
again.
BUG: 452553
BUG: 379474
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
The test fails sometimes with "Tried to add event to destroyed queue".
It does so because the event queue is not destroyed last. See also
33827bbdbe for more details.
With the current vision for how output backends work, the compositor
should take up more responsibilities. There are a few good reasons: some
things just don't make sense to be in backends, to allow sharing code
across backends easier, etc. On the other hand, we have X11, with its
own ways of doing things which are not always compatible with what we
want to do on Wayland.
The goal of this patch is to start splitting the compositor into
platform specific counterparts, with potentially moving X11 compositing
in kwin_x11. The main benefit of this is that we will be able to
push forward with wayland things more freely. Ideally it would be great
if we could make kwin_x11 have its own low level compositing code paths
that are nicely encapsulated in that executable and don't leak into
libkwin abstractions.
The biggest drawback of this approach is that there is going to be some
code duplication between x11 and wayland compositing code paths. But I
expect it to be the case only for a short term until we start landing
more abstractions in kwin_wayland, e.g. render devices, proper output
layer support, etc.
According to 4b686a204250b4416fce79fa55b8a89c5193de38 in kde-workspace,
the support for private colormaps was mainly useful to 8bit displays,
which are relic of time now.
At the moment, the wayland compositor has to handle the case of having
no workspace. This should be unnecessary and it creates a pesky cycling
dependency between Workspace and Compositor.
Given that the Workspace acts more like a container and kwin starts
accepting client connections after starting compositing, it's possible
to create the Workspace earlier and simplify the start() function a bit.
The main motivation behind this change is to encapsulate X11 compositor
implementation to the point that it can be moved from libkwin to
kwin_x11.
There are two options: either get rid of suspend and resume requests, or
add suspend and resume virtual functions in the Compositor. The apps
must definitely not rely on the dbus api, they must use the X11 api.
Compositing suspension api works only on X11 and it's quite obscure,
it's not used by any other KDE component.
So this patch goes for the most simplest option: dropping the requests.
The Shadow no longer owns the texture, so it can be loaded while
compositing is off.
This changes removes the compositing status check to simplify code.
This allows checking if the given override redirect is the composite
overlay window without resorting to platform specific implementation of
Compositor.
Currently, the Workspace is responsible for rerouting
X11Window::blockingCompositingChanged to
X11Compositor::updateClientCompositingBlocking(). It has a few issues:
if the client is initially blocking compositing, it's not going to work
as expected. The second issue is that it creates a coupling between
platform specific compositor implementation and generic Workspace. It's
a blocker for moving X11Compositor to kwin_x11 executable, etc.
implicit sync doesn't work properly with glFlush + KMS and llvmpipe doesn't support
EGL_ANDROID_native_fence_sync either, so we need to wait for rendering to complete
in a blocking fashion.
If somebody else claims the compositing selection, we definitely do not
want to stop compositing. It will also help with encapsulating
X11-specific code and splitting it out in the future.
Config loading is split in two groups: loading compositing config and
loading the rest. They are loaded separately at different times. Some
options are loaded in the Options constructor, some are loaded when compositing
starts, some are loaded when the Workspace is created. It's not easy to
keep track of what loads what and when.
This change simplifies option handling by loading all options in bulk
and decouples Options from OutputBackend and GLPlatform to ensure that
it can safely load options before kwin is fully operational.
Before 885e9acb6e
Application::processStartupEnvironment() returned
QProcessEnvironment::systemEnvironment() which means the current
environment of KWin when this function was called. By setting
InheritFromParent we can replicate this behavior.
This fixes KWin starting processes on X11.
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
If a transaction entry is removed, the graphics buffer reference will
be dropped and it's possible that the TransactionDmaBufLocker is going
to be destroyed as well.
If that happens, the transaction may remain in the locked state.
At the moment transactions from the same client are applied in the
commit order even if the trasactions affect unrelated surfaces.
This patch desynchronizes transactions affecting unrelated surfaces.
With this, if a client updates two surfaces (as an example, Firefox with
two windows) and one of its surfaces takes longer to render, the other
surface is not going to be slowed down.
Another nice thing is that it removes client from Transaction, which
might be potentially useful to the Workspace for coordinated resize or
something.
This makes unconstraining code more reusable (in case of applet popups
use xdg-positioner too), and in general, it makes sense for better
encapsulation.
Transactions provide a way to apply new surface state to multiple
surfaces atomically.
A transaction can be locked. In which case, it's not going to be applied
until all locks are dropped. For example, this can be used to delay
applying new surface state until the committed buffers become idle.
After introducing SurfaceExtension, SurfaceRole has lost its commit()
function. It serves informative purpose now only.
Shell surface implementations don't have to inherit from SurfaceRole.
By making SurfaceRole act more like a value type, it's possible to fix
role handling in wl_pointer.set_cursor.
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
Since there is now exist the signal right before maximize, use it to
set oldGeometry instead of storing previous values every time with
windowFrameGeometryChanged.
This fixes the effect under Wayland.
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.
This commit also drops most of the code around checks for direct rendering. If
direct rendering isn't supported, creating the OpenGL context will now simply fail,
achieving the same effect
In certain cases it can be useful to delay applying a surface commit. As
an example, the compositor may wait until the committed graphics buffer
is ready for reading to avoid stalling its graphics pipeline.
This change introduces basic surface state locking capabilities and
ports some surface extensions to new helpers to manage associated state.
Currently, committed fields are contiguously accumulated. With this, it
will be possible to see what fields have been committed when the
committed() signal is emitted.
It would be nice if xdg-surface and xdg-surface role state are in a
single object so it's easier to stash them. This change refactors
xdg-shell handling to allow that.
xdg-surface state now belongs to xdg-toplevel or xdg-popup state.
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
Avoids accidentally triggering an edge when dragging a scroll bar or
text selection all the way to the screen edge.
Special case for moving windows, as you want to be able to drag
a window to an edge to switch virtual desktops.
Compositor::scheduleRepaint() needs some knowledge of the composited
layers, which would be great to get rid of to split wayland and x11
compositing bits.
Display the window caption and class name (safe for the icon) like is done
with the windows themselves.
Eases debugging properties, such as "transientFor".
Otherwise, when using Alt as modifier for moving windows, the tabbox window
cannot be clicked because Alt is held down during Alt+Tab, which would try
to initiate a window move but the window isn't actually movable, so ends up
doing nothing.
It also allows to interact with Plasma popups, which are also immovable,
while the modified key is pressed.
Currently when we move the mouse the one render loop triggers a repaint.
When the cursor layer needs a new update we end up in the compositor
repainting the main content.
Even though painting should mostly no-op it still goes through all
existing items and effects to collect damage, still potentially making
the GL context current which could stall. A waste when we know we
haven't got anything to do. It's enough to cause noticable mouse lag on
some hardware.
Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
It never belonged in the OutputBackend, but we also didn't have a better
place when the relevant code had been added.
With the introduction of graphics buffer allocators, it's no longer the
case.
Some wheels might send fewer or more than 120 fractions per step.
In order to always register a discrete step, we count these as a step
already at half(120/2) of one mouse wheel step in stepping mode.
The timer resets the initial value of the step because the mouse
can switch between free spin and stepping mode.
When transitioning from free spin to stepping mode,
the mouse calibrates its wheel position to the starting point
and generates some fractions.
As a result, our starting position can appear far from the zero point,
potentially causing us to count two(or zero) steps instead of one.
Additionally, the compositor might start when the mouse is in
free spin mode(or the mouse could be connected in free spin mode),
leading to the same issue.
https://gitlab.freedesktop.org/libinput/libinput/-/issues/814
At the moment, popups are assigned to the current desktop and activity.
However, a toplevel can be on several virtual desktops. If user switches
between virtual desktops and the active window does not change, it can
result in not being able to dismiss or open new popups depending on the
toolkit implementation details.
To prevent that, keep popups on same virtual desktops as their parents.
BUG: 398628
Removes the dependency on Plasma Framework from the KCMs.
This won't use the current Plasma theme but always the default one.
However, the monitor graphic hasn't really been used anywhere else
anymore (it used to be in e.g. the wallpaper settings in Plasma 4),
so I think this is alright.
The buffer transform specifies a transform from the buffer coordinate
space to the surface coordinate space.
The inverse buffer transform specifies a transform from the surface
coordinate space to the buffer coordinate space.
OutputTransform::map(QRect, QSizeF) expects both arguments to be in the
same coordinate space.
In case of SurfaceInterfacePrivate::computeSourceBox(), both should be
scaled surface coordinates so bufferTransform.inverted() maps the source
rect to the proper buffer coordinate space.
Ensures that e.g. context menus move about with their parents when they
get moved around.
However, as per spec don't re-constrain the window when its positioner
is non-reactive. This change calculates the offset from its parent window
once initially and places the window relative to that whenever the parent
moves.
Only when the positioner is reactive, will it recalculate the placement fully.
BUG: 461994
XdgPopupWindow disregards it for the most part anyway and asks workspace
for the placement area directly. Also gives XdgPopupWindow more control
on the placement when it's all contained inside of it for the upcoming commit.
Selection acts as an abstraction around multiple X11Sources, when we get
a new source we asyncronously emit that x11OffersChanged when it
completes.
If the selection is lost, we were just deleting the source, without
notifying other parts.
XwlDataSource is the datasource that SeatInterface knows about. We need
to delete this when the X11 connection is no longer valid. SeatInterface
will update the selection when the XwmlDataSource is deleted if it's the
active selection.
The hook is introduced as updating the selection in Clipboard will cause
Selection to delete m_xSource which gets messy.
BUG: 449909
The preview item implements hover event filters, which by default
are accepted and not propagated to their parent, breaking the
hightlight on hover for the GridView.
We can simply "ignore()" those events so they are propagated,
but still fully functional.
Preemptively, do the same also for mouse events, which seem to be
already propagated now, but shouldn't according to the QQuickItem
documentation.
CCBUG: 473011
While not common a client can have bound the global multiple times
and create window objects through all of them. In this case the event
send to the client would carry the wrong object since only the clients
of the two resources were checked for equality.
We can save the resource of the window managment the window
belongs to by extending the resource and storing it there.
Sending the initialState has been moved out of resource_bind since
it happens directly after allocate() and there being no opportunity
to set the custom wmResource field in between.
Instead of hardcoding ARGB8888 and using implicit modifiers, look through
the list of available formats and modifiers and pick a match that egl will
actually accept.
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
At the moment, the blur effect operates in two modes:
- generic where the blur effect samples from pixels outside the window
- and a more strict version where the blur effect only blurs what's
behind the window
The latter mode is preferred for panels and its popup. However, it also
makes sense to enable this mode for normal windows too. This simplifies
the blur effect a bit.
modifiersRelevantForTabBox handles modifiers being consumed, which is wrong for the
tabbox; all it needs is to ignore capslock. To ensure that happens, this commit adds
a separate method for modifiers relevant for the tabbox.
BUG: 473099
Specification for data control states:
"The first selection event is sent upon binding the
wlr_data_control_device object."
This differs to other data devices.
CCBUG: 459389
The show_window_menu request is in surface-local coordinates,
which include any client-side window shadows.
Translate the menu coordinates so the window shows up in the
right spot.
At commit time, the newest commit that's ready will be chosen, ensuring that
cursor updates added just before commit time can't delay the primary plane
update unnecessarily
This change adds support for xdg_wm_base v6, which introduces
xdg_toplevel suspended state.
The suspended state is tied to the visibility of the window item so the
effects could possibily "resume" window content updates.
`Placements::placeSmart` searches for an optimal position for windows, attempting to minimize overlap. The core of this algorithm tracks the
client's height and width in `ch` and `cw`, which have been adjusted by -1. This simplifies logic determining the bottom and right points of a
window when you are starting at the top and left points.
However, this decision requires adjusting that number by +1 when doing the opposite: determining the top and left points when you start with
the bottom and right points.
placeSmart cycles through window locations, searching for acceptable nooks and crannies to fit a window in, nicely. It begins by checking
for places to put the top left corner of the window which abut another constraint. If that fails, it then tries to place the bottom right
abutting a constraining feature.
After finding a suitable bottom (or right) location, the top (or left) location must be determined, requiring the -1 adjustment to be undone.
This patch adds that +1 back in.
# The bug it solves
This error can be seen by opening a bunch of windows that are placed using the "Minimal Overlapping" rule. The open space on the screen will be tiled from left to right, and then top to bottom in the windows. Once no more windows can be placed like that, the next window will be placed at the extreme bottom-right corner. However, it will be one pixel too low and one pixel too far to the right---if you try to move the window, it will "snap" to the correct spot.
This single pixel may seem minor or even irrelevant, but when you use the "Present Windows" desktop effect on a multiple-monitor setup, this one pixel will cause the window to show up on both monitors.
Otherwise we will still react on a frameGeometryChanged signal
and try to relayout the popup when its transient parent was
already set to null leading to a crash.
BUG: 472532
There is a chance that DrmGpu::pageFlipHandler gets executed on the main
thread while drmModeAtomicCommit hasn't returned yet on the commit thread.
When this situation happens, the destructor of DrmAtomicCommit doesn't set
the buffers to be current for the relevant drm planes, and once it gets
deleted, the framebuffers get destroyed and the output turns off.
To prevent that from happening, this commit moves the relevant code to a
method that gets explicitly called from the pageflip handler.
In v5, the xdg_toplevel.wm_capabilities event had been introduced which
specifies a list of actions allowed by the compositors. Mainly useful to
client-side decorated apps.
Use the linear filter to ensure that the cursor doesn't look blocky with
some scale factors and use the clamp-to-edge wrap mode to avoid
potential artifacts when the image is scaled.
This reverts commit fd04fe04c0.
This change wasn't technically wrong, but presents an awkward developer
API until the point where we can port *all* PlasmaComponents to their
upstream QQC2 versions, and as such, it was premature.
Basically:
- PlasmaExtras.Heading -> Kirigami.Heading
- PlasmaComponents3.Label -> QQC2.label
We can do this because these components only existed in the past to use
special Plasma colors, but no visual styling. And the color stuff is
obsolete because Kirigami colors work correctly in Plasma now.
Everything was tested with a dark Plasma theme and a light color scheme
to ensure no regressions.
At the moment, the SurfaceItem needs to track individual properties that
may contribute to the buffer source box. That's error prone.
To fix that, this change makes the SurfaceInterface indicate when the
source box has changed and the SurfaceItem should sync its source box,
discard quads, etc.
Pending buffers for drm planes and crtcs are no longer tracked in the planes
and crtcs themselves, but instead in a DrmCommit object that is used as
the user data for the pageflip handler. This way multiple commits can be
pending at the same time without causing conflicts, and the handling of
pending buffers is simplified as well.
With color management, the main framebuffer has values over 1. As the effect used GL_RGBA8 for its
fbos, all values in them got clamped to 1, making the result look much darker than it should be. To
fix that, this commit changes it to use the same format as the main framebuffer, ensuring that the
range of values that can be stored is the same
This separate thread submits commits as late as possible, so that until
immediately before vblank the cursor position can still be updated, reducing
its latency and opening the door for more optimizations.
Vscode starts with a valid source rect but it resets it eventually by
calling wp_viewport.set_source(-1, -1, -1, -1).
On the other hand, `current.viewport.sourceGeometryIsSet` would be true
if that happens.
SurfaceInterface::bufferSourceBox() should use the buffer size when the
source rect has been unset otherwise the damage handling code will be
confused and it's likely that the scene won't issue repaint requests.
At the moment, graphics buffers coming from wayland and internal windows
use different code paths to update textures. However, they don't have
to.
If the internal windows are ported to GraphicsBuffer, it will be
possible to unify SurfacePixmapInternal and SurfacePixmapWayland to make
pixmap logic a bit simpler.
The buffer source box is synchronized when the surface-to-buffer matrix
changes. However, when using 100% scaling, it's likely that the
surface-to-buffer matrix will be identity and therefore no corresponding
signal to indicate the change will be emitted.
To fix that, we need to update the buffer source box also when the
buffer size changes.
In some cases, it's desired to know what the inverse transform of a
given output transform is. It's possible to make it work by providing
helper functions, but we tend to avoid doing so.
This change converts the OutputTransform from an enum to a class so it's
possible to have both data + methods in the same type. Unfortunately,
unlike Rust, C++ provides no way to attach methods to enums, classes and
structs is the only way to go.
Being in the KWin namespace has a couple of advantages: the enum can be
forward declared, and the transform can be replaced with a slightly more
complex but useful type.
If the surface item's contents is scaled, i.e. its scale factor doesn't
match the output's scale, GL_LINEAR will be applied to smooth the
contents. The unfortunate thing is that it's possible some of the
changed pixels will bleed to the neighbor ones.
In order to handle that scenario better, this change makes the
SurfaceItem expand the damage if there's scale factor mismatch.
bufferSourceBox and bufferTransform properties were introduced to detect
if the surface contents is going to be scaled. bufferSourceBox covers
both crop transform from wp_viewport and scale factor from wl_surface.
bufferTransform is same as wl_surface's buffer transform property.
The bufferSourceBox provides a way to get the source region of the
attached buffer. It can be used to compute the effective scale factor
when using wp_viewport.
We want the platform cursor to have roughly the same lifespan as the
application.
By using QObject parent mechanism, this gets deleted after the
Application destructor in the QObject destructor.
This causes an issue that removing an event filter (used by the X11
cursor) calls into the application singleton which is no longer valid.
BUG: 465970
We only have one KWin script making use of this and that one is shown
regardless. The issue with this flag is that it will hide scripts from
the user without a possibility to see them.
For effects, we have quite a few internal ones and a possibility to show
even hidden ones. But we can not reuse this logic for the scripts.
BUG: 458572
FIXED-IN: 6.0
if usb device is the primaryGpu, the device unplug kwin_wayland exit
` } else if (device->action() == QStringLiteral("remove")) {
DrmGpu *gpu = findGpu(device->devNum());
if (gpu) {
if (primaryGpu() == gpu) {
qCCritical(KWIN_DRM) << "Primary gpu has been removed! Quitting...";
QCoreApplication::exit(1);
return;
} else {
gpu->setRemoved();
updateOutputs();
}
}`
With simpledrm, only linear modifiers are supported, but with llvmpipe, only
implicit modifiers are supported. As it's still possible to allocate linear
buffers without modififer support by using GBM_BO_USE_LINEAR, this commit fixes
that problem by adding linear modififers to the supported list.
* 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
When streaming direct scan out we take the layers texture directly.
When setting the contentTransform we discard the mirrorY transform that
we know is set on DMA bufs. This results in recording being upside-down.
NVidia GPUs can't render to linear buffers, so we can't force a linear modifier
for CPU rendering. The proprietary NVidia driver also can't map gbm buffers
with all formats and modifiers, so instead of mapping the gbm buffer, this
patch changes KWin to instead use glReadPixels for accessing the source
buffer
The main reasoning behind double buffering was to avoid InternalWindow's
copy of m_frontBuffer detaching. But it already detaches when the qpa
calls blitImage(). So remove double buffering to simplify the backing
store.
While the GLFramebuffer::blitFromRenderTarget helper un-applies the transformations
the rendertarget has, the effect is not written with that in mind. In order to keep
it working properly, blit without any transformations and only adjust the coordinate
system difference between texture and fbo
Previously, we showed the window switcher even if there was only one
window, or no windows.
Now, we show the window switcher only if there are two or more windows.
Note that "desktop" counts as a window when the switcher's "show desktop
mode" is enabled.
BUG: 370396
BUG: 419408
Previously, we always added the desktop to the client list when the list
was empty. We added it even if the switcher's "show desktop mode" was
disabled.
Now, we only add the desktop to the client list if the switcher's "show
desktop mode" is enabled.
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>
Frame extents are written out over the wire they should be in X11 native
pixels.
i.e if we are using 200% scaling, and have X11 clients scale themselves
then from the point of view of the client reading the properties the
window decorations are twice the size as normal.
BUG: 471132
ScreencastStream is a C++ class, but we're having C style event handling
as static functions within the class. Mixing two styles within a class
isn't very clear.
We can turn them into normal methods with some thin wrapper functions
round the event handling.
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
The event spy is removed when xwayland closed, but it's based on the
process not the wayland socket, so it can be temporarily out of sync.
There were no guards for the connection being null.
BUG: 471789
glCopyTexSubImage2D is super slow on Intel GPUs on wayland.
We have an existing method to read from the framebuffer that is used in
the blur and other effects.
Rather than creating a scratch framebuffer every frame we keep a cache
per window for the lifespan of the effect.
BUG: 469151
qPrintable creates temporary objects that are destroyed before
`xkb_keymap_new_from_names` is called. It's highly likely that the data
we pass to xkbcommon will be overwritten by random data by that point.
Fix that by storing values as QByteArrays just like
`Xkb::loadKeymapFromConfig` does.
Static plugins being linked with shared libraries doesn't work smoothly.
POSITION_INDEPENDENT_CODE target property needs to be set for
every such plugin. However, there can be targets that we have no control
over, which need POSITION_INDEPENDENT_CODE to be set too. Asking such
projects to add this property and them refusing to do so would be
reasonable because kwin's entire static plugin pipeline is weird.
The test framework was made a shared library because kwin build
directory used to get really big (in 10s of gigabytes).
Due to the -fPIC issues, this change makes the test framework a static
lib again. Obviously, this brings back the big build directory problem.
But, it's not as terrible as it used to be. With this change, kwin build
directory is a couple of gigabytes in debug build, which is a lot but
not as bad as it used to be before.
Window captions have a suffix for disambiguation, based on window
captions of other mapped windows.
In xdgshell we update this when a caption changes, but this could be
before a window is mapped. This can lead to two windows at once having
the same suffix, as a suffix could be used but not in the list of
searched clients.
BUG: 450369
Outputs get disabled before they get destroyed, so destroying the window
when the output gets disabled and when it gets destroyed causes the window
to be destroyed twice and run into an assert
The InputConfig was introduced to handle tests that don't have valid
kwinApp object. Those tests have been either reworked or dropped, so
let's drop the InputConfig to tidy the config stuff.
Interactions with KScreen cause settings to be reset to the default when the lid
gets closed, so handling lid closing in KWin needs to wait until KScreen no longer
writes configs
BUG: 471282
This allows us to avoid losing precision when updating surface pixmaps.
Surface damage needs special handling either way.
Another advantage from switching to buffer damage is that it lets us to
decouple surface textures from surface items, which is useful for making
surface helpers more reusable.
Because the kcm list has to be maintained manually, it's prone to get
outdated and incomplete (it already is!). On the other hand, "configure
window manager" is somewhat redundant as same kcms can be opened in
system settings.
If a gbm_bo is allocated with GBM_BO_USE_WRITE, it will be backed by a
dumb buffer under the hood. However, it seems like neither gbm_bo_get_fd()
nor gbm_bo_get_plane_fd() would return valid file descriptors, which are
required to fill in DmaBufAttributes.
As an interim solution, this change makes the GbmGraphicsBufferAllocator
allocate dumb buffers on its own rather than delegate it to gbm.
The egl import mode ensures that there's a local buffer, which is
preferred as it minimizes the number of data transfers over PCIe.
With dmabuf, it's unclear what the driver will do. But the main takeaway
from discussion with mesa developers is that it's undesired for
gbm_bo_import() to migrate or perform data transfers behind the user's
back, it should be done explicitly.
This change ports the drm backend to the GraphicsBuffer and
GraphicsBufferAllocator.
The main motivation is to unify graphics buffer abstractions across
various backends and to prepare it for output layers, which could be
nicer if we could have direct control over the buffers.
GEM handles are not reference counted and are unique per drm file
descriptor.
With the upcoming changes, dmabuf and dumb buffers will be abstraced
using DmaBufAttributes.
The issue with it is that we need GEM handles to get a drm framebuffer.
drmPrimeFDToHandle() can be used to get the GEM handle for a drm file
descriptor, but we would hit the reference counting issues then and
potentially double close GEM handles.
In order to resolve that, this change makes the drm backend reopen the
drm node to get a new GEM handle namespace for rendering.
The drm backend needs to allocate both dmabuf and dumb buffers, for
example for multi-gpu import.
Allowing GbmGraphicsBufferAllocator to allocate dumb buffers allows us
to avoid using several buffer allocators in the drm backend.
The software flag indicates whether the graphics buffer allocator needs
to allocate a buffer suitable for software rendering. Its intended usage
is to allow the gbm allocator to allocate both dmabuf and dumb buffers.