summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2022-02-11 09:20:46 +0100
committerOlivier Fourdan <ofourdan@redhat.com>2022-02-11 11:02:59 +0100
commit278b48acbb5ef0c0a3353d1269e97044edcca0e8 (patch)
tree39303b3a305e2751688b02250c7166937ad8ac6b
parentc155a4903553129af44e4b5f9cf5f7db1d7b863e (diff)
xwayland: Fix cursor color
When using colored X11 cursors, the colors would appear wrong, yellow would show white, green would show as cyan, and blue would show black whereas red would show fine. This is because the code expanding the cursor data accounts for green for both green and blue channels. Funnily this bug has been there from the beginning. Fix the issue by correctly account for the color channels. Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1303 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Simon Ser <contact@emersion.fr> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> (cherry picked from commit 6ad6517a796cb4536d368091b647423981ad1217)
-rw-r--r--hw/xwayland/xwayland-cursor.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index 16c13fb64..e3c1aaa50 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -54,9 +54,11 @@ expand_source_and_mask(CursorPtr cursor, CARD32 *data)
p = data;
fg = ((cursor->foreRed & 0xff00) << 8) |
- (cursor->foreGreen & 0xff00) | (cursor->foreGreen >> 8);
+ (cursor->foreGreen & 0xff00) |
+ (cursor->foreBlue >> 8);
bg = ((cursor->backRed & 0xff00) << 8) |
- (cursor->backGreen & 0xff00) | (cursor->backGreen >> 8);
+ (cursor->backGreen & 0xff00) |
+ (cursor->backBlue >> 8);
stride = BitmapBytePad(bits->width);
for (y = 0; y < bits->height; y++)
for (x = 0; x < bits->width; x++) {