cursorsource: fix scaling with Xwayland
Before this commit, the device pixel ratio of the cursor was set to ignore the Xwayland scale override, while the size of the cursor surface was scaled. This change removes the scaling of the cursor surface size, to make the cursor be no longer cut off in rendering. BUG: 466094
This commit is contained in:
parent
3334fb8752
commit
81571203f1
1 changed files with 6 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "cursorsource.h"
|
||||
#include "cursor.h"
|
||||
#include "wayland/clientconnection.h"
|
||||
#include "wayland/shmclientbuffer.h"
|
||||
#include "wayland/surface_interface.h"
|
||||
|
||||
|
@ -143,6 +144,10 @@ void SurfaceCursorSource::update(KWaylandServer::SurfaceInterface *surface, cons
|
|||
m_hotspot = QPoint();
|
||||
m_surface = nullptr;
|
||||
} else {
|
||||
// TODO Plasma 6: once Xwayland cursor scaling can be done correctly, remove this
|
||||
// scaling is intentionally applied "wrong" here to make the cursor stay a consistent size even with un-scaled Xwayland:
|
||||
// - the device pixel ratio of the image is not multiplied by scaleOverride
|
||||
// - the surface size is scaled up with scaleOverride, to un-do the scaling done elsewhere
|
||||
auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(surface->buffer());
|
||||
if (buffer) {
|
||||
m_image = buffer->data().copy();
|
||||
|
@ -150,7 +155,7 @@ void SurfaceCursorSource::update(KWaylandServer::SurfaceInterface *surface, cons
|
|||
} else {
|
||||
m_image = QImage();
|
||||
}
|
||||
m_size = surface->size().toSize();
|
||||
m_size = (surface->size() * surface->client()->scaleOverride()).toSize();
|
||||
m_hotspot = hotspot;
|
||||
m_surface = surface;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue