/* * Fonction pour VScrollBar */ void DrawThumbV(struct XObj *xobj, XEvent *evp) { int x,y,w,h; XSegment segm; char str[20]; x = xobj->width/2 - 10; y = 2 + (xobj->height - 36)*(xobj->value - xobj->value3) / (xobj->value2 - xobj->value3); w = 20; h = 32; DrawReliefRect(x, y, w, h, xobj, hili, shad); segm.x1 = x + 3; segm.y1 = y + 15; segm.x2 = x + w - 3; segm.y2 = y + 15; XSetForeground(dpy, xobj->gc, xobj->TabColor[shad]); XDrawSegments(dpy, xobj->win, xobj->gc, &segm, 1); segm.x1 = x + 3; segm.y1 = y + 16; segm.x2 = x + w - 3; segm.y2 = y + 16; XSetForeground(dpy, xobj->gc, xobj->TabColor[hili]); XDrawSegments(dpy, xobj->win, xobj->gc, &segm, 1); XSetForeground(dpy, xobj->gc, xobj->TabColor[fore]); sprintf(str, "%d", xobj->value); x = x-FlocaleTextWidth(xobj->Ffont, str, strlen(str))-6; y = y + 13 + xobj->Ffont->ascent/2; MyDrawString(dpy, xobj, xobj->win, x, y, str, fore, hili, back, !xobj->flags[1], NULL, evp); }
void RedrawBottomButton(GC rgc, GC sgc,int x1, int y1) { XSegment seg[4]; int i=0; seg[i].x1 = x1+1; seg[i].y1 = y1+1; seg[i].x2 = x1+SCROLL_BAR_WIDTH/2; seg[i++].y2 = y1+SCROLL_BAR_WIDTH - 2; seg[i].x1 = x1; seg[i].y1 = y1+0; seg[i].x2 = x1+SCROLL_BAR_WIDTH/2; seg[i++].y2 = y1+SCROLL_BAR_WIDTH - 1; seg[i].x1 = x1+1; seg[i].y1 = y1+1; seg[i].x2 = x1+SCROLL_BAR_WIDTH - 2; seg[i++].y2 = y1+1; seg[i].x1 = x1; seg[i].y1 = y1+0; seg[i].x2 = x1+SCROLL_BAR_WIDTH - 1; seg[i++].y2 = y1+0; XDrawSegments(dpy,main_win, rgc, seg, i); i = 0; seg[i].x1 = x1+SCROLL_BAR_WIDTH - 2; seg[i].y1 = y1+1; seg[i].x2 = x1+SCROLL_BAR_WIDTH/2; seg[i++].y2 = y1+SCROLL_BAR_WIDTH - 2; seg[i].x1 = x1+SCROLL_BAR_WIDTH - 1; seg[i].y1 = y1+0; seg[i].x2 = x1+SCROLL_BAR_WIDTH/2; seg[i++].y2 = y1+SCROLL_BAR_WIDTH - 1; XDrawSegments(dpy, main_win, sgc, seg, i); }
/** *** RelieveWindow() *** Draws the relief pattern around a window. **/ void RelieveWindow(Window wn,int width,int x,int y,int w,int h,Pixel relief, Pixel shadow,int rev) { XSegment seg[4]; unsigned long gcm=0; XGCValues gcv; Pixel p; int i,j; if(!width) return; if(width<0) { width=-width; p=relief;relief=shadow;shadow=p; } if(rev) { p=relief;relief=shadow;shadow=p; } gcm=GCForeground; gcv.foreground=relief; XChangeGC(Dpy,NormalGC,gcm,&gcv); for(j=0;j<width && w>1 && h>1 ;j++,w-=2,h-=2,x+=1,y+=1) { i=0; seg[i].x1 = x; seg[i].y1 = y; seg[i].x2 = x+w-1; seg[i++].y2 = y; seg[i].x1 = x; seg[i].y1 = y; seg[i].x2 = x; seg[i++].y2 = y+h-1; XDrawSegments(Dpy,wn,NormalGC,seg,i); } w+=width*2;h+=width*2;x-=width;y-=width; gcm=GCForeground; gcv.foreground=shadow; XChangeGC(Dpy,NormalGC,gcm,&gcv); for(j=0;j<width && w>1 && h>1 ;j++,w-=2,h-=2,x+=1,y+=1) { i=0; seg[i].x1 = x+1; seg[i].y1 = y+h-1; seg[i].x2 = x+w-1; seg[i++].y2 = y+h-1; seg[i].x1 = x+w-1; seg[i].y1 = y+1; seg[i].x2 = x+w-1; seg[i++].y2 = y+h-1; XDrawSegments(Dpy,wn,NormalGC,seg,i); } }
void DrawPopupMenu(struct XObj *xobj, XEvent *evp) { XSegment segm[4]; char* str; int x,y; int asc = xobj->Ffont->ascent; DrawReliefRect(0, 0, xobj->width, xobj->height, xobj, hili, shad); /* Dessin de la fleche / arrow drawing */ segm[0].x1 = 7; segm[0].y1 = asc; segm[0].x2 = 19; segm[0].y2 = asc; segm[1].x1 = 8; segm[1].y1 = asc; segm[1].x2 = 13; segm[1].y2 = 5 + asc; segm[2].x1 = 6; segm[2].y1 = asc - 1; segm[2].x2 = 19; segm[2].y2 = 0 + asc -1; segm[3].x1 = 7; segm[3].y1 = asc; segm[3].x2 = 12; segm[3].y2 = 5 +asc; XSetForeground(dpy, xobj->gc, xobj->TabColor[shad]); XDrawSegments(dpy, xobj->win, xobj->gc, segm, 4); segm[0].x1 = 17; segm[0].y1 = asc + 1; segm[0].x2 = 13; segm[0].y2 = 5 + asc; segm[1].x1 = 19; segm[1].y1 = asc; segm[1].x2 = 14; segm[1].y2 = 5 + asc; XSetForeground(dpy, xobj->gc, xobj->TabColor[hili]); XDrawSegments(dpy, xobj->win, xobj->gc, segm, 2); /* Dessin du titre du popup menu */ str = (char*)GetMenuTitle(xobj->title, xobj->value); y = asc + 5; x = GetXTextPosition(xobj,xobj->width, FlocaleTextWidth(xobj->Ffont,str,strlen(str)), 25,8,8); MyDrawString(dpy, xobj, xobj->win, x, y, str, fore, hili, back, !xobj->flags[1], NULL, evp); free(str); }
/********************************************************************** * XG_DRAWTRIANGLE * - draws a triangle outline **********************************************************************/ void xg_drawtriangle(void *xgid, int x1, int y1, int x2, int y2, int x3, int y3, unsigned int pixel, int style) { struct xg_graphic *graphic; GC *gc; XSegment segments[3]; int nsegments = 3; graphic = (struct xg_graphic *) xgid; if (style == XG_SOLIDLINE) gc = &graphic->gc_solid; else gc = &graphic->gc_dash; segments[0].x1 = (short) x1; segments[0].y1 = (short) y1; segments[0].x2 = (short) x2; segments[0].y2 = (short) y2; segments[1].x1 = (short) x2; segments[1].y1 = (short) y2; segments[1].x2 = (short) x3; segments[1].y2 = (short) y3; segments[2].x1 = (short) x3; segments[2].y1 = (short) y3; segments[2].x2 = (short) x1; segments[2].y2 = (short) y1; XSetForeground(graphic->dpy, *gc, pixel); XDrawSegments(graphic->dpy, graphic->xid, *gc, segments, nsegments); }
/* text cursor drawing */ void DrawPointTxt(struct XObj *xobj,unsigned int pixel) { #define dec 2 int x,y; int offset_abs,offset_rel; XSegment segm[2]; /* calculate byte offsets */ offset_abs = FlocaleStringCharToByteOffset(xobj->Ffont,xobj->title, xobj->value); offset_rel = FlocaleStringCharToByteOffset(xobj->Ffont,xobj->title, xobj->value3); x = FlocaleTextWidth(xobj->Ffont, xobj->title + offset_rel, offset_abs - offset_rel)+5; y = xobj->Ffont->ascent + 5; segm[0].x1=x; segm[0].y1=y; segm[0].x2=x-dec; segm[0].y2=y+dec; segm[1].x1=x; segm[1].y1=y; segm[1].x2=x+dec; segm[1].y2=y+dec; XSetForeground(dpy,xobj->gc,pixel); XDrawSegments(dpy,xobj->win,xobj->gc,segm,2); }
void polysegment_test(void) { XSegment *segments; int num_segments = 600; long totaltime; char buf[80]; int i; num_segments *= X.percent; segments = (XSegment *) malloc(sizeof(XSegment) * num_segments); segments[0].x1 = random()%400; segments[0].y1 = random()%400; segments[0].x2 = random()%400; segments[0].y2 = random()%400; for(i=1;i<num_segments;++i) { segments[i].x1 = (segments[i-1].x1-segments[i-1].y2+400+i)%400; segments[i].y1 = (segments[i-1].y1+segments[i-1].x2+i)%400; segments[i].x2 = (segments[i-1].x1-segments[i-1].y1+400+i)%400; segments[i].y2 = (segments[i-1].x2+segments[i-1].y2+i)%400; } XSync(X.dpy,0); start_timer(); XDrawSegments(X.dpy,X.win,X.gc,segments,num_segments); XSync(X.dpy,0); totaltime = end_timer(); snprintf(buf,sizeof buf,"%d segments in %.3f seconds.",num_segments, (double)totaltime/1000000.); show_result(buf); free(segments); }
void DrawCheckBox(struct XObj *xobj) { XSegment segm[2]; int asc,desc,dir; XCharStruct struc; /* Dessin du rectangle arrondi / drawing of the round rectangle */ XTextExtents(xobj->xfont, "lp", strlen("lp"), &dir, &asc, &desc, &struc); DrawReliefRect(0, asc-11, xobj->height, xobj->height, xobj, hili, shad); /* Calcul de la position de la chaine de charactere */ /* Compute the position of string */ DrawString(dpy, xobj, xobj->win, 23, asc,xobj->title, strlen(xobj->title), fore, hili, back, !xobj->flags[1]); /* Dessin de la croix / draw the cross */ if (xobj->value) { XSetLineAttributes(dpy, xobj->gc, 2, LineSolid, CapProjecting, JoinMiter); segm[0].x1 = 5; segm[0].y1 = 5; segm[0].x2 = xobj->height - 6; segm[0].y2 = xobj->height - 6; segm[1].x1 = 5; segm[1].y1 = xobj->height - 6; segm[1].x2 = xobj->height - 6; segm[1].y2 = 5; XSetForeground(dpy, xobj->gc, xobj->TabColor[fore]); XDrawSegments(dpy, xobj->win, xobj->gc, segm, 2); XSetLineAttributes(dpy, xobj->gc, 1, LineSolid, CapRound, JoinMiter); } }
static void draw_ticks (struct state *st, Drawable d, struct disc *disc, int x, int y, int radius) { XSegment segs[72]; int i; double tick = (M_PI * 2) / 72; for (i = 0; i < 72; i++) { int radius2 = radius; double th = (i * tick) + (2 * M_PI * (disc->theta / ((double) 360*64))); if (i % 6) radius2 -= radius / 16; else radius2 -= radius / 8; segs[i].x1 = x + radius * cos(th); segs[i].y1 = y + radius * sin(th); segs[i].x2 = x + radius2 * cos(th); segs[i].y2 = y + radius2 * sin(th); } XDrawSegments (st->dpy, d, disc->gc, segs, countof(segs)); draw_letters (st, d, disc, x, y, radius); }
static void draw_ksegment (GLOBAL *g, OBJECT *obj) { register short x1, y1, x2, y2; int dx, dy; int i; g->counter++; x1 = ((Ksegment *)obj->cur)->x1; /* in the natural coordinate system */ y1 = ((Ksegment *)obj->cur)->y1; x2 = ((Ksegment *)obj->cur)->x2; y2 = ((Ksegment *)obj->cur)->y2; dx = x2 - x1; dy = y2 - y1; /* maybe throw away values and start over */ if( ((dx*dx) + (dy * dy)) < 100) { init_ksegment (g, obj); x1 = ((Ksegment *)obj->cur)->x1; /* in the natural coordinate system */ y1 = ((Ksegment *)obj->cur)->y1; x2 = ((Ksegment *)obj->cur)->x2; y2 = ((Ksegment *)obj->cur)->y2; } for (i=0; i<g->symmetry; i++) { (((Ksegment *)obj->cur)->xsegments)[i].x1 = NEWX(x1,y1); (((Ksegment *)obj->cur)->xsegments)[i].y1 = NEWY(x1,y1); (((Ksegment *)obj->cur)->xsegments)[i].x2 = NEWX(x2,y2); (((Ksegment *)obj->cur)->xsegments)[i].y2 = NEWY(x2,y2); (((Ksegment *)obj->cur)->xsegments)[i].x1 = (x1 = (((Ksegment *)obj->cur)->xsegments)[i].x1) + g->xoff; (((Ksegment *)obj->cur)->xsegments)[i].y1 = (y1 = (((Ksegment *)obj->cur)->xsegments)[i].y1) + g->yoff; (((Ksegment *)obj->cur)->xsegments)[i].x2 = (x2 = (((Ksegment *)obj->cur)->xsegments)[i].x2) + g->xoff; (((Ksegment *)obj->cur)->xsegments)[i].y2 = (y2 = (((Ksegment *)obj->cur)->xsegments)[i].y2) + g->yoff; } XSetForeground(g->dpy, g->draw_gc, (((Ksegment *)obj->cur)->color).pixel); XDrawSegments(g->dpy, g->window, g->draw_gc, ((Ksegment *)obj->cur)->xsegments, g->symmetry); ((Ksegment *)obj->cur)->drawn = 1; if (((((Ksegment *)obj->cur)->next)->drawn) != 0) { XDrawSegments(g->dpy, g->window, g->erase_gc, ((Ksegment *)obj->cur)->next->xsegments, g->symmetry); } }
void drawProcedure(XEvent *event, void *data){ WMDrawPixmap(pixmap, ((struct _pict*)data)->dwin,HOFF,30); XDrawRectangle(display,((struct _pict*)data)->dwin,g3, HOFF,VOFF,100,100); XFillRectangle(screen->display, ((struct _pict*)data)->dwin , WMColorGC(screen->white), HOFF, VOFF, 100, 100); XDrawSegments(display, ((struct _pict*)data)->dwin, WMColorGC(screen->black), ((struct _pict*)data)->segments, ((struct _pict*)data)->seglen); XFlush(display); return; }
void DrawRelief(struct XObj *xobj) { XSegment segm[2]; int i; if (xobj->value!=0) { for (i=1;i<2;i++) { segm[0].x1=xobj->x-i; segm[0].y1=xobj->y-i; segm[0].x2=xobj->x+xobj->width+i-2; segm[0].y2=xobj->y-i; segm[1].x1=xobj->x-i; segm[1].y1=xobj->y-i; segm[1].x2=xobj->x-i; segm[1].y2=xobj->y+xobj->height+i-2; if (xobj->value==-1) XSetForeground( dpy,xobj->gc,xobj->TabColor[shad]); else XSetForeground( dpy,xobj->gc,xobj->TabColor[hili]); XDrawSegments(dpy,x11base->win,xobj->gc,segm,2); segm[0].x1=xobj->x-i; segm[0].y1=xobj->y+xobj->height+i-1; segm[0].x2=xobj->x+xobj->width+i-1; segm[0].y2=xobj->y+xobj->height+i-1; segm[1].x1=xobj->x+xobj->width+i-1; segm[1].y1=xobj->y-i; segm[1].x2=xobj->x+xobj->width+i-1; segm[1].y2=xobj->y+xobj->height+i-1; if (xobj->value==-1) XSetForeground( dpy,xobj->gc,xobj->TabColor[hili]); else XSetForeground( dpy,xobj->gc,xobj->TabColor[shad]); XDrawSegments(dpy,x11base->win,xobj->gc,segm,2); } } }
/**************************************************************************** * * Draws the relief pattern around a window * ****************************************************************************/ void RelieveWindow(Window win,int x,int y,int w,int h, GC rgc,GC sgc) { XSegment seg[4]; int i; i=0; seg[i].x1 = x; seg[i].y1 = y; seg[i].x2 = w+x-1; seg[i++].y2 = y; seg[i].x1 = x; seg[i].y1 = y; seg[i].x2 = x; seg[i++].y2 = h+y-1; seg[i].x1 = x+1; seg[i].y1 = y+1; seg[i].x2 = x+w-2; seg[i++].y2 = y+1; seg[i].x1 = x+1; seg[i].y1 = y+1; seg[i].x2 = x+1; seg[i++].y2 = y+h-2; XDrawSegments(dpy, win, rgc, seg, i); i=0; seg[i].x1 = x; seg[i].y1 = y+h-1; seg[i].x2 = w+x-1; seg[i++].y2 = y+h-1; seg[i].x1 = x+w-1; seg[i].y1 = y; seg[i].x2 = x+w-1; seg[i++].y2 = y+h-1; if(d_depth<2) XDrawSegments(dpy, win, ShadowGC, seg, i); else XDrawSegments(dpy, win, sgc, seg, i); i=0; seg[i].x1 = x+1; seg[i].y1 = y+h-2; seg[i].x2 = x+w-2; seg[i++].y2 = y+h-2; seg[i].x1 = x+w-2; seg[i].y1 = y+1; seg[i].x2 = x+w-2; seg[i++].y2 = y+h-2; XDrawSegments(dpy, win, sgc, seg, i); }
void DrawThumbH(struct XObj *xobj) { int x,y,w,h; XSegment segm; char str[20]; int asc,desc,dir; XCharStruct struc; x=3+(xobj->width-36)*(xobj->value-xobj->value2)/(xobj->value3-xobj->value2); y=xobj->height/2-9; w=30; h=18; DrawReliefRect(x,y,w,h,xobj,xobj->TabColor[li].pixel,xobj->TabColor[shad].pixel, xobj->TabColor[black].pixel,-1); segm.x1=x+15; segm.y1=y+3; segm.x2=x+15; segm.y2=y+h-3; XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel); XDrawSegments(xobj->display,xobj->win,xobj->gc,&segm,1); segm.x1=x+16; segm.y1=y+3; segm.x2=x+16; segm.y2=y+h-3; XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel); XDrawSegments(xobj->display,xobj->win,xobj->gc,&segm,1); XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel); sprintf(str,"%d",xobj->value); x=x+15-(XTextWidth(xobj->xfont,str,strlen(str))/2); XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc); y=y-desc-4; DrawString(xobj->display,xobj->gc,xobj->win,x,y,str, strlen(str),xobj->TabColor[fore].pixel, xobj->TabColor[li].pixel,xobj->TabColor[back].pixel, !xobj->flags[1]); }
/** Render list of disjoint segments, \a pSegs in \a pDrawable on the * back-end server associated with \a pDrawable's screen. If the * offscreen optimization is enabled, only draw when \a pDrawable is at * least partially visible. */ void dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs) { DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); Drawable draw; if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); XDrawSegments(dmxScreen->beDisplay, draw, pGCPriv->gc, (XSegment *)pSegs, nseg); dmxSync(dmxScreen, FALSE); }
void DrawThumbV(struct XObj *xobj) { int x,y,w,h; XSegment segm; char str[20]; int asc,desc,dir; XCharStruct struc; x = xobj->width/2 - 10; y = 2 + (xobj->height - 36)*(xobj->value - xobj->value3) / (xobj->value2 - xobj->value3); w = 20; h = 32; DrawReliefRect(x, y, w, h, xobj, hili, shad); segm.x1 = x + 3; segm.y1 = y + 15; segm.x2 = x + w - 3; segm.y2 = y + 15; XSetForeground(dpy, xobj->gc, xobj->TabColor[shad]); XDrawSegments(dpy, xobj->win, xobj->gc, &segm, 1); segm.x1 = x + 3; segm.y1 = y + 16; segm.x2 = x + w - 3; segm.y2 = y + 16; XSetForeground(dpy, xobj->gc, xobj->TabColor[hili]); XDrawSegments(dpy, xobj->win, xobj->gc, &segm, 1); XSetForeground(dpy, xobj->gc, xobj->TabColor[fore]); sprintf(str, "%d", xobj->value); x = x-XTextWidth(xobj->xfont, str, strlen(str))-6; XTextExtents(xobj->xfont, "lp", strlen("lp"), &dir, &asc, &desc, &struc); y = y + 13 + asc/2; DrawString(dpy, xobj, xobj->win, x, y, str, strlen(str), fore, hili, back, !xobj->flags[1]); }
void p_segments(p_win *w) { p_scr *s = w->s; Display *dpy = s->xdpy->dpy; GC gc = x_getgc(s, w, FillSolid); int nmx = (XMaxRequestSize(dpy)-3)/2; int n = x_pt_count / 2; x_pt_count = 0; while (n>0) { if (n<nmx) nmx = n; /* note: assume here that XPoint[2] identical to XSegment */ XDrawSegments(dpy, w->d, gc, (XSegment *)x_pt_list, nmx); n -= nmx; } if (p_signalling) p_abort(); }
/*------------------------------------------------------------- ** DrawClockFace * * Draw the clock face (every fifth tick-mark is longer * than the others). */ static void DrawClockFace( DtClockGadget g ) { Boolean draw_minute_ticks = ((G_ClockWidth (g) > (Dimension) (2 * SIZE_DEFAULT)) && (G_ClockHeight (g) > (Dimension) (2 * SIZE_DEFAULT))); register int i; register int delta = (int)(g->clock.radius - g->clock.tick_spacing) / 3; if (! XtIsManaged ((Widget)g)) return; g->clock.segbuffptr = g->clock.segbuff; g->clock.numseg = 0; /* Set segments. */ for (i = 0; i < 60; i++) { if (draw_minute_ticks) { if ((i % 5) == 0) DrawLine (g, g->clock.tick_spacing, g->clock.radius, ((double) i)/60.); else DrawLine (g, g->clock.radius - delta, g->clock.radius, ((double) i)/60.); } else if ((i % 15) == 0) DrawLine (g, g->clock.radius - 1, g->clock.radius, ((double) i)/60.); } /* Draw clock face. */ XDrawSegments (XtDisplay (g), XtWindow (g), G_ClockHandGC (g), (XSegment *) & (g->clock.segbuff[0]), g->clock.numseg/2); g->clock.segbuffptr = g->clock.segbuff; g->clock.numseg = 0; }
void DoSegments(XParms xp, Parms p, int reps) { int i; for (i = 0; i != reps; i++) { XDrawSegments(xp->d, xp->w, pgc, segments, p->objects); if (pgc == xp->ddbggc) pgc = xp->ddfggc; else if(pgc == xp->ddfggc) pgc = xp->ddbggc; else if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } }
static PyObject * PaxGC_DrawSegments(PaxGCObject * self, PyObject *args) { PyObject *arg1; XSegment *segs_arg1; int nsegs_arg1; if (!PyArg_ParseTuple(args, "O", &arg1)) return NULL; if (!checkshortlist(4, arg1, (short**)&segs_arg1, &nsegs_arg1)) { if (!PyErr_Occurred()) PyErr_SetString(PyExc_TypeError, "arg1 should be XSegment[]"); return NULL; } XDrawSegments(self->display, self->drawable, self->gc, segs_arg1, nsegs_arg1); PyMem_Free(segs_arg1); Py_INCREF(Py_None); return Py_None; }
void DisplayX11::draw_lines( DisplayObject * d_obj, const RGBcolor & col, const int num, const Line2d * vec ) { D_XSegments * myobj; if ( ! d_obj ) { if ( d_xsegments.ss.max_size < num ) { d_xsegments.ss.set_max_size( num ); } d_xsegments.ss.set_cur_size( num ); myobj = &d_xsegments; myobj->mark_col_change(); myobj->mark_pos_change(); } else { myobj = static_cast< D_XSegments * >( d_obj ); //dynamic_cast should also work, but it doesn't <- why? } //here we have the assumption num= myobj->ss.max_size; i.e. the it is not allowed to change the number of points if ( myobj->col_change ) { myobj->col_change = false; myobj->XColor_pixel = AGetColor( col ); } if ( myobj->area_number != area_number ) { myobj->area_number = area_number; copy_2_XSegments( myobj->ss.tab, num, vec ); } ASetForeground( myobj->XColor_pixel ); XDrawSegments( disp, pixmap, gc, myobj->ss.tab, num ); }
/*----------------------------------------------------------------------*/ /* extern */ void XfeDrawHorizontalLine(Display * dpy, Drawable d, GC gc, Position x, Position y, Dimension width, Dimension thickness) { static XSegment * segs = NULL; static Cardinal nsegs = 0; XSegment * sp; Cardinal i; Cardinal count; assert(dpy != NULL); assert(d != None); assert(gc != NULL); /* Make sure a thickness is given */ if (!thickness || !width) return; /* Number of segments to draw */ count = thickness; /* Make sure we have enough segments */ if (nsegs < count) { nsegs = count; segs = (XSegment *) XtRealloc((char *) segs,sizeof(XSegment) * nsegs); } for (i = 0; i < thickness; i++) { sp = segs + i; sp->x1 = x; sp->y1 = sp->y2 = y + i; sp->x2 = x + width - 1; } XDrawSegments(dpy,d,gc,segs,count); }
void XsOutline::_drawIt (int x, int y, int w, int h) { const int nsegs = 8; XSegment segs[nsegs]; // Across the top segs[0].x1 = x; segs[0].y1 = y; segs[0].x2 = x + w - 1; segs[0].y2 = y; segs[1].x1 = x + BorderSize; segs[1].y1 = y + BorderSize; segs[1].x2 = x + w - BorderSize - 1; segs[1].y2 = y + BorderSize; // Down the left segs[2].x1 = x + w - 1; segs[2].y1 = y + 1; segs[2].x2 = x + w - 1; segs[2].y2 = y + h - 1; segs[3].x1 = x + w - BorderSize - 1; segs[3].y1 = y + BorderSize + 1; segs[3].x2 = x + w - BorderSize - 1; segs[3].y2 = y + h - BorderSize - 1; // Across the bottom segs[4].x1 = x + 1; segs[4].y1 = y + h - 1; segs[4].x2 = x + w - 2; segs[4].y2 = y + h - 1; segs[5].x1 = x + BorderSize + 1; segs[5].y1 = y + h - BorderSize - 1; segs[5].x2 = x + w - BorderSize - 2; segs[5].y2 = y + h - BorderSize - 1; // Up the left segs[6].x1 = x; segs[6].y1 = y + h - 1; segs[6].x2 = x; segs[6].y2 = y + 1; segs[7].x1 = x + BorderSize; segs[7].y1 = y + h - BorderSize - 1; segs[7].x2 = x + BorderSize; segs[7].y2 = y + BorderSize + 1; // Draw the segments XDrawSegments (XtDisplay (_w), XtWindow (XtParent (_w)), _gc, segs, nsegs); }
static void draw(struct test_display *dpy, struct test_target *tt, int alu, int width, int style, int cap, XSegment *seg, int nseg) { XGCValues val; GC gc; val.function = alu; val.foreground = WhitePixel(dpy->dpy, 0); val.line_width = width; val.line_style = style; val.cap_style = cap; gc = XCreateGC(dpy->dpy, tt->draw, GCForeground | GCFunction | GCLineWidth | GCLineStyle | GCCapStyle, &val); XDrawSegments(dpy->dpy, tt->draw, gc, seg, nseg); XFreeGC(dpy->dpy, gc); }
void EvtKeyCheckBox(struct XObj *xobj, XKeyEvent *EvtKey) { KeySym ks; unsigned char buf[10]; XSegment segm[2]; int asc,desc,dir; XCharStruct struc; XLookupString(EvtKey, (char *)buf, sizeof(buf), &ks, NULL); if (ks == XK_Return) { XTextExtents(xobj->xfont, "lp", strlen("lp"), &dir, &asc, &desc, &struc); xobj->value = !xobj->value; DrawReliefRect(0, asc-11, xobj->height, xobj->height, xobj, hili, shad); SendMsg(xobj,SingleClic); if (xobj->value) { XSetLineAttributes(dpy, xobj->gc, 2, LineSolid, CapProjecting, JoinMiter); segm[0].x1 = 5; segm[0].y1 = 5; segm[0].x2 = xobj->height - 6; segm[0].y2 = xobj->height - 6; segm[1].x1 = 5; segm[1].y1 = xobj->height - 6; segm[1].x2 = xobj->height - 6; segm[1].y2 = 5; XSetForeground(dpy, xobj->gc, xobj->TabColor[fore]); XDrawSegments(dpy, xobj->win, xobj->gc, segm, 2); XSetLineAttributes(dpy, xobj->gc, 1, LineSolid, CapRound, JoinMiter); } else { XClearArea(dpy, xobj->win, 4, 4, xobj->height-8, xobj->height-8, False); } } }
/* text cursor drawing */ void DrawPointTxt(struct XObj *xobj,unsigned int pixel) { #define dec 2 int x,y; XSegment segm[2]; int asc,desc,dir; XCharStruct struc; XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc); x=XTextWidth(xobj->xfont, xobj->title + xobj->value3, xobj->value - xobj->value3)+5; y=asc+5; segm[0].x1=x; segm[0].y1=y; segm[0].x2=x-dec; segm[0].y2=y+dec; segm[1].x1=x; segm[1].y1=y; segm[1].x2=x+dec; segm[1].y2=y+dec; XSetForeground(dpy,xobj->gc,pixel); XDrawSegments(dpy,xobj->win,xobj->gc,segm,2); }
static void Paint_world_radar_old(void) { int i, xi, yi, xm, ym, xp, yp = 0; int xmoff, xioff; int type, vis; double damage; double xs, ys; int npoint = 0, nsegment = 0; int start, end; int currColor, visibleColorChange; const int max = 256; u_byte visible[256]; u_byte visibleColor[256]; XSegment segments[256]; XPoint points[256]; radar_exposures = 2; if (radarPixmap2 == radarPixmap) XSetPlaneMask(dpy, radarGC, AllPlanes & ~(dpl_1[0] | dpl_1[1])); if (radarPixmap2 != radarWindow) { /* Clear radar */ XSetForeground(dpy, radarGC, colors[BLACK].pixel); XFillRectangle(dpy, radarPixmap2, radarGC, 0, 0, 256, RadarHeight); } else XClearWindow(dpy, radarWindow); /* * Calculate an array which is later going to be indexed * by map block type. The indexing should return a true * value when the map block should be visible on the radar * and a false value otherwise. */ memset(visible, 0, sizeof visible); visible[SETUP_FILLED] = 1; visible[SETUP_FILLED_NO_DRAW] = 1; visible[SETUP_REC_LU] = 1; visible[SETUP_REC_RU] = 1; visible[SETUP_REC_LD] = 1; visible[SETUP_REC_RD] = 1; visible[SETUP_FUEL] = 1; for (i = 0; i < 10; i++) visible[SETUP_TARGET+i] = 1; for (i = BLUE_BIT; i < (int)sizeof visible; i++) visible[i] = 1; if (instruments.showDecor) { visible[SETUP_DECOR_FILLED] = 1; visible[SETUP_DECOR_LU] = 1; visible[SETUP_DECOR_RU] = 1; visible[SETUP_DECOR_LD] = 1; visible[SETUP_DECOR_RD] = 1; } /* * Calculate an array which returns the color to use * for drawing when indexed with a map block type. */ memset(visibleColor, 0, sizeof visibleColor); visibleColor[SETUP_FILLED] = visibleColor[SETUP_FILLED_NO_DRAW] = visibleColor[SETUP_REC_LU] = visibleColor[SETUP_REC_RU] = visibleColor[SETUP_REC_LD] = visibleColor[SETUP_REC_RD] = visibleColor[SETUP_FUEL] = wallRadarColor; for (i = 0; i < 10; i++) visibleColor[SETUP_TARGET+i] = targetRadarColor; for (i = BLUE_BIT; i < (int)sizeof visible; i++) visibleColor[i] = wallRadarColor; if (instruments.showDecor) visibleColor[SETUP_DECOR_FILLED] = visibleColor[SETUP_DECOR_LU] = visibleColor[SETUP_DECOR_RU] = visibleColor[SETUP_DECOR_LD] = visibleColor[SETUP_DECOR_RD] = decorRadarColor; /* The following code draws the map on the radar. Segments and * points arrays are use to build lists of things to be drawn. * Normally the segments and points are drawn when the arrays are * full, but now they are also drawn when the color changes. The * visibleColor array is used to determine the color to be used * for the given visible block type. * * Another (and probably better) way to do this would be use * different segments and points arrays for each visible color. */ if (Setup->x >= 256) { xs = (double)(256 - 1) / (Setup->x - 1); ys = (double)(RadarHeight - 1) / (Setup->y - 1); currColor = -1; for (xi = 0; xi < Setup->x; xi++) { start = end = -1; xp = (int)(xi * xs + 0.5); xioff = xi * Setup->y; for (yi = 0; yi < Setup->y; yi++) { visibleColorChange = 0; type = Setup->map_data[xioff + yi]; if (type >= SETUP_TARGET && type < SETUP_TARGET + 10) vis = (Target_alive(xi, yi, &damage) == 0); else vis = visible[type]; if (vis) { yp = (int)(yi * ys + 0.5); if (start == -1) { if ((nsegment > 0 || npoint > 0) && currColor != visibleColor[type]) { if (nsegment > 0) { XDrawSegments(dpy, radarPixmap2, radarGC, segments, nsegment); nsegment = 0; } if (npoint > 0) { XDrawPoints(dpy, radarPixmap2, radarGC, points, npoint, CoordModeOrigin); npoint = 0; } } start = end = yp; currColor = visibleColor[type]; XSetForeground(dpy, radarGC, colors[currColor].pixel); } else { end = yp; visibleColorChange = (visibleColor[type] != currColor); } } if (start != -1 && (!vis || yi == Setup->y - 1 || visibleColorChange)) { if (end > start) { segments[nsegment].x1 = xp; segments[nsegment].y1 = RadarHeight - 1 - start; segments[nsegment].x2 = xp; segments[nsegment].y2 = RadarHeight - 1 - end; nsegment++; if (nsegment >= max || yi == Setup->y - 1) { XDrawSegments(dpy, radarPixmap2, radarGC, segments, nsegment); nsegment = 0; } } else { points[npoint].x = xp; points[npoint].y = RadarHeight - 1 - start; npoint++; if (npoint >= max || yi == Setup->y - 1) { XDrawPoints(dpy, radarPixmap2, radarGC, points, npoint, CoordModeOrigin); npoint = 0; } } start = end = -1; } if (visibleColorChange) { if (nsegment > 0) { XDrawSegments(dpy, radarPixmap2, radarGC, segments, nsegment); nsegment = 0; } if (npoint > 0) { XDrawPoints(dpy, radarPixmap2, radarGC, points, npoint, CoordModeOrigin); npoint = 0; } start = end = yp; currColor = visibleColor[type]; XSetForeground(dpy, radarGC, colors[currColor].pixel); } } } } else { xs = (double)(Setup->x - 1) / (256 - 1); ys = (double)(Setup->y - 1) / (RadarHeight - 1); currColor = -1; for (xi = 0; xi < 256; xi++) { xm = (int)(xi * xs + 0.5); xmoff = xm * Setup->y; start = end = -1; xp = xi; for (yi = 0; yi < (int)RadarHeight; yi++) { visibleColorChange = 0; ym = (int)(yi * ys + 0.5); type = Setup->map_data[xmoff + ym]; vis = visible[type]; if (type >= SETUP_TARGET && type < SETUP_TARGET + 10) vis = (Target_alive(xm, ym, &damage) == 0); if (vis) { yp = yi; if (start == -1) { if ((nsegment > 0 || npoint > 0) && currColor != visibleColor[type]) { if (nsegment > 0) { XDrawSegments(dpy, radarPixmap2, radarGC, segments, nsegment); nsegment = 0; } if (npoint > 0) { XDrawPoints(dpy, radarPixmap2, radarGC, points, npoint, CoordModeOrigin); npoint = 0; } } start = end = yp; currColor = visibleColor[type]; XSetForeground(dpy, radarGC, colors[currColor].pixel); } else { end = yp; visibleColorChange = visibleColor[type] != currColor; } } if (start != -1 && (!vis || yi == (int)RadarHeight - 1 || visibleColorChange)) { if (end > start) { segments[nsegment].x1 = xp; segments[nsegment].y1 = RadarHeight - 1 - start; segments[nsegment].x2 = xp; segments[nsegment].y2 = RadarHeight - 1 - end; nsegment++; if (nsegment >= max || yi == (int)RadarHeight - 1) { XDrawSegments(dpy, radarPixmap2, radarGC, segments, nsegment); nsegment = 0; } } else { points[npoint].x = xp; points[npoint].y = RadarHeight - 1 - start; npoint++; if (npoint >= max || yi == (int)RadarHeight - 1) { XDrawPoints(dpy, radarPixmap2, radarGC, points, npoint, CoordModeOrigin); npoint = 0; } } start = end = -1; } if (visibleColorChange) { if (nsegment > 0) { XDrawSegments(dpy, radarPixmap2, radarGC, segments, nsegment); nsegment = 0; } if (npoint > 0) { XDrawPoints(dpy, radarPixmap2, radarGC, points, npoint, CoordModeOrigin); npoint = 0; } start = end = yp; currColor = visibleColor[type]; XSetForeground(dpy, radarGC, colors[currColor].pixel); } } } } if (nsegment > 0) XDrawSegments(dpy, radarPixmap2, radarGC, segments, nsegment); if (npoint > 0) XDrawPoints(dpy, radarPixmap2, radarGC, points, npoint, CoordModeOrigin); if (radarPixmap2 == radarPixmap) XSetPlaneMask(dpy, radarGC, AllPlanes & ~(dpl_2[0] | dpl_2[1])); for (i = 0;; i++) { int dead_time; double targ_damage; if (Target_by_index(i, &xi, &yi, &dead_time, &targ_damage) == -1) break; if (dead_time) continue; Paint_radar_block(xi, yi, targetRadarColor); } }
void drawswarm(Window win, KRandomSequence &rnd) { swarmstruct *sp = &swarms[screen]; int b; /* <=- Wasp -=> */ /* Age the arrays. */ sp->wx[2] = sp->wx[1]; sp->wx[1] = sp->wx[0]; sp->wy[2] = sp->wy[1]; sp->wy[1] = sp->wy[0]; /* Accelerate */ sp->wxv += balance_rand(WASPACC); sp->wyv += balance_rand(WASPACC); /* Speed Limit Checks */ if (sp->wxv > WASPVEL) sp->wxv = WASPVEL; if (sp->wxv < -WASPVEL) sp->wxv = -WASPVEL; if (sp->wyv > WASPVEL) sp->wyv = WASPVEL; if (sp->wyv < -WASPVEL) sp->wyv = -WASPVEL; /* Move */ sp->wx[0] = sp->wx[1] + sp->wxv; sp->wy[0] = sp->wy[1] + sp->wyv; /* Bounce Checks */ if ((sp->wx[0] < sp->border) || (sp->wx[0] > sp->width - sp->border - 1)) { sp->wxv = -sp->wxv; sp->wx[0] += sp->wxv; } if ((sp->wy[0] < sp->border) || (sp->wy[0] > sp->height - sp->border - 1)) { sp->wyv = -sp->wyv; sp->wy[0] += sp->wyv; } /* Don't let things settle down. */ sp->xv[rnd.getLong(sp->beecount)] += balance_rand(3); sp->yv[rnd.getLong(sp->beecount)] += balance_rand(3); /* <=- Bees -=> */ for (b = 0; b < sp->beecount; b++) { int distance, dx, dy; /* Age the arrays. */ X(2, b) = X(1, b); X(1, b) = X(0, b); Y(2, b) = Y(1, b); Y(1, b) = Y(0, b); /* Accelerate */ dx = sp->wx[1] - X(1, b); dy = sp->wy[1] - Y(1, b); distance = abs(dx) + abs(dy); /* approximation */ if (distance == 0) distance = 1; sp->xv[b] += (dx * BEEACC) / distance; sp->yv[b] += (dy * BEEACC) / distance; /* Speed Limit Checks */ if (sp->xv[b] > BEEVEL) sp->xv[b] = BEEVEL; if (sp->xv[b] < -BEEVEL) sp->xv[b] = -BEEVEL; if (sp->yv[b] > BEEVEL) sp->yv[b] = BEEVEL; if (sp->yv[b] < -BEEVEL) sp->yv[b] = -BEEVEL; /* Move */ X(0, b) = X(1, b) + sp->xv[b]; Y(0, b) = Y(1, b) + sp->yv[b]; /* Fill the segment lists. */ sp->segs[b].x1 = X(0, b); sp->segs[b].y1 = Y(0, b); sp->segs[b].x2 = X(1, b); sp->segs[b].y2 = Y(1, b); sp->old_segs[b].x1 = X(1, b); sp->old_segs[b].y1 = Y(1, b); sp->old_segs[b].x2 = X(2, b); sp->old_segs[b].y2 = Y(2, b); } XSetForeground(dsp, Scr[screen].gc, BlackPixel(dsp, screen)); XDrawLine(dsp, win, Scr[screen].gc, sp->wx[1], sp->wy[1], sp->wx[2], sp->wy[2]); XDrawSegments(dsp, win, Scr[screen].gc, sp->old_segs, sp->beecount); XSetForeground(dsp, Scr[screen].gc, WhitePixel(dsp, screen)); XDrawLine(dsp, win, Scr[screen].gc, sp->wx[0], sp->wy[0], sp->wx[1], sp->wy[1]); if (!mono && Scr[screen].npixels > 2) { XSetForeground(dsp, Scr[screen].gc, Scr[screen].pixels[sp->pix]); if (++sp->pix >= Scr[screen].npixels) sp->pix = 0; } XDrawSegments(dsp, win, Scr[screen].gc, sp->segs, sp->beecount); }
static void draw_xor_rect (MetaScreen *screen, const MetaRectangle *rect, int width, int height) { /* The lines in the center can't overlap the rectangle or each * other, or the XOR gets reversed. So we have to draw things * a bit oddly. */ XSegment segments[8]; MetaRectangle shrunk_rect; int i; #define LINE_WIDTH META_WIREFRAME_XOR_LINE_WIDTH /* We don't want the wireframe going outside the window area. * It makes it harder for the user to position windows and it exposes other * annoying bugs. */ shrunk_rect = *rect; shrunk_rect.x += LINE_WIDTH / 2 + LINE_WIDTH % 2; shrunk_rect.y += LINE_WIDTH / 2 + LINE_WIDTH % 2; shrunk_rect.width -= LINE_WIDTH + 2 * (LINE_WIDTH % 2); shrunk_rect.height -= LINE_WIDTH + 2 * (LINE_WIDTH % 2); XDrawRectangle (screen->display->xdisplay, screen->xroot, screen->root_xor_gc, shrunk_rect.x, shrunk_rect.y, shrunk_rect.width, shrunk_rect.height); /* Don't put lines inside small rectangles where they won't fit */ if (shrunk_rect.width < (LINE_WIDTH * 4) || shrunk_rect.height < (LINE_WIDTH * 4)) return; if ((width >= 0) && (height >= 0)) { XGCValues gc_values = { 0 }; if (XGetGCValues (screen->display->xdisplay, screen->root_xor_gc, GCFont, &gc_values)) { char *text; int text_length; XFontStruct *font_struct; int text_width, text_height; int box_x, box_y; int box_width, box_height; font_struct = XQueryFont (screen->display->xdisplay, gc_values.font); if (font_struct != NULL) { text = g_strdup_printf ("%d x %d", width, height); text_length = strlen (text); text_width = text_length * font_struct->max_bounds.width; text_height = font_struct->max_bounds.descent + font_struct->max_bounds.ascent; box_width = text_width + 2 * LINE_WIDTH; box_height = text_height + 2 * LINE_WIDTH; box_x = shrunk_rect.x + (shrunk_rect.width - box_width) / 2; box_y = shrunk_rect.y + (shrunk_rect.height - box_height) / 2; if ((box_width < shrunk_rect.width) && (box_height < shrunk_rect.height)) { XFillRectangle (screen->display->xdisplay, screen->xroot, screen->root_xor_gc, box_x, box_y, box_width, box_height); XDrawString (screen->display->xdisplay, screen->xroot, screen->root_xor_gc, box_x + LINE_WIDTH, box_y + LINE_WIDTH + font_struct->max_bounds.ascent, text, text_length); } g_free (text); XFreeFontInfo (NULL, font_struct, 1); if ((box_width + LINE_WIDTH) >= (shrunk_rect.width / 3)) return; if ((box_height + LINE_WIDTH) >= (shrunk_rect.height / 3)) return; } } } /* Two vertical lines at 1/3 and 2/3 */ segments[0].x1 = shrunk_rect.x + shrunk_rect.width / 3; segments[0].y1 = shrunk_rect.y + LINE_WIDTH / 2 + LINE_WIDTH % 2; segments[0].x2 = segments[0].x1; segments[0].y2 = shrunk_rect.y + shrunk_rect.height - LINE_WIDTH / 2; segments[1] = segments[0]; segments[1].x1 = shrunk_rect.x + (shrunk_rect.width / 3) * 2; segments[1].x2 = segments[1].x1; /* Now make two horizontal lines at 1/3 and 2/3, but not * overlapping the verticals */ segments[2].x1 = shrunk_rect.x + LINE_WIDTH / 2 + LINE_WIDTH % 2; segments[2].x2 = segments[0].x1 - LINE_WIDTH / 2; segments[2].y1 = shrunk_rect.y + shrunk_rect.height / 3; segments[2].y2 = segments[2].y1; segments[3] = segments[2]; segments[3].x1 = segments[2].x2 + LINE_WIDTH; segments[3].x2 = segments[1].x1 - LINE_WIDTH / 2; segments[4] = segments[3]; segments[4].x1 = segments[3].x2 + LINE_WIDTH; segments[4].x2 = shrunk_rect.x + shrunk_rect.width - LINE_WIDTH / 2; /* Second horizontal line is just like the first, but * shifted down */ i = 5; while (i < 8) { segments[i] = segments[i - 3]; segments[i].y1 = shrunk_rect.y + (shrunk_rect.height / 3) * 2; segments[i].y2 = segments[i].y1; ++i; } XDrawSegments (screen->display->xdisplay, screen->xroot, screen->root_xor_gc, segments, G_N_ELEMENTS (segments)); }
void EvtMouseCheckBox(struct XObj *xobj, XButtonEvent *EvtButton) { static XEvent event; int End = 1; unsigned int modif; int x1,x2,y1,y2; Window Win1,Win2; Window WinBut = 0; int In = 0; XSegment segm[2]; int asc,desc,dir; XCharStruct struc; while (End) { XNextEvent(dpy, &event); switch (event.type) { case EnterNotify: XQueryPointer(dpy, *xobj->ParentWin, &Win1, &Win2, &x1, &y1, &x2, &y2, &modif); if (WinBut == 0) { WinBut = Win2; /* Mouse on button */ XTextExtents(xobj->xfont, "lp", strlen("lp"), &dir, &asc, &desc, &struc); DrawReliefRect(0, asc-11, xobj->height, xobj->height, xobj, shad, hili); In = 1; } else { if (Win2 == WinBut) { /* Mouse on button */ DrawReliefRect(0, asc-11, xobj->height, xobj->height, xobj, shad, hili); In = 1; } else if (In) { In = 0; /* Mouse not on button */ DrawReliefRect(0, asc-11, xobj->height, xobj->height, xobj, hili, shad); } } break; case LeaveNotify: XQueryPointer(dpy, *xobj->ParentWin, &Win1, &Win2, &x1, &y1, &x2, &y2, &modif); if (Win2 == WinBut) { In = 1; /* Mouse on button */ DrawReliefRect(0, asc-11, xobj->height, xobj->height, xobj, shad, hili); } else if (In) { /* Mouse not on button */ DrawReliefRect(0, asc-11, xobj->height, xobj->height, xobj, hili, shad); In = 0; } break; case ButtonRelease: End = 0; /* Mouse not on button */ if (In) { /* Envoie d'un message vide de type SingleClic pour un clique souris */ xobj->value = !xobj->value; DrawReliefRect(0, asc-11, xobj->height, xobj->height, xobj, hili, shad); SendMsg(xobj,SingleClic); } if (xobj->value) { XSetLineAttributes(dpy, xobj->gc, 2, LineSolid, CapProjecting, JoinMiter); segm[0].x1 = 5; segm[0].y1 = 5; segm[0].x2 = xobj->height - 6; segm[0].y2 = xobj->height - 6; segm[1].x1 = 5; segm[1].y1 = xobj->height - 6; segm[1].x2 = xobj->height - 6; segm[1].y2 = 5; XSetForeground(dpy, xobj->gc, xobj->TabColor[fore]); XDrawSegments(dpy, xobj->win, xobj->gc, segm, 2); XSetLineAttributes(dpy, xobj->gc, 1, LineSolid, CapRound, JoinMiter); } else { XClearArea(dpy, xobj->win, 4, 4, xobj->height-8, xobj->height-8, False); } break; } } }