From 5d00e0bdbd7796d078522627327d600775c7d9b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Thu, 25 Mar 2021 11:59:57 +0100 Subject: [PATCH] fix cursor index out of range error. --- internal/desktop/xorg/xorg.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/desktop/xorg/xorg.go b/internal/desktop/xorg/xorg.go index ab079de2..34146f3b 100644 --- a/internal/desktop/xorg/xorg.go +++ b/internal/desktop/xorg/xorg.go @@ -246,11 +246,11 @@ func GetCursorImage() *types.CursorImage { pixels := C.GoBytes(unsafe.Pointer(cur.pixels), C.int(width*height*8)) img := image.NewRGBA(image.Rect(0, 0, width, height)) - for row := 0; row < height; row++ { - for col := 0; col < width; col++ { - pos := ((row * height) + col) * 8 + for y := 0; y < height; y++ { + for x := 0; x < width; x++ { + pos := ((y * width) + x) * 8 - img.SetRGBA(col, row, color.RGBA{ + img.SetRGBA(x, y, color.RGBA{ A: pixels[pos+3], R: pixels[pos+2], G: pixels[pos+1],