diff --git a/cursor.c b/cursor.c
index 3995a31..dfb9eef 100644
--- a/cursor.c
+++ b/cursor.c
@@ -1,51 +1,57 @@
 #include "qemu-common.h"
 #include "console.h"
 
-static const char cursor_hidden_32[32*32];
-static const char cursor_left_ptr_32[32*32] = {
-    "                                "
-    " X                              "
-    " XX                             "
-    " X.X                            "
-    " X..X                           "
-    " X...X                          "
-    " X....X                         "
-    " X.....X                        "
-    " X......X                       "
-    " X.......X                      "
-    " X........X                     "
-    " X.....XXXXX                    "
-    " X..X..X                        "
-    " X.X X..X                       "
-    " XX  X..X                       "
-    " X    X..X                      "
-    "      X..X                      "
-    "       X..X                     "
-    "       X..X                     "
-    "        XX                      "
-    "                                "
-};
+#include "cursor_hidden.xpm"
+#include "cursor_left_ptr.xpm"
 
 /* for creating built-in cursors */
-static void cursor_parse_ascii_art(QEMUCursor *c, const char *ptr)
+static QEMUCursor *cursor_parse_xpm(const char *xpm[])
 {
-    int i, pixels;
-
-    pixels = c->width * c->height;
-    for (i = 0; i < pixels; i++) {
-        switch (ptr[i]) {
-        case 'X': /* black */
-            c->data[i] = 0xff000000;
-            break;
-        case '.': /* white */
-            c->data[i] = 0xffffffff;
-            break;
-        case ' ': /* transparent */
-        default:
-            c->data[i] = 0x00000000;
-            break;
+    QEMUCursor *c;
+    uint32_t ctab[128];
+    unsigned int width, height, colors, chars;
+    unsigned int line = 0, i, r, g, b, x, y, pixel;
+    char name[16];
+    uint8_t idx;
+
+    /* parse header line: width, height, #colors, #chars */
+    if (sscanf(xpm[line], "%d %d %d %d", &width, &height, &colors, &chars) != 4) {
+        fprintf(stderr, "%s: header parse error: \"%s\"\n",
+                __FUNCTION__, xpm[line]);
+        return NULL;
+    }
+    if (chars != 1) {
+        fprintf(stderr, "%s: chars != 1 not supported\n", __FUNCTION__);
+        return NULL;
+    }
+    line++;
+
+    /* parse color table */
+    for (i = 0; i < colors; i++, line++) {
+        if (sscanf(xpm[line], "%c c %15s", &idx, name) == 2) {
+            if (sscanf(name, "#%02x%02x%02x", &r, &g, &b) == 3) {
+                ctab[idx] = (0xff << 24) | (b << 16) | (g << 8) | r;
+                continue;
+            }
+            if (strcmp(name, "None") == 0) {
+                ctab[idx] = 0x00000000;
+                continue;
+            }
         }
+        fprintf(stderr, "%s: color parse error: \"%s\"\n",
+                __FUNCTION__, xpm[line]);
+        return NULL;
     }
+
+    /* parse pixel data */
+    c = cursor_alloc(width, height);
+    for (pixel = 0, y = 0; y < height; y++, line++) {
+        for (x = 0; x < height; x++, pixel++) {
+            idx = xpm[line][x];
+            c->data[pixel] = ctab[idx];
+        }
+    }
+    return c;
 }
 
 /* nice for debugging */
@@ -75,8 +81,7 @@ QEMUCursor *cursor_builtin_hidden(void)
 {
     QEMUCursor *c;
 
-    c = cursor_alloc(32, 32);
-    cursor_parse_ascii_art(c, cursor_hidden_32);
+    c = cursor_parse_xpm(cursor_hidden_xpm);
     return c;
 }
 
@@ -84,10 +89,7 @@ QEMUCursor *cursor_builtin_left_ptr(void)
 {
     QEMUCursor *c;
 
-    c = cursor_alloc(32, 32);
-    cursor_parse_ascii_art(c, cursor_left_ptr_32);
-    c->hot_x = 1;
-    c->hot_y = 1;
+    c = cursor_parse_xpm(cursor_left_ptr_xpm);
     return c;
 }
 
diff --git a/cursor_hidden.xpm b/cursor_hidden.xpm
new file mode 100644
index 0000000..354e7a9
--- /dev/null
+++ b/cursor_hidden.xpm
@@ -0,0 +1,37 @@
+/* XPM */
+static const char *cursor_hidden_xpm[] = {
+    "32 32 1 1",
+    "  c None",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+};
diff --git a/cursor_left_ptr.xpm b/cursor_left_ptr.xpm
new file mode 100644
index 0000000..6c9ada9
--- /dev/null
+++ b/cursor_left_ptr.xpm
@@ -0,0 +1,39 @@
+/* XPM */
+static const char *cursor_left_ptr_xpm[] = {
+    "32 32 3 1",
+    "X c #000000",
+    ". c #ffffff",
+    "  c None",
+    "X                               ",
+    "XX                              ",
+    "X.X                             ",
+    "X..X                            ",
+    "X...X                           ",
+    "X....X                          ",
+    "X.....X                         ",
+    "X......X                        ",
+    "X.......X                       ",
+    "X........X                      ",
+    "X.....XXXXX                     ",
+    "X..X..X                         ",
+    "X.X X..X                        ",
+    "XX  X..X                        ",
+    "X    X..X                       ",
+    "     X..X                       ",
+    "      X..X                      ",
+    "      X..X                      ",
+    "       XX                       ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+    "                                ",
+};
