diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:24 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:24 +0000 |
commit | be0f398fee08e03ab73ec0d580df688cc989fbaa (patch) | |
tree | 0a9313c511240d63cda275ee3cfd667ca6592d5a | |
parent | 5e5a590668dc3ebe7e2cb568aad4c9c14021f2a2 (diff) |
XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1
-rw-r--r-- | dsimple.c | 50 | ||||
-rw-r--r-- | dsimple.h | 39 | ||||
-rw-r--r-- | xwininfo.c | 56 | ||||
-rw-r--r-- | xwininfo.man | 9 |
4 files changed, 111 insertions, 43 deletions
@@ -26,25 +26,22 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xlsfonts/dsimple.c,v 3.6 2001/12/14 20:02:09 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/cursorfont.h> #include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> /* * Other_stuff.h: Definitions of routines in other_stuff. * * Written by Mark Lillibridge. Last updated 7/1/87 */ -unsigned long Resolve_Color(); -Pixmap Bitmap_To_Pixmap(); -Window Select_Window(); -void out(); -void blip(); -Window Window_With_Name(); -void Fatal_Error(); +#include "dsimple.h" /* * Just_display: A group of routines designed to make the writting of simple @@ -58,10 +55,11 @@ void Fatal_Error(); /* This stuff is defined in the calling program by just_display.h */ -extern char *program_name; -extern Display *dpy; -extern int screen; +char *program_name = "unknown_program"; +Display *dpy; +int screen; +static void _bitmap_error(int, char *); /* * Malloc: like malloc but handles out of memory using Fatal_Error. @@ -69,7 +67,7 @@ extern int screen; char *Malloc(size) unsigned size; { - char *data, *malloc(); + char *data; if (!(data = malloc(size))) Fatal_Error("Out of memory!"); @@ -85,7 +83,7 @@ char *Realloc(ptr, size) char *ptr; int size; { - char *new_ptr, *realloc(); + char *new_ptr; if (!ptr) return(Malloc(size)); @@ -326,9 +324,6 @@ Window Select_Window_Args(rargc, argv) * Written by Mark Lillibridge. Last updated 7/1/87 */ -extern Display *dpy; -extern int screen; - /* * Resolve_Color: This routine takes a color name and returns the pixel # * that when used in the window w will be of color name. @@ -402,7 +397,9 @@ Pixmap Bitmap_To_Pixmap(dpy, d, gc, bitmap, width, height) */ void blip() { - outl("blip!"); + fflush(stdout); + fprintf(stderr, "blip!\n"); + fflush(stderr); } @@ -493,13 +490,14 @@ Window Window_With_Name(dpy, top, name) * in code so we can tell where we are. Outl may be invoked like * printf with up to 7 arguments. */ -/* VARARGS1 */ -outl(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) - char *msg; - char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; +void +outl(char *msg, ...) { + va_list args; fflush(stdout); - fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); fprintf(stderr, "\n"); fflush(stderr); } @@ -509,15 +507,15 @@ outl(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) * Standard fatal error routine - call like printf but maximum of 7 arguments. * Does not require dpy or screen defined. */ -/* VARARGS1 */ -void Fatal_Error(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) -char *msg; -char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; +void Fatal_Error(char *msg, ...) { + va_list args; fflush(stdout); fflush(stderr); fprintf(stderr, "%s: error: ", program_name); - fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); fprintf(stderr, "\n"); exit(1); } @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xlsfonts/dsimple.h,v 1.8 2002/12/24 17:43:01 tsi Exp $ */ /* * Just_display.h: This file contains the definitions needed to use the @@ -40,16 +41,28 @@ from The Open Group. /* Global variables used by routines in just_display.c */ -char *program_name = "unknown_program"; /* Name of this program */ -Display *dpy; /* The current display */ -int screen; /* The current screen */ +extern char *program_name; /* Name of this program */ +extern Display *dpy; /* The current display */ +extern int screen; /* The current screen */ #define INIT_NAME program_name=argv[0] /* use this in main to setup program_name */ /* Declaritions for functions in just_display.c */ -void Fatal_Error(); +#if NeedFunctionPrototypes +char *Malloc(unsigned); +char *Realloc(char *, int); +char *Get_Display_Name(int *, char **); +Display *Open_Display(char *); +void Setup_Display_And_Screen(int *, char **); +XFontStruct *Open_Font(char *); +void Beep(void); +Pixmap ReadBitmapFile(Drawable, char *, int *, int *, int *, int *); +void WriteBitmapFile(char *, Pixmap, int, int, int, int); +Window Select_Window_Args(int *, char **); +void usage(void); +#else char *Malloc(); char *Realloc(); char *Get_Display_Name(); @@ -60,10 +73,11 @@ void Beep(); Pixmap ReadBitmapFile(); void WriteBitmapFile(); Window Select_Window_Args(); +void usage(); +#endif #define X_USAGE "[host:display]" /* X arguments handled by Get_Display_Name */ -#define SELECT_USAGE "[{-root|-id <id>|-font <font>|-name <name>}]" /* * Other_stuff.h: Definitions of routines in other_stuff. @@ -73,9 +87,22 @@ Window Select_Window_Args(); * Send bugs, etc. to chariot@athena.mit.edu. */ +#if NeedFunctionPrototypes +unsigned long Resolve_Color(Window, char *); +Pixmap Bitmap_To_Pixmap(Display *, Drawable, GC, Pixmap, int, int); +Window Select_Window(Display *); +void blip(void); +Window Window_With_Name(Display *, Window, char *); +#else unsigned long Resolve_Color(); Pixmap Bitmap_To_Pixmap(); Window Select_Window(); -void out(); void blip(); Window Window_With_Name(); +#endif +#ifdef __GNUC__ +void Fatal_Error(char *, ...) __attribute__((__noreturn__)); +#else +void Fatal_Error(char *, ...); +#endif +void outl(char *, ...); @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xwininfo/xwininfo.c,v 1.8 2001/12/14 20:02:35 dawes Exp $ */ /* @@ -47,15 +48,45 @@ from The Open Group. #include <X11/extensions/shape.h> #include <X11/Xmu/WinUtil.h> #include <stdio.h> +#include <stdlib.h> /* Include routines to handle parsing defaults */ #include "dsimple.h" +typedef struct { + long code; + char *name; +} binding; + +#if NeedFunctionPrototypes +extern void scale_init(void); +extern char *nscale(int, int, int, char *); +extern char *xscale(int); +extern char *yscale(int); +extern char *bscale(int); +extern int bad_window_handler(Display *, XErrorEvent *); +extern int main(int, char **); +extern char *LookupL(long, binding *); +extern char *Lookup(int, binding *); +extern void Display_Window_Id(Window, int); +extern void Display_Stats_Info(Window); +extern void Display_Bits_Info(Window); +extern void Display_Event_Mask(long); +extern void Display_Events_Info(Window); +extern void Display_Tree_Info(Window, int); +extern void display_tree_info_1(Window, int, int); +extern void Display_Hints(XSizeHints *); +extern void Display_Size_Hints(Window); +extern void Display_Window_Shape(Window); +extern void Display_WM_Info(Window); +#endif + static char *window_id_format = "0x%lx"; /* * Report the syntax for calling xwininfo: */ +void usage() { fprintf (stderr, @@ -224,6 +255,7 @@ char *bscale(b) to see if the -id the user specified is valid. */ /* ARGSUSED */ +int bad_window_handler(disp, err) Display *disp; XErrorEvent *err; @@ -233,9 +265,11 @@ bad_window_handler(disp, err) sprintf(badid, window_id_format, err->resourceid); Fatal_Error("No such window with id %s.", badid); exit (1); + return 0; } +int main(argc, argv) int argc; char **argv; @@ -344,7 +378,7 @@ main(argc, argv) Window root; int x, y; unsigned width, height, bw, depth; - int (*old_handler)(); + XErrorHandler old_handler; old_handler = XSetErrorHandler(bad_window_handler); XGetGeometry (dpy, window, &root, &x, &y, &width, &height, &bw, &depth); @@ -376,11 +410,6 @@ main(argc, argv) /* * Lookup: lookup a code in a table. */ -typedef struct { - long code; - char *name; -} binding; - static char _lookup_buffer[100]; char *LookupL(code, table) @@ -414,6 +443,7 @@ char *Lookup(code, table) * Routine to display a window id in dec/hex with name if window has one */ +void Display_Window_Id(window, newline_wanted) Window window; Bool newline_wanted; @@ -501,6 +531,7 @@ static binding _visual_classes[] = { { DirectColor, "DirectColor" }, { 0, 0 }}; +void Display_Stats_Info(window) Window window; { @@ -692,6 +723,7 @@ static binding _bool[] = { { 1, "Yes" }, { 0, 0 } }; +void Display_Bits_Info(window) Window window; { @@ -707,9 +739,9 @@ Display_Bits_Info(window) Lookup(win_attributes.win_gravity, _gravities)); printf(" Backing-store hint: %s\n", Lookup(win_attributes.backing_store, _backing_store_hint)); - printf(" Backing-planes to be preserved: 0x%x\n", + printf(" Backing-planes to be preserved: 0x%lx\n", win_attributes.backing_planes); - printf(" Backing pixel: %d\n", win_attributes.backing_pixel); + printf(" Backing pixel: %ld\n", win_attributes.backing_pixel); printf(" Save-unders: %s\n", Lookup(win_attributes.save_under, _bool)); } @@ -746,6 +778,7 @@ static binding _event_mask_names[] = { { OwnerGrabButtonMask, "OwnerGrabButton" }, { 0, 0 } }; +void Display_Event_Mask(mask) long mask; { @@ -761,6 +794,7 @@ Display_Event_Mask(mask) /* * Display info on events */ +void Display_Events_Info(window) Window window; { @@ -789,6 +823,7 @@ Display_Events_Info(window) /* * Display root, parent, and (recursively) children information */ +void Display_Tree_Info(window, recurse) Window window; int recurse; /* true if should show children's children */ @@ -796,6 +831,7 @@ Display_Tree_Info(window, recurse) display_tree_info_1(window, recurse, 0); } +void display_tree_info_1(window, recurse, level) Window window; int recurse; @@ -870,6 +906,7 @@ display_tree_info_1(window, recurse, level) /* * Display a set of size hints */ +void Display_Hints(hints) XSizeHints *hints; { @@ -948,6 +985,7 @@ Display_Hints(hints) /* * Display Size Hints info */ +void Display_Size_Hints(window) Window window; { @@ -974,6 +1012,7 @@ Display_Size_Hints(window) } +void Display_Window_Shape (window) Window window; { @@ -1014,6 +1053,7 @@ static binding _state_hints[] = { { InactiveState, "Inactive State" }, { 0, 0 } }; +void Display_WM_Info(window) Window window; { diff --git a/xwininfo.man b/xwininfo.man index e49552d..6a6e008 100644 --- a/xwininfo.man +++ b/xwininfo.man @@ -22,7 +22,10 @@ .\" 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 XWININFO 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xwininfo/xwininfo.man,v 1.8 2001/12/14 20:02:35 dawes Exp $ +.\" +.TH XWININFO 1 __xorgversion__ .SH NAME xwininfo \- window information utility for X .SH SYNOPSIS @@ -152,7 +155,7 @@ This option is a quick way to ask for all information possible. .PP .TP 8 .B \-display \fIdisplay\fP -This option allows you to specify the server to connect to; see \fIX(1)\fP. +This option allows you to specify the server to connect to; see \fIX(__miscmansuffix__)\fP. .SH EXAMPLE .PP The following is a sample summary taken with no options specified: @@ -185,7 +188,7 @@ xwininfo: Window id: 0x60000f "xterm" .B DISPLAY To get the default host and display number. .SH SEE ALSO -X(1), xprop(1) +X(__miscmansuffix__), xprop(1) .SH BUGS Using \fB\-stats \-bits\fP shows some redundant information. .PP |