diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-17 19:04:09 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-17 19:04:09 +0000 |
commit | 9b186ebf782312d8813abf65ac66c3d66466d69e (patch) | |
tree | ce8e5ab1cfd0b2da6f754c8747b342678c7d0f8a /xsetroot.c | |
parent | 500a078602d5db1e420a07c81dada5a676e0cc90 (diff) |
merge XFree86 4.3.0.1 to -CURRENTXORG-RELEASE-1-BASEXEVIE-MERGEXEVIE-BASEXINERAMA_2XEVIE
Diffstat (limited to 'xsetroot.c')
-rw-r--r-- | xsetroot.c | 72 |
1 files changed, 39 insertions, 33 deletions
@@ -32,14 +32,17 @@ 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.8 2001/12/14 20:02:23 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xatom.h> +#include <X11/Xmu/CurUtil.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "X11/bitmaps/gray" - #define Dynamic 1 char *program_name; @@ -53,7 +56,19 @@ int save_colors = 0; int unsave_past = 0; Pixmap save_pixmap = (Pixmap)None; -usage() +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"); @@ -74,14 +89,9 @@ usage() /*NOTREACHED*/ } -Pixmap MakeModulaBitmap(), ReadBitmapFile(); -XColor NameToXColor(); -unsigned long NameToPixel(); -Cursor CreateCursorFromName(); -main(argc, argv) - int argc; - char **argv; +int +main(int argc, char *argv[]) { int excl = 0; int nonexcl = 0; @@ -264,7 +274,8 @@ main(argc, argv) /* Free past incarnation if needed, and retain state if needed. */ -FixupState() +static void +FixupState(void) { Atom prop, type; int format; @@ -299,9 +310,8 @@ FixupState() * SetBackgroundToBitmap: Set the root window background to a caller supplied * bitmap. */ -SetBackgroundToBitmap(bitmap, width, height) - Pixmap bitmap; - unsigned int width, height; +static void +SetBackgroundToBitmap(Pixmap bitmap, unsigned int width, unsigned int height) { Pixmap pix; GC gc; @@ -336,8 +346,8 @@ SetBackgroundToBitmap(bitmap, width, height) */ #define BITMAP_HOT_DEFAULT 8 -CreateCursorFromFiles(cursor_file, mask_file) - char *cursor_file, *mask_file; +static Cursor +CreateCursorFromFiles(char *cursor_file, char *mask_file) { Pixmap cursor_bitmap, mask_bitmap; unsigned int width, height, ww, hh; @@ -381,9 +391,8 @@ CreateCursorFromFiles(cursor_file, mask_file) return(cursor); } -Cursor -CreateCursorFromName (name) - char *name; +static Cursor +CreateCursorFromName(char *name) { XColor fg, bg, temp; int i; @@ -407,21 +416,21 @@ CreateCursorFromName (name) /* * MakeModulaBitmap: Returns a modula bitmap based on an x & y mod. */ -Pixmap MakeModulaBitmap(mod_x, mod_y) - int mod_x, mod_y; +static Pixmap +MakeModulaBitmap(int mod_x, int mod_y) { int i; long pattern_line = 0; char modula_data[16*16/8]; - for (i=0; i<16; i++) { + 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] = 0xff; - modula_data[i*2+1] = 0xff; + 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; @@ -435,9 +444,8 @@ Pixmap MakeModulaBitmap(mod_x, mod_y) /* * NameToXColor: Convert the name of a color to its Xcolor value. */ -XColor NameToXColor(name, pixel) - char *name; - unsigned long pixel; +static XColor +NameToXColor(char *name, unsigned long pixel) { XColor c; @@ -453,9 +461,8 @@ XColor NameToXColor(name, pixel) return(c); } -unsigned long NameToPixel(name, pixel) - char *name; - unsigned long pixel; +static unsigned long +NameToPixel(char *name, unsigned long pixel) { XColor ecolor; @@ -479,10 +486,9 @@ unsigned long NameToPixel(name, pixel) return(ecolor.pixel); } -Pixmap ReadBitmapFile(filename, width, height, x_hot, y_hot) - char *filename; - unsigned int *width, *height; - int *x_hot, *y_hot; +static Pixmap +ReadBitmapFile(char *filename, unsigned int *width, unsigned int *height, + int *x_hot, int *y_hot) { Pixmap bitmap; int status; |