Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37899102
en ru br
ALT Linux repos
S:1.1.2-alt1
5.0: 1.0.2-alt1
4.1: 1.0.2-alt1
4.0: 1.0.1-alt1

Group :: System/X11
RPM: xsetroot

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

pax_global_header00006660000000000000000000000064114630640510014512gustar00rootroot0000000000000052 comment=0c55a8f8edabef5ccd9930048df7d3aecd551d54
xsetroot-1.1.0/000075500000000000000000000000001146306405100133765ustar00rootroot00000000000000xsetroot-1.1.0/.gitignore000064400000000000000000000017621146306405100153740ustar00rootroot00000000000000#
# X.Org module default exclusion patterns
# The next section if for module specific patterns
#
# Do not edit the following section
# GNU Build System (Autotools)
aclocal.m4
autom4te.cache/
autoscan.log
ChangeLog
compile
config.guess
config.h
config.h.in
config.log
config-ml.in
config.py
config.status
config.status.lineno
config.sub
configure
configure.scan
depcomp
.deps/
INSTALL
install-sh
.libs/
libtool
libtool.m4
ltmain.sh
lt~obsolete.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
Makefile
Makefile.in
mdate-sh
missing
mkinstalldirs
*.pc
py-compile
stamp-h?
symlink-tree
texinfo.tex
ylwrap

# Do not edit the following section
# Edit Compile Debug Document Distribute
*~
*.[0-9]
*.[0-9]x
*.bak
*.bin
core
*.dll
*.exe
*-ISO*.bdf
*-JIS*.bdf
*-KOI8*.bdf
*.kld
*.ko
*.ko.cmd
*.lai
*.l[oa]
*.[oa]
*.obj
*.patch
*.so
*.pcf.gz
*.pdb
*.tar.bz2
*.tar.gz
#
# Add & Override patterns for xsetroot
#
# Edit the following section as needed
# For example, !report.pc overrides *.pc. See 'man gitignore'
#
xsetroot
xsetroot-1.1.0/COPYING000064400000000000000000000021661146306405100144360ustar00rootroot00000000000000Copyright 1987, 1988, 1998 The Open Group

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.

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
xsetroot-1.1.0/Makefile.am000064400000000000000000000036651146306405100154440ustar00rootroot00000000000000#
# Copyright 2005 Red Hat, 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 Red Hat not be used in
# advertising or publicity pertaining to distribution of the software without
# specific, written prior permission. Red Hat makes no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
#
# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL RED HAT 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.

bin_PROGRAMS = xsetroot

AM_CFLAGS = $(CWARNFLAGS) $(XSETROOT_CFLAGS)
xsetroot_LDADD = $(XSETROOT_LIBS)

xsetroot_SOURCES = \
xsetroot.c

appman_PRE = \
xsetroot.man


appmandir = $(APP_MAN_DIR)

appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)

EXTRA_DIST = $(appman_PRE)
MAINTAINERCLEANFILES = ChangeLog INSTALL
CLEANFILES = $(appman_DATA)


.PHONY: ChangeLog INSTALL

INSTALL:
$(INSTALL_CMD)

ChangeLog:
$(CHANGELOG_CMD)

dist-hook: ChangeLog INSTALL

SUFFIXES = .$(APP_MAN_SUFFIX) .man

# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
.man.$(APP_MAN_SUFFIX):
$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@

if LINT
ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS)
lint:
$(LINT) $(ALL_LINT_FLAGS) $(xsetroot_SOURCES)
endif LINT
xsetroot-1.1.0/README000064400000000000000000000012601146306405100142550ustar00rootroot00000000000000xsetroot - root window parameter setting utility for X

All questions regarding this software should be directed at the
Xorg mailing list:

http://lists.freedesktop.org/mailman/listinfo/xorg

Please submit bug reports to the Xorg bugzilla:

https://bugs.freedesktop.org/enter_bug.cgi?product=xorg

The master development code repository can be found at:

git://anongit.freedesktop.org/git/xorg/app/xsetroot

http://cgit.freedesktop.org/xorg/app/xsetroot

For patch submission instructions, see:

http://www.x.org/wiki/Development/Documentation/SubmittingPatches

For more information on the git code manager, see:

http://wiki.x.org/wiki/GitPage

xsetroot-1.1.0/autogen.sh000075500000000000000000000003041146306405100153740ustar00rootroot00000000000000#! /bin/sh

srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.

ORIGDIR=`pwd`
cd $srcdir

autoreconf -v --install || exit 1
cd $ORIGDIR || exit $?

$srcdir/configure --enable-maintainer-mode "$@"

xsetroot-1.1.0/configure.ac000064400000000000000000000034301146306405100156640ustar00rootroot00000000000000
dnl Copyright 2005 Red Hat, Inc.
dnl
dnl Permission to use, copy, modify, distribute, and sell this software and its
dnl documentation for any purpose is hereby granted without fee, provided that
dnl the above copyright notice appear in all copies and that both that
dnl copyright notice and this permission notice appear in supporting
dnl documentation, and that the name of Red Hat not be used in
dnl advertising or publicity pertaining to distribution of the software without
dnl specific, written prior permission. Red Hat makes no
dnl representations about the suitability of this software for any purpose. It
dnl is provided "as is" without express or implied warranty.
dnl
dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dnl PERFORMANCE OF THIS SOFTWARE.
dnl
dnl Process this file with autoconf to create configure.

AC_PREREQ([2.60])
AC_INIT([xsetroot], [1.1.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xsetroot])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE

# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
m4_ifndef([XORG_MACROS_VERSION],
[m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.8)

AM_CONFIG_HEADER(config.h)

XORG_DEFAULT_OPTIONS

# Checks for pkg-config packages
PKG_CHECK_MODULES(XSETROOT, xmuu x11 xbitmaps xcursor)

XORG_WITH_LINT

AC_OUTPUT([Makefile])
xsetroot-1.1.0/xsetroot.c000064400000000000000000000344071146306405100154410ustar00rootroot00000000000000/*
*
Copyright 1987, 1998 The Open Group

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.

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/

/*
* xsetroot.c MIT Project Athena, X Window System root window
* parameter setting utility. This program will set
* various parameters of the X root window.
*
* Author: Mark Lillibridge, MIT Project Athena
* 11-Jun-87
*/

#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>
#include "X11/bitmaps/gray"

#define Dynamic 1

static char *program_name;
static Display *dpy;
static int screen;
static Window root;
static char *fore_color = NULL;
static char *back_color = NULL;
static int reverse = 0;
static int save_colors = 0;
static int unsave_past = 0;
static Pixmap save_pixmap = (Pixmap)None;

static void usage(void);
static void FixupState(void);
static void SetBackgroundToBitmap(Pixmap bitmap,
unsigned int width, unsigned int height);
static Cursor CreateCursorFromFiles(char *cursor_file, char *mask_file);
static Cursor CreateCursorFromName(char *name);
static Pixmap MakeModulaBitmap(int mod_x, int mod_y);
static XColor NameToXColor(char *name, unsigned long pixel);
static unsigned long NameToPixel(char *name, unsigned long pixel);
static Pixmap ReadBitmapFile(char *filename, unsigned int *width, unsigned int *height, int *x_hot, int *y_hot);

static void
usage(void)
{
fprintf(stderr, "usage: %s [options]\n", program_name);
fprintf(stderr, " where options are:\n");
fprintf(stderr, " -display <display> or -d <display>\n");
fprintf(stderr, " -fg <color> or -foreground <color>\n");
fprintf(stderr, " -bg <color> or -background <color>\n");
fprintf(stderr, " -rv or -reverse\n");
fprintf(stderr, " -help\n");
fprintf(stderr, " -def or -default\n");
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");
fprintf(stderr, " -mod <x> <y>\n");
exit(1);
/*NOTREACHED*/
}


int
main(int argc, char *argv[])
{
int excl = 0;
int nonexcl = 0;
int restore_defaults = 0;
char *display_name = NULL;
char *name = NULL;
char *cursor_file = NULL;
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;
int mod_x = 0;
int mod_y = 0;
register int i;
unsigned int ww, hh;
Pixmap bitmap;

program_name=argv[0];

for (i = 1; i < argc; i++) {
if (!strcmp ("-display", argv[i]) || !strcmp ("-d", argv[i])) {
if (++i>=argc) usage ();
display_name = argv[i];
continue;
}
if (!strcmp("-help", argv[i])) {
usage();
}
if (!strcmp("-def", argv[i]) || !strcmp("-default", argv[i])) {
restore_defaults = 1;
continue;
}
if (!strcmp("-name", argv[i])) {
if (++i>=argc) usage();
name = argv[i];
nonexcl++;
continue;
}
if (!strcmp("-cursor", argv[i])) {
if (++i>=argc) usage();
cursor_file = argv[i];
if (++i>=argc) usage();
cursor_mask = argv[i];
nonexcl++;
continue;
}
if (!strcmp("-cursor_name", argv[i])) {
if (++i>=argc) usage();
cursor_name = argv[i];
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];
continue;
}
if (!strcmp("-bg",argv[i]) || !strcmp("-background",argv[i])) {
if (++i>=argc) usage();
back_color = argv[i];
continue;
}
if (!strcmp("-solid", argv[i])) {
if (++i>=argc) usage();
solid_color = argv[i];
excl++;
continue;
}
if (!strcmp("-gray", argv[i]) || !strcmp("-grey", argv[i])) {
gray = 1;
excl++;
continue;
}
if (!strcmp("-bitmap", argv[i])) {
if (++i>=argc) usage();
bitmap_file = argv[i];
excl++;
continue;
}
if (!strcmp("-mod", argv[i])) {
if (++i>=argc) usage();
mod_x = atoi(argv[i]);
if (mod_x <= 0) mod_x = 1;
if (++i>=argc) usage();
mod_y = atoi(argv[i]);
if (mod_y <= 0) mod_y = 1;
excl++;
continue;
}
if (!strcmp("-rv",argv[i]) || !strcmp("-reverse",argv[i])) {
reverse = 1;
continue;
}
usage();
}

/* Check for multiple use of exclusive options */
if (excl > 1) {
fprintf(stderr, "%s: choose only one of {solid, gray, bitmap, mod}\n",
program_name);
usage();
}

dpy = XOpenDisplay(display_name);
if (!dpy) {
fprintf(stderr, "%s: unable to open display '%s'\n",
program_name, XDisplayName (display_name));
exit (2);
}
screen = DefaultScreen(dpy);
root = RootWindow(dpy, screen);

/* If there are no arguments then restore defaults. */
if (!excl && !nonexcl)
restore_defaults = 1;

/* Handle a cursor file */
if (cursor_file) {
cursor = CreateCursorFromFiles(cursor_file, cursor_mask);
XDefineCursor(dpy, root, cursor);
XFreeCursor(dpy, cursor);
}

if (cursor_name) {
cursor = CreateCursorFromName (cursor_name);
if (cursor)
{
XDefineCursor (dpy, root, cursor);
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,
gray_width, gray_height);
SetBackgroundToBitmap(bitmap, gray_width, gray_height);
}

/* Handle -solid option */
if (solid_color) {
XSetWindowBackground(dpy, root, NameToPixel(solid_color,
BlackPixel(dpy, screen)));
XClearWindow(dpy, root);
unsave_past = 1;
}

/* Handle -bitmap option */
if (bitmap_file) {
bitmap = ReadBitmapFile(bitmap_file, &ww, &hh, (int *)NULL, (int *)NULL);
SetBackgroundToBitmap(bitmap, ww, hh);
}

/* Handle set background to a modula pattern */
if (mod_x) {
bitmap = MakeModulaBitmap(mod_x, mod_y);
SetBackgroundToBitmap(bitmap, 16, 16);
}

/* Handle set name */
if (name)
XStoreName(dpy, root, name);

/* Handle restore defaults */
if (restore_defaults) {
if (!cursor_file)
XUndefineCursor(dpy, root);
if (!excl) {
XSetWindowBackgroundPixmap(dpy, root, (Pixmap) None);
XClearWindow(dpy, root);
unsave_past = 1;
}
}

FixupState();
XCloseDisplay(dpy);
exit (0);
}


/* Free past incarnation if needed, and retain state if needed. */
static void
FixupState(void)
{
Atom prop, type;
int format;
unsigned long length, after;
unsigned char *data;

if (!(DefaultVisual(dpy, screen)->class & Dynamic))
unsave_past = 0;
if (!unsave_past && !save_colors)
return;
prop = XInternAtom(dpy, "_XSETROOT_ID", False);
if (unsave_past) {
(void)XGetWindowProperty(dpy, root, prop, 0L, 1L, True, AnyPropertyType,
&type, &format, &length, &after, &data);
if ((type == XA_PIXMAP) && (format == 32) &&
(length == 1) && (after == 0))
XKillClient(dpy, *((Pixmap *)data));
else if (type != None)
fprintf(stderr, "%s: warning: _XSETROOT_ID property is garbage\n",
program_name);
}
if (save_colors) {
if (!save_pixmap)
save_pixmap = XCreatePixmap(dpy, root, 1, 1, 1);
XChangeProperty(dpy, root, prop, XA_PIXMAP, 32, PropModeReplace,
(unsigned char *) &save_pixmap, 1);
XSetCloseDownMode(dpy, RetainPermanent);
}
}

/*
* SetBackgroundToBitmap: Set the root window background to a caller supplied
* bitmap.
*/
static void
SetBackgroundToBitmap(Pixmap bitmap, unsigned int width, unsigned int height)
{
Pixmap pix;
GC gc;
XGCValues gc_init;

gc_init.foreground = NameToPixel(fore_color, BlackPixel(dpy, screen));
gc_init.background = NameToPixel(back_color, WhitePixel(dpy, screen));
if (reverse) {
unsigned long temp=gc_init.foreground;
gc_init.foreground=gc_init.background;
gc_init.background=temp;
}
gc = XCreateGC(dpy, root, GCForeground|GCBackground, &gc_init);
pix = XCreatePixmap(dpy, root, width, height,
(unsigned int)DefaultDepth(dpy, screen));
XCopyPlane(dpy, bitmap, pix, gc, 0, 0, width, height, 0, 0, (unsigned long)1);
XSetWindowBackgroundPixmap(dpy, root, pix);
XFreeGC(dpy, gc);
XFreePixmap(dpy, bitmap);
if (save_colors)
save_pixmap = pix;
else
XFreePixmap(dpy, pix);
XClearWindow(dpy, root);
unsave_past = 1;
}


/*
* CreateCursorFromFiles: make a cursor of the right colors from two bitmap
* files.
*/
#define BITMAP_HOT_DEFAULT 8

static Cursor
CreateCursorFromFiles(char *cursor_file, char *mask_file)
{
Pixmap cursor_bitmap, mask_bitmap;
unsigned int width, height, ww, hh;
int x_hot, y_hot;
Cursor cursor;
XColor fg, bg, temp;

fg = NameToXColor(fore_color, BlackPixel(dpy, screen));
bg = NameToXColor(back_color, WhitePixel(dpy, screen));
if (reverse) {
temp = fg; fg = bg; bg = temp;
}

cursor_bitmap = ReadBitmapFile(cursor_file, &width, &height, &x_hot, &y_hot);
mask_bitmap = ReadBitmapFile(mask_file, &ww, &hh, (int *)NULL, (int *)NULL);

if (width != ww || height != hh) {
fprintf(stderr,
"%s: dimensions of cursor bitmap and cursor mask bitmap are different\n",
program_name);
exit(1);
/*NOTREACHED*/
}

if ((x_hot == -1) && (y_hot == -1)) {
x_hot = BITMAP_HOT_DEFAULT;
y_hot = BITMAP_HOT_DEFAULT;
}
if ((x_hot < 0) || (x_hot >= width) ||
(y_hot < 0) || (y_hot >= height)) {
fprintf(stderr, "%s: hotspot is outside cursor bounds\n", program_name);
exit(1);
/*NOTREACHED*/
}

cursor = XCreatePixmapCursor(dpy, cursor_bitmap, mask_bitmap, &fg, &bg,
(unsigned int)x_hot, (unsigned int)y_hot);
XFreePixmap(dpy, cursor_bitmap);
XFreePixmap(dpy, mask_bitmap);

return(cursor);
}

static Cursor
CreateCursorFromName(char *name)
{
XColor fg, bg, temp;
int i;
Font fid;

fg = NameToXColor(fore_color, BlackPixel(dpy, screen));
bg = NameToXColor(back_color, WhitePixel(dpy, screen));
if (reverse) {
temp = fg; fg = bg; bg = temp;
}
i = XmuCursorNameToIndex (name);
if (i == -1)
return (Cursor) 0;
fid = XLoadFont (dpy, "cursor");
if (!fid)
return (Cursor) 0;
return XCreateGlyphCursor (dpy, fid, fid,
i, i+1, &fg, &bg);
}

/*
* MakeModulaBitmap: Returns a modula bitmap based on an x & y mod.
*/
static Pixmap
MakeModulaBitmap(int mod_x, int mod_y)
{
int i;
long pattern_line = 0;
char modula_data[16*16/8];

for (i=16; i--; ) {
pattern_line <<=1;
if ((i % mod_x) == 0) pattern_line |= 0x0001;
}
for (i=0; i<16; i++) {
if ((i % mod_y) == 0) {
modula_data[i*2] = (char)0xff;
modula_data[i*2+1] = (char)0xff;
} else {
modula_data[i*2] = pattern_line & 0xff;
modula_data[i*2+1] = (pattern_line>>8) & 0xff;
}
}

return(XCreateBitmapFromData(dpy, root, modula_data, 16, 16));
}


/*
* NameToXColor: Convert the name of a color to its Xcolor value.
*/
static XColor
NameToXColor(char *name, unsigned long pixel)
{
XColor c;

if (!name || !*name) {
c.pixel = pixel;
XQueryColor(dpy, DefaultColormap(dpy, screen), &c);
} else if (!XParseColor(dpy, DefaultColormap(dpy, screen), name, &c)) {
fprintf(stderr, "%s: unknown color or bad color format: %s\n",
program_name, name);
exit(1);
/*NOTREACHED*/
}
return(c);
}

static unsigned long
NameToPixel(char *name, unsigned long pixel)
{
XColor ecolor;

if (!name || !*name)
return pixel;
if (!XParseColor(dpy,DefaultColormap(dpy,screen),name,&ecolor)) {
fprintf(stderr,"%s: unknown color \"%s\"\n",program_name,name);
exit(1);
/*NOTREACHED*/
}
if (!XAllocColor(dpy, DefaultColormap(dpy, screen),&ecolor)) {
fprintf(stderr, "%s: unable to allocate color for \"%s\"\n",
program_name, name);
exit(1);
/*NOTREACHED*/
}
if ((ecolor.pixel != BlackPixel(dpy, screen)) &&
(ecolor.pixel != WhitePixel(dpy, screen)) &&
(DefaultVisual(dpy, screen)->class & Dynamic))
save_colors = 1;
return(ecolor.pixel);
}

static Pixmap
ReadBitmapFile(char *filename, unsigned int *width, unsigned int *height,
int *x_hot, int *y_hot)
{
Pixmap bitmap;
int status;

status = XReadBitmapFile(dpy, root, filename, width,
height, &bitmap, x_hot, y_hot);
if (status == BitmapSuccess)
return(bitmap);
else if (status == BitmapOpenFailed)
fprintf(stderr, "%s: can't open file: %s\n", program_name, filename);
else if (status == BitmapFileInvalid)
fprintf(stderr, "%s: bad bitmap format file: %s\n",
program_name, filename);
else
fprintf(stderr, "%s: insufficient memory for bitmap: %s",
program_name, filename);
exit(1);
/*NOTREACHED*/
}
xsetroot-1.1.0/xsetroot.man000064400000000000000000000116211146306405100157630ustar00rootroot00000000000000.\" Copyright 1988, 1998 The Open Group
.\"
.\" 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.
.\"
.\" The above copyright notice and this permission notice shall be included
.\" in all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
.\" OTHER DEALINGS IN THE SOFTWARE.
.\"
.\" Except as contained in this notice, the name of The Open Group shall
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
.\"
.TH XSETROOT 1 __xorgversion__
.SH NAME
xsetroot \- root window parameter setting utility for X
.SH SYNOPSIS
.B xsetroot
[-help] [-def] [-display \fIdisplay\fP]
[-cursor \fIcursorfile maskfile\fP]
[-cursor_name \fIcursorname\fP]
[-xcf \fIcursorfile\fP \fIcursorsize\fP]
[-bitmap \fIfilename\fP]
[-mod \fIx y\fP] [-gray] [-grey] [-fg \fIcolor\fP] [-bg \fIcolor\fP] [-rv]
[-solid \fIcolor\fP] [-name \fIstring\fP]
.SH DESCRIPTION
The
.I xsetroot
program
allows you to tailor the appearance of the background ("root")
window on a workstation display running X. Normally, you experiment with
.I xsetroot
until you find a personalized look that you like, then put the
.I xsetroot
command that produces it into your X startup file.
If no options are specified, or if
.I -def
is specified, the window is reset to its default state. The
.I -def
option can be specified along with other options and only the non-specified
characteristics will be reset to the default state.
.PP
Only one of the background color/tiling changing options
(-solid, -gray, -grey, -bitmap, and -mod) may be specified at a time.
.SH OPTIONS
.PP
The various options are as follows:
.IP \fB-help\fP
Print a usage message and exit.
.IP \fB-def\fP
Reset unspecified attributes to the default values. (Restores the background
to the familiar gray mesh and the cursor to the hollow x shape.)
.IP "\fB-cursor\fP \fIcursorfile\fP \fImaskfile\fP"
This lets you change the pointer cursor to whatever
you want when the pointer cursor is outside of any window.
Cursor and mask files are bitmaps (little pictures), and can be made with the
.I bitmap(1)
program. You probably want the mask file to be all black until you
get used to the way masks work.
.IP "\fB-cursor_name\fP \fIcursorname\fP
This lets you change the pointer cursor to one of the standard
cursors from the cursor font. Refer to appendix B of the X protocol for
the names (except that the XC_ prefix is elided for this option).
.IP "\fB-xcf\fP \fIcursorfile\fP \fIcursorsize\fP"
This lets you change the pointer cursor to one loaded from an Xcursor file
as defined by libXcursor, at the specified size.
.IP "\fB-bitmap\fP \fIfilename\fP"
Use the bitmap specified in the file to set the window pattern. You can
make your own bitmap files (little pictures) using the
.I bitmap(1)
program. The entire background will be made up of repeated "tiles" of
the bitmap.
.IP "\fB-mod\fP \fIx\fP \fIy\fP"
This is used if you want a plaid-like grid pattern on your screen.
x and y are integers ranging from 1 to 16. Try the different combinations.
Zero and negative numbers are taken as 1.
.IP \fB-gray\fP
Make the entire background gray. (Easier on the eyes.)
.IP \fB-grey\fP
Make the entire background grey.
.IP "\fB-fg\fP \fIcolor\fP"
Use ``color'' as the foreground color. Foreground and background colors
are meaningful only in combination with -cursor, -bitmap, or -mod.
.IP "\fB-bg\fP \fIcolor\fP"
Use ``color'' as the background color.
.IP \fB-rv\fP
This exchanges the foreground and background colors. Normally the foreground
color is black and the background color is white.
.IP "\fB-solid\fP \fIcolor\fP"
This sets the background of the root window to the specified color. This
option is only useful on color servers.
.IP "\fB-name\fP \fIstring\fP"
Set the name of the root window to ``string''. There is no default value.
Usually a name is assigned to a window so that the
window manager can use a text representation when the window is iconified.
This option is unused since you can't iconify the background.
.IP "\fB-display\fP \fIdisplay\fP"
Specifies the server to connect to; see \fIX(__miscmansuffix__)\fP.
.SH "SEE ALSO"
X(__miscmansuffix__), xset(1), xrdb(1), Xcursor(__libmansuffix__)
.SH AUTHOR
Mark Lillibridge, MIT Project Athena
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin