📄 client.c
字号:
}/** * Performs a logical exclusive OR operation on the specified source regions * and places the result in the destination region. The destination region * will contain only the parts of the source regions which do not overlap. * * @param dst_rgn The ID of the destination region. * @param src_rgn1 The ID of the first source region. * @param src_rgn2 The ID of the second source region. * * @ingroup nanox_region */voidGrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, GR_REGION_ID src_rgn2){ nxXorRegionReq *req; LOCK(&nxGlobalLock); req = AllocReq(XorRegion); req->regionid = dst_rgn; req->srcregionid1 = src_rgn1; req->srcregionid2 = src_rgn2; UNLOCK(&nxGlobalLock);}/** * Calculates the intersection of the two specified source regions and places * the result in the specified destination region. The destination region * will contain only the parts of the source regions which overlap each other. * * @param dst_rgn The ID of the destination region. * @param src_rgn1 The ID of the first source region. * @param src_rgn2 The ID of the second source region. * * @ingroup nanox_region */voidGrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, GR_REGION_ID src_rgn2){ nxIntersectRegionReq *req; LOCK(&nxGlobalLock); req = AllocReq(IntersectRegion); req->regionid = dst_rgn; req->srcregionid1 = src_rgn1; req->srcregionid2 = src_rgn2; UNLOCK(&nxGlobalLock);}/** * Sets the clip mask of the specified graphics context to the specified * region. Subsequent drawing operations using this graphics context will not * draw outside the specified region. The region ID can be set to 0 to remove * the clipping region from the specified graphics context. * * @param gc The ID of the graphics context to set the clip mask of. * @param region The ID of the region to use as the clip mask, or 0 for none. * * @ingroup nanox_region */voidGrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region){ nxSetGCRegionReq *req; LOCK(&nxGlobalLock); req = AllocReq(SetGCRegion); req->gcid = gc; req->regionid = region; UNLOCK(&nxGlobalLock);}/** * Sets the X,Y origin of the user clip region in the specified * graphics context. * * @param gc The ID of the graphics context with user clip region. * @param xoff New X offset of user clip region. * @param yoff New Y offset of user clip region. * * @ingroup nanox_draw */void GrSetGCClipOrigin(GR_GC_ID gc, int xoff, int yoff){ nxSetGCClipOriginReq *req; LOCK(&nxGlobalLock); req = AllocReq(SetGCClipOrigin); req->gcid = gc; req->xoff = xoff; req->yoff = yoff; UNLOCK(&nxGlobalLock);}/** * Controls if GR_EVENT_TYPE_EXPOSURE events are sent as a * result of GrCopyArea using the specified graphics context. * * @param gc The ID of the graphics context * @param exposure TRUE to send events, FALSE otherwise. * * @ingroup nanox_draw */void GrSetGCGraphicsExposure(GR_GC_ID gc, GR_BOOL exposure){ nxSetGCGraphicsExposureReq *req; LOCK(&nxGlobalLock); req = AllocReq(SetGCGraphicsExposure); req->gcid = gc; req->exposure = exposure; UNLOCK(&nxGlobalLock);}/** * Tests whether the specified point is within the specified region, and * then returns either True or False depending on the result. * * @param region the ID of the region to examine. * @param x the X coordinate of the point to test for. * @param y the Y coordinate of the point to test for. * @return TRUE if the point is within the region, otherwise FALSE. * * @ingroup nanox_region */GR_BOOLGrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y){ nxPointInRegionReq *req; GR_BOOL ret_value; LOCK(&nxGlobalLock); req = AllocReq(PointInRegion); req->regionid = region; req->x = x; req->y = y; if(TypedReadBlock(&ret_value, sizeof(ret_value), GrNumPointInRegion) == -1) ret_value = GR_FALSE; UNLOCK(&nxGlobalLock); return ret_value;}/** * Tests whether the specified rectangle is contained within the specified * region. Returns GR_RECT_OUT if it is not inside it at all, GR_RECT_ALLIN * if it is completely contained within the region, or GR_RECT_PARTIN if * it is partially contained within the region. * * @param region The ID of the region to examine. * @param x The X coordinates of the rectangle to test. * @param y The Y coordinates of the rectangle to test. * @param w The width of the rectangle to test. * @param h The height of the rectangle to test. * @return GR_RECT_PARTIN, GR_RECT_ALLIN, or GR_RECT_OUT. * * @ingroup nanox_region */intGrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y, GR_COORD w, GR_COORD h){ nxRectInRegionReq *req; unsigned short ret_value; LOCK(&nxGlobalLock); req = AllocReq(RectInRegion); req->regionid = region; req->x = x; req->y = y; req->w = w; req->h = h; if(TypedReadBlock(&ret_value, sizeof(ret_value), GrNumRectInRegion) == -1) ret_value = 0; UNLOCK(&nxGlobalLock); return (int)ret_value;}/** * Determines whether the specified region is empty. * * @param region The ID of the region to examine. * @return GR_TRUE if the region is empty, or GR_FALSE if it is not. * * @ingroup nanox_region */GR_BOOLGrEmptyRegion(GR_REGION_ID region){ nxEmptyRegionReq *req; GR_BOOL ret_value; LOCK(&nxGlobalLock); req = AllocReq(EmptyRegion); req->regionid = region; if(TypedReadBlock(&ret_value, sizeof(ret_value), GrNumEmptyRegion) == -1) ret_value = GR_FALSE; UNLOCK(&nxGlobalLock); return ret_value;}/** * Determines whether the specified regions are identical, and returns GR_TRUE * if it is, or GR_FALSE otherwise. * * @param rgn1 The ID of the first region to examine. * @param rgn2 The ID of the second region to examine. * @return GR_TRUE if the regions are equal, or GR_FALSE otherwise * * @ingroup nanox_region */GR_BOOLGrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2){ nxEqualRegionReq *req; GR_BOOL ret_value; LOCK(&nxGlobalLock); req = AllocReq(EqualRegion); req->region1 = rgn1; req->region2 = rgn2; if(TypedReadBlock(&ret_value, sizeof(ret_value), GrNumEqualRegion) == -1) ret_value = GR_FALSE; UNLOCK(&nxGlobalLock); return ret_value;}/** * Offsets the specified region by the specified distance. * * @param region The ID of the region to offset * @param dx The distance to offset the region by in the X axis * @param dy The distance to offset the region by in the Y axis * * @ingroup nanox_region */voidGrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy){ nxOffsetRegionReq *req; LOCK(&nxGlobalLock); req = AllocReq(OffsetRegion); req->region = region; req->dx = dx; req->dy = dy; UNLOCK(&nxGlobalLock);}/** * Fills in the specified rectangle structure with a bounding box that would * completely enclose the specified region, and also returns the type of the * specified region. * * @param region The ID of the region to get the bounding box of * @param rect Pointer to a rectangle structure * @return The region type * * @todo FIXME check Doxygen comments from this point down. * * @ingroup nanox_region */intGrGetRegionBox(GR_REGION_ID region, GR_RECT *rect){ nxGetRegionBoxReq *req; unsigned short ret_value; if (!rect) return GR_FALSE; LOCK(&nxGlobalLock); req = AllocReq(GetRegionBox); req->regionid = region; if(TypedReadBlock(rect, sizeof(*rect), GrNumGetRegionBox) == -1) return GR_FALSE; if(TypedReadBlock(&ret_value, sizeof(ret_value), GrNumGetRegionBox) == -1) ret_value = GR_FALSE; UNLOCK(&nxGlobalLock); return ret_value;}/** * Creates a new region structure, fills it with the region described by the * specified polygon, and returns the ID used to refer to it. * * @param mode the polygon mode to use (GR_POLY_EVENODD or GR_POLY_WINDING) * @param count the number of points in the polygon * @param points pointer to an array of point structures describing the polygon * @return the ID of the newly allocated region structure, or 0 on error * * @ingroup nanox_region */GR_REGION_ID GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points){ nxNewPolygonRegionReq *req; long size; GR_REGION_ID region; if(count == 0) return GrNewRegion(); if(points == NULL) return 0; LOCK(&nxGlobalLock); size = (long)count * sizeof(GR_POINT); req = AllocReqExtra(NewPolygonRegion, size); req->mode = mode; /* FIXME: unportable method, depends on sizeof(int) in GR_POINT*/ memcpy(GetReqData(req), points, size); if(TypedReadBlock(®ion, sizeof(region), GrNumNewPolygonRegion) == -1) region = 0; UNLOCK(&nxGlobalLock); return region;}/** * Recursively maps (makes visible) the specified window and all of the * child windows which have a sufficient map count. The border and background * of the window are painted, and an exposure event is generated for the * window and every child which becomes visible. * * @param wid the ID of the window to map * * @ingroup nanox_window */void GrMapWindow(GR_WINDOW_ID wid){ nxMapWindowReq *req; LOCK(&nxGlobalLock); req = AllocReq(MapWindow); req->windowid = wid; UNLOCK(&nxGlobalLock);}/** * Recursively unmaps (makes invisible) the specified window and all of the * child windows. * * @param wid the ID of the window to unmap * * @ingroup nanox_window */void GrUnmapWindow(GR_WINDOW_ID wid){ nxUnmapWindowReq *req; LOCK(&nxGlobalLock); req = AllocReq(UnmapWindow); req->windowid = wid; UNLOCK(&nxGlobalLock);}/** * Places the specified window at the top of its parents drawing stack, above * all of its sibling windows. * * @param wid the ID of the window to raise * * @ingroup nanox_window */void GrRaiseWindow(GR_WINDOW_ID wid){ nxRaiseWindowReq *req; LOCK(&nxGlobalLock); req = AllocReq(RaiseWindow); req->windowid = wid; UNLOCK(&nxGlobalLock);}/** * Places the specified window at the bottom of its parents drawing stack, * below all of its sibling windows. * * @param wid the ID of the window to lower * * @ingroup nanox_window */void GrLowerWindow(GR_WINDOW_ID wid){ nxLowerWindowReq *req; LOCK(&nxGlobalLock); req = AllocReq(LowerWindow); req->windowid = wid; UNLOCK(&nxGlobalLock);}/** * Moves the specified window to the specified position relative to its * parent window. * * @param wid the ID of the window to move * @param x the X coordinate to move the window to relative to its parent. * @param y the Y coordinate to move the window to relative to its parent. * * @ingroup nanox_window */void GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y){ nxMoveWindowReq *req; LOCK(&nxGlobalLock); req = AllocReq(MoveWindow); req->windowid = wid; req->x = x; req->y = y; UNLOCK(&nxGlobalLock);}/** * Resizes the specified window to be the specified width and height. * * @param wid the ID of the window to resize * @param width the width to resize the window to * @param height the height to resize the window to * * @ingroup nanox_window */void GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height){ nxResizeWindowReq *req; LOCK(&nxGlobalLock); req = AllocReq(ResizeWindow); req->windowid = wid; req->width = width; req->height = height; UNLOCK(&nxGlobalLock);}/** * Changes the parent window of the specified window to the specified parent * window and places it at the specified coordinates relative to the new * parent. * * @param wid the ID of the window to reparent * @param pwid the ID of the new parent window * @param x the X coordinate to place the window at relative to the new parent * @param y the Y coordinate to place the window at relative to the new parent * * @ingroup nanox_window */void GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y){ nxReparentWindowReq *req; LOCK(&nxGlobalLock); req = AllocReq(ReparentWindow); req->windowid = wid; req->parentid = pwid; req->x = x; req->y = y; UNLOCK(&nxGlobalLock);}/** * Clears the specified window by to its background color or pixmap. * If exposeflag is non zero, an exposure event is generated for * the window after it has been cleared. * * @param wid Window ID. * @param x X co-ordinate of rectangle to clear. * @param y Y co-ordinate of rectangle to clear. * @param width Width of rectangle to clear. * @param height Height of rectangle to clear. * @param exposeflag A flag indicating whether to also generate an exposure event. * * @ingroup nanox_draw */voidGrClearArea(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, GR_BOOL exposeflag){ nxClearAreaReq *req; LOCK(&nxGlobalLock); req = AllocReq(ClearArea); req->windowid = wid; req->x = x; req->y = y; req->width = width; req->height = height; req->exposeflag = exposeflag; UNLOCK(&nxGlobalLock);}/** * Returns the ID of the window which currently has the keyboard focus. * * @return the ID of the window which currently has the keyboard focus * * @ingroup nanox_window */GR_WINDOW_IDGrGetFocus(void){ GR_WINDOW_ID wid; LOCK(&nxGlobalLock); AllocReq(GetFocus); if(TypedReadBlock(&wid, sizeof(wid), GrNumGetFocus) == -1) wid = 0; UNLOCK(&nxGlobalLock); return wid;}/** * Sets the keyboard focus to the specified window.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -