Currently, if the screen edge is blocked and the cursor is inside its
approach geometry, kwin is going to paint screen edge glow.
It doesn't look good and it can have some performance penalties with
fullscreen video games because the direct scanout path will be blocked.
BUG: 454503
At the moment, dmabuf importing is scattered all over the place in kwin.
It would be great if we had one function that takes dma-buf attributes
and returns an EGLImage if successful.
As the first step, make linux-dmabuf-v1 implementation provide dmabuf
attrs compatible with KWin::DmaBufAttributes.
QSize() will construct an invalid size. An invalid size has width and
height set to -1. In other words, QSize() != QSize(0, 0). This can create
issues when computing the bounding rect of a surface that has invisible
subsurfaces.
For example, if the subsurface rect is QRect(0,0 -1x-1), the top-left
corner of the bounding rect will be affected.
In order to make computation of the bounding rect robust, initialize the
surface size to 0 explicitly.
BUG: 454535
Originally, DeformEffect was meant to be used in effect that deform
windows, but its usage has become wider than anticipated. This change
renames the DeformEffect to OffscreenEffect to accommodate for that.
In Gtk's text-input-v3 implementation it expect done to update the
client serial after every commit. Though it is unclear whether this is a
protocol requirements, do the same thing like mutter for more
compatiblity, especially Gtk3 is in EOL not likely to be patched any
time soon.
To do so, we will need to keep track of the last active preedit,
otherwise only send_done() will clear the preedit.
Behaviour was fixed in c3f5f8ce01. If an
item starts at 0,0 and is 100 pixels wide in normal geometry the 100th
pixel is not inside the rectangle.
SubSurface::testSurfaceAt was adjusted correctly but this was missed as
we test the same thing twice!
QRectF::contains includes all edges. If two subsurfaces are next to each
other ::contains will treat it as having a singularity where a value is
on 2 subsurfaces rather than either one of the other, which isn't what
we want for our purposes.
The unit test is extended but also featured some wrong values, the
biggest clue that it was wrong was that we used different test
co-ordiantes for surfaceContains and inputContains.
Anything in xcb_ structs are always in X local, all member variables
aside from buffers are in kwin local space.
This patch ignores a few paths that are not relevant on wayland.
This allows for compositor managed different co-ordinate space between kwin's
logical co-ordinate space and a client's logical co-ordinate space.
When combined with a modified kwin!1959 this allows us to set a DPI in xrdb and
mark all xwayland windows as being 2x (or other) and avoid upscales for xwayland
clients in a way that doesn't impact other wayland clients or require
third-party changes. Any use of fractional values is in layers we control
instead of over the wire. kwayland-server is the right place for this
abstraction as we need Outputs to differ on a per resource basis. Something we
can't control from within kwin.
Right now only protocols used by Xwayland are covered. If we covered
remaining protocols we can offer user-control on all remaining clients which
could open up other possibilities such as a user controlled dynamic resizing,
or adapt to possible future protocol changes with wayland scaling.
Allow dragging windows between screens, using a placeholder thumbnail item to
render part of the thumbnail on the other screen.
BUG: 283333
BUG: 453996
BUG: 448566
There are a few benefits to using smart pointers from the standard library:
- std::unique_ptr has move semantics. With move semantics, transfer of ownership
can be properly expressed
- std::shared_ptr is more efficient than QSharedPointer
- more developers are used to them, making contributions for newcomers easier
We're also already using a mix of both; because Qt shared pointers provide
no benefits, porting to standard smart pointers improves consistency in
the code base. Because of that, this commit ports most of the uses of QSharedPointer
to std::shared_ptr, and some uses of QScopedPointer to std::unique_ptr
The current shortcuts could conceivably override app shortcuts, since
they don't use the Meta key. The following changes are made:
Switch keyboard layout: Ctrl+Alt+K -> Meta+Alt+K
Activate window that wants attention: Ctrl+Alt+A -> Meta+Ctrl+A
Kill Window: Ctrl+Alt+Esc -> Meta+Ctrl+Esc
These are safe to change in the code rather than adding new ones and
keeping the old ones around for compatibility's sake because
KGlobalAccel::setDefaultShortcuts by default preserves old shortcuts
when they are changed, and we aren't overriding that behavior here. So
only new installs will get the new shortcuts and existing user installs
will be untouched.
Makes sure disabled outputs are reported as such, leaving behind the
assumption that all outputs are always enabled.
Ensures the corresponding outputEnabled/Disabled signals are emitted.
Updates the window title to reflect the output state.
AppletPopup window type should accept focus, behaving like other window types like
Dock. At the moment it is instead behaving like notification, which seems wrong.
This should also fix a failing unit test.
AppletPopup's are typically supposed to be attached to the panel and
should remain visible when the virtual desktop is changed. If the
AppletPopup is pinned and the virtual desktop is changed, without
this patch, the window does not remain attached to the panel. This is
how AppletPopup was supposed to work even according to the unit test
which currently fails.
The lowest latency setting wasn't applied because the internal
implementation contained an excess 'e' in comparison to the setting
exposed to the user
BUG: 453694
When a gesture is cancelled because of the distance between fingers or the
time it took to register them all, no gesture has been taken yet. In that
case, the canceling would never be ended, effectively disabling all touchscreen
gestures.
On Wayland, we create a dummy window to fix HiDPI issues. At the moment,
the QQuickRenderControl::renderWindow() returns a fixed offset 0,0.
As it turns out, QQuickItem::mapToGlobal() will poke the
QQuickRenderControl::renderWindow() function to map the specified point
to the global coordinate space.
Since the renderWindow() function returns hardcoded offset, the
mapToGlobal() function is sort of broken in fullscreen effects.
In order to fix mapToGlobal() on Wayland, this change makes the
EffectQuickRenderControl return the position of the associated
OffscreenQuickView.
When zoom factor is 1, the zoom effect will paint the scene in an
offscreen texture, but not actually paint the textures on the screen.
Zoom factor can be 1 when the effect has been just stopped.
BUG: 454407
When the effect closes, all the extra data attached to the window
(offToCornerId and apertureCorner properties) are not valid anymore
and need to be reset right after the animation end.
also manage the two edge cases where a window either appeared or
got minimized while the effect was running to either show it or not
BUG: 454280
On Wayland, screens are repainted independent of each other. If zooming
animation stops on one screen, other screens may still be stuck in the
zoomed state and therefore result in potential flickering. Issue a full
screen repaint when zooming stops to ensure that other screens are
repainted with "unscaled" contents.
BUG: 454407
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2472>
Currently, if you want to use TimeLine, you need to track the last
presentation timestamp which boils down to carrying some boilerplate
code.
The current situation can be improved by making TimeLine work with
presentation timestamps.
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2473>
The magnification filter was changed to GL_NEAREST with the reasoning
that "pixel granularity" would be more correct. Perhaps that was not a
bright idea. Change it back to GL_LINEAR.
BUG: 454408
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2471>
In response to a XCB_CONFIGURE_NOTIFY on the output window, the new size
is set as mode and the output layer buffer is recreated.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2459>
The config group is formed as "Effect-" + plugin id, i.e. "desktopgrid"
Config migration from DesktopGrid to desktopgrid is already handled by
a kconf_update script.
BUG: 454102
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2464>
Under Gnome/Unity/XFCE, but not Plasma(!), QFontconfigDatabase queries
the platform native interface for certain font settings
(e.g. antialiasingEnabled). Without a QPNI this would crash KWin
as soon as it tried to query for fonts.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2468>
This fixes integration of the zoom effect with the blur effect and qtquick
effects such as overview or window view.
The main con of the proposed solution is that offscreen rendering can be
a bit overkill. But on the other hand, it's the most robust way to
ensure that fullscreen effects integrate correctly with the zoom effect.
For example, without it, the quick scene effect would need to figure out
what screen views to paint for the given screen. There are also more
finicky cases, e.g. the screen transform effect.
BUG: 447002
BUG: 447670
BUG: 453467
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2451>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2451>
Under kwin_wayland `kwinApp()->connection()` is for communicating with
XWayland, but in X11Windowed backend we need to talk to the host XServer.
Restore `XRenderUtils::init` and set it accordingly based on
whether we're running standalone or windowed, so that `kwin_wayland`
works running nested in an X session again.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2457>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2457>
With some effects, latency policy doesn't matter and it's preferred if
kwin uses the smoothest animation latency policy in order to minimize
the number of frame drops, e.g. slide.
After commit c1d0aa18, the namespace where the KCM is installed
changed to `plasma/kcms/systemsettings/`.
We need to point to this new plugin location when the KCM is
launched via Alt-F3 > "Window Specific Properties"
Also let's set the full plugin location from CMake instead of
harcoded in C++ so it is easier to keep it in sync.
BUG: 454066
FIXED-IN: 5.25.0
The Blendchanges effect works by showing a snapshot of the current
screen for a few ms. Any other active full screen effect will look
broken, so it should take priority.
This is pre-empting an issue with a new Plasma feature that syncs
colours to wallpapers. Once we animate activity switches / have per
desktop wallpapers it'll glitch out.
The XRender backend has been removed, leaving most of KWinXRenderUtils unused.
The few features that are still used, notable `XRenderPicture` and pict format
are moved into the x11/common directory.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
For some reason with legacy the cursor gets an offset when changing the
image. In order to work around this, directly issue a cursor move with the
corrected position when changing the buffer
As we don't provide any ability for the user to configure the gestures yet,
the gesture for the desktop grid should stay as it was in the last release.
This commit swaps the gestures for desktopgrid and overview to achieve that.
At the moment, the data offer initializes supported and preferred action
to "none". But if the target doesn't accept anything the source
provides, the compositor may still need to send action events with "none"
This change makes data offer and data source provide dnd actions wrapped
in std::optional in order to indicate if they have been set explicitly.
SeatInterface emits dragEnded when the drag is dropped. The target may want
to interact with the data source after the drop happened, for example only
fetching data after the drop and not during the drag.
(Note that the Wayland protocol has the same
Xvisits are now not deleted prematurely but only when they are really finished.
(Note that the Wayland protocol has the same distinction between dropped and
finished so it maps nicely).
For storing previous visits the same code pattern as in the rest of the XWayland
DND code is used.
The SelectionSource is reset when the next Drag/Drop operation involving a X window
is started (see startDrag and doHandleXfixesNotify) or when the Wayland source is
about to be deleted.
BUG:450460
FIXED-in:5.25.0
Gesture recognition code doesn't handle correctly cancelling a touch
sequence. testTouchPoint in one of its tests simulates pressing the
screen with three fingers and cancelling the touch sequence.
Emitting the Workspace::windowAdded() signal before actually adding the
window to the Workspace is counter-intuitive and it can a source of
potential bugs as relevant window lists in Workspace don't contain the
window yet.
The features that this KCM lets you trigger barely work on X11 and
really only work properly on Wayland.
Unfortunately we don't have the ability to have separate settings
between X11 and Wayland, and for this reason we removed a default left
touch edge in 3df7985570 a year and a half
ago because it was too buggy on X11.
This commit takes the next step and hides the KCM entirely on X11, so
you can only use it on Wayland where it actually works properly.
One potential downside is be that any users who are actually using it
on X11 will lose the ability to use a GUI to configure these features
unless they go to the Wayland session to do it. However the number of
such users is likely small given how the feature does not really work on
X11.
However the upside is that Wayland users who can see the KCM can
actually use the features that it lets you configure because they work
properly there.
As it turns out, it's needed to ensure that the Workspace emits the
stackingOrder changed signal when a new window is added. It's also
implicitly needed to make sure that Window::stackingOrder() is updated.
Currently we guess the supported and preferred dnd actions in data offer
for version >= 3. This can create problems because kwin may not send the
right action events when the supported dnd actions actually change.
With this only the main and the libinput threads will use realtime
scheduling, so it will be harder to leak realtime scheduling to somebody
else.
The only caveat is that kwin would need to keep CAP_SYS_NICE around,
however on the other hand, it's needed to ensure that kwin_wayland is
able to get high priority EGL contexts with some drivers, e.g. intel.
QX11Info is used in `platform.cpp`, which is used by both
kwin_x11 and kwin_wayland. The latter only gets it implicitly
through KGlobalAccelPrivate.
Ideally, platform.cpp was split to not require QX11Info in
kwin_wayland in the first place.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
As a wayland compositor kwin can hold many open file descriptors and
therefore it's easier for it to hit the soft file descriptor limit. This
change makes kwin_wayland bump the soft file descriptor limit to the
hard limit. With systemd, it's usually 500K.
In order to prevent causing mess in child processes, pthread_atfork() is
used to register a handler which will be invoked in the child process
after fork() in order to restore RLIMIT_NOFILE to its original value.
Overview is quite polished now, enough that we have a default touchpad
gesture that opens it by default. It's time to move it out of public
beta and enable it by default, and this commit does that.
BUG: 446753
FIXED-IN: 5.25
It appears that importing gbm_bo's using eglCreateImageKHR() doesn't
work on nvidia.
Another issue is that Platform::createDmaBufTexture() uses
gbm_bo_create(). The nvidia driver doesn't like that, it's preferred to
use gbm_bo_create_with_modifiers().
In order to address those issues, this change refactors how gbm_bo
objects are imported and how gbm_bo's are allocated for dmabuf textures,
so the same code can be reused in EglGbmBackend::textureForOutput()
and Platform::createDmaBufTexture().
This makes it consistent with WindowView (and the panel window doesn't respond
to input anyways even if shown, which is misleading).
BUG: 444274
FIXED-IN: 5.24.6
This allows using global shortcuts while a move/resize is ongoing. Most
importantly, this allows moving a window to a different desktop by
picking it up and then using a global shortcut to move to a different
desktop.
BUG: 444696
The Workspace has two stacks - one with managed windows and deleted
windows, the other includes windows from the first stack + override
redirect windows.
This change merges both stacks. It has several benefits - we will be
able to move window elevation stuff to Workspace and streamline the
scene stuff, for example it will be possible to have a root item.
Another advantage is that unmanaged windows will have
Window::stackingOrder() property set, which can be useful in the future
in qml effects or (qtquick scene if we push harder in that front).
Another advantage is that kwin will make less X11 calls when restacking
managed windows.
WindowItem has proper visibility set now, so these two interim hacks can
be removed now.
Workspace::stackingOrderChanged still needs to be kept around as the
Scene has no root item which could track the order of its child (window)
items.
At the moment we trigger the edges even when the active window is full
screen which is unfortunate when running certain games, for example when
you're attacking the village at the north-east in Age of Empires and you
have the Overview effect on.
This changes the default to inhibit them (like we used to just do for
sides but not corners for some reason) and adds a checkbox to restore
them even in that case.
BUG: 441464
Conceptually, scheduling repainting in Window doesn't belong there. This
change rewires EffectWindow internals so it schedules repaints using the
associated WindowItem.
Window::addWorkspaceRepaint() has not been removed yet because
Window::elevate() uses it.
This change makes the WindowItem track the opacity and schedule a
repaint. It further decouples the legacy scene from code window
abstractions.
It's an API breaking change. WindowPaintData no longer can make windows
more opaque. It only provides additional opacity factor.
It can happen that a gbm implementation does not support modifiers, while
the drm driver does. To prevent that from breaking KWin, fall back to creating
a gbm surface without modifiers when creating one with modifiers fails.
BUG: 453320
I am trying to cross-compile and since qtwaylandscanner_kde is used
during the build, I need to build a native version of the
qtwaylandscanner_kde tool first. This change allows building
qtwaylandscanner_kde as a standalone CMake project which the cross-build
can then be pointed at to find the host tool. If an explicit path to
qwaylandscanner_kde is not passed, we will try to use ExternalProject_Add
to build it. This approach was taken from ksyntaxhighlighting:
https://invent.kde.org/frameworks/syntax-highlighting/-/blob/master/src/indexer/CMakeLists.txt
This patch makes it significantly easier to cross-compile KWin, as we now
only need a native QtCore library instead of all the dependencies.
The Scene no longer clips window quads if the specified paint region is
infinite. The infinite region is defined as (INT_MIN/2, INT_MIN/2,
INT_MAX, INT_MAX). If you try to scale the infinite region, you will
easily hit integer overflow.
This change makes the DeformEffect disable geometry clipping if the given
paint region is infinite region in order to avoid hitting integer
overflow.
This allows to toss a large amount of custom rendering code.
Furthermore, it removes the build-time dependency on Plasma Framework
for FrameSvg and Theme from KWin core as it's pulled in through QML
imports now.
It also cleans up the API and removes functions that are effectively
unused or no-op after this change.
For instance, effects often destroy their effect frames
in pre/postPaintScreen, which would now destroy an `OffscreenQuickView`,
which changes GL context. This is alleviated by delaying detruction
of the internal view.
Support for the features of text cross-fade and selection frame,
which are not used by any of the built-in effects, is dropped.
Signed-off-by: Eike Hein <eike.hein@mbition.io>
The lanczos filter depends on the effect system. It makes very difficult
changing painting code from SceneWindow to Item.
Given that the last big users of the laczos filter - present windows and
desktop grid effects were re-written in QML. The only remaining user of
the lanczos filter is the thumbnail aside effect. Given that it's a
really obscure usecase, switching to the linear filter won't be very
noticeable.
As a backup plan, one can reimplement the thumbnailaside effect using
QML. The lanczos filter is already implemented in plasma-framework.
The first time the GBM backend's EGL context is made current after
creation, both the read and draw surfaces are set to EGL_NO_SURFACE.
This will set the GL read and draw buffers to GL_NONE in accordance with
the EGL spec.
When a real surface is later made current, however, the spec is arguably
unclear on whether the read and draw buffers should remain set to
GL_NONE or whether they should be restored to the default GL_BACK. The
Mesa driver does the latter, the NVIDIA driver does the former.
To work around this difference, Kwin has an explicit call to
glDrawBuffer in GbmSurface::makeContextCurrent. It does not have a
corresponding call to glReadBuffer, though, which can cause some desktop
effects such as background contrast to render incorrectly with the
NVIDIA driver. This change adds that missing call.
Workspace::findAbstractClient(QUuid) overload is used only by the
windows krunner plugin.
This change fixes a potential null dereferencing and removes the
findAbstractClient() overload in favor of a more generic findToplevel()
overload.
Releasing the buffers is necessary for example in the case of a GPU reset,
to make sure that the gbm surface is still properly destroyed and all buffers
with invalid content freed.
Instead of buffers being both drm framebuffers and gbm / dumb buffers, these
responsibilities are now split, which makes it possible to do zero copy
screen casting in the future.
Both framebuffers and gbm / dumb buffers also now always hold a valid underlying
resource, which simplifies code a bit.