summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-03-25 16:56:47 +0000
committerDana Jansens <danakj@orodu.net>2007-03-25 16:56:47 +0000
commitc567f5937b09708848c6b83c29f808f3d44145cc (patch)
tree41b15f9fe65e093fc561a2e1ad416656d816d6ff /openbox
parent59c5d1cc4e9d149510c62af16354ebd172452f48 (diff)
add support for the X Cursor library. this means a nicer cursor for startup notification.
Diffstat (limited to 'openbox')
-rw-r--r--openbox/openbox.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/openbox/openbox.c b/openbox/openbox.c
index 4a15edd6..c24ed76a 100644
--- a/openbox/openbox.c
+++ b/openbox/openbox.c
@@ -70,6 +70,9 @@
#include <errno.h>
#include <X11/cursorfont.h>
+#if USE_XCURSOR
+#include <X11/Xcursor/Xcursor.h>
+#endif
RrInstance *ob_rr_inst;
RrTheme *ob_rr_theme;
@@ -91,6 +94,7 @@ static gboolean being_replaced = FALSE;
static void signal_handler(gint signal, gpointer data);
static void parse_args(gint argc, gchar **argv);
+static Cursor load_cursor(const gchar *name, guint fontval);
gint main(gint argc, gchar **argv)
{
@@ -174,28 +178,21 @@ gint main(gint argc, gchar **argv)
/* create available cursors */
cursors[OB_CURSOR_NONE] = None;
- cursors[OB_CURSOR_POINTER] =
- XCreateFontCursor(ob_display, XC_left_ptr);
- cursors[OB_CURSOR_BUSY] =
- XCreateFontCursor(ob_display, XC_watch);
- cursors[OB_CURSOR_MOVE] =
- XCreateFontCursor(ob_display, XC_fleur);
- cursors[OB_CURSOR_NORTH] =
- XCreateFontCursor(ob_display, XC_top_side);
- cursors[OB_CURSOR_NORTHEAST] =
- XCreateFontCursor(ob_display, XC_top_right_corner);
- cursors[OB_CURSOR_EAST] =
- XCreateFontCursor(ob_display, XC_right_side);
- cursors[OB_CURSOR_SOUTHEAST] =
- XCreateFontCursor(ob_display, XC_bottom_right_corner);
- cursors[OB_CURSOR_SOUTH] =
- XCreateFontCursor(ob_display, XC_bottom_side);
- cursors[OB_CURSOR_SOUTHWEST] =
- XCreateFontCursor(ob_display, XC_bottom_left_corner);
- cursors[OB_CURSOR_WEST] =
- XCreateFontCursor(ob_display, XC_left_side);
- cursors[OB_CURSOR_NORTHWEST] =
- XCreateFontCursor(ob_display, XC_top_left_corner);
+ cursors[OB_CURSOR_POINTER] = load_cursor("left_ptr", XC_left_ptr);
+ cursors[OB_CURSOR_BUSY] = load_cursor("left_ptr_watch", XC_watch);
+ cursors[OB_CURSOR_MOVE] = load_cursor("fleur", XC_fleur);
+ cursors[OB_CURSOR_NORTH] = load_cursor("top_side", XC_top_side);
+ cursors[OB_CURSOR_NORTHEAST] = load_cursor("top_right_corner",
+ XC_top_right_corner);
+ cursors[OB_CURSOR_EAST] = load_cursor("right_side", XC_right_side);
+ cursors[OB_CURSOR_SOUTHEAST] = load_cursor("bottom_right_corner",
+ XC_bottom_right_corner);
+ cursors[OB_CURSOR_SOUTH] = load_cursor("bottom_side", XC_bottom_side);
+ cursors[OB_CURSOR_SOUTHWEST] = load_cursor("bottom_left_corner",
+ XC_bottom_left_corner);
+ cursors[OB_CURSOR_WEST] = load_cursor("left_side", XC_left_side);
+ cursors[OB_CURSOR_NORTHWEST] = load_cursor("top_left_corner",
+ XC_top_left_corner);
/* create available keycodes */
keys[OB_KEY_RETURN] =
@@ -440,6 +437,18 @@ static void parse_args(gint argc, gchar **argv)
}
}
+static Cursor load_cursor(const gchar *name, guint fontval)
+{
+ Cursor c = None;
+
+#if USE_XCURSOR
+ c = XcursorLibraryLoadCursor(ob_display, name);
+#endif
+ if (c == None)
+ XCreateFontCursor(ob_display, fontval);
+ return c;
+}
+
void ob_exit_with_error(const gchar *msg)
{
g_critical(msg);