📄 xlib.h
字号:
/* $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, 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 * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * X Window System is a Trademark of MIT. * *//* * Xlib.h - Header definition and support file for the C subroutine * interface library (Xlib) to the X Window System Protocol (V11). * Structures and symbols starting with "_" are private to the library. */#ifndef _XLIB_H_#define _XLIB_H_#define XlibSpecificationRelease 5#if !defined(MAC_TCL) && !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# define Region XRegion#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#define X_WCHAR#endif#endif#ifndef X_WCHAR#include <stddef.h>#else/* replace this with #include or typedef appropriate for your system */typedef unsigned long wchar_t;#endiftypedef char *XPointer;#define Bool int#if defined(MAC_TCL) || defined(MAC_OSX_TK)/* Use define rather than typedef, since may need to undefine this later */#define Status int#elsetypedef int Status;#endif#define True 1#define False 0#define QueuedAlready 0#define QueuedAfterReading 1#define QueuedAfterFlush 2#define ConnectionNumber(dpy) ((dpy)->fd)#define RootWindow(dpy, scr) (((dpy)->screens[(scr)]).root)#define DefaultScreen(dpy) ((dpy)->default_screen)#define DefaultRootWindow(dpy) (((dpy)->screens[(dpy)->default_screen]).root)#define DefaultVisual(dpy, scr) (((dpy)->screens[(scr)]).root_visual)#define DefaultGC(dpy, scr) (((dpy)->screens[(scr)]).default_gc)#define BlackPixel(dpy, scr) (((dpy)->screens[(scr)]).black_pixel)#define WhitePixel(dpy, scr) (((dpy)->screens[(scr)]).white_pixel)#define AllPlanes ((unsigned long)~0L)#define QLength(dpy) ((dpy)->qlen)#define DisplayWidth(dpy, scr) (((dpy)->screens[(scr)]).width)#define DisplayHeight(dpy, scr) (((dpy)->screens[(scr)]).height)#define DisplayWidthMM(dpy, scr)(((dpy)->screens[(scr)]).mwidth)#define DisplayHeightMM(dpy, scr)(((dpy)->screens[(scr)]).mheight)#define DisplayPlanes(dpy, scr) (((dpy)->screens[(scr)]).root_depth)#define DisplayCells(dpy, scr) (DefaultVisual((dpy), (scr))->map_entries)#define ScreenCount(dpy) ((dpy)->nscreens)#define ServerVendor(dpy) ((dpy)->vendor)#define ProtocolVersion(dpy) ((dpy)->proto_major_version)#define ProtocolRevision(dpy) ((dpy)->proto_minor_version)#define VendorRelease(dpy) ((dpy)->release)#define DisplayString(dpy) ((dpy)->display_name)#define DefaultDepth(dpy, scr) (((dpy)->screens[(scr)]).root_depth)#define DefaultColormap(dpy, scr)(((dpy)->screens[(scr)]).cmap)#define BitmapUnit(dpy) ((dpy)->bitmap_unit)#define BitmapBitOrder(dpy) ((dpy)->bitmap_bit_order)#define BitmapPad(dpy) ((dpy)->bitmap_pad)#define ImageByteOrder(dpy) ((dpy)->byte_order)#define NextRequest(dpy) ((dpy)->request + 1)#define LastKnownRequestProcessed(dpy) ((dpy)->request)/* macros for screen oriented applications (toolkit) */#define ScreenOfDisplay(dpy, scr)(&((dpy)->screens[(scr)]))#define DefaultScreenOfDisplay(dpy) (&((dpy)->screens[(dpy)->default_screen]))#define DisplayOfScreen(s) ((s)->display)#define RootWindowOfScreen(s) ((s)->root)#define BlackPixelOfScreen(s) ((s)->black_pixel)#define WhitePixelOfScreen(s) ((s)->white_pixel)#define DefaultColormapOfScreen(s)((s)->cmap)#define DefaultDepthOfScreen(s) ((s)->root_depth)#define DefaultGCOfScreen(s) ((s)->default_gc)#define DefaultVisualOfScreen(s)((s)->root_visual)#define WidthOfScreen(s) ((s)->width)#define HeightOfScreen(s) ((s)->height)#define WidthMMOfScreen(s) ((s)->mwidth)#define HeightMMOfScreen(s) ((s)->mheight)#define PlanesOfScreen(s) ((s)->root_depth)#define CellsOfScreen(s) (DefaultVisualOfScreen((s))->map_entries)#define MinCmapsOfScreen(s) ((s)->min_maps)#define MaxCmapsOfScreen(s) ((s)->max_maps)#define DoesSaveUnders(s) ((s)->save_unders)#define DoesBackingStore(s) ((s)->backing_store)#define EventMaskOfScreen(s) ((s)->root_input_mask)/* * Extensions need a way to hang private data on some structures. */typedef struct _XExtData { int number; /* number returned by XRegisterExtension */ struct _XExtData *next; /* next item on list of data for structure */ int (*free_private)(); /* called to free private storage */ XPointer private_data; /* data private to this extension. */} XExtData;/* * This file contains structures used by the extension mechanism. */typedef struct { /* public to extension, cannot be changed */ int extension; /* extension number */ int major_opcode; /* major op-code assigned by server */ int first_event; /* first event number for the extension */ int first_error; /* first error number for the extension */} XExtCodes;/* * Data structure for retrieving info about pixmap formats. */typedef struct { int depth; int bits_per_pixel; int scanline_pad;} XPixmapFormatValues;/* * Data structure for setting graphics context. */typedef struct { int function; /* logical operation */ unsigned long plane_mask;/* plane mask */ unsigned long foreground;/* foreground pixel */ unsigned long background;/* background pixel */ int line_width; /* line width */ int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */ int join_style; /* JoinMiter, JoinRound, JoinBevel */ int fill_style; /* FillSolid, FillTiled, FillStippled, FillOpaeueStippled */ int fill_rule; /* EvenOddRule, WindingRule */ int arc_mode; /* ArcChord, ArcPieSlice */ Pixmap tile; /* tile pixmap for tiling operations */ Pixmap stipple; /* stipple 1 plane pixmap for stipping */ int ts_x_origin; /* offset for tile or stipple operations */ int ts_y_origin; Font font; /* default text font for text operations */ int subwindow_mode; /* ClipByChildren, IncludeInferiors */ Bool graphics_exposures;/* boolean, should exposures be generated */ int clip_x_origin; /* origin for clipping */ int clip_y_origin; Pixmap clip_mask; /* bitmap clipping; other calls for rects */ int dash_offset; /* patterned/dashed line information */ char dashes;} XGCValues;/* * Graphics context. The contents of this structure are implementation * dependent. A GC should be treated as opaque by application code. */typedef XGCValues *GC;/* * Visual structure; contains information about colormapping possible. */typedef struct { XExtData *ext_data; /* hook for extension to hang data */ VisualID visualid; /* visual id of this visual */#if defined(__cplusplus) || defined(c_plusplus) int c_class; /* C++ class of screen (monochrome, etc.) */#else int class; /* class of screen (monochrome, etc.) */#endif unsigned long red_mask, green_mask, blue_mask; /* mask values */ int bits_per_rgb; /* log base 2 of distinct color values */ int map_entries; /* color map entries */} Visual;/* * 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 */ Visual *visuals; /* list of visuals possible at this depth */} Depth;/* * Information about the screen. The contents of this structure are * implementation dependent. A Screen should be treated as opaque * by application code. */typedef struct { XExtData *ext_data; /* hook for extension to hang data */ struct _XDisplay *display;/* back pointer to display structure */ Window root; /* Root window id. */ int width, height; /* width and height of screen */ int mwidth, mheight; /* width and height of in millimeters */ int ndepths; /* number of depths possible */ Depth *depths; /* list of allowable depths on the screen */ int root_depth; /* bits per pixel */ Visual *root_visual; /* root visual */ GC default_gc; /* GC for the root root visual */ Colormap cmap; /* default color map */ unsigned long white_pixel; 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; long root_input_mask; /* initial root input mask */} Screen;/* * Format structure; describes ZFormat data the screen will understand. */typedef struct { XExtData *ext_data; /* hook for extension to hang data */ int depth; /* depth of this image format */ int bits_per_pixel; /* bits/pixel at this depth */ int scanline_pad; /* scanline must padded to this multiple */} ScreenFormat;/* * Data structure for setting window attributes. */typedef struct { Pixmap background_pixmap; /* background or None or ParentRelative */ unsigned long background_pixel; /* background pixel */ Pixmap border_pixmap; /* border of the window */ unsigned long border_pixel; /* border pixel value */ int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ unsigned long backing_planes;/* planes to be preseved if possible */ unsigned long backing_pixel;/* value to use in restoring planes */ Bool save_under; /* should bits under be saved? (popups) */ long event_mask; /* set of events that should be saved */ long do_not_propagate_mask; /* set of events that should not propagate */ Bool override_redirect; /* boolean value for override-redirect */ Colormap colormap; /* color map to be associated with window */ Cursor cursor; /* cursor to be displayed (or None) */} XSetWindowAttributes;typedef struct { int x, y; /* location of window */ int width, height; /* width and height of window */ int border_width; /* border width of window */ int depth; /* depth of window */ Visual *visual; /* the associated visual structure */ Window root; /* root of screen containing window */#if defined(__cplusplus) || defined(c_plusplus) int c_class; /* C++ InputOutput, InputOnly*/#else int class; /* InputOutput, InputOnly*/#endif int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ unsigned long backing_planes;/* planes to be preserved if possible */ unsigned long backing_pixel;/* value to be used when restoring planes */ Bool save_under; /* boolean, should bits under be saved? */ Colormap colormap; /* color map to be associated with window */ Bool map_installed; /* boolean, is color map currently installed*/ int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ long all_event_masks; /* set of events all people have interest in*/ long your_event_mask; /* my event mask */ long do_not_propagate_mask; /* set of events that should not propagate */ Bool override_redirect; /* boolean value for override-redirect */ Screen *screen; /* back pointer to correct screen */} XWindowAttributes;/* * Data structure for host setting; getting routines. * */typedef struct { int family; /* for example FamilyInternet */ int length; /* length of address, in bytes */ char *address; /* pointer to where to find the bytes */} XHostAddress;/* * Data structure for "image" data, used by image manipulation routines. */typedef struct _XImage { int width, height; /* size of image */ int xoffset; /* number of pixels offset in X direction */ int format; /* XYBitmap, XYPixmap, ZPixmap */ char *data; /* pointer to image data */ int byte_order; /* data byte order, LSBFirst, MSBFirst */ int bitmap_unit; /* quant. of scanline 8, 16, 32 */ int bitmap_bit_order; /* LSBFirst, MSBFirst */ int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */ int depth; /* depth of image */ int bytes_per_line; /* accelarator to next line */ int bits_per_pixel; /* bits per pixel (ZPixmap) */ unsigned long red_mask; /* bits in z arrangment */ unsigned long green_mask; unsigned long blue_mask; XPointer obdata; /* hook for the object routines to hang on */ struct funcs { /* image manipulation routines */ struct _XImage *(*create_image)();#if NeedFunctionPrototypes int (*destroy_image) (struct _XImage *); unsigned long (*get_pixel) (struct _XImage *, int, int); int (*put_pixel) (struct _XImage *, int, int, unsigned long); struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int); int (*add_pixel) (struct _XImage *, long);#else int (*destroy_image)(); unsigned long (*get_pixel)(); int (*put_pixel)(); struct _XImage *(*sub_image)(); int (*add_pixel)();#endif } f;} XImage;/* * Data structure for XReconfigureWindow */typedef struct { int x, y; int width, height; int border_width; Window sibling; int stack_mode;} XWindowChanges;/* * Data structure used by color operations */typedef struct { unsigned long pixel; unsigned short red, green, blue; char flags; /* do_red, do_green, do_blue */ 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. */typedef struct { short x1, y1, x2, y2;} XSegment;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; short angle1, angle2;} XArc;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -