[gnome-robots] convert cursors to XPM



commit d10f023b14548075eff6800f2d7d6010b382347a
Author: Andrey Kutejko <andy128k gmail com>
Date:   Tue Aug 25 00:20:45 2020 +0200

    convert cursors to XPM

 src/cursor-up-left.h  | 108 ++++++++++++++------------------------------------
 src/cursor-up-right.h | 108 ++++++++++++++------------------------------------
 src/cursors.c         |  27 ++++++++-----
 3 files changed, 74 insertions(+), 169 deletions(-)
---
diff --git a/src/cursor-up-left.h b/src/cursor-up-left.h
index 4516606..086af2a 100644
--- a/src/cursor-up-left.h
+++ b/src/cursor-up-left.h
@@ -1,80 +1,30 @@
-/* GdkPixbuf RGBA C-Source image dump */
-
-#ifdef __SUNPRO_C
-#pragma align 4 (cursor_up_left)
-#endif
-#ifdef __GNUC__
-static const guint8 cursor_up_left[] __attribute__ ((__aligned__ (4))) =
-#else
-static const guint8 cursor_up_left[] =
-#endif
-{ ""
-  /* Pixbuf magic (0x47646b50) */
-  "GdkP"
-  /* length: header (24) + pixel_data (1600) */
-  "\0\0\6X"
-  /* pixdata_type (0x1010002) */
-  "\1\1\0\2"
-  /* rowstride (80) */
-  "\0\0\0P"
-  /* width (20) */
-  "\0\0\0\24"
-  /* height (20) */
-  "\0\0\0\24"
-  /* pixel_data: */
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377"
-  "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
-  "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
-  "\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
-  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377"
-  "\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
-  "\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0"
-  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377"
-  "\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\377\0\0\0\377"
-  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
-  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
-  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377"
-  "\377\377\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\377\0\0\0\377"
-  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377"
-  "\377\377\0\0\0\377\377\377\377\377\0\0\0\0\377\377\377\377\0\0\0\377"
-  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377"
-  "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377"
-  "\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377"
-  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377"
-  "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0"
-  "\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\377\377\377"
-  "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0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\0\0\0\0\0"};
-
+static const char* cursor_up_left[] = {
+  /* width height num_colors chars_per_pixel */
+  " 20 20 3 2",
+  /* colors */
+  ".. c none",
+  "## c #ffffff",
+  "** c #000000",
+  /* pixels */
+  "........................................",
+  "..######################................",
+  "..##****************##..................",
+  "..##**************##....................",
+  "..##************##......................",
+  "..##**************##....................",
+  "..##****************##..................",
+  "..##******************##................",
+  "..##****##**************##..............",
+  "..##**##..##**************##............",
+  "..####......##**********##..............",
+  "..##..........##******##................",
+  "................##**##..................",
+  "..................##....................",
+  "........................................",
+  "........................................",
+  "........................................",
+  "........................................",
+  "........................................",
+  "........................................"
+};
 
diff --git a/src/cursor-up-right.h b/src/cursor-up-right.h
index 354e167..1e70aee 100644
--- a/src/cursor-up-right.h
+++ b/src/cursor-up-right.h
@@ -1,80 +1,30 @@
-/* GdkPixbuf RGBA C-Source image dump */
-
-#ifdef __SUNPRO_C
-#pragma align 4 (cursor_up_right)
-#endif
-#ifdef __GNUC__
-static const guint8 cursor_up_right[] __attribute__ ((__aligned__ (4))) =
-#else
-static const guint8 cursor_up_right[] =
-#endif
-{ ""
-  /* Pixbuf magic (0x47646b50) */
-  "GdkP"
-  /* length: header (24) + pixel_data (1600) */
-  "\0\0\6X"
-  /* pixdata_type (0x1010002) */
-  "\1\1\0\2"
-  /* rowstride (80) */
-  "\0\0\0P"
-  /* width (20) */
-  "\0\0\0\24"
-  /* height (20) */
-  "\0\0\0\24"
-  /* pixel_data: */
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377"
-  "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
-  "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
-  "\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377"
-  "\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
-  "\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377"
-  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377"
-  "\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\377\0\0\0\377"
-  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
-  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377"
-  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
-  "\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\377\0\0"
-  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377"
-  "\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\377\0\0\0\377\0\0"
-  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0"
-  "\0\377\377\377\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\377\0"
-  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0"
-  "\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\377\377"
-  "\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\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
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"};
-
+static const char* cursor_up_right[] = {
+  /* width height num_colors chars_per_pixel */
+  " 20 20 3 2",
+  /* colors */
+  ".. c none",
+  "## c #ffffff",
+  "** c #000000",
+  /* pixels */
+  "........................................",
+  "................######################..",
+  "..................##****************##..",
+  "....................##**************##..",
+  "......................##************##..",
+  "....................##**************##..",
+  "..................##****************##..",
+  "................##******************##..",
+  "..............##**************##****##..",
+  "............##**************##..##**##..",
+  "..............##**********##......####..",
+  "................##******##..........##..",
+  "..................##**##................",
+  "....................##..................",
+  "........................................",
+  "........................................",
+  "........................................",
+  "........................................",
+  "........................................",
+  "........................................"
+};
 
diff --git a/src/cursors.c b/src/cursors.c
index 6a85f17..da71635 100644
--- a/src/cursors.c
+++ b/src/cursors.c
@@ -38,6 +38,7 @@
 #include "cursor-up-right.h"
 
 typedef struct {
+  int is_xpm;
   const guint8 *data;
   gsize data_len;
   int hsx;
@@ -45,18 +46,18 @@ typedef struct {
   GdkCursor *cursor;
 } cursor_props;
 
-#define CURSOR_ENTRY(d,hx,hy) { cursor_##d, sizeof (cursor_##d), hx, hy, NULL }
+#define CURSOR_ENTRY(is_xpm, d,hx,hy) { is_xpm, cursor_##d, sizeof (cursor_##d), hx, hy, NULL }
 
 cursor_props cursor_list[] = {
-  CURSOR_ENTRY (up_left, 3, 3),
-  CURSOR_ENTRY (up, 10, 3),
-  CURSOR_ENTRY (up_right, 17, 3),
-  CURSOR_ENTRY (left, 3, 10),
-  CURSOR_ENTRY (hold, 10, 10),
-  CURSOR_ENTRY (right, 17, 10),
-  CURSOR_ENTRY (down_left, 3, 17),
-  CURSOR_ENTRY (down, 10, 17),
-  CURSOR_ENTRY (down_right, 17, 17)
+  CURSOR_ENTRY (1, up_left, 3, 3),
+  CURSOR_ENTRY (0, up, 10, 3),
+  CURSOR_ENTRY (1, up_right, 17, 3),
+  CURSOR_ENTRY (0, left, 3, 10),
+  CURSOR_ENTRY (0, hold, 10, 10),
+  CURSOR_ENTRY (0, right, 17, 10),
+  CURSOR_ENTRY (0, down_left, 3, 17),
+  CURSOR_ENTRY (0, down, 10, 17),
+  CURSOR_ENTRY (0, down_right, 17, 17)
 };
 
 GdkCursor *default_cursor;
@@ -73,9 +74,13 @@ make_cursors (void)
 
   c = cursor_list;
   for (i = 0; i < G_N_ELEMENTS (cursor_list); ++i) {
+    if (c->is_xpm) {
+      pixbuf = gdk_pixbuf_new_from_xpm_data ((const char**) c->data);
+    } else {
 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-    pixbuf = gdk_pixbuf_new_from_inline (c->data_len, c->data, FALSE, NULL);
+      pixbuf = gdk_pixbuf_new_from_inline (c->data_len, c->data, FALSE, NULL);
 G_GNUC_END_IGNORE_DEPRECATIONS
+    }
     c->cursor = gdk_cursor_new_from_pixbuf (gdk_display_get_default (),
                                             pixbuf,
                                             c->hsx, c->hsy);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]