[PATCH 1/2] cursor: Add a default cursor theme

Philipp Brüschweiler blei42 at gmail.com
Thu Sep 6 07:20:15 PDT 2012


This theme is loaded when the specified cursor theme can not be found.

These cursors are extracted from the xorg sources and transformed into
xpm files by a small helper program (commited separately).
---
 cursor/bottom_left_corner.xpm  |  48 ++++++++++
 cursor/bottom_right_corner.xpm |  48 ++++++++++
 cursor/bottom_side.xpm         |  48 ++++++++++
 cursor/fleur.xpm               |  48 ++++++++++
 cursor/hand1.xpm               |  48 ++++++++++
 cursor/left_ptr.xpm            |  48 ++++++++++
 cursor/left_side.xpm           |  47 +++++++++
 cursor/right_side.xpm          |  47 +++++++++
 cursor/top_left_corner.xpm     |  48 ++++++++++
 cursor/top_right_corner.xpm    |  48 ++++++++++
 cursor/top_side.xpm            |  48 ++++++++++
 cursor/watch.xpm               |  48 ++++++++++
 cursor/wayland-cursor.c        | 211 ++++++++++++++++++++++++++++++++++++++++-
 cursor/xterm.xpm               |  48 ++++++++++
 14 Dateien geändert, 832 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
 create mode 100644 cursor/bottom_left_corner.xpm
 create mode 100644 cursor/bottom_right_corner.xpm
 create mode 100644 cursor/bottom_side.xpm
 create mode 100644 cursor/fleur.xpm
 create mode 100644 cursor/hand1.xpm
 create mode 100644 cursor/left_ptr.xpm
 create mode 100644 cursor/left_side.xpm
 create mode 100644 cursor/right_side.xpm
 create mode 100644 cursor/top_left_corner.xpm
 create mode 100644 cursor/top_right_corner.xpm
 create mode 100644 cursor/top_side.xpm
 create mode 100644 cursor/watch.xpm
 create mode 100644 cursor/xterm.xpm

diff --git a/cursor/bottom_left_corner.xpm b/cursor/bottom_left_corner.xpm
new file mode 100644
index 0000000..d09291f
--- /dev/null
+++ b/cursor/bottom_left_corner.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *bottom_left_corner[] = {
+"16 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"OOOO____________",
+"OXXO____________",
+"OXXO_OOO____OO__",
+"OXXO_OXO___OXO__",
+"OXXO_OXO__OXO___",
+"OXXO_OXO_OXO____",
+"OXXO_OXOOXO_____",
+"OXXO_OXOXO______",
+"OXXO_OXXOOOOOO__",
+"OXXO_OXXXXXXXO__",
+"OXXO_OOOOOOOOO__",
+"OXXO____________",
+"OXXOOOOOOOOOOOOO",
+"OXXXXXXXXXXXXXXO",
+"OXXXXXXXXXXXXXXO",
+"OOOOOOOOOOOOOOOO",
+};
+
+static struct hotspot bottom_left_corner_hotspot = { 1, 14 };
diff --git a/cursor/bottom_right_corner.xpm b/cursor/bottom_right_corner.xpm
new file mode 100644
index 0000000..a66537b
--- /dev/null
+++ b/cursor/bottom_right_corner.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *bottom_right_corner[] = {
+"16 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"____________OOOO",
+"____________OXXO",
+"__OO____OOO_OXXO",
+"__OXO___OXO_OXXO",
+"___OXO__OXO_OXXO",
+"____OXO_OXO_OXXO",
+"_____OXOOXO_OXXO",
+"______OXOXO_OXXO",
+"__OOOOOOXXO_OXXO",
+"__OXXXXXXXO_OXXO",
+"__OOOOOOOOO_OXXO",
+"____________OXXO",
+"OOOOOOOOOOOOOXXO",
+"OXXXXXXXXXXXXXXO",
+"OXXXXXXXXXXXXXXO",
+"OOOOOOOOOOOOOOOO",
+};
+
+static struct hotspot bottom_right_corner_hotspot = { 14, 14 };
diff --git a/cursor/bottom_side.xpm b/cursor/bottom_side.xpm
new file mode 100644
index 0000000..9705f86
--- /dev/null
+++ b/cursor/bottom_side.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *bottom_side[] = {
+"15 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"______OOO______",
+"______OXO______",
+"______OXO______",
+"______OXO______",
+"______OXO______",
+"______OXO______",
+"__OO__OXO__OO__",
+"__OXO_OXO_OXO__",
+"___OXOOXOOXO___",
+"____OXOXOXO____",
+"_____OXXXO_____",
+"______OXO______",
+"OOOOOOOOOOOOOOO",
+"OXXXXXXXXXXXXXO",
+"OXXXXXXXXXXXXXO",
+"OOOOOOOOOOOOOOO",
+};
+
+static struct hotspot bottom_side_hotspot = { 7, 14 };
diff --git a/cursor/fleur.xpm b/cursor/fleur.xpm
new file mode 100644
index 0000000..284a863
--- /dev/null
+++ b/cursor/fleur.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *fleur[] = {
+"16 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"______OOOO______",
+"______OXXOO_____",
+"_____OXXXXO_____",
+"____OXXXXXXO____",
+"___O_OOXXOO_O___",
+"__OXO_OXXO_OXO__",
+"OOXXOOOXXOOOXXOO",
+"OXXXXXXXXXXXXXXO",
+"OXXXXXXXXXXXXXXO",
+"OOXXOOOXXOOOXXOO",
+"__OXO_OXXO_OXO__",
+"___O_OOXXOO_O___",
+"____OXXXXXXO____",
+"_____OXXXXO_____",
+"______OXXO______",
+"______OOOO______",
+};
+
+static struct hotspot fleur_hotspot = { 8, 8 };
diff --git a/cursor/hand1.xpm b/cursor/hand1.xpm
new file mode 100644
index 0000000..bc1ac18
--- /dev/null
+++ b/cursor/hand1.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *hand1[] = {
+"13 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"__________OXX",
+"________OXXXX",
+"______OXXXXO_",
+"_____OXXXXO__",
+"____OXXXXO___",
+"___OXXXXXXO__",
+"_OOXXXXXXXXO_",
+"OXOXXXXXXXOO_",
+"XXXXXXXXXXXO_",
+"XOXXXXXXXXXO_",
+"OOOOXXXXXXO__",
+"OOOOXXXXXO___",
+"XOOXOXOOO____",
+"XXOOOXO______",
+"OXXOXO_______",
+"_OXXO________",
+};
+
+static struct hotspot hand1_hotspot = { 12, 0 };
diff --git a/cursor/left_ptr.xpm b/cursor/left_ptr.xpm
new file mode 100644
index 0000000..d69e86a
--- /dev/null
+++ b/cursor/left_ptr.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *left_ptr[] = {
+"10 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"OO________",
+"OXO_______",
+"OXXO______",
+"OXXXO_____",
+"OXXXXO____",
+"OXXXXXO___",
+"OXXXXXXO__",
+"OXXXXXXXO_",
+"OXXXXXXXXO",
+"OXXXXXOOOO",
+"OXXOXXO___",
+"OXO_OXXO__",
+"OO__OXXO__",
+"_____OXXO_",
+"_____OXXO_",
+"______OO__",
+};
+
+static struct hotspot left_ptr_hotspot = { 1, 1 };
diff --git a/cursor/left_side.xpm b/cursor/left_side.xpm
new file mode 100644
index 0000000..a7c9084
--- /dev/null
+++ b/cursor/left_side.xpm
@@ -0,0 +1,47 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *left_side[] = {
+"16 15 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"OOOO____________",
+"OXXO____________",
+"OXXO____OO______",
+"OXXO___OXO______",
+"OXXO__OXO_______",
+"OXXO_OXO________",
+"OXXOOXOOOOOOOOOO",
+"OXXOXXXXXXXXXXXO",
+"OXXOOXOOOOOOOOOO",
+"OXXO_OXO________",
+"OXXO__OXO_______",
+"OXXO___OXO______",
+"OXXO____OO______",
+"OXXO____________",
+"OOOO____________",
+};
+
+static struct hotspot left_side_hotspot = { 1, 7 };
diff --git a/cursor/right_side.xpm b/cursor/right_side.xpm
new file mode 100644
index 0000000..f0b654e
--- /dev/null
+++ b/cursor/right_side.xpm
@@ -0,0 +1,47 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *right_side[] = {
+"16 15 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"____________OOOO",
+"____________OXXO",
+"______OO____OXXO",
+"______OXO___OXXO",
+"_______OXO__OXXO",
+"________OXO_OXXO",
+"OOOOOOOOOOXOOXXO",
+"OXXXXXXXXXXXOXXO",
+"OOOOOOOOOOXOOXXO",
+"________OXO_OXXO",
+"_______OXO__OXXO",
+"______OXO___OXXO",
+"______OO____OXXO",
+"____________OXXO",
+"____________OOOO",
+};
+
+static struct hotspot right_side_hotspot = { 14, 7 };
diff --git a/cursor/top_left_corner.xpm b/cursor/top_left_corner.xpm
new file mode 100644
index 0000000..ed5ff3a
--- /dev/null
+++ b/cursor/top_left_corner.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *top_left_corner[] = {
+"16 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"OOOOOOOOOOOOOOOO",
+"OXXXXXXXXXXXXXXO",
+"OXXXXXXXXXXXXXXO",
+"OXXOOOOOOOOOOOOO",
+"OXXO____________",
+"OXXO_OOOOOOOOO__",
+"OXXO_OXXXXXXXO__",
+"OXXO_OXXOOOOOO__",
+"OXXO_OXOXO______",
+"OXXO_OXOOXO_____",
+"OXXO_OXO_OXO____",
+"OXXO_OXO__OXO___",
+"OXXO_OXO___OXO__",
+"OXXO_OOO____OO__",
+"OXXO____________",
+"OOOO____________",
+};
+
+static struct hotspot top_left_corner_hotspot = { 1, 1 };
diff --git a/cursor/top_right_corner.xpm b/cursor/top_right_corner.xpm
new file mode 100644
index 0000000..0622916
--- /dev/null
+++ b/cursor/top_right_corner.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *top_right_corner[] = {
+"16 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"OOOOOOOOOOOOOOOO",
+"OXXXXXXXXXXXXXXO",
+"OXXXXXXXXXXXXXXO",
+"OOOOOOOOOOOOOXXO",
+"____________OXXO",
+"__OOOOOOOOO_OXXO",
+"__OXXXXXXXO_OXXO",
+"__OOOOOOXXO_OXXO",
+"______OXOXO_OXXO",
+"_____OXOOXO_OXXO",
+"____OXO_OXO_OXXO",
+"___OXO__OXO_OXXO",
+"__OXO___OXO_OXXO",
+"__OO____OOO_OXXO",
+"____________OXXO",
+"____________OOOO",
+};
+
+static struct hotspot top_right_corner_hotspot = { 14, 1 };
diff --git a/cursor/top_side.xpm b/cursor/top_side.xpm
new file mode 100644
index 0000000..7a29dfc
--- /dev/null
+++ b/cursor/top_side.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *top_side[] = {
+"15 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"OOOOOOOOOOOOOOO",
+"OXXXXXXXXXXXXXO",
+"OXXXXXXXXXXXXXO",
+"OOOOOOOOOOOOOOO",
+"______OXO______",
+"_____OXXXO_____",
+"____OXOXOXO____",
+"___OXOOXOOXO___",
+"__OXO_OXO_OXO__",
+"__OO__OXO__OO__",
+"______OXO______",
+"______OXO______",
+"______OXO______",
+"______OXO______",
+"______OXO______",
+"______OOO______",
+};
+
+static struct hotspot top_side_hotspot = { 7, 1 };
diff --git a/cursor/watch.xpm b/cursor/watch.xpm
new file mode 100644
index 0000000..72a6fd2
--- /dev/null
+++ b/cursor/watch.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *watch[] = {
+"16 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"__OXXXXXXXXO____",
+"__OXXXXXXXXO____",
+"__OXXXXXXXXO____",
+"_OXXXXXXXXXXO___",
+"OXXOOOOXOOOXXO__",
+"XXOOOOOXOOOOXXOO",
+"XOOOOOOXOOOOOXXX",
+"XOOOOOXXXOOOOXXX",
+"XOOOOOXXXOOOOXXX",
+"XOOOOXOOOOOOOXXX",
+"XXOOXOOOOOOOXXOO",
+"OXXOOOOOOOOXXO__",
+"_OXXXXXXXXXXO___",
+"__OXXXXXXXXO____",
+"__OXXXXXXXXO____",
+"__OXXXXXXXXO____",
+};
+
+static struct hotspot watch_hotspot = { 15, 9 };
diff --git a/cursor/wayland-cursor.c b/cursor/wayland-cursor.c
index 186ab6f..fe4a9ab 100644
--- a/cursor/wayland-cursor.c
+++ b/cursor/wayland-cursor.c
@@ -181,6 +181,211 @@ wl_cursor_destroy(struct wl_cursor *cursor)
 	free(cursor);
 }
 
+static void
+read_xpm_color(uint32_t *ctable, const char *line)
+{
+	unsigned char key;
+	char cstr[10];
+	char *end;
+	uint32_t value;
+
+	if (sscanf(line, "%1c c %9s", &key, cstr) < 2) {
+		fprintf(stderr, "error in XPM color definition '%s'\n", line);
+		return;
+	}
+
+	value = strtol(&cstr[1], &end, 16);
+
+	if (strcmp(cstr, "None") == 0) {
+		ctable[key] = 0x00000000;
+	} else if (cstr[0] != '#' || !(cstr[1] != '\0' && *end == '\0')) {
+		fprintf(stderr, "error interpreting XPM color '%s'\n", cstr);
+		return;
+	} else {
+		ctable[key] = value | 0xff000000;
+	}
+}
+
+static void
+read_xpm_row(char *data, const char *line, uint32_t *ctable, int width)
+{
+	uint32_t *pixel = (uint32_t *)data;
+	uint8_t *p = (uint8_t *)line;
+	int i;
+
+	for (i = 0; i < width; ++i)
+		pixel[i] = ctable[p[i]];
+}
+
+static void
+read_xpm_into_image(struct cursor_image *image, char **xpm_data)
+{
+	int colors;
+	int cpp;
+	int i;
+	int size, stride;
+	uint32_t ctable[256] = { 0 };
+	struct wl_cursor_theme *theme = image->theme;
+
+	if (sscanf(xpm_data[0], "%d %d %d %d", &image->image.width,
+		   &image->image.height, &colors, &cpp) < 4) {
+		fprintf(stderr, "error processing XPM data.\n");
+		return;
+	}
+
+	if (image->image.width < 1 || image->image.height < 1 || cpp != 1) {
+		fprintf(stderr, "error processing XPM data.\n");
+		return;
+	}
+
+	stride = image->image.width * 4;
+	size = stride * image->image.height;
+	image->offset = shm_pool_allocate(theme->pool, size);
+
+	for (i = 0; i < colors; ++i)
+		read_xpm_color(ctable, xpm_data[i + 1]);
+
+	for (i = 0; i < (int) image->image.height; ++i)
+		read_xpm_row(theme->pool->data + image->offset + i * stride,
+			     xpm_data[i + colors + 1], ctable,
+			     image->image.width);
+}
+
+struct hotspot {
+	int x, y;
+};
+
+#include "bottom_left_corner.xpm"
+#include "bottom_right_corner.xpm"
+#include "bottom_side.xpm"
+#include "fleur.xpm"
+#include "left_ptr.xpm"
+#include "left_side.xpm"
+#include "right_side.xpm"
+#include "top_left_corner.xpm"
+#include "top_right_corner.xpm"
+#include "top_side.xpm"
+#include "xterm.xpm"
+#include "hand1.xpm"
+#include "watch.xpm"
+
+static struct wl_cursor *
+wl_cursor_create_from_xpm(char *name, char **xpm, struct hotspot *hotspot,
+			  struct wl_cursor_theme *theme)
+{
+	struct cursor *cursor;
+	struct cursor_image *image;
+
+	cursor = malloc(sizeof *cursor);
+	if (!cursor)
+		return NULL;
+
+	cursor->cursor.image_count = 1;
+	cursor->cursor.images = malloc(sizeof *cursor->cursor.images);
+	if (!cursor->cursor.images) {
+		free(cursor);
+		return NULL;
+	}
+
+	cursor->cursor.name = strdup(name);
+	cursor->total_delay = 0;
+
+	image = malloc(sizeof *image);
+	if (!image) {
+		free(cursor->cursor.name);
+		free(cursor->cursor.images);
+		free(cursor);
+		return NULL;
+	}
+
+	cursor->cursor.images[0] = (struct wl_cursor_image *) image;
+	image->theme = theme;
+	image->buffer = NULL;
+	image->image.hotspot_x = hotspot->x;
+	image->image.hotspot_y = hotspot->y;
+	image->image.delay = 0;
+
+	read_xpm_into_image(image, xpm);
+
+	return &cursor->cursor;
+}
+
+static void
+load_default_theme(struct wl_cursor_theme *theme)
+{
+	free(theme->name);
+	theme->name = strdup("default");
+
+	theme->cursor_count = 13;
+	theme->cursors = malloc(13 * sizeof(*theme->cursors));
+
+	theme->cursors[0] =
+		wl_cursor_create_from_xpm("bottom_left_corner",
+					  bottom_left_corner,
+					  &bottom_left_corner_hotspot,
+					  theme);
+	theme->cursors[1] =
+		wl_cursor_create_from_xpm("bottom_right_corner",
+					  bottom_right_corner,
+					  &bottom_right_corner_hotspot,
+					  theme);
+	theme->cursors[2] =
+		wl_cursor_create_from_xpm("bottom_side",
+					  bottom_side,
+					  &bottom_side_hotspot,
+					  theme);
+	theme->cursors[3] =
+		wl_cursor_create_from_xpm("grabbing",
+					  fleur,
+					  &fleur_hotspot,
+					  theme);
+	theme->cursors[4] =
+		wl_cursor_create_from_xpm("left_ptr",
+					  left_ptr,
+					  &left_ptr_hotspot,
+					  theme);
+	theme->cursors[5] =
+		wl_cursor_create_from_xpm("left_side",
+					  left_side,
+					  &left_side_hotspot,
+					  theme);
+	theme->cursors[6] =
+		wl_cursor_create_from_xpm("right_side",
+					  right_side,
+					  &right_side_hotspot,
+					  theme);
+	theme->cursors[7] =
+		wl_cursor_create_from_xpm("top_left_corner",
+					  top_left_corner,
+					  &top_left_corner_hotspot,
+					  theme);
+	theme->cursors[8] =
+		wl_cursor_create_from_xpm("top_right_corner",
+					  top_right_corner,
+					  &top_right_corner_hotspot,
+					  theme);
+	theme->cursors[9] =
+		wl_cursor_create_from_xpm("top_side",
+					  top_side,
+					  &top_side_hotspot,
+					  theme);
+	theme->cursors[10] =
+		wl_cursor_create_from_xpm("xterm",
+					  xterm,
+					  &xterm_hotspot,
+					  theme);
+	theme->cursors[11] =
+		wl_cursor_create_from_xpm("hand1",
+					  hand1,
+					  &hand1_hotspot,
+					  theme);
+	theme->cursors[12] =
+		wl_cursor_create_from_xpm("watch",
+					  watch,
+					  &watch_hotspot,
+					  theme);
+}
+
 static struct wl_cursor *
 wl_cursor_create_from_xcursor_images(XcursorImages *images,
 				     struct wl_cursor_theme *theme)
@@ -261,7 +466,8 @@ load_callback(XcursorImages *images, void *data)
  * \param shm The compositor's shm interface.
  *
  * \return An object representing the theme that should be destroyed with
- * wl_cursor_theme_destroy() or %NULL on error.
+ * wl_cursor_theme_destroy() or %NULL on error. If no theme with the given
+ * name exists, a default theme will be loaded.
  */
 WL_EXPORT struct wl_cursor_theme *
 wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm)
@@ -290,6 +496,9 @@ wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm)
 
 	xcursor_load_theme(name, size, load_callback, theme);
 
+	if (theme->cursor_count == 0)
+		load_default_theme(theme);
+
 	return theme;
 }
 
diff --git a/cursor/xterm.xpm b/cursor/xterm.xpm
new file mode 100644
index 0000000..ed1451d
--- /dev/null
+++ b/cursor/xterm.xpm
@@ -0,0 +1,48 @@
+/*
+* Copyright 1999 SuSE, Inc.
+*
+* Permission to use, copy, modify, distribute, and sell this software and its
+* documentation for any purpose is hereby granted without fee, provided that
+* the above copyright notice appear in all copies and that both that
+* copyright notice and this permission notice appear in supporting
+* documentation, and that the name of SuSE not be used in advertising or
+* publicity pertaining to distribution of the software without specific,
+* written prior permission.  SuSE makes no representations about the
+* suitability of this software for any purpose.  It is provided "as is"
+* without express or implied warranty.
+*
+* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Author:  Keith Packard, SuSE, Inc.
+*/
+
+/* XPM */
+static char *xterm[] = {
+"9 16 3 1",
+"_ c None",
+"X c #000000",
+"O c #ffffff",
+"OOOO_OOOO",
+"OXXXOXXXO",
+"OOOXXXOOO",
+"__OOXOO__",
+"___OXO___",
+"___OXO___",
+"___OXO___",
+"___OXO___",
+"___OXO___",
+"___OXO___",
+"___OXO___",
+"___OXO___",
+"__OOXOO__",
+"OOOXXXOOO",
+"OXXXOXXXO",
+"OOOO_OOOO",
+};
+
+static struct hotspot xterm_hotspot = { 4, 8 };
-- 
1.7.12



More information about the wayland-devel mailing list