diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-10-31 20:13:47 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-10-31 20:13:47 +0000 |
commit | 0aea447cde00cd16718571f752213425ba2b2d23 (patch) | |
tree | dabbacc14acca649cd9f473c05b3acbb09469ad8 /app/xsetroot/xsetroot.c | |
parent | b4b222f5690d09162974693850b424987ea59453 (diff) |
Update to xsetroot 1.1.0
Diffstat (limited to 'app/xsetroot/xsetroot.c')
-rw-r--r-- | app/xsetroot/xsetroot.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/app/xsetroot/xsetroot.c b/app/xsetroot/xsetroot.c index 27db7f2b9..31233d9f5 100644 --- a/app/xsetroot/xsetroot.c +++ b/app/xsetroot/xsetroot.c @@ -1,5 +1,4 @@ /* - * $Xorg: xsetroot.c,v 1.4 2001/02/09 02:05:59 xorgcvs Exp $ * Copyright 1987, 1998 The Open Group @@ -32,12 +31,12 @@ in this Software without prior written authorization from The Open Group. * Author: Mark Lillibridge, MIT Project Athena * 11-Jun-87 */ -/* $XFree86: xc/programs/xsetroot/xsetroot.c,v 1.7 2001/04/01 14:00:24 tsi Exp $ */ #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xatom.h> #include <X11/Xmu/CurUtil.h> +#include <X11/Xcursor/Xcursor.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -81,6 +80,7 @@ usage(void) fprintf(stderr, " -name <string>\n"); fprintf(stderr, " -cursor <cursor file> <mask file>\n"); fprintf(stderr, " -cursor_name <cursor-font name>\n"); + fprintf(stderr, " -xcf <ARGB cursor file> <cursor size>\n"); fprintf(stderr, " -solid <color>\n"); fprintf(stderr, " -gray or -grey\n"); fprintf(stderr, " -bitmap <filename>\n"); @@ -102,6 +102,8 @@ main(int argc, char *argv[]) char *cursor_mask = NULL; char *cursor_name = NULL; char *solid_color = NULL; + char *xcf = NULL; + int xcf_size = 32; Cursor cursor; int gray = 0; char *bitmap_file = NULL; @@ -146,6 +148,16 @@ main(int argc, char *argv[]) nonexcl++; continue; } + if (!strcmp("-xcf", argv[i])) { + if (++i>=argc) usage(); + xcf = argv[i]; + if (++i>=argc) usage(); + xcf_size = atoi(argv[i]); + if (xcf_size <= 0) + xcf_size = 32; + nonexcl++; + continue; + } if (!strcmp("-fg",argv[i]) || !strcmp("-foreground",argv[i])) { if (++i>=argc) usage(); fore_color = argv[i]; @@ -225,6 +237,19 @@ main(int argc, char *argv[]) XFreeCursor (dpy, cursor); } } + if (xcf) { + XcursorImages *images = XcursorFilenameLoadImages(xcf, xcf_size); + if (!images) { + fprintf(stderr, "Invalid cursor file \"%s\"\n", xcf); + } else { + cursor = XcursorImagesLoadCursor(dpy, images); + if (cursor) + { + XDefineCursor (dpy, root, cursor); + XFreeCursor (dpy, cursor); + } + } + } /* Handle -gray and -grey options */ if (gray) { bitmap = XCreateBitmapFromData(dpy, root, gray_bits, |