Exemplo n.º 1
0
static void
apply_prefs_cb(XtPointer arg)
{
    struct topic_info *info = (struct topic_info *)arg;
    struct prefs_choice *prefs = (struct prefs_choice *)info->data;
    size_t i;
    Widget colorsel;

    if (get_widget_by_name(&colorsel, globals.widgets.top_level, Xdvi_COLOR_DIALOG_NAME, False)) {
	XtPopdown(XtParent(colorsel));
    }

    /* pop down dependent windows */
    TRACE_GUI((stderr, "window count: %lu\n", (unsigned long)prefs->depwin_cnt));
    for (i = 0; i < prefs->depwin_cnt; i++) {
	TRACE_GUI((stderr, "popping down %lu: %p", (unsigned long)i, (void *)(prefs->depwin[i])));
	if (XtIsRealized(prefs->depwin[i])) {
	    XtCallCallbacks(prefs->depwin[i], XmNcancelCallback, NULL);
	    XSync(DISP, True); /* wait for server to catch up */
	    if (XtIsRealized(prefs->depwin[i])) {
		TRACE_GUI((stderr, "calling XmNokCallback of %lu: %p", (unsigned long)i, (void *)(prefs->depwin[i])));
		XtCallCallbacks(prefs->depwin[i], XmNokCallback, NULL);
	    }
	}
    }
    free(prefs->depwin);
    prefs->depwin = NULL;
    prefs->depwin_cnt = 0;

    if (prefs->db == NULL) /* callback invoked multiple times? */
	return;

    merge_into_user_db(prefs->db); /* this destroys prefs->db */
    prefs->db = NULL;

    /* remember some current values */
    free(globals.curr_paper);
    if (resource.paper != NULL)
	globals.curr_paper = xstrdup(resource.paper);
    
    free(globals.curr_editor);
    if (resource.editor != NULL)
	globals.curr_editor = xstrdup(resource.editor);
    
    free(globals.curr_browser);
    if (resource.browser != NULL)
	globals.curr_browser = xstrdup(resource.browser);

    /*     fprintf(stderr, "set curr_browser to: |%s|\n", globals.curr_browser); */
    /*     fprintf(stderr, "set curr_editor to: |%s|\n", globals.curr_editor); */
    
    if (get_xdvi_window_id(False, NULL) && save_user_preferences(False)) {
	/* if other instances of xdvi are running, make them reread the
	   changed preferences by writing them to ~/.xdvirc.tmp and having
	   them read that file; otherwise they would overwrite the file if
	   user quits them after the current instance.
	*/
	get_xdvi_window_id(False, reread_prefs_cb);
    }
}
Exemplo n.º 2
0
static void
revert_prefs_cb(XtPointer arg)
{
    struct topic_info *info = (struct topic_info *)arg;
    struct prefs_choice *prefs = (struct prefs_choice *)info->data;
    size_t i;

    /* pop down dependent windows */
    TRACE_GUI((stderr, "window count: %lu", (unsigned long)prefs->depwin_cnt));
    for (i = 0; i < prefs->depwin_cnt; i++) {
	TRACE_GUI((stderr, "popping down %lu: %p", (unsigned long)i, (void *)(prefs->depwin[i])));
	if (XtIsRealized(prefs->depwin[i])) {
	    XtCallCallbacks(prefs->depwin[i], XmNcancelCallback, NULL);
	    XSync(DISP, True); /* wait for server to catch up */
	    if (XtIsRealized(prefs->depwin[i])) {
		TRACE_GUI((stderr, "calling XmNokCallback of %lu: %p", (unsigned long)i, (void *)(prefs->depwin[i])));
		XtCallCallbacks(prefs->depwin[i], XmNokCallback, NULL);
	    }
	}
    }
    free(prefs->depwin);
    prefs->depwin = NULL;
    prefs->depwin_cnt = 0;

    if (prefs->db == NULL) { /* callback invoked multiple times, or prefs not changed */
	return;
    }

    revert_resources();
    
    XrmDestroyDatabase(prefs->db);
    prefs->db = NULL;
}
Exemplo n.º 3
0
static void notify_act(Widget w, XEvent *event, String *params, Cardinal *n)
{
  CtrlWidget cw = (CtrlWidget)w;
  CtrlPart *c = & cw->ctrl;  
  TF();

  if( ! c->isflip ) {
    c->msg.cmd = MSG_FIRE;
    XtCallCallbacks( w, XtNcallback, (XtPointer) & c->msg );
  }
  else {
    if( c->msg.state == STATE_ARMED ) {
      c->msg.state = STATE_SELECTED;
      c->msg.cmd = MSG_FIRE;
      XtCallCallbacks( w, XtNcallback, (XtPointer) & c->msg );
    }
    else {
      c->msg.state = STATE_ARMED;
      /* make virtual keyboard visible */
      vis_setup_slider_t msg;
      msg.min = c->msg.min_value;
      msg.max = c->msg.max_value;
      msg.cur = c->msg.value;
      sig_send( w, VIS_SETUP_SLIDER, &msg );
    }
  }

  expose(w, NULL, 0);
}
Exemplo n.º 4
0
static void
panner_cb(Widget widget, XtPointer closure, XtPointer report_ptr)
{
    XawPannerReport *report = (XawPannerReport *)report_ptr;
    static int orig_x = 0, orig_y = 0;
    int x = report->slider_x;
    int y = report->slider_y;
    static Dimension w, h;
    static Arg arg_wh_clip[] = {
        {XtNwidth, (XtArgVal) &w},
        {XtNheight, (XtArgVal) &h},
    };

    UNUSED(closure);

    XtGetValues(globals.widgets.clip_widget, arg_wh_clip, XtNumber(arg_wh_clip));

    fprintf(stderr, "w: %d, h: %d, globals.page.w: %d, globals.page.h: %d\n",
            w, h, globals.page.w, globals.page.h);
    XtVaSetValues(widget,
                  XtNsliderWidth, w, XtNsliderHeight, h,
                  XtNcanvasWidth, globals.page.w, XtNcanvasHeight, globals.page.h,
                  NULL);

    fprintf(stderr, "panner moved: %d, %d\n", report->slider_x, report->slider_y);
    if (globals.widgets.x_bar != NULL)
        XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, cast_int_to_XtPointer(x - orig_x));
    if (globals.widgets.y_bar != NULL)
        XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, cast_int_to_XtPointer(y - orig_y));
    orig_x = x;
    orig_y = y;
}
Exemplo n.º 5
0
/*
** Cancel a block drag operation
*/
void CancelBlockDrag(TextWidget tw)
{
    textBuffer *buf = tw->text.textD->buffer;
    textBuffer *origBuf = tw->text.dragOrigBuf;
    selection *origSel = &origBuf->primary;
    int modRangeStart = -1, origModRangeEnd, bufModRangeEnd;
    char *repText;
    dragEndCBStruct endStruct;

    /* If the operation was a move, make the modify range reflect the
       removal of the text from the starting position */
    if (tw->text.dragSourceDeleted != 0)
    	trackModifyRange(&modRangeStart, &bufModRangeEnd, &origModRangeEnd,
    	    	tw->text.dragSourceDeletePos, tw->text.dragSourceInserted,
    	    	tw->text.dragSourceDeleted);
    
    /* Include the insert being undone from the last step in the modified
       range. */
    trackModifyRange(&modRangeStart, &bufModRangeEnd, &origModRangeEnd,
    	   tw->text.dragInsertPos, tw->text.dragInserted, tw->text.dragDeleted);
 
    /* Make the changes in the buffer */
    repText = BufGetRange(origBuf, modRangeStart, origModRangeEnd);
    BufReplace(buf, modRangeStart, bufModRangeEnd, repText);
    XtFree(repText);
    
    /* Reset the selection and cursor position */
    if (origSel->rectangular)
    	BufRectSelect(buf, origSel->start, origSel->end, origSel->rectStart,
    	    	origSel->rectEnd);
    else
    	BufSelect(buf, origSel->start, origSel->end);
    TextDSetInsertPosition(tw->text.textD, buf->cursorPosHint);
    XtCallCallbacks((Widget)tw, textNcursorMovementCallback, NULL);
    tw->text.emTabsBeforeCursor = 0;
    
    /* Free the backup buffer */
    BufFree(origBuf);
    
    /* Indicate end of drag */
    tw->text.dragState = DRAG_CANCELED;
    
    /* Call finish-drag calback */
    endStruct.startPos = 0;
    endStruct.nCharsDeleted = 0;
    endStruct.nCharsInserted = 0;
    endStruct.deletedText = NULL;
    XtCallCallbacks((Widget)tw, textNdragEndCallback, (XtPointer)&endStruct);
}
Exemplo n.º 6
0
void warpCanvasRotCb(
  Widget		w,
  XtPointer		client_data,
  XtPointer		call_data)
{
  MAPaintImageWinStruct	*winStruct = (MAPaintImageWinStruct *) client_data;
  XmPushButtonCallbackStruct
    *cbs = (XmPushButtonCallbackStruct *) call_data;

  if( cbs->event->xbutton.state & Mod1Mask ){
    winStruct->rot -= 1;
  }
  else {
    winStruct->rot += 1;
  }
  while( winStruct->rot < 0 ){
    winStruct->rot += 4;
  }
  winStruct->rot %= 4;

  if( winStruct == &(warpGlobals.ovly) ){
    warpSetOvlyXImages(winStruct, 0);
    warpSetOvlyXImages(winStruct, 1);
    warpSetOvlyXImage(winStruct);
  }
  else {
    warpSetXImage(winStruct);
  }
  XtCallCallbacks(winStruct->canvas, XmNexposeCallback, call_data);

  return;
}
Exemplo n.º 7
0
Arquivo: TextStrSo.c Projeto: att/uwin
Boolean
_XmTextModifyVerify(XmTextWidget initiator,
		    XEvent *event,
		    XmTextPosition *start,
		    XmTextPosition *end,
		    XmTextPosition *cursorPos,
		    XmTextBlock block,
		    XmTextBlock newblock,
		    Boolean *freeBlock)
{
XmTextVerifyCallbackStruct cbs;

    cbs.reason = XmCR_MODIFYING_TEXT_VALUE;
    cbs.event = event;
    cbs.doit = True;
    cbs.currInsert = *cursorPos;
    cbs.newInsert = *cursorPos;
    cbs.startPos = *start;
    cbs.endPos = *end;
    cbs.text = block;
    if (Text_ModifyVerifyCallback(initiator))
    {
        XtCallCallbacks((Widget)initiator, XmNmodifyVerifyCallback, &cbs);
    }
    return(cbs.doit);
}
Exemplo n.º 8
0
void
wl_help_context(Widget w, XtPointer closure, XtPointer call)
{
	XmAnyCallbackStruct	cbs;
	Cursor			qa;
	XEvent			ev;
	Widget			top;

	USEUP(closure); USEUP(call);

	top = wl_top(w);
	memset((void *)&ev,  '\0', sizeof(ev));
	qa = XCreateFontCursor(XtDisplay(top), XC_question_arrow);
	w  = XmTrackingEvent(top, qa, False, &ev);
	while(w != NULL) {
		if(XtHasCallbacks(w, XmNhelpCallback) != XtCallbackHasSome) {
			w = XtParent(w);
			continue;
		}
		memset((void *)&cbs, '\0', sizeof(cbs));
		cbs.reason = XmCR_HELP;
		cbs.event  = &ev;
		XtCallCallbacks(w, XmNhelpCallback, (XtPointer)&cbs);
		w = NULL;
	}

	/*
	 * XmTrackingEvent() will take care of resetting the cursor
	 */
	XFreeCursor(XtDisplay(top), qa);
}
Exemplo n.º 9
0
/*!
* \ingroup	HGU_GL
* \brief	Trackball animation time-out procedure which calls any 
*		trackball callbacks and then if the trackball is in
*		it's animation mode reregisters itself as a time-out
*		procedure.
* \param	clientData		Used to pass the trackball instance.
* \param	id			Timeout function id.
*/
static void	HGUglwCanvasTbAnimateFn(XtPointer clientData, XtIntervalId *id)
{
  Widget		givenW;
  HGUglwCanvasTbWidget tbW;
  HGUglwCanvasTbPart *ctb;
  HGUglwCanvasCallbackStruct cb;

  givenW = (Widget )clientData;
  tbW = (HGUglwCanvasTbWidget )clientData;
  ctb = &(tbW->hguGLwCanvasTb);
  WLZ_VTX_3_ADD(ctb->translateCurrent, ctb->translateCurrent,
  		ctb->translateDelta);
  ctb->rotateCurrent = HGUglQuatProduct(ctb->rotateCurrent, ctb->rotateDelta);
  cb.reason = HGUglw_CR_TRACKBALL;
  cb.event = &(ctb->tbEvent);
  cb.width = tbW->core.width;
  cb.height = tbW->core.height;
  cb.glxCtx = tbW->hguGLwCanvas.glxCtx;
  XtCallCallbacks((Widget )tbW, HGUglwNtrackballCallback, &cb);
  if(ctb->trackballMode != HGUglwCANVASTB_MODE_ANIMATION)
  {
    ctb->animateFnId = 0;
  }
  else
  {
    ctb->animateFnId = XtAppAddTimeOut(XtWidgetToApplicationContext(givenW),
				       ctb->animateInterval,
				       HGUglwCanvasTbAnimateFn,
				       clientData);
  }
}
Exemplo n.º 10
0
/************************************************************************
* Function:	void update_slider_value()				*
* Purpose:	Callback function used to update the the scale value	*
*		in response to a value input in the text field		*
*		All the XmNvalueChangedCallbacks are called		*
* Returns:								*
* Arguments:
************************************************************************/
static void update_slider_value(Widget		text,
				Widget		scale,
				XmAnyCallbackStruct	*cbs)
{
    short	points;
    int		val, min, max, oldval;
    HGU_XmSliderFunc	func;
    String	string;
    XmScaleCallbackStruct	scale_cbs;

    XtVaGetValues(text, XmNvalue, &string, NULL);
    XtVaGetValues(scale, XmNdecimalPoints, &points,
		  XmNminimum, &min, XmNmaximum, &max,
		  XmNuserData, &func, NULL);

    val = slider_scale_value(string, points, min, max, func);
    XtVaGetValues(scale, XmNvalue, &oldval, NULL);
    if( val == oldval ){
      return;
    }

    val = (val > min) ? val : min;
    val = (val < max) ? val : max;
    XtVaSetValues(scale, XmNvalue, val, NULL);

    scale_cbs.reason = XmCR_VALUE_CHANGED;
    scale_cbs.event  = (cbs == NULL) ? NULL : cbs->event;
    scale_cbs.value  = val;
    XtCallCallbacks( scale, XmNvalueChangedCallback, &scale_cbs );
}
Exemplo n.º 11
0
static void
CanvasResize(Widget w)
{
    if (!XtIsRealized(w))
        return;
    XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer) w);
}
Exemplo n.º 12
0
/*
** Complete a block text drag operation
*/
void FinishBlockDrag(TextWidget tw)
{
    dragEndCBStruct endStruct;
    int modRangeStart = -1, origModRangeEnd, bufModRangeEnd;
    char *deletedText;
    
    /* Find the changed region of the buffer, covering both the deletion
       of the selected text at the drag start position, and insertion at
       the drag destination */
    trackModifyRange(&modRangeStart, &bufModRangeEnd, &origModRangeEnd,
    	    	tw->text.dragSourceDeletePos, tw->text.dragSourceInserted,
    	    	tw->text.dragSourceDeleted);
    trackModifyRange(&modRangeStart, &bufModRangeEnd, &origModRangeEnd,
    	    	tw->text.dragInsertPos, tw->text.dragInserted,
    	    	tw->text.dragDeleted);

    /* Get the original (pre-modified) range of text from saved backup buffer */
    deletedText = BufGetRange(tw->text.dragOrigBuf, modRangeStart,
    	    origModRangeEnd);

    /* Free the backup buffer */
    BufFree(tw->text.dragOrigBuf);
    
    /* Return to normal drag state */
    tw->text.dragState = NOT_CLICKED;
    
    /* Call finish-drag calback */
    endStruct.startPos = modRangeStart;
    endStruct.nCharsDeleted = origModRangeEnd - modRangeStart;
    endStruct.nCharsInserted = bufModRangeEnd - modRangeStart;
    endStruct.deletedText = deletedText;
    XtCallCallbacks((Widget)tw, textNdragEndCallback, (XtPointer)&endStruct);
    XtFree(deletedText);
}
Exemplo n.º 13
0
void _XtPopup(
    Widget      widget,
    XtGrabKind  grab_kind,
    _XtBoolean  spring_loaded)
{
    register ShellWidget shell_widget = (ShellWidget) widget;

    if (! XtIsShell(widget)) {
	XtAppErrorMsg(XtWidgetToApplicationContext(widget),
		"invalidClass","xtPopup",XtCXtToolkitError,
                "XtPopup requires a subclass of shellWidgetClass",
                  (String *)NULL, (Cardinal *)NULL);
    }

    if (! shell_widget->shell.popped_up) {
	XtGrabKind call_data = grab_kind;
	XtCallCallbacks(widget, XtNpopupCallback, (XtPointer)&call_data);
	shell_widget->shell.popped_up = TRUE;
	shell_widget->shell.grab_kind = grab_kind;
	shell_widget->shell.spring_loaded = spring_loaded;
	if (shell_widget->shell.create_popup_child_proc != NULL) {
	    (*(shell_widget->shell.create_popup_child_proc))(widget);
	}
	if (grab_kind == XtGrabExclusive) {
	    XtAddGrab(widget, TRUE, spring_loaded);
	} else if (grab_kind == XtGrabNonexclusive) {
	    XtAddGrab(widget, FALSE, spring_loaded);
	}
	XtRealizeWidget(widget);
	XMapRaised(XtDisplay(widget), XtWindow(widget));
    } else
	XRaiseWindow(XtDisplay(widget), XtWindow(widget));

} /* _XtPopup */
Exemplo n.º 14
0
void warpCanvasMagCb(
  Widget		w,
  XtPointer		client_data,
  XtPointer		call_data)
{
  MAPaintImageWinStruct	*winStruct = (MAPaintImageWinStruct *) client_data;
  XmPushButtonCallbackStruct
    *cbs = (XmPushButtonCallbackStruct *) call_data;

  if( cbs->event->xbutton.state & (Mod1Mask|Mod2Mask|ControlMask|ShiftMask) ){
    if( winStruct->mag > 0.25 ){
      winStruct->mag /= 2.0;
    }
  }
  else {
    if( winStruct->mag < 8.0 ){
      winStruct->mag *= 2.0;
    }
  }	

  if( winStruct == &(warpGlobals.ovly) ){
    warpSetOvlyXImages(winStruct, 0);
    warpSetOvlyXImages(winStruct, 1);
    warpSetOvlyXImage(winStruct);
  }
  else {
    warpSetXImage(winStruct);
  }
  XtCallCallbacks(winStruct->canvas, XmNexposeCallback, call_data);

  return;
}
Exemplo n.º 15
0
boolean HelpOnContextCommand::doIt(CommandInterface *ci)
{
    Widget                       widget;
    MainWindowHelpCallbackStruct callData;

    widget =
	XmTrackingLocate
	    (this->window->getMainWindow(), 
	     HelpOnContextCommand::HelpCursor,
	     False);

    XSync(theApplication->getDisplay(), False);

    while (widget)
    {
	if (XtHasCallbacks(widget, XmNhelpCallback) == XtCallbackHasSome)
	{
	    callData.reason = DxCR_HELP;
	    callData.event  = NULL;
	    callData.widget = widget;
	    XtCallCallbacks
		(widget,
		 XmNhelpCallback,
		 (XtPointer)&callData);
	    break;
	}
	else
	{
	    widget = XtParent(widget);
	}
    }

    return TRUE;
}
Exemplo n.º 16
0
Arquivo: HelpCB.c Projeto: juddy/edcde
void
HelpModeCB(
        Widget w,
        caddr_t client_data,
        caddr_t call_data )
{
   Widget widget;

   switch(DtHelpReturnSelectedWidgetId(style.shell, (Cursor)NULL, &widget))
   {
      /*
       * There are additional cases (e.g. user aborts request) but I
       * don't feel they warrant an error dialog.
       */
      case DtHELP_SELECT_VALID:

          while (!XtIsShell(widget))
          {
             if (XtHasCallbacks(widget, XmNhelpCallback) == XtCallbackHasSome)
             {
                XtCallCallbacks(widget, XmNhelpCallback, (XtPointer)NULL);
                return;
             }
             widget = XtParent(widget);
          }
          break;

      case DtHELP_SELECT_INVALID:

          ErrDialog((char *)GETMESSAGE(2, 8, "You must select an item\nwithin the Style Manager."), style.shell);
          break;

   }
}
Exemplo n.º 17
0
void ui_menu_update_all(void)
{
    int i;

    for (i = 0; i < num_checkmark_menu_items; i++) {
        XtCallCallbacks(checkmark_menu_items[i], XtNcallback, (XtPointer)!NULL);
    }
}
Exemplo n.º 18
0
/* ARGSUSED */
static void Redisplay(Widget w, XEvent *event, Region region)
         
              
              	/* unused */
{
    /* This isn't correct - we need to call the callback with region. */
    XtCallCallbacks(w, XtNexposeCallback, (caddr_t) event);
}
Exemplo n.º 19
0
static void
Activate(Widget W, XtPointer client_data, XtPointer call_data)
{
#ifdef DEBUG
    printf("NumEntry - Activate(%s) - %s\n", XtName(W), XtName(XtParent(W)));
#endif
    DoMath(XtParent(W));
    XtCallCallbacks(XtParent(W), XmNactivateCallback, call_data);
}
Exemplo n.º 20
0
void 
ObjectHelp(
        Widget w,
        XtPointer clientData,
        XtPointer callData )

{
  XtCallCallbacks((Widget)clientData, XmNhelpCallback, NULL);
}
Exemplo n.º 21
0
/*ARGSUSED*/
static void 
draw_it(XtPointer client_data, XtIntervalId *id)
{
    StripChartWidget w = (StripChartWidget)client_data;
    double value;
   
    if (w->strip_chart.update > 0)
	w->strip_chart.interval_id =
	    XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)w),
			    w->strip_chart.update * MS_PER_SEC,draw_it,
			    client_data);

    if (w->strip_chart.interval >= XtWidth(w))
	MoveChart((StripChartWidget)w, True);

    /* Get the value, stash the point and draw corresponding line */
    if (w->strip_chart.get_value == NULL)
	return;

    XtCallCallbacks((Widget)w, XtNgetValue, (XtPointer)&value);

    /* 
     * Keep w->strip_chart.max_value up to date, and if this data 
     * point is off the graph, change the scale to make it fit
     */
    if (value > w->strip_chart.max_value) {
	w->strip_chart.max_value = value;
	if (XtIsRealized((Widget)w) &&
	    w->strip_chart.max_value > w->strip_chart.scale) {
	    XClearWindow(XtDisplay(w), XtWindow(w));
	    w->strip_chart.interval = repaint_window(w, 0, XtWidth(w));
	}
    }

    w->strip_chart.valuedata[w->strip_chart.interval] = value;
    if (XtIsRealized((Widget)w)) {
	int y = (int)(XtHeight(w) - XtHeight(w) * value
		     / w->strip_chart.scale);

	XFillRectangle(XtDisplay(w), XtWindow(w), w->strip_chart.fgGC,
		       w->strip_chart.interval, y, 
		       1, XtHeight(w) - y);

	/*
	 * Fill in the graph lines we just painted over
	 */
	if (w->strip_chart.points != NULL) {
	    w->strip_chart.points[0].x = w->strip_chart.interval;
	    XDrawPoints(XtDisplay(w), XtWindow(w), w->strip_chart.hiGC,
			w->strip_chart.points, w->strip_chart.scale - 1,
			CoordModePrevious);
	}

	XFlush(XtDisplay(w));		    /* Flush output buffers */
    }
    w->strip_chart.interval++;		    /* Next point */
}
Exemplo n.º 22
0
/************************************************************************
* Function:	Widget HGU_XmCreateHorizontalFuncSlider()		*
* Purpose:	Same as HGU_XmCreateHorizontalSlider() except that the	*
*		scale is determined by the input function. The only	*
*		constraint on the function is that it must accept	*
*		an argument in the range 0-1 and return a float value	*
*		in the range 0-1. A second argument is a flag to request*
*		the direct function or its inverse. The direct function *
*		maps the scale proportional value ie:			*
*		(scale_val-minval) / (maxval-minval) on to the		*
*		required proportional times 10**decimalPoints ie.	*
*		(true_val*10**decimalPoints - minval)/(maxval-minval).	*
************************************************************************/
static void UpdateFromText(
  Widget	w,
  XEvent	*event,
  String	*params,
  Cardinal	*num_params)
{
  XtCallCallbacks(w, XmNactivateCallback, NULL);
  return;
}
Exemplo n.º 23
0
/*
 * Procedure Redisplay() is called as the result of an Expose event.
 * Use the redraw callback to do a full redraw
 */
static void Redisplay(AngbandWidget wnew, XEvent *xev, Region region)
{
	int x1, x2, y1, y2;

	int i;

	term_data *old_td = (term_data*)(Term->data);
	term_data *td = &data[0];

	/* Ignore parameter */
	(void) region;

	/* Hack - Find the term to activate */
	for (i = 0; i < num_term; i++)
	{
		td = &data[i];

		/* Have we found it? */
		if (td->widget == wnew) break;

		/* Paranoia:  none of the widgets matched */
		if (!td) return;
	}

	/* Activate the proper Term */
	Term_activate(&td->t);

	/* Find the bounds of the exposed region */

	/*
	 * This probably could be obtained from the Region parameter -
	 * but I don't know anything about XAW.
	 */
	x1 = (xev->xexpose.x - wnew->angband.internal_border)
		/wnew->angband.fontwidth;
	x2 = (xev->xexpose.x + xev->xexpose.width -
		wnew->angband.internal_border)/wnew->angband.fontwidth;

	y1 = (xev->xexpose.y - wnew->angband.internal_border)
		/wnew->angband.fontheight;
	y2 = (xev->xexpose.y + xev->xexpose.height -
		wnew->angband.internal_border)/wnew->angband.fontheight;

	Term_redraw_section(x1, y1, x2, y2);

	/* Activate the old term */
	Term_activate(&old_td->t);


#if 0
	if (XtHasCallbacks((Widget)widget, XtNredrawCallback) == XtCallbackHasSome)
	{
		XtCallCallbacks((Widget)widget, XtNredrawCallback, NULL);
	}
#endif /* 0 */
}
Exemplo n.º 24
0
/* action procedures */
static void inputAxes (XtcwpAxesWidget w, XEvent *event,
                       char *args[], int nargs)
{
    XtcwpAxesCallbackStruct cb;
    args += 0*(nargs); /* keep compiler happy */

    /* call callback */
    fillCallbackStruct(w,XtcwpCR_INPUT,event,NULL,&cb);
    XtCallCallbacks ((Widget) w,XtNinputCallback,&cb);
}
Exemplo n.º 25
0
static void
LosingFocus(Widget W, XtPointer client_data, XtPointer call_data)
{
#ifdef DEBUG
    printf("NumEntry - LosingFocus(%s) - >%s<\n", XtName(W), NumEntry_Value(XtParent(W)));
#endif
    AutoRepeat(W, False);
    DoMath(XtParent(W));
    XtCallCallbacks(XtParent(W), XmNlosingFocusCallback, call_data);
}
Exemplo n.º 26
0
static void
update_button(Widget button, Pixel pix)
{
    struct color_button_info *cinfo;
    static XmDrawnButtonCallbackStruct cbs;
    
    XtVaGetValues(button, XmNuserData, &cinfo, NULL);
    cinfo->pixel = pix;
    cbs.reason = XmCR_EXPOSE;
    XtCallCallbacks(button, XmNexposeCallback, &cbs);
}
Exemplo n.º 27
0
/* ARGSUSED */
void
closeCB(
        Widget w,
        caddr_t client_data,
        caddr_t call_data )
{
    Editor *pPad = (Editor *)client_data;

    /* call the callback for Exit within the File Menu pulldown */
    XtCallCallbacks(pPad->ExitWid, XmNactivateCallback, (XtPointer)pPad);
}
Exemplo n.º 28
0
Arquivo: Grip.c Projeto: aosm/X11libs
/*
 * Implementation
 */
static void
GripAction(Widget widget, XEvent *event, String *params, Cardinal *num_params)
{
    XawGripCallDataRec call_data;

    call_data.event = event;
    call_data.params = params;
    call_data.num_params = *num_params;

    XtCallCallbacks(widget, XtNcallback, (XtPointer)&call_data);
}
Exemplo n.º 29
0
void write_obj_cb(
Widget	w,
XtPointer	client_data,
XtPointer	call_data)
{
  if( write_obj_dialog ){
    XtManageChild( write_obj_dialog );
    XtPopup( XtParent(write_obj_dialog), XtGrabNone );
    /* kludge to update the file selections */
    XtCallCallbacks(write_obj_dialog, XmNmapCallback, call_data);
  }
  return;
}
Exemplo n.º 30
0
static void
CanvasExpose(Widget w, XEvent * event, Region region)
{
    CanvasExposeDataRec data;

    data.w = w;
    data.event = event;
    data.region = region;

    if (!XtIsRealized(w))
        return;
    XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer) &data);
}