Blob Blame History Raw
From c4428fd886ca344fb77a684028e181236873b05e Mon Sep 17 00:00:00 2001
From: Alon Levy <alevy@redhat.com>
Date: Wed, 28 Aug 2013 16:14:16 +0300
Subject: [PATCH 2/2] gtk/channel-cursor: copy spicec hack, RHBZ #998529

flip -> unsupported by x11, since XCreatePixmapCursor has no invert
functionality, only a mask, shape, background and foreground colors. Use
this checkerboard hack to get some contrast for cursors in the guest
that relied on invert for the same contrast.
---
 gtk/channel-cursor.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c
index 41ad696..e4a996b 100644
--- a/gtk/channel-cursor.c
+++ b/gtk/channel-cursor.c
@@ -259,11 +259,24 @@ static void mono_cursor(display_cursor *cursor, const guint8 *data)
         for (x = 0; x < cursor->hdr.width; x++, dest += 4) {
             if (and[x/8] & bit) {
                 if (xor[x/8] & bit) {
-                    /* flip -> hmm? */
-                    dest[0] = 0x00;
-                    dest[1] = 0x00;
-                    dest[2] = 0x00;
-                    dest[3] = 0x80;
+                    /*
+                     * flip -> unsupported by x11, since XCreatePixmapCursor has
+                     * no invert functionality, only a mask, shape, background and
+                     * foreground colors. Use this checkerboard hack to get some
+                     * contrast for cursors in the guest that relied on invert for
+                     * the same contrast.
+                     */
+                    if ((x ^ y) & 1) {
+                        dest[0] = 0x30;
+                        dest[1] = 0x30;
+                        dest[2] = 0x30;
+                        dest[3] = 0xc0;
+                    } else {
+                        dest[0] = 0x50;
+                        dest[1] = 0x50;
+                        dest[2] = 0x50;
+                        dest[3] = 0x30;
+                    }
                 } else {
                     /* unchanged -> transparent */
                     dest[0] = 0x00;
-- 
1.8.3.1