etrunko / rpms / spice-gtk

Forked from rpms/spice-gtk 4 years ago
Clone
Blob Blame History Raw
From 630d4d0b2cddefa85aeab796b1859a9d65aaec5d Mon Sep 17 00:00:00 2001
From: Alon Levy <alevy@redhat.com>
Date: Wed, 28 Aug 2013 16:01:15 +0300
Subject: [PATCH 1/2] gtk/channel-cursor.c: add cursor_type_to_string for
 debugging

---
 gtk/channel-cursor.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c
index 99e7a48..41ad696 100644
--- a/gtk/channel-cursor.c
+++ b/gtk/channel-cursor.c
@@ -325,6 +325,23 @@ static void display_cursor_unref(display_cursor *cursor)
         g_free(cursor);
 }
 
+static const char *cursor_type_to_string(int type)
+{
+    switch (type) {
+    case SPICE_CURSOR_TYPE_MONO:
+        return "mono";
+    case SPICE_CURSOR_TYPE_ALPHA:
+        return "alpha";
+    case SPICE_CURSOR_TYPE_COLOR32:
+        return "color32";
+    case SPICE_CURSOR_TYPE_COLOR16:
+        return "color16";
+    case SPICE_CURSOR_TYPE_COLOR4:
+        return "color4";
+    }
+    return "unknown";
+}
+
 static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor)
 {
     SpiceCursorChannelPrivate *c = SPICE_CURSOR_CHANNEL(channel)->priv;
@@ -343,8 +360,9 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor)
     if (scursor->flags & SPICE_CURSOR_FLAGS_NONE)
         return NULL;
 
-    CHANNEL_DEBUG(channel, "%s: type %d, %" PRIx64 ", %dx%d", __FUNCTION__,
-                  hdr->type, hdr->unique, hdr->width, hdr->height);
+    CHANNEL_DEBUG(channel, "%s: type %s(%d), %" PRIx64 ", %dx%d", __FUNCTION__,
+                  cursor_type_to_string(hdr->type), hdr->type, hdr->unique,
+                  hdr->width, hdr->height);
 
     if (scursor->flags & SPICE_CURSOR_FLAGS_FROM_CACHE) {
         item = cache_find(&c->cursors, hdr->unique);
-- 
1.8.3.1