diff options
Diffstat (limited to 'xlib')
-rw-r--r-- | xlib/X11/X.h | 92 | ||||
-rw-r--r-- | xlib/X11/Xfuncproto.h | 12 | ||||
-rw-r--r-- | xlib/X11/Xlib.h | 65 | ||||
-rw-r--r-- | xlib/X11/Xutil.h | 32 | ||||
-rw-r--r-- | xlib/X11/keysym.h | 12 | ||||
-rw-r--r--[-rwxr-xr-x] | xlib/rgb.txt | 0 | ||||
-rw-r--r-- | xlib/xbytes.h | 17 | ||||
-rw-r--r--[-rwxr-xr-x] | xlib/xcolors.c | 0 | ||||
-rw-r--r-- | xlib/xdraw.c | 46 | ||||
-rw-r--r-- | xlib/xgc.c | 523 | ||||
-rw-r--r-- | xlib/ximage.c | 33 | ||||
-rw-r--r-- | xlib/xutil.c | 48 |
12 files changed, 468 insertions, 412 deletions
diff --git a/xlib/X11/X.h b/xlib/X11/X.h index 7755cac..daf2283 100644 --- a/xlib/X11/X.h +++ b/xlib/X11/X.h @@ -13,13 +13,13 @@ and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -33,7 +33,7 @@ SOFTWARE. #define X_PROTOCOL 11 /* current protocol version */ #define X_PROTOCOL_REVISION 0 /* current minor version */ -#if defined(MAC_TCL) || defined(MAC_OSX_TK) +#if defined(MAC_OSX_TK) # define Cursor XCursor # define Region XRegion #endif @@ -100,39 +100,39 @@ typedef unsigned long KeyCode; /* In order to use IME, the Macintosh needs #define NoSymbol 0L /* special KeySym */ -/***************************************************************** - * EVENT DEFINITIONS +/***************************************************************** + * EVENT DEFINITIONS *****************************************************************/ /* Input Event Masks. Used as event-mask window attribute and as arguments to Grab requests. Not to be confused with event names. */ #define NoEventMask 0L -#define KeyPressMask (1L<<0) -#define KeyReleaseMask (1L<<1) -#define ButtonPressMask (1L<<2) -#define ButtonReleaseMask (1L<<3) -#define EnterWindowMask (1L<<4) -#define LeaveWindowMask (1L<<5) -#define PointerMotionMask (1L<<6) -#define PointerMotionHintMask (1L<<7) -#define Button1MotionMask (1L<<8) -#define Button2MotionMask (1L<<9) -#define Button3MotionMask (1L<<10) -#define Button4MotionMask (1L<<11) -#define Button5MotionMask (1L<<12) -#define ButtonMotionMask (1L<<13) +#define KeyPressMask (1L<<0) +#define KeyReleaseMask (1L<<1) +#define ButtonPressMask (1L<<2) +#define ButtonReleaseMask (1L<<3) +#define EnterWindowMask (1L<<4) +#define LeaveWindowMask (1L<<5) +#define PointerMotionMask (1L<<6) +#define PointerMotionHintMask (1L<<7) +#define Button1MotionMask (1L<<8) +#define Button2MotionMask (1L<<9) +#define Button3MotionMask (1L<<10) +#define Button4MotionMask (1L<<11) +#define Button5MotionMask (1L<<12) +#define ButtonMotionMask (1L<<13) #define KeymapStateMask (1L<<14) -#define ExposureMask (1L<<15) -#define VisibilityChangeMask (1L<<16) -#define StructureNotifyMask (1L<<17) -#define ResizeRedirectMask (1L<<18) -#define SubstructureNotifyMask (1L<<19) -#define SubstructureRedirectMask (1L<<20) -#define FocusChangeMask (1L<<21) -#define PropertyChangeMask (1L<<22) -#define ColormapChangeMask (1L<<23) -#define OwnerGrabButtonMask (1L<<24) +#define ExposureMask (1L<<15) +#define VisibilityChangeMask (1L<<16) +#define StructureNotifyMask (1L<<17) +#define ResizeRedirectMask (1L<<18) +#define SubstructureNotifyMask (1L<<19) +#define SubstructureRedirectMask (1L<<20) +#define FocusChangeMask (1L<<21) +#define PropertyChangeMask (1L<<22) +#define ColormapChangeMask (1L<<23) +#define OwnerGrabButtonMask (1L<<24) /* Event names. Used in "type" field in XEvent structures. Not to be confused with event masks above. They start from 2 because 0 and 1 @@ -229,7 +229,7 @@ are reserved in the protocol for errors and replies. */ #define NotifyWhileGrabbed 3 #define NotifyHint 1 /* for MotionNotify events */ - + /* Notify detail */ #define NotifyAncestor 0 @@ -299,7 +299,7 @@ are reserved in the protocol for errors and replies. */ #define RevertToParent 2 /***************************************************************** - * ERROR CODES + * ERROR CODES *****************************************************************/ #define Success 0 /* everything's okay */ @@ -314,9 +314,9 @@ are reserved in the protocol for errors and replies. */ #define BadDrawable 9 /* parameter not a Pixmap or Window */ #define BadAccess 10 /* depending on context: - key/button already grabbed - - attempt to free an illegal - cmap entry - - attempt to store into a read-only + - attempt to free an illegal + cmap entry + - attempt to store into a read-only color map entry. - attempt to modify the access control list from other than the local host. @@ -333,7 +333,7 @@ are reserved in the protocol for errors and replies. */ #define LastExtensionError 255 /***************************************************************** - * WINDOW DEFINITIONS + * WINDOW DEFINITIONS *****************************************************************/ /* Window classes used by CreateWindow */ @@ -525,7 +525,7 @@ are reserved in the protocol for errors and replies. */ #define GCCapStyle (1L<<6) #define GCJoinStyle (1L<<7) #define GCFillStyle (1L<<8) -#define GCFillRule (1L<<9) +#define GCFillRule (1L<<9) #define GCTile (1L<<10) #define GCStipple (1L<<11) #define GCTileStipXOrigin (1L<<12) @@ -542,7 +542,7 @@ are reserved in the protocol for errors and replies. */ #define GCLastBit 22 /***************************************************************** - * FONTS + * FONTS *****************************************************************/ /* used in QueryFont -- draw direction */ @@ -553,7 +553,7 @@ are reserved in the protocol for errors and replies. */ #define FontChange 255 /***************************************************************** - * IMAGING + * IMAGING *****************************************************************/ /* ImageFormat -- PutImage, GetImage */ @@ -563,7 +563,7 @@ are reserved in the protocol for errors and replies. */ #define ZPixmap 2 /* depth == drawable depth */ /***************************************************************** - * COLOR MAP STUFF + * COLOR MAP STUFF *****************************************************************/ /* For CreateColormap */ @@ -588,7 +588,7 @@ are reserved in the protocol for errors and replies. */ #define TileShape 1 /* size tiled fastest */ #define StippleShape 2 /* size stippled fastest */ -/***************************************************************** +/***************************************************************** * KEYBOARD/POINTER STUFF *****************************************************************/ @@ -619,7 +619,7 @@ are reserved in the protocol for errors and replies. */ #define MappingPointer 2 /***************************************************************** - * SCREEN SAVER STUFF + * SCREEN SAVER STUFF *****************************************************************/ #define DontPreferBlanking 0 @@ -649,10 +649,10 @@ are reserved in the protocol for errors and replies. */ /* for ChangeAccessControl */ -#define EnableAccess 1 +#define EnableAccess 1 #define DisableAccess 0 -/* Display classes used in opening the connection +/* Display classes used in opening the connection * Note that the statically allocated ones are even numbered and the * dynamically changeable ones are odd numbered */ @@ -669,7 +669,7 @@ are reserved in the protocol for errors and replies. */ #define LSBFirst 0 #define MSBFirst 1 -#if defined(MAC_TCL) || defined(MAC_OSX_TK) +#if defined(MAC_OSX_TK) # undef Cursor # undef Region #endif diff --git a/xlib/X11/Xfuncproto.h b/xlib/X11/Xfuncproto.h index a59379b..6d63002 100644 --- a/xlib/X11/Xfuncproto.h +++ b/xlib/X11/Xfuncproto.h @@ -1,14 +1,14 @@ /* $XConsortium: Xfuncproto.h,v 1.7 91/05/13 20:49:21 rws Exp $ */ -/* +/* * Copyright 1989, 1991 by the Massachusetts Institute of Technology * * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting + * documentation for any purpose and without fee is hereby granted, 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 M.I.T. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * diff --git a/xlib/X11/Xlib.h b/xlib/X11/Xlib.h index 252b11d..667bdc7 100644 --- a/xlib/X11/Xlib.h +++ b/xlib/X11/Xlib.h @@ -1,14 +1,14 @@ /* $XConsortium: Xlib.h,v 11.221 93/07/02 14:13:28 gildea Exp $ */ -/* +/* * Copyright 1985, 1986, 1987, 1991 by the Massachusetts Institute of Technology * * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting + * documentation for any purpose and without fee is hereby granted, 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 M.I.T. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * @@ -27,14 +27,9 @@ #define XlibSpecificationRelease 5 -#if !defined(MAC_TCL) && !defined(MAC_OSX_TK) +#if !defined(MAC_OSX_TK) # include <X11/X.h> #endif -#ifdef MAC_TCL -# include <X.h> -# define Cursor XCursor -# define Region XRegion -#endif #ifdef MAC_OSX_TK # include <X11/X.h> # define Cursor XCursor @@ -42,11 +37,7 @@ #endif /* applications should not depend on these two headers being included! */ -#ifdef MAC_TCL -#include <Xfuncproto.h> -#else #include <X11/Xfuncproto.h> -#endif #ifndef X_WCHAR #ifdef X_NOT_STDC_ENV @@ -64,7 +55,7 @@ typedef unsigned long wchar_t; typedef char *XPointer; #define Bool int -#if defined(MAC_TCL) || defined(MAC_OSX_TK) +#if defined(MAC_OSX_TK) /* Use define rather than typedef, since may need to undefine this later */ #define Status int #else @@ -172,10 +163,10 @@ typedef struct { unsigned long background;/* background pixel */ int line_width; /* line width */ int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ - int cap_style; /* CapNotLast, CapButt, + int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */ int join_style; /* JoinMiter, JoinRound, JoinBevel */ - int fill_style; /* FillSolid, FillTiled, + int fill_style; /* FillSolid, FillTiled, FillStippled, FillOpaeueStippled */ int fill_rule; /* EvenOddRule, WindingRule */ int arc_mode; /* ArcChord, ArcPieSlice */ @@ -218,7 +209,7 @@ typedef struct { /* * Depth structure; contains information for each possible depth. - */ + */ typedef struct { int depth; /* this depth (Z) of the depth */ int nvisuals; /* number of Visual types at this depth */ @@ -246,7 +237,7 @@ typedef struct { unsigned long black_pixel; /* White and Black pixel values */ int max_maps, min_maps; /* max and min color maps */ int backing_store; /* Never, WhenMapped, Always */ - Bool save_unders; + Bool save_unders; long root_input_mask; /* initial root input mask */ } Screen; @@ -357,7 +348,7 @@ typedef struct _XImage { } f; } XImage; -/* +/* * Data structure for XReconfigureWindow */ typedef struct { @@ -378,7 +369,7 @@ typedef struct { char pad; } XColor; -/* +/* * Data structures for graphics operations. On most machines, these are * congruent with the wire protocol structures, so reformatting the data * can be avoided on these architectures. @@ -390,12 +381,12 @@ typedef struct { typedef struct { short x, y; } XPoint; - + typedef struct { short x, y; unsigned short width, height; } XRectangle; - + typedef struct { short x, y; unsigned short width, height; @@ -496,7 +487,7 @@ typedef struct _XDisplay { struct _XExten *ext_procs; /* extensions initialized on this display */ /* * the following can be fixed size, as the protocol defines how - * much address space is available. + * much address space is available. * While this could be done using the extension vector, there * may be MANY events processed, so a search through the extension * list to find the right procedure for each event might be @@ -611,7 +602,7 @@ typedef struct { int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ int detail; /* - * NotifyAncestor, NotifyVirtual, NotifyInferior, + * NotifyAncestor, NotifyVirtual, NotifyInferior, * NotifyNonlinear,NotifyNonlinearVirtual */ Bool same_screen; /* same screen flag */ @@ -630,9 +621,9 @@ typedef struct { int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ int detail; /* - * NotifyAncestor, NotifyVirtual, NotifyInferior, + * NotifyAncestor, NotifyVirtual, NotifyInferior, * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer, - * NotifyPointerRoot, NotifyDetailNone + * NotifyPointerRoot, NotifyDetailNone */ } XFocusChangeEvent; typedef XFocusChangeEvent XFocusInEvent; @@ -646,7 +637,7 @@ typedef struct { Display *display; /* Display the event was read from */ Window window; char key_vector[32]; -} XKeymapEvent; +} XKeymapEvent; typedef struct { int type; @@ -1133,7 +1124,7 @@ typedef struct { typedef unsigned long XIMFeedback; #define XIMReverse 1 -#define XIMUnderline (1<<1) +#define XIMUnderline (1<<1) #define XIMHighlight (1<<2) #define XIMPrimary (1<<5) #define XIMSecondary (1<<6) @@ -1142,11 +1133,11 @@ typedef unsigned long XIMFeedback; typedef struct _XIMText { unsigned short length; XIMFeedback *feedback; - Bool encoding_is_wchar; + Bool encoding_is_wchar; union { char *multi_byte; wchar_t *wide_char; - } string; + } string; } XIMText; typedef struct _XIMPreeditDrawCallbackStruct { @@ -1161,13 +1152,13 @@ typedef enum { XIMForwardWord, XIMBackwardWord, XIMCaretUp, XIMCaretDown, XIMNextLine, XIMPreviousLine, - XIMLineStart, XIMLineEnd, + XIMLineStart, XIMLineEnd, XIMAbsolutePosition, XIMDontChange } XIMCaretDirection; typedef enum { - XIMIsInvisible, /* Disable caret feedback */ + XIMIsInvisible, /* Disable caret feedback */ XIMIsPrimary, /* UI defined caret feedback */ XIMIsSecondary /* UI defined caret feedback */ } XIMCaretStyle; @@ -1182,7 +1173,7 @@ typedef enum { XIMTextType, XIMBitmapType } XIMStatusDataType; - + typedef struct _XIMStatusDrawCallbackStruct { XIMStatusDataType type; union { @@ -1206,7 +1197,7 @@ _XFUNCPROTOBEGIN _XFUNCPROTOEND -#if defined(MAC_TCL) || defined(MAC_OSX_TK) +#if defined(MAC_OSX_TK) # undef Cursor # undef Region #endif diff --git a/xlib/X11/Xutil.h b/xlib/X11/Xutil.h index 8534768..58124b0 100644 --- a/xlib/X11/Xutil.h +++ b/xlib/X11/Xutil.h @@ -6,13 +6,13 @@ and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -29,11 +29,11 @@ SOFTWARE. /* You must include <X11/Xlib.h> before including this file */ -#if defined(MAC_TCL) || defined(MAC_OSX_TK) +#if defined(MAC_OSX_TK) # define Region XRegion #endif -/* +/* * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding * value (x, y, width, height) was found in the parsed string. */ @@ -128,7 +128,7 @@ IconPositionHint|IconMaskHint|WindowGroupHint) /* - * new structure for manipulating TEXT properties; used with WM_NAME, + * new structure for manipulating TEXT properties; used with WM_NAME, * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND. */ typedef struct { @@ -206,16 +206,16 @@ typedef struct _XComposeStatus { || ((unsigned)(keysym) == XK_Mode_switch) \ || ((unsigned)(keysym) == XK_Num_Lock)) /* - * opaque reference to Region data type + * opaque reference to Region data type */ -typedef struct _XRegion *Region; +typedef struct _XRegion *Region; /* Return values from XRectInRegion() */ - + #define RectangleOut 0 #define RectangleIn 1 #define RectanglePart 2 - + /* * Information used by the visual utility routines to find desired visual @@ -435,7 +435,7 @@ extern Status XGetStandardColormap( Display* /* display */, Window /* w */, XStandardColormap* /* colormap_return */, - Atom /* property */ + Atom /* property */ #endif ); @@ -460,7 +460,7 @@ extern Status XGetWMClientMachine( extern XWMHints *XGetWMHints( #if NeedFunctionPrototypes Display* /* display */, - Window /* w */ + Window /* w */ #endif ); @@ -485,7 +485,7 @@ extern Status XGetWMNormalHints( Display* /* display */, Window /* w */, XSizeHints* /* hints_return */, - long* /* supplied_return */ + long* /* supplied_return */ #endif ); @@ -591,7 +591,7 @@ extern void XSetIconSizes( Display* /* display */, Window /* w */, XIconSize* /* size_list */, - int /* count */ + int /* count */ #endif ); @@ -848,7 +848,7 @@ extern void XXorRegion( _XFUNCPROTOEND -#if defined(MAC_TCL) || defined(MAC_OSX_TK) +#if defined(MAC_OSX_TK) # undef Region #endif diff --git a/xlib/X11/keysym.h b/xlib/X11/keysym.h index 027afe0..550b76d 100644 --- a/xlib/X11/keysym.h +++ b/xlib/X11/keysym.h @@ -6,13 +6,13 @@ and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -32,8 +32,4 @@ SOFTWARE. #define XK_LATIN4 #define XK_GREEK -#ifdef MAC_TCL -#include <keysymdef.h> -#else #include <X11/keysymdef.h> -#endif diff --git a/xlib/rgb.txt b/xlib/rgb.txt index 3b7ba4d..3b7ba4d 100755..100644 --- a/xlib/rgb.txt +++ b/xlib/rgb.txt diff --git a/xlib/xbytes.h b/xlib/xbytes.h index 611e246..13e2faa 100644 --- a/xlib/xbytes.h +++ b/xlib/xbytes.h @@ -5,17 +5,16 @@ * * Copyright (c) 1995 Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _XBYTES #define _XBYTES /* - * The bits in a byte can be reversed so the least significant becomes - * the most significant by indexing xBitReverseTable with the byte - * to be reversed. + * The bits in a byte can be reversed so the least significant becomes the + * most significant by indexing xBitReverseTable with the byte to be reversed. */ static unsigned char xBitReverseTable[256] = { @@ -54,3 +53,11 @@ static unsigned char xBitReverseTable[256] = { }; #endif /* _XBYTES */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/xlib/xcolors.c b/xlib/xcolors.c index 70ab3cb..70ab3cb 100755..100644 --- a/xlib/xcolors.c +++ b/xlib/xcolors.c diff --git a/xlib/xdraw.c b/xlib/xdraw.c index 8523df7..b8d7973 100644 --- a/xlib/xdraw.c +++ b/xlib/xdraw.c @@ -1,13 +1,12 @@ /* * xdraw.c -- * - * This file contains generic procedures related to X drawing - * primitives. + * This file contains generic procedures related to X drawing primitives. * * Copyright (c) 1995 Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tk.h" @@ -29,11 +28,12 @@ */ int -XDrawLine(display, d, gc, x1, y1, x2, y2) - Display* display; - Drawable d; - GC gc; - int x1, y1, x2, y2; /* Coordinates of line segment. */ +XDrawLine( + Display *display, + Drawable d, + GC gc, + int x1, int y1, + int x2, int y2) /* Coordinates of line segment. */ { XPoint points[2]; @@ -49,8 +49,8 @@ XDrawLine(display, d, gc, x1, y1, x2, y2) * * XFillRectangle -- * - * Fills a rectangular area in the given drawable. This procedure - * is implemented as a call to XFillRectangles. + * Fills a rectangular area in the given drawable. This procedure is + * implemented as a call to XFillRectangles. * * Results: * None @@ -62,14 +62,14 @@ XDrawLine(display, d, gc, x1, y1, x2, y2) */ int -XFillRectangle(display, d, gc, x, y, width, height) - Display* display; - Drawable d; - GC gc; - int x; - int y; - unsigned int width; - unsigned int height; +XFillRectangle( + Display *display, + Drawable d, + GC gc, + int x, + int y, + unsigned int width, + unsigned int height) { XRectangle rectangle; rectangle.x = x; @@ -78,3 +78,11 @@ XFillRectangle(display, d, gc, x, y, width, height) rectangle.height = height; return XFillRectangles(display, d, gc, &rectangle, 1); } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ @@ -5,31 +5,31 @@ * contexts. * * Copyright (c) 1995-1996 Sun Microsystems, Inc. - * Copyright (c) 2002-2007 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright (c) 2002-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright 2008-2009, Apple Inc. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <tkInt.h> -#if !defined(MAC_TCL) && !defined(MAC_OSX_TK) -# include <X11/Xlib.h> -#endif -#ifdef MAC_TCL -# include <Xlib.h> -# include <X.h> -# define Cursor XCursor -# define Region XRegion -#endif -#ifdef MAC_OSX_TK -# include <tkMacOSXInt.h> -# include <X11/Xlib.h> -# include <X11/X.h> -# define Cursor XCursor -# define Region XRegion +#if !defined(MAC_OSX_TK) +# include <X11/Xlib.h> +# define gcCacheSize 0 +# define TkpInitGCCache(gc) +# define TkpFreeGCCache(gc) +# define TkpGetGCCache(gc) +#else +# include <tkMacOSXInt.h> +# include <X11/Xlib.h> +# include <X11/X.h> +# define Cursor XCursor +# define Region XRegion +# define gcCacheSize sizeof(TkpGCCache) #endif +#undef TkSetRegion /* *---------------------------------------------------------------------- @@ -106,52 +106,57 @@ static void FreeClipMask(GC gc) { */ GC -XCreateGC(display, d, mask, values) - Display* display; - Drawable d; - unsigned long mask; - XGCValues* values; +XCreateGC( + Display *display, + Drawable d, + unsigned long mask, + XGCValues *values) { GC gp; -/* - * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars are - * defined, which is invisible from the outside. The list is assumed to end - * with a 0-char, so this must be set explicitely during initialization. - */ + /* + * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars + * are defined, which is invisible from the outside. The list is assumed + * to end with a 0-char, so this must be set explicitely during + * initialization. + */ #define MAX_DASH_LIST_SIZE 10 - gp = (XGCValues *)ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE); + gp = (XGCValues *) ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + + gcCacheSize); if (!gp) { return None; } - gp->function = (mask & GCFunction) ?values->function :GXcopy; - gp->plane_mask = (mask & GCPlaneMask) ?values->plane_mask :~0; - gp->foreground = (mask & GCForeground) ?values->foreground : - BlackPixelOfScreen(DefaultScreenOfDisplay(display)); - gp->background = (mask & GCBackground) ?values->background : - WhitePixelOfScreen(DefaultScreenOfDisplay(display)); - gp->line_width = (mask & GCLineWidth) ?values->line_width :1; - gp->line_style = (mask & GCLineStyle) ?values->line_style :LineSolid; - gp->cap_style = (mask & GCCapStyle) ?values->cap_style :0; - gp->join_style = (mask & GCJoinStyle) ?values->join_style :0; - gp->fill_style = (mask & GCFillStyle) ?values->fill_style :FillSolid; - gp->fill_rule = (mask & GCFillRule) ?values->fill_rule :WindingRule; - gp->arc_mode = (mask & GCArcMode) ?values->arc_mode :ArcPieSlice; - gp->tile = (mask & GCTile) ?values->tile :None; - gp->stipple = (mask & GCStipple) ?values->stipple :None; - gp->ts_x_origin = (mask & GCTileStipXOrigin) ?values->ts_x_origin:0; - gp->ts_y_origin = (mask & GCTileStipYOrigin) ?values->ts_y_origin:0; - gp->font = (mask & GCFont) ?values->font :None; - gp->subwindow_mode = (mask & GCSubwindowMode)?values->subwindow_mode:ClipByChildren; - gp->graphics_exposures = (mask & GCGraphicsExposures)?values->graphics_exposures:True; - gp->clip_x_origin = (mask & GCClipXOrigin) ?values->clip_x_origin :0; - gp->clip_y_origin = (mask & GCClipYOrigin) ?values->clip_y_origin :0; - gp->dash_offset = (mask & GCDashOffset) ?values->dash_offset :0; - gp->dashes = (mask & GCDashList) ?values->dashes :4; - (&(gp->dashes))[1] = 0; +#define InitField(name,maskbit,default) \ + (gp->name = (mask & (maskbit)) ? values->name : (default)) + + InitField(function, GCFunction, GXcopy); + InitField(plane_mask, GCPlaneMask, (unsigned long)(~0)); + InitField(foreground, GCForeground, + BlackPixelOfScreen(DefaultScreenOfDisplay(display))); + InitField(background, GCBackground, + WhitePixelOfScreen(DefaultScreenOfDisplay(display))); + InitField(line_width, GCLineWidth, 1); + InitField(line_style, GCLineStyle, LineSolid); + InitField(cap_style, GCCapStyle, 0); + InitField(join_style, GCJoinStyle, 0); + InitField(fill_style, GCFillStyle, FillSolid); + InitField(fill_rule, GCFillRule, WindingRule); + InitField(arc_mode, GCArcMode, ArcPieSlice); + InitField(tile, GCTile, None); + InitField(stipple, GCStipple, None); + InitField(ts_x_origin, GCTileStipXOrigin, 0); + InitField(ts_y_origin, GCTileStipYOrigin, 0); + InitField(font, GCFont, None); + InitField(subwindow_mode, GCSubwindowMode, ClipByChildren); + InitField(graphics_exposures, GCGraphicsExposures, True); + InitField(clip_x_origin, GCClipXOrigin, 0); + InitField(clip_y_origin, GCClipYOrigin, 0); + InitField(dash_offset, GCDashOffset, 0); + InitField(dashes, GCDashList, 4); + (&(gp->dashes))[1] = 0; gp->clip_mask = None; if (mask & GCClipMask) { @@ -160,17 +165,39 @@ XCreateGC(display, d, mask, values) clip_mask->type = TKP_CLIP_PIXMAP; clip_mask->value.pixmap = values->clip_mask; } + TkpInitGCCache(gp); return gp; } +#ifdef MAC_OSX_TK +/* + *---------------------------------------------------------------------- + * + * TkpGetGCCache -- + * + * Results: + * Pointer to the TkpGCCache at the end of the GC. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +TkpGCCache* +TkpGetGCCache(GC gc) { + return (gc ? (TkpGCCache*)(((char*) gc) + sizeof(XGCValues) + + MAX_DASH_LIST_SIZE) : NULL); +} +#endif + /* *---------------------------------------------------------------------- * * XChangeGC -- * - * Changes the GC components specified by valuemask for the - * specified GC. + * Changes the GC components specified by valuemask for the specified GC. * * Results: * None. @@ -182,35 +209,43 @@ XCreateGC(display, d, mask, values) */ int -XChangeGC(d, gc, mask, values) - Display * d; - GC gc; - unsigned long mask; - XGCValues *values; -{ - if (mask & GCFunction) { gc->function = values->function; } - if (mask & GCPlaneMask) { gc->plane_mask = values->plane_mask; } - if (mask & GCForeground) { gc->foreground = values->foreground; } - if (mask & GCBackground) { gc->background = values->background; } - if (mask & GCLineWidth) { gc->line_width = values->line_width; } - if (mask & GCLineStyle) { gc->line_style = values->line_style; } - if (mask & GCCapStyle) { gc->cap_style = values->cap_style; } - if (mask & GCJoinStyle) { gc->join_style = values->join_style; } - if (mask & GCFillStyle) { gc->fill_style = values->fill_style; } - if (mask & GCFillRule) { gc->fill_rule = values->fill_rule; } - if (mask & GCArcMode) { gc->arc_mode = values->arc_mode; } - if (mask & GCTile) { gc->tile = values->tile; } - if (mask & GCStipple) { gc->stipple = values->stipple; } - if (mask & GCTileStipXOrigin) { gc->ts_x_origin = values->ts_x_origin; } - if (mask & GCTileStipYOrigin) { gc->ts_y_origin = values->ts_y_origin; } - if (mask & GCFont) { gc->font = values->font; } - if (mask & GCSubwindowMode) { gc->subwindow_mode = values->subwindow_mode; } - if (mask & GCGraphicsExposures) { gc->graphics_exposures = values->graphics_exposures; } - if (mask & GCClipXOrigin) { gc->clip_x_origin = values->clip_x_origin; } - if (mask & GCClipYOrigin) { gc->clip_y_origin = values->clip_y_origin; } - if (mask & GCClipMask) { XSetClipMask(d, gc, values->clip_mask); } - if (mask & GCDashOffset) { gc->dash_offset = values->dash_offset; } - if (mask & GCDashList) { gc->dashes = values->dashes; (&(gc->dashes))[1] = 0;} +XChangeGC( + Display *d, + GC gc, + unsigned long mask, + XGCValues *values) +{ +#define ModifyField(name,maskbit) \ + if (mask & (maskbit)) { gc->name = values->name; } + + ModifyField(function, GCFunction); + ModifyField(plane_mask, GCPlaneMask); + ModifyField(foreground, GCForeground); + ModifyField(background, GCBackground); + ModifyField(line_width, GCLineWidth); + ModifyField(line_style, GCLineStyle); + ModifyField(cap_style, GCCapStyle); + ModifyField(join_style, GCJoinStyle); + ModifyField(fill_style, GCFillStyle); + ModifyField(fill_rule, GCFillRule); + ModifyField(arc_mode, GCArcMode); + ModifyField(tile, GCTile); + ModifyField(stipple, GCStipple); + ModifyField(ts_x_origin, GCTileStipXOrigin); + ModifyField(ts_y_origin, GCTileStipYOrigin); + ModifyField(font, GCFont); + ModifyField(subwindow_mode, GCSubwindowMode); + ModifyField(graphics_exposures, GCGraphicsExposures); + ModifyField(clip_x_origin, GCClipXOrigin); + ModifyField(clip_y_origin, GCClipYOrigin); + ModifyField(dash_offset, GCDashOffset); + if (mask & GCClipMask) { + XSetClipMask(d, gc, values->clip_mask); + } + if (mask & GCDashList) { + gc->dashes = values->dashes; + (&(gc->dashes))[1] = 0; + } return Success; } @@ -230,12 +265,13 @@ XChangeGC(d, gc, mask, values) *---------------------------------------------------------------------- */ -int XFreeGC(d, gc) - Display * d; - GC gc; +int XFreeGC( + Display *d, + GC gc) { if (gc != None) { FreeClipMask(gc); + TkpFreeGCCache(gc); ckfree((char *) gc); } return Success; @@ -246,8 +282,8 @@ int XFreeGC(d, gc) * * XSetForeground, etc. -- * - * The following functions are simply accessor functions for - * the GC slots. + * The following functions are simply accessor functions for the GC + * slots. * * Results: * None. @@ -259,32 +295,32 @@ int XFreeGC(d, gc) */ int -XSetForeground(display, gc, foreground) - Display *display; - GC gc; - unsigned long foreground; +XSetForeground( + Display *display, + GC gc, + unsigned long foreground) { gc->foreground = foreground; return Success; } int -XSetBackground(display, gc, background) - Display *display; - GC gc; - unsigned long background; +XSetBackground( + Display *display, + GC gc, + unsigned long background) { gc->background = background; return Success; } int -XSetDashes(display, gc, dash_offset, dash_list, n) - Display* display; - GC gc; - int dash_offset; - _Xconst char* dash_list; - int n; +XSetDashes( + Display *display, + GC gc, + int dash_offset, + _Xconst char *dash_list, + int n) { char *p = &(gc->dashes); @@ -304,40 +340,40 @@ XSetDashes(display, gc, dash_offset, dash_list, n) } int -XSetFunction(display, gc, function) - Display *display; - GC gc; - int function; +XSetFunction( + Display *display, + GC gc, + int function) { gc->function = function; return Success; } int -XSetFillRule(display, gc, fill_rule) - Display *display; - GC gc; - int fill_rule; +XSetFillRule( + Display *display, + GC gc, + int fill_rule) { gc->fill_rule = fill_rule; return Success; } int -XSetFillStyle(display, gc, fill_style) - Display *display; - GC gc; - int fill_style; +XSetFillStyle( + Display *display, + GC gc, + int fill_style) { gc->fill_style = fill_style; return Success; } int -XSetTSOrigin(display, gc, x, y) - Display *display; - GC gc; - int x, y; +XSetTSOrigin( + Display *display, + GC gc, + int x, int y) { gc->ts_x_origin = x; gc->ts_y_origin = y; @@ -345,44 +381,43 @@ XSetTSOrigin(display, gc, x, y) } int -XSetFont(display, gc, font) - Display *display; - GC gc; - Font font; +XSetFont( + Display *display, + GC gc, + Font font) { gc->font = font; return Success; } int -XSetArcMode(display, gc, arc_mode) - Display *display; - GC gc; - int arc_mode; +XSetArcMode( + Display *display, + GC gc, + int arc_mode) { gc->arc_mode = arc_mode; return Success; } int -XSetStipple(display, gc, stipple) - Display *display; - GC gc; - Pixmap stipple; +XSetStipple( + Display *display, + GC gc, + Pixmap stipple) { gc->stipple = stipple; return Success; } int -XSetLineAttributes(display, gc, line_width, line_style, cap_style, - join_style) - Display *display; - GC gc; - unsigned int line_width; - int line_style; - int cap_style; - int join_style; +XSetLineAttributes( + Display *display, + GC gc, + unsigned int line_width, + int line_style, + int cap_style, + int join_style) { gc->line_width = line_width; gc->line_style = line_style; @@ -392,11 +427,11 @@ XSetLineAttributes(display, gc, line_width, line_style, cap_style, } int -XSetClipOrigin(display, gc, clip_x_origin, clip_y_origin) - Display* display; - GC gc; - int clip_x_origin; - int clip_y_origin; +XSetClipOrigin( + Display *display, + GC gc, + int clip_x_origin, + int clip_y_origin) { gc->clip_x_origin = clip_x_origin; gc->clip_y_origin = clip_y_origin; @@ -425,13 +460,13 @@ XSetClipOrigin(display, gc, clip_x_origin, clip_y_origin) */ void -TkSetRegion(display, gc, r) - Display* display; - GC gc; - TkRegion r; +TkSetRegion( + Display *display, + GC gc, + TkRegion r) { if (r == None) { - FreeClipMask(gc); + Tcl_Panic("must not pass None to TkSetRegion for compatibility with X11; use XSetClipMask instead"); } else { TkpClipMask *clip_mask = AllocClipMask(gc); @@ -444,10 +479,10 @@ TkSetRegion(display, gc, r) } int -XSetClipMask(display, gc, pixmap) - Display* display; - GC gc; - Pixmap pixmap; +XSetClipMask( + Display *display, + GC gc, + Pixmap pixmap) { if (pixmap == None) { FreeClipMask(gc); @@ -466,157 +501,167 @@ XSetClipMask(display, gc, pixmap) #if 0 Cursor -XCreateFontCursor(display, shape) - Display* display; - unsigned int shape; +XCreateFontCursor( + Display *display, + unsigned int shape) { return (Cursor) 0; } void -XDrawImageString(display, d, gc, x, y, string, length) - Display* display; - Drawable d; - GC gc; - int x; - int y; - _Xconst char* string; - int length; +XDrawImageString( + Display *display, + Drawable d, + GC gc, + int x, + int y, + _Xconst char *string, + int length) { } #endif void -XDrawPoint(display, d, gc, x, y) - Display* display; - Drawable d; - GC gc; - int x; - int y; +XDrawPoint( + Display *display, + Drawable d, + GC gc, + int x, + int y) { XDrawLine(display, d, gc, x, y, x, y); } void -XDrawPoints(display, d, gc, points, npoints, mode) - Display* display; - Drawable d; - GC gc; - XPoint* points; - int npoints; - int mode; +XDrawPoints( + Display *display, + Drawable d, + GC gc, + XPoint *points, + int npoints, + int mode) { int i; for (i=0; i<npoints; i++) { - XDrawPoint(display, d, gc, points[i].x, points[i].y); + XDrawLine(display, d, gc, + points[i].x, points[i].y, points[i].x, points[i].y); } } -#if !defined(MAC_TCL) && !defined(MAC_OSX_TK) +#if !defined(MAC_OSX_TK) void -XDrawSegments(display, d, gc, segments, nsegments) - Display* display; - Drawable d; - GC gc; - XSegment* segments; - int nsegments; +XDrawSegments( + Display *display, + Drawable d, + GC gc, + XSegment *segments, + int nsegments) { } #endif #if 0 char * -XFetchBuffer(display, nbytes_return, buffer) - Display* display; - int* nbytes_return; - int buffer; +XFetchBuffer( + Display *display, + int *nbytes_return, + int buffer) { return (char *) 0; } -Status XFetchName(display, w, window_name_return) - Display* display; - Window w; - char** window_name_return; +Status +XFetchName( + Display *display, + Window w, + char **window_name_return) { return (Status) 0; } -Atom *XListProperties(display, w, num_prop_return) - Display* display; - Window w; - int* num_prop_return; +Atom * +XListProperties( + Display* display, + Window w, + int *num_prop_return) { return (Atom *) 0; } void -XMapRaised(display, w) - Display* display; - Window w; +XMapRaised( + Display *display, + Window w) { } void -XPutImage(display, d, gc, image, src_x, src_y, dest_x, dest_y, width, height) - Display* display; - Drawable d; - GC gc; - XImage* image; - int src_x; - int src_y; - int dest_x; - int dest_y; - unsigned int width; - unsigned int height; +XPutImage( + Display *display, + Drawable d, + GC gc, + XImage *image, + int src_x, + int src_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height) { } void -XQueryTextExtents(display, font_ID, string, nchars, direction_return, - font_ascent_return, font_descent_return, overall_return) - Display* display; - XID font_ID; - _Xconst char* string; - int nchars; - int* direction_return; - int* font_ascent_return; - int* font_descent_return; - XCharStruct* overall_return; +XQueryTextExtents( + Display *display, + XID font_ID, + _Xconst char *string, + int nchars, + int *direction_return, + int *font_ascent_return, + int *font_descent_return, + XCharStruct *overall_return) { } void -XReparentWindow(display, w, parent, x, y) - Display* display; - Window w; - Window parent; - int x; - int y; +XReparentWindow( + Display *display, + Window w, + Window parent, + int x, + int y) { } void -XRotateBuffers(display, rotate) - Display* display; - int rotate; +XRotateBuffers( + Display *display, + int rotate) { } void -XStoreBuffer(display, bytes, nbytes, buffer) - Display* display; - _Xconst char* bytes; - int nbytes; - int buffer; +XStoreBuffer( + Display *display, + _Xconst char *bytes, + int nbytes, + int buffer) { } void -XUndefineCursor(display, w) - Display* display; - Window w; +XUndefineCursor( + Display *display, + Window w) { } #endif + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/xlib/ximage.c b/xlib/ximage.c index e7ac86c..aaab946 100644 --- a/xlib/ximage.c +++ b/xlib/ximage.c @@ -5,12 +5,11 @@ * * Copyright (c) 1995 Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" - /* *---------------------------------------------------------------------- @@ -19,10 +18,10 @@ * * Construct a single plane pixmap from bitmap data. * - * NOTE: This procedure has the correct behavior on Windows and - * the Macintosh, but not on UNIX. This is probably because the - * emulation for XPutImage on those platforms compensates for whatever - * is wrong here :-) + * NOTE: This procedure has the correct behavior on Windows and the + * Macintosh, but not on UNIX. This is probably because the emulation for + * XPutImage on those platforms compensates for whatever is wrong here + * :-) * * Results: * Returns a new Pixmap. @@ -34,12 +33,12 @@ */ Pixmap -XCreateBitmapFromData(display, d, data, width, height) - Display* display; - Drawable d; - _Xconst char* data; - unsigned int width; - unsigned int height; +XCreateBitmapFromData( + Display *display, + Drawable d, + _Xconst char *data, + unsigned int width, + unsigned int height) { XImage *ximage; GC gc; @@ -60,3 +59,11 @@ XCreateBitmapFromData(display, d, data, width, height) XFreeGC(display, gc); return pix; } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/xlib/xutil.c b/xlib/xutil.c index 23b589c..267a624 100644 --- a/xlib/xutil.c +++ b/xlib/xutil.c @@ -5,30 +5,24 @@ * * Copyright (c) 1995-1996 Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <stdlib.h> #include <tk.h> -#ifdef MAC_TCL -# include <Xutil.h> -# include <Xatom.h> -#else -# include <X11/Xutil.h> -# include <X11/Xatom.h> -#endif +#include <X11/Xutil.h> +#include <X11/Xatom.h> /* *---------------------------------------------------------------------- * * XInternAtom -- * - * This procedure simulates the XInternAtom function by calling - * Tk_Uid to get a unique id for every atom. This is only a - * partial implementation, since it doesn't work across - * applications. + * This procedure simulates the XInternAtom function by calling Tk_Uid to + * get a unique id for every atom. This is only a partial implementation, + * since it doesn't work across applications. * * Results: * A new Atom. @@ -40,10 +34,10 @@ */ Atom -XInternAtom(display, atom_name, only_if_exists) - Display* display; - _Xconst char* atom_name; - Bool only_if_exists; +XInternAtom( + Display *display, + _Xconst char *atom_name, + Bool only_if_exists) { static Atom atom = XA_LAST_PREDEFINED; @@ -68,13 +62,13 @@ XInternAtom(display, atom_name, only_if_exists) */ XVisualInfo * -XGetVisualInfo(display, vinfo_mask, vinfo_template, nitems_return) - Display* display; - long vinfo_mask; - XVisualInfo* vinfo_template; - int* nitems_return; +XGetVisualInfo( + Display *display, + long vinfo_mask, + XVisualInfo *vinfo_template, + int *nitems_return) { - XVisualInfo *info = (XVisualInfo *)ckalloc(sizeof(XVisualInfo)); + XVisualInfo *info = (XVisualInfo *) ckalloc(sizeof(XVisualInfo)); info->visual = DefaultVisual(display, 0); info->visualid = info->visual->visualid; info->screen = 0; @@ -112,3 +106,11 @@ XGetVisualInfo(display, vinfo_mask, vinfo_template, nitems_return) *nitems_return = 1; return info; } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ |