Client: Fix cursor hotspot on high-dpi
QWaylandInputDevice::setCursor(wl_buffer, QPoint, QSize, bufferscale) assumes a hotspot and a size in surface coordinates, while wl_cursor_image uses pixel coordinates. Divide by bufferScale to get the correct values. This breaks hidpi cursors on kwin 5.13.1 and earlier, where buffer scale for cursor surfaces are ignored. Change-Id: I7c86bc541ccf5fb878facebbe93d2b1f842dfc5c Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
d923a19491
commit
3e66edd846
@ -389,11 +389,17 @@ void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *scree
|
||||
|
||||
void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, int bufferScale)
|
||||
{
|
||||
setCursor(buffer,
|
||||
image ? QPoint(image->hotspot_x, image->hotspot_y) : QPoint(),
|
||||
image ? QSize(image->width, image->height) : QSize(), bufferScale);
|
||||
if (image) {
|
||||
// Convert from pixel coordinates to surface coordinates
|
||||
QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale;
|
||||
QSize size = QSize(image->width, image->height) / bufferScale;
|
||||
setCursor(buffer, hotspot, size, bufferScale);
|
||||
} else {
|
||||
setCursor(buffer, QPoint(), QSize(), bufferScale);
|
||||
}
|
||||
}
|
||||
|
||||
// size and hotspot are in surface coordinates
|
||||
void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size, int bufferScale)
|
||||
{
|
||||
if (mCaps & WL_SEAT_CAPABILITY_POINTER) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user