📄 nano-x.h
字号:
#ifndef _NANO_X_H#define _NANO_X_H/* Copyright (c) 1999, 2000, 2001, 2002, 2003 Greg Haerr <greg@censoft.com> * Portions Copyright (c) 2002 by Koninklijke Philips Electronics N.V. * Copyright (c) 2000 Alex Holden <alex@linuxhacker.org> * Copyright (c) 1991 David I. Bell * Permission is granted to use, distribute, or modify this source, * provided that this copyright notice remains intact. * * Nano-X public definition header file: user applications should * include only this header file. */#ifdef __cplusplusextern "C" {#endif#include "mwtypes.h" /* exported engine MW* types*//* * The following typedefs are inherited from the Microwindows * engine layer. */typedef MWCOORD GR_COORD; /* coordinate value */typedef MWCOORD GR_SIZE; /* size value */typedef MWCOLORVAL GR_COLOR; /* full color value */typedef MWPIXELVAL GR_PIXELVAL; /* hw pixel value */typedef MWIMAGEBITS GR_BITMAP; /* bitmap unit */typedef MWUCHAR GR_CHAR; /* filename, window title */typedef MWTEXTFLAGS GR_TEXTFLAGS; /* text encoding flags */typedef MWKEY GR_KEY; /* keystroke value */typedef MWSCANCODE GR_SCANCODE; /* oem keystroke scancode value */typedef MWKEYMOD GR_KEYMOD; /* keystroke modifiers */typedef MWSCREENINFO GR_SCREEN_INFO; /* screen information */typedef MWWINDOWFBINFO GR_WINDOW_FB_INFO; /* direct client-mapped window info */typedef MWFONTINFO GR_FONT_INFO; /* font information */typedef MWIMAGEINFO GR_IMAGE_INFO; /* image information */typedef MWIMAGEHDR GR_IMAGE_HDR; /* multicolor image representation */typedef MWLOGFONT GR_LOGFONT; /* logical font descriptor */typedef MWPALENTRY GR_PALENTRY; /* palette entry */typedef MWPOINT GR_POINT; /* definition of a point */typedef MWTIMEOUT GR_TIMEOUT; /* timeout value */typedef MWFONTLIST GR_FONTLIST; /* list of fonts */typedef MWKBINFO GR_KBINFO; /* keyboard information */typedef MWSTIPPLE GR_STIPPLE; /* Stipple information */typedef MWTRANSFORM GR_TRANSFORM; /* Transform information *//* Basic typedefs. */typedef int GR_COUNT; /* number of items */typedef unsigned char GR_CHAR_WIDTH; /* width of character */typedef unsigned int GR_ID; /* resource ids */typedef GR_ID GR_DRAW_ID; /* drawable id */typedef GR_DRAW_ID GR_WINDOW_ID; /* window or pixmap id */typedef GR_ID GR_GC_ID; /* graphics context id */typedef GR_ID GR_REGION_ID; /* region id */typedef GR_ID GR_FONT_ID; /* font id */typedef GR_ID GR_IMAGE_ID; /* image id */typedef GR_ID GR_TIMER_ID; /* timer id */typedef GR_ID GR_CURSOR_ID; /* cursor id */typedef unsigned short GR_BOOL; /* boolean value */typedef int GR_ERROR; /* error types */typedef int GR_EVENT_TYPE; /* event types */typedef int GR_UPDATE_TYPE; /* window update types */typedef unsigned long GR_EVENT_MASK; /* event masks */typedef char GR_FUNC_NAME[25];/* function name */typedef unsigned long GR_WM_PROPS; /* window property flags */typedef unsigned long GR_SERIALNO; /* Selection request ID number */typedef unsigned short GR_MIMETYPE; /* Index into mime type list */typedef unsigned long GR_LENGTH; /* Length of a block of data */typedef unsigned int GR_BUTTON; /* mouse button value *//** Nano-X rectangle, different from MWRECT */typedef struct { GR_COORD x; /**< upper left x coordinate*/ GR_COORD y; /**< upper left y coordinate*/ GR_SIZE width; /**< rectangle width*/ GR_SIZE height; /**< rectangle height*/} GR_RECT;/* The root window id. */#define GR_ROOT_WINDOW_ID ((GR_WINDOW_ID) 1)/* GR_COLOR color constructor */#define GR_RGB(r,g,b) MWRGB(r,g,b)#define GR_ARGB(a,r,g,b) MWARGB(a,r,g,b)/* Drawing modes for GrSetGCMode */#define GR_MODE_COPY MWMODE_COPY /* src*/#define GR_MODE_SET MWMODE_COPY /* obsolete, use GR_MODE_COPY*/#define GR_MODE_XOR MWMODE_XOR /* src ^ dst*/#define GR_MODE_OR MWMODE_OR /* src | dst*/#define GR_MODE_AND MWMODE_AND /* src & dst*/#define GR_MODE_CLEAR MWMODE_CLEAR /* 0*/#define GR_MODE_SETTO1 MWMODE_SETTO1 /* 11111111*/ /* will be GR_MODE_SET*/#define GR_MODE_EQUIV MWMODE_EQUIV /* ~(src ^ dst)*/#define GR_MODE_NOR MWMODE_NOR /* ~(src | dst)*/#define GR_MODE_NAND MWMODE_NAND /* ~(src & dst)*/#define GR_MODE_INVERT MWMODE_INVERT /* ~dst*/#define GR_MODE_COPYINVERTED MWMODE_COPYINVERTED /* ~src*/#define GR_MODE_ORINVERTED MWMODE_ORINVERTED /* ~src | dst*/#define GR_MODE_ANDINVERTED MWMODE_ANDINVERTED /* ~src & dst*/#define GR_MODE_ORREVERSE MWMODE_ORREVERSE /* src | ~dst*/#define GR_MODE_ANDREVERSE MWMODE_ANDREVERSE /* src & ~dst*/#define GR_MODE_NOOP MWMODE_NOOP /* dst*/#define GR_MODE_DRAWMASK 0x00FF#define GR_MODE_EXCLUDECHILDREN 0x0100 /* exclude children on clip*//* Line modes */#define GR_LINE_SOLID MWLINE_SOLID#define GR_LINE_ONOFF_DASH MWLINE_ONOFF_DASH#define GR_FILL_SOLID MWFILL_SOLID#define GR_FILL_STIPPLE MWFILL_STIPPLE#define GR_FILL_OPAQUE_STIPPLE MWFILL_OPAQUE_STIPPLE#define GR_FILL_TILE MWFILL_TILE/* Polygon regions*/#define GR_POLY_EVENODD MWPOLY_EVENODD#define GR_POLY_WINDING MWPOLY_WINDING/* builtin font std names*/#define GR_FONT_SYSTEM_VAR MWFONT_SYSTEM_VAR#define GR_FONT_SYSTEM_FIXED MWFONT_SYSTEM_FIXED#define GR_FONT_GUI_VAR MWFONT_GUI_VAR /* deprecated*/#define GR_FONT_OEM_FIXED MWFONT_OEM_FIXED /* deprecated*//* GrText/GrGetTextSize encoding flags*/#define GR_TFASCII MWTF_ASCII#define GR_TFUTF8 MWTF_UTF8#define GR_TFUC16 MWTF_UC16#define GR_TFUC32 MWTF_UC32#define GR_TFXCHAR2B MWTF_XCHAR2B#define GR_TFPACKMASK MWTF_PACKMASK/* GrText alignment flags*/#define GR_TFTOP MWTF_TOP#define GR_TFBASELINE MWTF_BASELINE#define GR_TFBOTTOM MWTF_BOTTOM/* GrSetFontAttr flags*/#define GR_TFKERNING MWTF_KERNING#define GR_TFANTIALIAS MWTF_ANTIALIAS#define GR_TFUNDERLINE MWTF_UNDERLINE/* GrArc, GrArcAngle types*/#define GR_ARC MWARC /* arc only*/#define GR_ARCOUTLINE MWARCOUTLINE /* arc + outline*/#define GR_PIE MWPIE /* pie (filled)*//* GrSetWindowRegion types*/#define GR_WINDOW_BOUNDING_MASK 0 /* outer border*/#define GR_WINDOW_CLIP_MASK 1 /* inner border*//* Booleans */#define GR_FALSE 0#define GR_TRUE 1/* Loadable Image support definition */#define GR_IMAGE_MAX_SIZE (-1)/* Button flags */#define GR_BUTTON_R MWBUTTON_R /* right button*/#define GR_BUTTON_M MWBUTTON_M /* middle button*/#define GR_BUTTON_L MWBUTTON_L /* left button */#define GR_BUTTON_ANY (MWBUTTON_R|MWBUTTON_M|MWBUTTON_L) /* any*//* GrSetBackgroundPixmap flags */#define GR_BACKGROUND_TILE 0 /* Tile across the window */#define GR_BACKGROUND_CENTER 1 /* Draw in center of window */#define GR_BACKGROUND_TOPLEFT 2 /* Draw at top left of window */#define GR_BACKGROUND_STRETCH 4 /* Stretch image to fit window*/#define GR_BACKGROUND_TRANS 8 /* Don't fill in gaps *//* GrNewPixmapFromData flags*/#define GR_BMDATA_BYTEREVERSE 01 /* byte-reverse bitmap data*/#define GR_BMDATA_BYTESWAP 02 /* byte-swap bitmap data*/#if 0 /* don't define unimp'd flags*//* Window property flags */#define GR_WM_PROP_NORESIZE 0x04 /* don't let user resize window */#define GR_WM_PROP_NOICONISE 0x08 /* don't let user iconise window */#define GR_WM_PROP_NOWINMENU 0x10 /* don't display a window menu button */#define GR_WM_PROP_NOROLLUP 0x20 /* don't let user roll window up */#define GR_WM_PROP_ONTOP 0x200 /* try to keep window always on top */#define GR_WM_PROP_STICKY 0x400 /* keep window after desktop change */#define GR_WM_PROP_DND 0x2000 /* accept drag and drop icons */#endif/* Window properties*/#define GR_WM_PROPS_NOBACKGROUND 0x00000001L/* Don't draw window background*/#define GR_WM_PROPS_NOFOCUS 0x00000002L /* Don't set focus to this window*/#define GR_WM_PROPS_NOMOVE 0x00000004L /* Don't let user move window*/#define GR_WM_PROPS_NORAISE 0x00000008L /* Don't let user raise window*/#define GR_WM_PROPS_NODECORATE 0x00000010L /* Don't redecorate window*/#define GR_WM_PROPS_NOAUTOMOVE 0x00000020L /* Don't move window on 1st map*/#define GR_WM_PROPS_NOAUTORESIZE 0x00000040L /* Don't resize window on 1st map*//* default decoration style*/#define GR_WM_PROPS_APPWINDOW 0x00000000L /* Leave appearance to WM*/#define GR_WM_PROPS_APPMASK 0xF0000000L /* Appearance mask*/#define GR_WM_PROPS_BORDER 0x80000000L /* Single line border*/#define GR_WM_PROPS_APPFRAME 0x40000000L /* 3D app frame (overrides border)*/#define GR_WM_PROPS_CAPTION 0x20000000L /* Title bar*/#define GR_WM_PROPS_CLOSEBOX 0x10000000L /* Close box*/#define GR_WM_PROPS_MAXIMIZE 0x08000000L /* Application is maximized*//* Flags for indicating valid bits in GrSetWMProperties call*/#define GR_WM_FLAGS_PROPS 0x0001 /* Properties*/#define GR_WM_FLAGS_TITLE 0x0002 /* Title*/#define GR_WM_FLAGS_BACKGROUND 0x0004 /* Background color*/#define GR_WM_FLAGS_BORDERSIZE 0x0008 /* Border size*/#define GR_WM_FLAGS_BORDERCOLOR 0x0010 /* Border color*//* NOTE: this struct must be hand-packed to a DWORD boundary for nxproto.h*//** * Window manager properties used by the GrGetWMProperties()/GrSetWMProperties() calls. */typedef struct { GR_WM_PROPS flags; /**< Which properties valid in struct for set*/ GR_WM_PROPS props; /**< Window property bits*/ GR_CHAR *title; /**< Window title*/ GR_COLOR background; /**< Window background color*/ GR_SIZE bordersize; /**< Window border size*/ GR_COLOR bordercolor; /**< Window border color*/} GR_WM_PROPERTIES;/** * Window properties returned by the GrGetWindowInfo() call. */typedef struct { GR_WINDOW_ID wid; /**< window id (or 0 if no such window) */ GR_WINDOW_ID parent; /**< parent window id */ GR_WINDOW_ID child; /**< first child window id (or 0) */ GR_WINDOW_ID sibling; /**< next sibling window id (or 0) */ GR_BOOL inputonly; /**< TRUE if window is input only */ GR_BOOL mapped; /**< TRUE if window is mapped */ GR_BOOL realized; /**< TRUE if window is mapped and visible */ GR_COORD x; /**< parent-relative x position of window */ GR_COORD y; /**< parent-relative y position of window */ GR_SIZE width; /**< width of window */ GR_SIZE height; /**< height of window */ GR_SIZE bordersize; /**< size of border */ GR_COLOR bordercolor; /**< color of border */ GR_COLOR background; /**< background color */ GR_EVENT_MASK eventmask; /**< current event mask for this client */ GR_WM_PROPS props; /**< window properties */ GR_CURSOR_ID cursor; /**< cursor id*/ unsigned long processid; /**< process id of owner*/} GR_WINDOW_INFO;/** * Graphics context properties returned by the GrGetGCInfo() call. */typedef struct { GR_GC_ID gcid; /**< GC id (or 0 if no such GC) */ int mode; /**< drawing mode */ GR_REGION_ID region; /**< user region */ int xoff; /**< x offset of user region */ int yoff; /**< y offset of user region */ GR_FONT_ID font; /**< font number */ GR_COLOR foreground; /**< foreground RGB color or pixel value */ GR_COLOR background; /**< background RGB color or pixel value */ GR_BOOL fgispixelval; /**< TRUE if 'foreground' is actually a GR_PIXELVAL */ GR_BOOL bgispixelval; /**< TRUE if 'background' is actually a GR_PIXELVAL */ GR_BOOL usebackground; /**< use background in bitmaps */ GR_BOOL exposure; /**< send exposure events on GrCopyArea */} GR_GC_INFO;/** * color palette */typedef struct { GR_COUNT count; /**< # valid entries */ GR_PALENTRY palette[256]; /**< palette */} GR_PALETTE;/** Calibration data passed to GrCalcTransform */typedef struct { int xres; /**< X resolution of the screen */ int yres; /**< Y resolution of the screen */ int minx; /**< min raw X value */ int miny; /**< min raw Y values */ int maxx; /**< max raw X value */ int maxy; /**< max raw Y value */ GR_BOOL xswap; /**< true if the x component should be swapped */ GR_BOOL yswap; /**< true if the y component should be swapped */} GR_CAL_DATA;/* Error codes */#define GR_ERROR_BAD_WINDOW_ID 1#define GR_ERROR_BAD_GC_ID 2#define GR_ERROR_BAD_CURSOR_SIZE 3#define GR_ERROR_MALLOC_FAILED 4#define GR_ERROR_BAD_WINDOW_SIZE 5#define GR_ERROR_KEYBOARD_ERROR 6#define GR_ERROR_MOUSE_ERROR 7#define GR_ERROR_INPUT_ONLY_WINDOW 8#define GR_ERROR_ILLEGAL_ON_ROOT_WINDOW 9#define GR_ERROR_TOO_MUCH_CLIPPING 10#define GR_ERROR_SCREEN_ERROR 11#define GR_ERROR_UNMAPPED_FOCUS_WINDOW 12#define GR_ERROR_BAD_DRAWING_MODE 13#define GR_ERROR_BAD_LINE_ATTRIBUTE 14#define GR_ERROR_BAD_FILL_MODE 15#define GR_ERROR_BAD_REGION_ID 16/* Event types. * Mouse motion is generated for every motion of the mouse, and is used to * track the entire history of the mouse (many events and lots of overhead). * Mouse position ignores the history of the motion, and only reports the * latest position of the mouse by only queuing the latest such event for * any single client (good for rubber-banding). */#define GR_EVENT_TYPE_ERROR (-1)#define GR_EVENT_TYPE_NONE 0#define GR_EVENT_TYPE_EXPOSURE 1#define GR_EVENT_TYPE_BUTTON_DOWN 2#define GR_EVENT_TYPE_BUTTON_UP 3#define GR_EVENT_TYPE_MOUSE_ENTER 4#define GR_EVENT_TYPE_MOUSE_EXIT 5#define GR_EVENT_TYPE_MOUSE_MOTION 6#define GR_EVENT_TYPE_MOUSE_POSITION 7#define GR_EVENT_TYPE_KEY_DOWN 8#define GR_EVENT_TYPE_KEY_UP 9#define GR_EVENT_TYPE_FOCUS_IN 10#define GR_EVENT_TYPE_FOCUS_OUT 11#define GR_EVENT_TYPE_FDINPUT 12#define GR_EVENT_TYPE_UPDATE 13#define GR_EVENT_TYPE_CHLD_UPDATE 14#define GR_EVENT_TYPE_CLOSE_REQ 15#define GR_EVENT_TYPE_TIMEOUT 16#define GR_EVENT_TYPE_SCREENSAVER 17#define GR_EVENT_TYPE_CLIENT_DATA_REQ 18#define GR_EVENT_TYPE_CLIENT_DATA 19#define GR_EVENT_TYPE_SELECTION_CHANGED 20#define GR_EVENT_TYPE_TIMER 21#define GR_EVENT_TYPE_PORTRAIT_CHANGED 22/* Event masks */#define GR_EVENTMASK(n) (((GR_EVENT_MASK) 1) << (n))#define GR_EVENT_MASK_NONE GR_EVENTMASK(GR_EVENT_TYPE_NONE)#define GR_EVENT_MASK_ERROR 0x80000000L#define GR_EVENT_MASK_EXPOSURE GR_EVENTMASK(GR_EVENT_TYPE_EXPOSURE)#define GR_EVENT_MASK_BUTTON_DOWN GR_EVENTMASK(GR_EVENT_TYPE_BUTTON_DOWN)#define GR_EVENT_MASK_BUTTON_UP GR_EVENTMASK(GR_EVENT_TYPE_BUTTON_UP)#define GR_EVENT_MASK_MOUSE_ENTER GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_ENTER)#define GR_EVENT_MASK_MOUSE_EXIT GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_EXIT)#define GR_EVENT_MASK_MOUSE_MOTION GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_MOTION)#define GR_EVENT_MASK_MOUSE_POSITION GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_POSITION)#define GR_EVENT_MASK_KEY_DOWN GR_EVENTMASK(GR_EVENT_TYPE_KEY_DOWN)#define GR_EVENT_MASK_KEY_UP GR_EVENTMASK(GR_EVENT_TYPE_KEY_UP)#define GR_EVENT_MASK_FOCUS_IN GR_EVENTMASK(GR_EVENT_TYPE_FOCUS_IN)#define GR_EVENT_MASK_FOCUS_OUT GR_EVENTMASK(GR_EVENT_TYPE_FOCUS_OUT)#define GR_EVENT_MASK_FDINPUT GR_EVENTMASK(GR_EVENT_TYPE_FDINPUT)#define GR_EVENT_MASK_UPDATE GR_EVENTMASK(GR_EVENT_TYPE_UPDATE)#define GR_EVENT_MASK_CHLD_UPDATE GR_EVENTMASK(GR_EVENT_TYPE_CHLD_UPDATE)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -