📄 nano-x.h
字号:
#define GR_EVENT_MASK_CLOSE_REQ GR_EVENTMASK(GR_EVENT_TYPE_CLOSE_REQ)#define GR_EVENT_MASK_TIMEOUT GR_EVENTMASK(GR_EVENT_TYPE_TIMEOUT)#define GR_EVENT_MASK_SCREENSAVER GR_EVENTMASK(GR_EVENT_TYPE_SCREENSAVER)#define GR_EVENT_MASK_CLIENT_DATA_REQ GR_EVENTMASK(GR_EVENT_TYPE_CLIENT_DATA_REQ)#define GR_EVENT_MASK_CLIENT_DATA GR_EVENTMASK(GR_EVENT_TYPE_CLIENT_DATA)#define GR_EVENT_MASK_SELECTION_CHANGED GR_EVENTMASK(GR_EVENT_TYPE_SELECTION_CHANGED)#define GR_EVENT_MASK_TIMER GR_EVENTMASK(GR_EVENT_TYPE_TIMER)#define GR_EVENT_MASK_PORTRAIT_CHANGED GR_EVENTMASK(GR_EVENT_TYPE_PORTRAIT_CHANGED)/* Event mask does not affect GR_EVENT_TYPE_HOTKEY_DOWN and * GR_EVENT_TYPE_HOTKEY_UP, hence no masks for those events. */#define GR_EVENT_MASK_ALL ((GR_EVENT_MASK) -1L)/* update event types */#define GR_UPDATE_MAP 1#define GR_UPDATE_UNMAP 2#define GR_UPDATE_MOVE 3#define GR_UPDATE_SIZE 4#define GR_UPDATE_UNMAPTEMP 5 /* unmap during window move/resize*/#define GR_UPDATE_ACTIVATE 6 /* toplevel window [de]activate*/#define GR_UPDATE_DESTROY 7#define GR_UPDATE_REPARENT 8/** * Event for errors detected by the server. * These events are not delivered to GrGetNextEvent, but instead call * the user supplied error handling function. Only the first one of * these errors at a time is saved for delivery to the client since * there is not much to be done about errors anyway except complain * and exit. */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_FUNC_NAME name; /**< function name which failed */ GR_ERROR code; /**< error code */ GR_ID id; /**< resource id (maybe useless) */} GR_EVENT_ERROR;/** * Event for a mouse button pressed down or released. */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_WINDOW_ID wid; /**< window id event delivered to */ GR_WINDOW_ID subwid; /**< sub-window id (pointer was in) */ GR_COORD rootx; /**< root window x coordinate */ GR_COORD rooty; /**< root window y coordinate */ GR_COORD x; /**< window x coordinate of mouse */ GR_COORD y; /**< window y coordinate of mouse */ GR_BUTTON buttons; /**< current state of all buttons */ GR_BUTTON changebuttons; /**< buttons which went down or up */ GR_KEYMOD modifiers; /**< modifiers (MWKMOD_SHIFT, etc)*/ GR_TIMEOUT time; /**< tickcount time value*/} GR_EVENT_BUTTON;/** * Event for a keystroke typed for the window with has focus. */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_WINDOW_ID wid; /**< window id event delived to */ GR_WINDOW_ID subwid; /**< sub-window id (pointer was in) */ GR_COORD rootx; /**< root window x coordinate */ GR_COORD rooty; /**< root window y coordinate */ GR_COORD x; /**< window x coordinate of mouse */ GR_COORD y; /**< window y coordinate of mouse */ GR_BUTTON buttons; /**< current state of buttons */ GR_KEYMOD modifiers; /**< modifiers (MWKMOD_SHIFT, etc)*/ GR_KEY ch; /**< 16-bit unicode key value, MWKEY_xxx */ GR_SCANCODE scancode; /**< OEM scancode value if available*/ GR_BOOL hotkey; /**< TRUE if generated from GrGrabKey(GR_GRAB_HOTKEY_x) */} GR_EVENT_KEYSTROKE;/** * Event for exposure for a region of a window. */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_WINDOW_ID wid; /**< window id */ GR_COORD x; /**< window x coordinate of exposure */ GR_COORD y; /**< window y coordinate of exposure */ GR_SIZE width; /**< width of exposure */ GR_SIZE height; /**< height of exposure */} GR_EVENT_EXPOSURE;/** * General events for focus in or focus out for a window, or mouse enter * or mouse exit from a window, or window unmapping or mapping, etc. * Server portrait mode changes are also sent using this event to * all windows that request it. */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_WINDOW_ID wid; /**< window id */ GR_WINDOW_ID otherid; /**< new/old focus id for focus events*/} GR_EVENT_GENERAL;/** * Events for mouse motion or mouse position. */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_WINDOW_ID wid; /**< window id event delivered to */ GR_WINDOW_ID subwid; /**< sub-window id (pointer was in) */ GR_COORD rootx; /**< root window x coordinate */ GR_COORD rooty; /**< root window y coordinate */ GR_COORD x; /**< window x coordinate of mouse */ GR_COORD y; /**< window y coordinate of mouse */ GR_BUTTON buttons; /**< current state of buttons */ GR_KEYMOD modifiers; /**< modifiers (MWKMOD_SHIFT, etc)*/} GR_EVENT_MOUSE;/** * GrRegisterInput() event. */typedef struct { GR_EVENT_TYPE type; /**< event type */ int fd; /**< input file descriptor*/} GR_EVENT_FDINPUT;/** * GR_EVENT_TYPE_UPDATE */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_WINDOW_ID wid; /**< select window id*/ GR_WINDOW_ID subwid; /**< update window id (=wid for UPDATE event)*/ GR_COORD x; /**< new window x coordinate */ GR_COORD y; /**< new window y coordinate */ GR_SIZE width; /**< new width */ GR_SIZE height; /**< new height */ GR_UPDATE_TYPE utype; /**< update_type */} GR_EVENT_UPDATE;/** * GR_EVENT_TYPE_SCREENSAVER */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_BOOL activate; /**< true = activate, false = deactivate */} GR_EVENT_SCREENSAVER;/** * GR_EVENT_TYPE_CLIENT_DATA_REQ */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_WINDOW_ID wid; /**< ID of requested window */ GR_WINDOW_ID rid; /**< ID of window to send data to */ GR_SERIALNO serial; /**< Serial number of transaction */ GR_MIMETYPE mimetype; /**< Type to supply data as */} GR_EVENT_CLIENT_DATA_REQ;/** * GR_EVENT_TYPE_CLIENT_DATA */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_WINDOW_ID wid; /**< ID of window data is destined for */ GR_WINDOW_ID rid; /**< ID of window data is from */ GR_SERIALNO serial; /**< Serial number of transaction */ unsigned long len; /**< Total length of data */ unsigned long datalen; /**< Length of following data */ void *data; /**< Pointer to data (filled in on client side) */} GR_EVENT_CLIENT_DATA;/** * GR_EVENT_TYPE_SELECTION_CHANGED */typedef struct { GR_EVENT_TYPE type; /**< event type */ GR_WINDOW_ID new_owner; /**< ID of new selection owner */} GR_EVENT_SELECTION_CHANGED;/** * GR_EVENT_TYPE_TIMER */typedef struct { GR_EVENT_TYPE type; /**< event type, GR_EVENT_TYPE_TIMER */ GR_WINDOW_ID wid; /**< ID of window timer is destined for */ GR_TIMER_ID tid; /**< ID of expired timer */} GR_EVENT_TIMER;/** * Union of all possible event structures. * This is the structure returned by GrGetNextEvent() and similar routines. */typedef union { GR_EVENT_TYPE type; /**< event type */ GR_EVENT_ERROR error; /**< error event */ GR_EVENT_GENERAL general; /**< general window events */ GR_EVENT_BUTTON button; /**< button events */ GR_EVENT_KEYSTROKE keystroke; /**< keystroke events */ GR_EVENT_EXPOSURE exposure; /**< exposure events */ GR_EVENT_MOUSE mouse; /**< mouse motion events */ GR_EVENT_FDINPUT fdinput; /**< fd input events*/ GR_EVENT_UPDATE update; /**< window update events */ GR_EVENT_SCREENSAVER screensaver; /**< Screen saver events */ GR_EVENT_CLIENT_DATA_REQ clientdatareq; /**< Request for client data events */ GR_EVENT_CLIENT_DATA clientdata; /**< Client data events */ GR_EVENT_SELECTION_CHANGED selectionchanged; /**< Selection owner changed */ GR_EVENT_TIMER timer; /**< Timer events */} GR_EVENT;typedef void (*GR_FNCALLBACKEVENT)(GR_EVENT *);/* GR_BITMAP macros*//* size of GR_BITMAP image in words*/#define GR_BITMAP_SIZE(width, height) MWIMAGE_SIZE(width, height)#define GR_BITMAPBITS MWIMAGE_BITSPERIMAGE#define GR_BITVALUE(n) MWIMAGE_BITVALUE(n)#define GR_FIRSTBIT MWIMAGE_FIRSTBIT#define GR_NEXTBIT(m) MWIMAGE_NEXTBIT(m)#define GR_TESTBIT(m) MWIMAGE_TESTBIT(m)#define GR_SHIFTBIT(m) MWIMAGE_SHIFTBIT(m)/* GrGrabKey() types. *//** * Key reservation type for GrGrabKey() - a key is reserved exclusively, * and hotkey events are sent regardless of focus. * * Hotkey events are sent to the client that reserved the key. The window * ID passed to the GrGrabKey() call is passed as the source window. * * This type of reservation is useful for implementing a "main menu" key * or similar hotkeys. * * This can be used to implement the MHP method * org.dvb.event.EventManager.addUserEventListener(listener,client,events). * * @see GrGrabKey() * @see GrUngrabKey() */#define GR_GRAB_HOTKEY_EXCLUSIVE 0/** * Key reservation type for GrGrabKey() - hotkey events are sent when a key * is pressed, regardless of focus. This is not an exclusive reservation, * so the app that has the focus will get a normal key event. * * Hotkey events are sent to the client that reserved the key. The window * ID passed to the GrGrabKey() call is passed as the source window. * * Note that because this is not an exclusive grab, it does not stop * other applications from grabbing the same key (using #GR_GRAB_HOTKEY * or any other grab mode). If an application has an exclusive grab on * a key, then any grabs of type #GR_GRAB_HOTKEY will be ignored when * dispatching that key event. * * This can be used to implement the MHP method * org.dvb.event.EventManager.addUserEventListener(listener,events). * * @see GrGrabKey() * @see GrUngrabKey() */#define GR_GRAB_HOTKEY 1/** * Key reservation type for GrGrabKey() - a key is reserved exclusively, * and normal key events are sent if the specified window has focus. * * This stops other applications from getting events on the specified key. * * For example, an application could use this to reserve the number * keys before asking the user for a PIN, to prevent other applications * stealing the PIN using #GR_GRAB_TYPE_HOTKEY. (Note that this assumes * the applications are running in a controlled environment, such as * Java, so they can only interact with the platform in limited ways). * * This can be used to implement the MHP method * org.dvb.event.EventManager.addExclusiveAccessToAWTEvent(client,events). * * @see GrGrabKey() * @see GrUngrabKey() */#define GR_GRAB_EXCLUSIVE 2/** * Key reservation type for GrGrabKey() - a key is reserved exclusively, * and normal key events are sent if the specified window has focus, * or the mouse pointer is over the window. * * This stops other applications from getting events on the specified key. * * This is for compatibility with the first GrGrabKey() API, which only * supported this kind of reservation. * * @see GrGrabKey() * @see GrUngrabKey() */#define GR_GRAB_EXCLUSIVE_MOUSE 3/** * Highest legal value of any GR_GRAB_xxx constant. (Lowest legal value * must be 0). * * @internal */#define GR_GRAB_MAX GR_GRAB_EXCLUSIVE_MOUSE/* GrGetSysColor colors*//* desktop background*/#define GR_COLOR_DESKTOP 0/* caption colors*/#define GR_COLOR_ACTIVECAPTION 1#define GR_COLOR_ACTIVECAPTIONTEXT 2#define GR_COLOR_INACTIVECAPTION 3#define GR_COLOR_INACTIVECAPTIONTEXT 4/* 3d border shades*/#define GR_COLOR_WINDOWFRAME 5#define GR_COLOR_BTNSHADOW 6#define GR_COLOR_3DLIGHT 7#define GR_COLOR_BTNHIGHLIGHT 8/* top level application window backgrounds/text*/#define GR_COLOR_APPWINDOW 9#define GR_COLOR_APPTEXT 10/* button control backgrounds/text (usually same as app window colors)*/#define GR_COLOR_BTNFACE 11#define GR_COLOR_BTNTEXT 12/* edit/listbox control backgrounds/text, selected highlights*/#define GR_COLOR_WINDOW 13#define GR_COLOR_WINDOWTEXT 14#define GR_COLOR_HIGHLIGHT 15#define GR_COLOR_HIGHLIGHTTEXT 16#define GR_COLOR_GRAYTEXT 17/* menu backgrounds/text*/#define GR_COLOR_MENUTEXT 18#define GR_COLOR_MENU 19/** * Error strings per error number */#define GR_ERROR_STRINGS \ "", \ "Bad window id: %d\n", \ "Bad graphics context: %d\n", \ "Bad cursor size\n", \ "Out of server memory\n", \ "Bad window size: %d\n", \ "Keyboard error\n", \ "Mouse error\n", \ "Input only window: %d\n", \ "Illegal on root window: %d\n", \ "Clipping overflow\n", \ "Screen error\n", \ "Unmapped focus window: %d\n", \ "Bad drawing mode gc: %d\n", \ "Bad line attribute gc: %d\n", \ "Bad fill mode gc: %d\n", \ "Bad region id: %d\n",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -