示例#1
0
static void
XawLabelDestroy(Widget w)
{
    LabelWidget lw = (LabelWidget)w;

    if (lw->label.label != lw->core.name)
	XtFree(lw->label.label);
    XtReleaseGC(w, lw->label.normal_GC);
    XtReleaseGC(w, lw->label.gray_GC);
    XmuReleaseStippledPixmap(XtScreen(w), lw->label.stipple);
}
示例#2
0
文件: Command.c 项目: aosm/X11
/*ARGSUSED*/
static Boolean 
XawCommandSetValues(Widget current, Widget request, Widget cnew,
		    ArgList args, Cardinal *num_args)
{
    CommandWidget oldcbw = (CommandWidget)current;
    CommandWidget cbw = (CommandWidget)cnew;
    Boolean redisplay = False;

    if (oldcbw->core.sensitive != cbw->core.sensitive && !cbw->core.sensitive) {
	cbw->command.highlighted = HighlightNone;
	redisplay = True;
    }

    if (cbw->command.set) {
	unsigned int i;
	Pixel foreground, background;

	foreground = oldcbw->label.foreground;
	background = oldcbw->core.background_pixel;
	for (i = 0; i < *num_args; i++) {
	    if (STR_EQUAL(args[i].name, XtNforeground))
		background = cbw->label.foreground;
	    else if (STR_EQUAL(args[i].name, XtNbackground))
		foreground = cbw->core.background_pixel;
	}
	cbw->label.foreground = foreground;
	cbw->core.background_pixel = background;
    }

    if (oldcbw->label.foreground != cbw->label.foreground
	|| oldcbw->core.background_pixel != cbw->core.background_pixel
	|| oldcbw->command.highlight_thickness
	!= cbw->command.highlight_thickness
	|| oldcbw->label.font != cbw->label.font) {
	XtReleaseGC(cnew, cbw->command.inverse_GC);

	cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground, 
					cbw->core.background_pixel);
	cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel, 
					 cbw->label.foreground);
	XtReleaseGC(cnew, cbw->label.normal_GC);
	cbw->label.normal_GC = cbw->command.normal_GC;

	redisplay = True;
    }

    if (XtIsRealized(cnew)
	&& oldcbw->command.shape_style != cbw->command.shape_style
	&& !ShapeButton(cbw, True))
	cbw->command.shape_style = oldcbw->command.shape_style;

    return (redisplay);
}
示例#3
0
文件: List.c 项目: aosm/X11
static void
XawListDestroy(Widget w)
{
    ListWidget lw = (ListWidget)w;
    XGCValues values;
    
    XGetGCValues(XtDisplay(w), lw->list.graygc, GCTile, &values);
    XmuReleaseStippledPixmap(XtScreen(w), values.tile);
    XtReleaseGC(w, lw->list.graygc);
    XtReleaseGC(w, lw->list.revgc);
    XtReleaseGC(w, lw->list.normgc);
}
示例#4
0
    static void _grabbedLabelGadgetExpose(Widget _w, XEvent *_event, 
					  Region _region)
    {
	GC insensitiveGC;

	XmLabelGadget label = (XmLabelGadget)_w;

	unsigned char label_type = XmSTRING;
	XtVaGetValues(_w, XmNlabelType, &label_type, XtPointer(0));

	if (XtIsSensitive(_w) || label_type != XmSTRING)
	    (*oldLabelGadgetExposeProc)(_w, _event, _region);
	else
	{
#if defined(LesstifVersion)
	    // LessTif invokes resize() when exposing the widget,
	    // creating a new insensitive GC.  Inhibit this.
	    XtWidgetProc oldResizeProc = XtClass(_w)->core_class.resize;
	    XtClass(_w)->core_class.resize = noResize;
	    oldResizeProc(_w);
#endif

	    insensitiveGC = LABEL(label).insensitive_GC;

	    LABEL(label).TextRect.x += 1;
	    LABEL(label).TextRect.y += 1;
	    if (LABEL(label)._acc_text != 0)
	    {
		LABEL(label).acc_TextRect.x += 1;
		LABEL(label).acc_TextRect.y += 1;
	    }
	    LABEL(label).insensitive_GC = _gadgetParentTopShadowGC(label);
	    (*oldLabelGadgetExposeProc)(_w, _event, _region);
	    XtReleaseGC(_w, LABEL(label).insensitive_GC);

	    LABEL(label).TextRect.x -= 1;
	    LABEL(label).TextRect.y -= 1;
	    if (LABEL(label)._acc_text != 0)
	    {
		LABEL(label).acc_TextRect.x -= 1;
		LABEL(label).acc_TextRect.y -= 1;
	    }
	    LABEL(label).insensitive_GC = _gadgetParentBottomShadowGC(label);
	    (*oldLabelGadgetExposeProc)(_w, _event, _region);
	    XtReleaseGC(_w, LABEL(label).insensitive_GC);

	    LABEL(label).insensitive_GC = insensitiveGC;

#if defined(LesstifVersion)
	    XtClass(_w)->core_class.resize = oldResizeProc;
#endif
	}
    }
/*
 * Function:
 *	XawMultiSinkDestroy
 *
 * Parameters:
 *	w - MultiSink Object
 *
 * Description:
 *	This function cleans up when the object is destroyed.
 */
static void
XawMultiSinkDestroy(Widget w)
{
    MultiSinkObject sink = (MultiSinkObject)w;

    XtReleaseGC(w, sink->multi_sink.normgc);
    XtReleaseGC(w, sink->multi_sink.invgc);
    if (sink->multi_sink.xorgc)
	XtReleaseGC(w, sink->multi_sink.xorgc);
    sink->multi_sink.normgc =
	sink->multi_sink.invgc =
	sink->multi_sink.xorgc = NULL;
}
示例#6
0
static void Destroy (Widget gw)
{
    LoginWidget w = (LoginWidget)gw;
    bzero (w->login.data.name, NAME_LEN);
    bzero (w->login.data.passwd, PASSWORD_LEN);
    XtReleaseGC(gw, w->login.textGC);
    XtReleaseGC(gw, w->login.bgGC);
    XtReleaseGC(gw, w->login.xorGC);
    XtReleaseGC(gw, w->login.promptGC);
    XtReleaseGC(gw, w->login.greetGC);
    XtReleaseGC(gw, w->login.failGC);
#ifdef XPM
    XtReleaseGC(gw, w->login.hiGC);
    XtReleaseGC(gw, w->login.shdGC);

    if (True == w->login.logoValid)
    {
        if (w->login.logoPixmap != 0)
            XFreePixmap(XtDisplay(w), w->login.logoPixmap);

        if (w->login.logoMask != 0)
            XFreePixmap(XtDisplay(w), w->login.logoMask);
    }
#endif /* XPM */
}
示例#7
0
/*ARGSUSED*/
static Boolean 
SetValues(Widget cw,
	  Widget rw,		/* unused */
	  Widget nw,
	  ArgList args,		/* unused */
	  Cardinal *num_args)	/* unused */
{
  XmGrabShellWidget new_w = (XmGrabShellWidget) nw;
  XmGrabShellWidget old_w = (XmGrabShellWidget) cw;
  Boolean redisplay = FALSE;
  
  if (old_w->grab_shell.shadow_thickness != new_w->grab_shell.shadow_thickness)
    {
      if (XtIsRealized(nw)) {
	DoLayout(nw);
	redisplay = TRUE;
      }
    }
  
  if ((old_w->grab_shell.top_shadow_color != 
       new_w->grab_shell.top_shadow_color) ||
      (old_w->grab_shell.top_shadow_pixmap != 
       new_w->grab_shell.top_shadow_pixmap))
    {
      XtReleaseGC (nw, new_w->grab_shell.top_shadow_GC);
      new_w->grab_shell.top_shadow_GC = 
	_XmGetPixmapBasedGC (nw, 
			     new_w->grab_shell.top_shadow_color,
			     new_w->core.background_pixel,
			     new_w->grab_shell.top_shadow_pixmap);
      redisplay = TRUE;
    }
  
  if ((old_w->grab_shell.bottom_shadow_color != 
       new_w->grab_shell.bottom_shadow_color) ||
      (old_w->grab_shell.bottom_shadow_pixmap != 
       new_w->grab_shell.bottom_shadow_pixmap))
    {
      XtReleaseGC (nw, new_w->grab_shell.bottom_shadow_GC);
      new_w->grab_shell.bottom_shadow_GC = 
	_XmGetPixmapBasedGC (nw, 
			     new_w->grab_shell.bottom_shadow_color,
			     new_w->core.background_pixel,
			     new_w->grab_shell.bottom_shadow_pixmap);
      redisplay = TRUE;
    }

  return redisplay; 
}
示例#8
0
static void Destroy (Widget gw)
{
     ClockWidget w = (ClockWidget)gw;
     if (w->clock.interval_id) XtRemoveTimeOut (w->clock.interval_id);
     if (! w->clock.transparent) {
	 XtReleaseGC(gw, w->clock.minuteGC);
	 XtReleaseGC(gw, w->clock.hourGC);
	 XtReleaseGC(gw, w->clock.jewelGC);
	 XtReleaseGC(gw, w->clock.eraseGC);
     }
     if (w->clock.shapeGC)
	XFreeGC(XtDisplay(gw), w->clock.shapeGC);
    if (w->clock.shape_mask)
	XFreePixmap (XtDisplay (w), w->clock.shape_mask);
}
示例#9
0
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
{
    XfeBmButtonPart *		bmp = _XfeBmButtonPart(w);
	
	XtReleaseGC(w,bmp->pixmap_GC);
}
示例#10
0
/*----------------------------------------------------------------------*/
static Boolean
SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
    XfeArrowPart *	np = _XfeArrowPart(nw);
    XfeArrowPart *	op = _XfeArrowPart(ow);

    /* arrow_direction */
    if (np->arrow_direction != op->arrow_direction)
    {
        /* Make sure arrow direction is ok */
        XfeRepTypeCheck(nw,XmRArrowDirection,&np->arrow_direction,
                        XmARROW_DOWN);

        _XfeConfigFlags(nw) |= XfeConfigExpose;
    }

    /* arrow_width */
    if ((np->arrow_width != op->arrow_width) ||
            (np->arrow_height != op->arrow_height))
    {
        _XfeConfigFlags(nw) |= XfeConfigGLE;
    }

    /* foreground or background */
    if ((_XfeForeground(nw) != _XfeForeground(ow)) ||
            (_XfeBackgroundPixel(nw) != _XfeBackgroundPixel(ow)))
    {
        XtReleaseGC(nw,np->arrow_insens_GC);

        np->arrow_insens_GC = XfeAllocateColorGc(nw,_XfeForeground(nw),_XfeBackgroundPixel(nw),False);

    }

    return _XfePrimitiveChainSetValues(ow,rw,nw,xfeArrowWidgetClass);
}
示例#11
0
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
{
    XfeArrowPart *	ap = _XfeArrowPart(w);

    XtReleaseGC(w,ap->arrow_insens_GC);
}
/*ARGSUSED*/
static Boolean
XawScrollbarSetValues(Widget current, Widget request, Widget desired,
		      ArgList args, Cardinal *num_args)
{
    ScrollbarWidget w = (ScrollbarWidget)current;
    ScrollbarWidget dw = (ScrollbarWidget)desired;
    Boolean redraw = False;

    /*
     * If these values are outside the acceptable range ignore them...
     */
    if (dw->scrollbar.top < 0.0 || dw->scrollbar.top > 1.0)
	dw->scrollbar.top = w->scrollbar.top;

    if (dw->scrollbar.shown < 0.0 || dw->scrollbar.shown > 1.0)
	dw->scrollbar.shown = w->scrollbar.shown;

    if (XtIsRealized (desired)) {
	if (w->scrollbar.foreground != dw->scrollbar.foreground ||
	    w->core.background_pixel != dw->core.background_pixel ||
	    w->scrollbar.thumb != dw->scrollbar.thumb) {
	    XtReleaseGC((Widget)dw, w->scrollbar.gc);
	    CreateGC((Widget)dw);
	    redraw = True;
	}
	if (w->scrollbar.top != dw->scrollbar.top ||
	    w->scrollbar.shown != dw->scrollbar.shown)
	    redraw = True;
    }

    return (redraw);
}
static void
XawScrollbarDestroy(Widget w)
{
    ScrollbarWidget sbw = (ScrollbarWidget)w;

    XtReleaseGC(w, sbw->scrollbar.gc);
}
示例#14
0
文件: Command.c 项目: aosm/X11
/*ARGSUSED*/
static void 
XawCommandInitialize(Widget request, Widget cnew,
		     ArgList args, Cardinal *num_args)
{
    CommandWidget cbw = (CommandWidget)cnew;
    int shape_event_base, shape_error_base;

    if (!cbw->label.font) XtError("Aborting: no font found\n");
    
    if (cbw->command.shape_style != XawShapeRectangle &&
	!XShapeQueryExtension(XtDisplay(cnew), &shape_event_base,
			      &shape_error_base))
	cbw->command.shape_style = XawShapeRectangle;

    if (cbw->command.highlight_thickness == DEFAULT_SHAPE_HIGHLIGHT) {
	if (cbw->command.shape_style != XawShapeRectangle)
	    cbw->command.highlight_thickness = 0;
	else
	    cbw->command.highlight_thickness = DEFAULT_HIGHLIGHT_THICKNESS;
    }

    cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground, 
				    cbw->core.background_pixel);
    cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel, 
				     cbw->label.foreground);
    XtReleaseGC(cnew, cbw->label.normal_GC);
    cbw->label.normal_GC = cbw->command.normal_GC;

    cbw->command.set = False;
    cbw->command.highlighted = HighlightNone;
}
示例#15
0
static Boolean
SetValues(
          Widget cw,
          Widget WXUNUSED(rw),
          Widget nw,
          ArgList WXUNUSED(args),
          Cardinal *WXUNUSED(num_args) )
{
    XmGaugeWidget cgw = (XmGaugeWidget)cw;
    XmGaugeWidget ngw = (XmGaugeWidget)nw;

    Boolean redraw = False;
    if(cgw->primitive.foreground != ngw->primitive.foreground) {
        XGCValues values;

        redraw = True;
        XtReleaseGC(nw, ngw->gauge.gc);
        values.foreground = ngw->primitive.foreground;
        ngw->gauge.gc = XtGetGC(nw, GCForeground, &values);
    }
    if(cgw->gauge.value != ngw->gauge.value) {
        redraw = True;
    }
    return redraw;
}
示例#16
0
static void 
Destroy(
        Widget w )
{
  XmArrowButtonWidget aw = (XmArrowButtonWidget) w;
  
  if (aw->arrowbutton.timer)
  {
    XtRemoveTimeOut(aw->arrowbutton.timer);
    /* Solaris 2.6 Motif diff bug 1254749, 1 lines */
    aw->arrowbutton.timer = (XtIntervalId) NULL;
  }
  
  XtReleaseGC(w, aw->arrowbutton.arrow_GC);
  XtReleaseGC(w, aw->arrowbutton.insensitive_GC);
}
示例#17
0
void draw_pixmap(Widget w, XtPointer client_data, XtPointer call_data)
{
    GC gc; XGCValues vals;
    XpmImage *xpmImage = (XpmImage*) client_data;
//    Pixmap pixmap;
    XImage *image, *si;

    gc=XtGetGC(w, 0 ,&vals);


    XpmCreateImageFromXpmImage(XtDisplay(w), xpmImage, &image, &si, NULL);

    XPutImage(XtDisplay(w), XtWindow(w), gc, image, 0, 0, 0, 0,
              xpmImage->width, xpmImage->height);

    XDestroyImage(image);

//    XpmCreatePixmapFromXpmImage(XtDisplay(w), XtWindow(w),
//                                xpmImage, &pixmap, NULL, NULL);
//    XCopyArea(XtDisplay(w),pixmap,XtWindow(w), gc, 0, 0,
//              xpmImage->width, xpmImage->height, 0, 0);
//    XFreePixmap(XtDisplay(w),pixmap);

    XtReleaseGC(w, gc);

}
示例#18
0
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
{
    XfeBmCascadePart * bmc = _XfeBmCascadePart(w);

	XtReleaseGC(w,bmc->pixmap_GC);
}
示例#19
0
文件: Command.c 项目: aosm/X11
static void 
XawCommandDestroy(Widget w)
{
    CommandWidget cbw = (CommandWidget)w;

    /* Label will release cbw->command.normal_GC */
    XtReleaseGC(w, cbw->command.inverse_GC);
}
示例#20
0
文件: Tree.c 项目: aosm/X11libs
static void
XawTreeDestroy(Widget gw)
{
    TreeWidget w = (TreeWidget) gw;

    XtReleaseGC (gw, w->tree.gc);
    if (w->tree.largest) XtFree ((char *) w->tree.largest);
}
示例#21
0
static void
Destroy(Widget w)
{
    XmGaugeWidget gw = (XmGaugeWidget)w;
#define THIS gw->gauge
    XtReleaseGC(w, THIS.gc);
#undef THIS
}
示例#22
0
int video_close(PLOT *plot)
{
	struct videodata *plotdata = (struct videodata *)plot->plotdata;
	Widget w = (Widget)plot->plot_widget;

	if (plot->ticklblfont != NULL) XmFontListFree(plot->ticklblfont);
	if (plotdata->pixmapalloced) XFreePixmap(XtDisplay(w), plotdata->pixmap);
	if (plotdata->xcc) XCCFree(plotdata->xcc);
	if (plotdata->framedata) free(plotdata->framedata);
	XtReleaseGC(w, plotdata->drawing_GC);
	XtReleaseGC(w, plotdata->inverse_GC);
	XtReleaseGC(w, plotdata->mark_GC);
	XtDestroyWidget(plot->plot_widget);
	free(plotdata->image);
	free(plot->plotdata);
	plot->plotdata = NULL;
	return SUCCESS;
}
示例#23
0
/*ARGSUSED*/
static Boolean 
SetValues(
        Widget cw,
        Widget rw,
        Widget nw,
        ArgList args,		/* unused */
        Cardinal *num_args)	/* unused */
{
  XmArrowButtonWidget current = (XmArrowButtonWidget) cw;
  XmArrowButtonWidget new_w = (XmArrowButtonWidget) nw;
  
  Boolean returnFlag = FALSE;
  
  /*  Check the data put into the new widget.  */
  
  if (!XmRepTypeValidValue(XmRID_ARROW_DIRECTION, 
			   new_w->arrowbutton.direction, (Widget) new_w))
    {
      new_w->arrowbutton.direction = current->arrowbutton.direction;
    }
  
  
  /*  See if the GC's need to be regenerated and widget redrawn.  */
  if (new_w->core.background_pixel != current->core.background_pixel ||
      new_w->primitive.foreground != current->primitive.foreground)
    {
      returnFlag = TRUE;
      XtReleaseGC ((Widget) new_w, new_w->arrowbutton.arrow_GC);
      XtReleaseGC ((Widget) new_w, new_w->arrowbutton.insensitive_GC);
      GetArrowGC (new_w);
    }
  
  if (new_w->arrowbutton.direction != current->arrowbutton.direction ||
      XtIsSensitive(nw) != XtIsSensitive(cw) ||
      new_w->primitive.highlight_thickness !=
      current->primitive.highlight_thickness ||
      new_w->primitive.shadow_thickness != current->primitive.shadow_thickness)
    {
      returnFlag = TRUE;
    }
  
  return (returnFlag);
}
示例#24
0
/*	Function Name: Destroy
 *	Description: Called as the scrollbar is going away...
 *	Arguments: w - the scrollbar.
 *	Returns: nonw
 */
static void
Destroy (Widget w)
{
    ScrollbarWidget sbw = (ScrollbarWidget) w;
#ifdef XAW_ARROW_SCROLLBARS
    if(sbw->scrollbar.timer_id != (XtIntervalId) 0)
	XtRemoveTimeOut (sbw->scrollbar.timer_id);
#endif
    XtReleaseGC (w, sbw->scrollbar.gc);
}
示例#25
0
static void Destroy (Widget gw)
{
     EyesWidget w = (EyesWidget)gw;
     int i;

     if (w->eyes.interval_id)
	XtRemoveTimeOut (w->eyes.interval_id);
     for (i = 0; i < PART_MAX; i ++)
	     XtReleaseGC(gw, w->eyes.gc[i]);
}
示例#26
0
/*----------------------------------------------------------------------*/
void
_XfePrimitiveReleaseBackgroundGC(Widget w)
{
	/* Make sure the gc has been allocated */
	if (!_XfeBackgroundGC(w))
	{
		return;
	}

    /* Free the background gc */
    XtReleaseGC(w,_XfeBackgroundGC(w));
}
示例#27
0
/*
 * Procedure Destroy() is called during the destruction of the widget.
 * Destroy() releases and frees GCs, frees the pixmaps and frees the
 * fonts.
 */
static void Destroy(AngbandWidget widget)
{
	int n;

	/* Free all GC's */
	for (n = 0; n < NUM_COLORS + 1; n++)
	{
		XtReleaseGC((Widget)widget, widget->angband.gc[n]);
	}

	/* Free the font */
	XFreeFont(XtDisplay((Widget)widget), widget->angband.fnt);
}
/*ARGSUSED*/
static Boolean
XawMultiSinkSetValues(Widget current, Widget request, Widget cnew,
		      ArgList args, Cardinal *num_args)
{
    MultiSinkObject w = (MultiSinkObject)cnew;
    MultiSinkObject old_w = (MultiSinkObject)current;

    /* Font set is not in the GC! Do not make a new GC when font set changes! */

    if (w->multi_sink.fontset != old_w->multi_sink.fontset) {
	((TextWidget)XtParent(cnew))->text.redisplay_needed = True;
#ifndef NO_TAB_FIX
	SetTabs((Widget)w, w->text_sink.tab_count, w->text_sink.char_tabs);
#endif
    }

    if (w->text_sink.background != old_w->text_sink.background
	|| w->text_sink.foreground != old_w->text_sink.foreground
#ifndef OLDXAW
	|| w->text_sink.cursor_color != old_w->text_sink.cursor_color
#endif
	) {
	XtReleaseGC(cnew, w->multi_sink.normgc);
	XtReleaseGC(cnew, w->multi_sink.invgc);
	if (w->multi_sink.xorgc)
	    XtReleaseGC(cnew, w->multi_sink.xorgc);
	GetGC(w);
	((TextWidget)XtParent(cnew))->text.redisplay_needed = True;
    }
    else if (w->multi_sink.echo != old_w->multi_sink.echo
	     || w->multi_sink.display_nonprinting
	     != old_w->multi_sink.display_nonprinting)
      ((TextWidget)XtParent(cnew))->text.redisplay_needed = True;

    return (False);
}
示例#29
0
文件: Balloon.c 项目: Gilles86/afni
/*****
* Name: 		checkGC
* Return Type: 	void
* Description: 	creates a GC for us to use;
* In: 
*	BALLOON:	XmBalloonWidget id;
* Returns:
*	nothing.
*****/
static void
checkGC(BALLOON)
{
	XGCValues xgc;

	xgc.foreground = ATTR(foreground);
	xgc.background = balloon->core.background_pixel;
	xgc.fill_style = FillSolid; 

#if XtSpecificationRelease < 5	
	xgc.font = ATTR(font->fid); 
#endif

	if(ATTR(gc))
		XtReleaseGC((Widget)balloon, ATTR(gc));
	ATTR(gc) = XtGetGC((Widget)balloon,
		GCForeground|GCBackground|GCFillStyle, &xgc);
}
示例#30
0
static void 
ResetXorGC(XmPannerWidget pw)		/* used when resources change */
{
    if (XmPanner_xor_gc(pw)) 
	XtReleaseGC ((Widget) pw, XmPanner_xor_gc(pw));

    if (XmPanner_rubber_band(pw)) {
	XtGCMask valuemask = (GCForeground | GCFunction);
	XGCValues values;

	values.foreground = (pw->primitive.foreground ^
			     pw->core.background_pixel);
	values.function = GXxor;
	XmPanner_xor_gc(pw) = XtGetGC ((Widget) pw, valuemask, &values);
    } else {
	XmPanner_xor_gc(pw) = NULL;
    }
}