From 3334fb8752bb1e5dd40d8fa9969c8ba24d2547b8 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Mon, 20 Feb 2023 16:22:24 +0100 Subject: [PATCH] cursordelgate: round cursor position when rendering Otherwise there can be weird artifacts when screen scaling is involved --- src/cursordelegate_opengl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cursordelegate_opengl.cpp b/src/cursordelegate_opengl.cpp index 392ce6df2d..e4ba065da8 100644 --- a/src/cursordelegate_opengl.cpp +++ b/src/cursordelegate_opengl.cpp @@ -13,6 +13,8 @@ #include "kwinglutils.h" #include "scene/cursorscene.h" +#include + namespace KWin { @@ -48,7 +50,7 @@ void CursorDelegateOpenGL::paint(RenderTarget *renderTarget, const QRegion ®i QMatrix4x4 mvp; mvp.ortho(QRect(QPoint(0, 0), renderTarget->size())); - mvp.translate(cursorRect.x() * scale, cursorRect.y() * scale); + mvp.translate(std::round(cursorRect.x() * scale), std::round(cursorRect.y() * scale)); GLFramebuffer *fbo = std::get(renderTarget->nativeHandle()); GLFramebuffer::pushFramebuffer(fbo);