scene: Avoid creating SurfaceItem for Xwayland's cursor surfaces

SurfaceInterface::scaleOverride() doesn't scale the bufferScale, so if the
scale override is 2, but the buffer scale specified by the client is 1,
bufferScale() will return 1.

Xwayland cursor surface implicitly relied on this behavior.

Porting cursor to SurfaceItem changed that. Now cursor surfaces honor
the scale override, which makes Xwayland cursors too small.

In order to properly fix, plasma has to scale Xcursor.size in xrdb. The
problem is that plasma also sets XCURSOR_THEME and XCURSOR_SIZE envvars
that take precedence. Plasma must stop setting those envvars, but it's
doable only with Qt 6.5, which got MouseCursorTheme and MouseCursorSize
hints in QPlatformTheme.
This commit is contained in:
Vlad Zahorodnii 2023-01-04 11:10:32 +00:00
parent c10b35facb
commit b549776b68

View file

@ -11,6 +11,8 @@
#include "scene/itemrenderer.h"
#include "scene/scene.h"
#include "scene/surfaceitem_wayland.h"
#include "wayland/surface_interface.h"
#include "wayland_server.h"
namespace KWin
{
@ -30,7 +32,12 @@ void CursorItem::refresh()
{
const CursorSource *source = Cursors::self()->currentCursor()->source();
if (auto surfaceSource = qobject_cast<const SurfaceCursorSource *>(source)) {
// TODO Plasma 6: Stop setting XCURSOR_SIZE and scale Xcursor.size in xrdb.
if (surfaceSource->surface() && surfaceSource->surface()->client() == waylandServer()->xWaylandConnection()) {
setImage(surfaceSource->image());
} else {
setSurface(surfaceSource->surface());
}
} else if (auto imageSource = qobject_cast<const ImageCursorSource *>(source)) {
setImage(imageSource->image());
} else if (auto shapeSource = qobject_cast<const ShapeCursorSource *>(source)) {