Example #1
0
File: UxXt.c Project: juddy/edcde
/******************************************************************************
NAME:           UxDestroyContextCB ( wgt, client_data, call_data )

INPUT:          Widget          wgt             - widget
                XtPointer       client_data     - pointer to be freed
                XtPointer       call_data       - not used

RETURN:         void

DESCRIPTION:    This callback function registers a timeout to free the
                context structure. This mechanism is used to ensure that
                user's destroyCallbacks are executed before we free the
                context structure.

CREATION:       Visual Edge Software            April 6 1991
-----------------------------------------------------------------------------*/
void    UxDestroyContextCB( Widget _wgt, XtPointer client_data,
                                XtPointer _call_data )
{
        Widget          wgt = _wgt;
        XtPointer       call_data = _call_data;

        if (client_data != NULL) {
                XtAppAddTimeOut(UxAppContext, 0,
                                DelayedFreeData, client_data);
        }
}
Example #2
0
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
  int	n;
  Arg	args[6];

  Initialize();
  ProcessArgs(argv);
  ReadConfigFile();

  AutoScale();

  if (!Interactive)
    PrintPS((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL);
  else
    {
    AppShell = XtAppInitialize(&appContext, APP_CLASS, NULL, 0, &argc, argv,
                                fallback_resources, NULL, 0);

    XtGetApplicationResources(AppShell, (caddr_t) &iv, resources,
                                XtNumber(resources), NULL, 0);

    n = 0;
    MainShell = XtCreatePopupShell("topLevelShell",
                                topLevelShellWidgetClass, AppShell, args, n);

    MainWindow = CreateMainWindow(MainShell);

    n = 0;
    ControlShell = XtCreatePopupShell("controlShell",
                                topLevelShellWidgetClass, AppShell, args, n);

    CreateControlWindow(ControlShell);

    CreateErrorBox(AppShell);
    CreateQueryBox(AppShell);
    CreateWarningBox(AppShell);
    CreateFileSelectionBox(AppShell);

    if (NumberDataFiles > 0)
      NewDataFile((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL);

    OpenControlWindow(NULL, NULL, NULL);
    XtManageChild(MainWindow);
    XtPopup(XtParent(MainWindow), XtGrabNone);

    if (RealTime)
      XtAppAddTimeOut(appContext, 1000, UpdateDataRT, NULL);

    XtAppMainLoop(appContext);
    }

  return(0);

}	/* END MAIN */
Example #3
0
/* Timer callback called on time out. */
static void timer_callback (XtPointer client_data, XtIntervalId *timer_id)
{
    XtIntervalId g_timer_id;

    g_timer_id = XtAppAddTimeOut(context,
				 200,	/* interval */
				 (XtTimerCallbackProc) timer_callback,
				 (XtPointer) NULL);

    Md_search_input_LB();
}
Example #4
0
/* animation timer */
void UITimer(int delay, XtTimerCallbackProc action)
{
    if( !ui ){
        return;
    }
    if( delay <= 0 && ui->timer ){
        XtRemoveTimeOut(ui->timer);
    } else {
        ui->timer = XtAppAddTimeOut(ui->context, delay, action, NULL);
    }
}
Example #5
0
static void qnpxt_keep_alive() {
    // make sure we fire off Qt's timers
    int ttw = QApplication::eventLoop()->timeToWait();
    if ( static_d->timerid != -1 )
	XtRemoveTimeOut( static_d->timerid );
    static_d->timerid = -1;
    if ( ttw != -1 ) {
	static_d->timerid =
	    XtAppAddTimeOut( static_d->appContext, ttw, qnpxt_timeout_handler, 0 );
    }
}
Example #6
0
void iupmotTipEnterNotify(Ihandle *ih)
{
  iupmotTipLeaveNotify();

  if (motTipsSet(ih) == FALSE)
    return;

  mot_tips.ih = ih;

  mot_tips.ShowTimerId = XtAppAddTimeOut( /* EnterWin to Show */
    iupmot_appcontext,
    mot_tips.ShowInterval,
    (XtTimerCallbackProc)motTipsShow,
    NULL);
  mot_tips.HideTimerId = XtAppAddTimeOut( /* Visible to Hide */
    iupmot_appcontext,
    mot_tips.HideInterval,
    (XtTimerCallbackProc)motTipsHide,
    NULL);
}
Example #7
0
void Container::ResizeTimeOut(void *data, XtIntervalId * /*id*/)
{
   Container *obj = (Container *)data;
   int h4 = obj->Parent()->Height();
   Dimension h1, h2, h3;

   if (obj->NumChildren())
    {
      Dimension max_height;
      MotifUI **children = (MotifUI **)obj->Children();
      int i;
      XtWidgetGeometry preferred;

      max_height = 0;
      for (i = 0; i < obj->NumChildren(); i++)
       {
	 if (XtIsManaged(children[i]->BaseWidget()))
	  {
            XtQueryGeometry(children[i]->BaseWidget(), NULL, &preferred);
            if ((h1 = preferred.height) > max_height)
	     {
	       max_height = h1;
	       break;
	     }
	  }
       }
      Position y;
      if (max_height)
         XtVaGetValues(children[0]->BaseWidget(), XmNy, &y, NULL);
      else
	 y = 0;
      h1 = max_height + (2 * y);
    }
   else
      XtVaGetValues(obj->_workArea, XmNheight, &h1, NULL);
   XtVaGetValues(obj->_clipWidget, XmNheight, &h2, NULL);
   XtVaGetValues(obj->_w, XmNheight, &h3, NULL);
   h3 = h3 - h2 + h1;
   if (h2 != h1)
    {
      if (h4 > (int)h3)
         h3 = h4;
      else if (obj->NumChildren() == 0)
         return;
      h4 = h3;
    }
   else if (h4 <= (int)h3)
      return;
   XtVaSetValues(obj->_w, XmNheight, h4, NULL);
   obj->Refresh();
   XtVaGetValues(obj->_w, XmNheight, &h3, NULL);
   if (h3 != h4)
      XtAppAddTimeOut(obj->appContext, 500, ResizeTimeOut, obj);
}
Example #8
0
/* When the subprocess has generated some output, this reads as much as it
   can into s->buf at s->buf_tail.
 */
static void
drain_input (state *s)
{
  XtAppContext app = XtDisplayToApplicationContext (s->dpy);

  if (! s->pipe) return;

  /* if (! s->input_available_p) return; */
  /* s->input_available_p = False; */

  if (! input_available_p (fileno (s->pipe)))
    return;


  if (s->buf_tail < sizeof(s->buf) - 2)
    {
      int target = sizeof(s->buf) - s->buf_tail - 2;
      int n;
      n = read (fileno (s->pipe),
                (void *) (s->buf + s->buf_tail),
                target);
      if (n > 0)
        {
          s->buf_tail += n;
          s->buf[s->buf_tail] = 0;
        }
      else
        {
          XtRemoveInput (s->pipe_id);
          s->pipe_id = 0;
          pclose (s->pipe);
          s->pipe = 0;

          /* If the process didn't print a terminating newline, add one. */
          if (s->buf_tail > 1 &&
              s->buf[s->buf_tail-1] != '\n')
            {
              s->buf[s->buf_tail++] = '\n';
              s->buf[s->buf_tail] = 0;
            }

          /* Then add one more, to make sure there's a sentence break at EOF.
           */
          s->buf[s->buf_tail++] = '\n';
          s->buf[s->buf_tail] = 0;

          /* Set up a timer to re-launch the subproc in a bit. */
          if (s->timer_id) abort();
          s->timer_id = XtAppAddTimeOut (app, s->subproc_relaunch_delay,
                                         relaunch_generator_timer,
                                         (XtPointer) s);
        }
    }
}
Example #9
0
File: Main.c Project: juddy/edcde
/* ARGSUSED */
void
CheckForDone(
   XtPointer clientData,
   XtIntervalId id)
{
    if ( toplevel->core.num_popups ==  0 ) 
	exit(exitStatus);

    XtAppAddTimeOut(appContext,
	10, (XtTimerCallbackProc)CheckForDone,
      NULL);
}
Example #10
0
/** Set the Key Callback */
void CGWindow::SetIdleCallback(CGIdleCallback idleCallback, void *idleArg)
{
	m_IdleCallback = idleCallback;
	m_IdleArg = idleArg;
	if (idleCallback) {
		m_IntervalID = XtAppAddTimeOut(m_Context,200, TimerCB, (XtPointer)this);
	}
	else {
		XtRemoveTimeOut(m_IntervalID);
	}
	this->Modified();
}
Example #11
0
File: alarm.c Project: juddy/edcde
extern void
ring_it(XtPointer client_data, XtIntervalId *interval_id) {
	Calendar	*c = (Calendar *)client_data;

    if (c->view->rings == 0) {
        c->view->rings = 5;
        XtAppAddTimeOut(c->xcontext->app, 250, bell_ringer, c);
    }

    /* If the application is busy delivering a ring reminder
       don't deliver another one. */
}
Example #12
0
void SubGraphsMotif::trace_scan( SubGraphsMotif *subgraphs)
{
  int time = 200;

  if ( subgraphs->trace_started) {
    brow_TraceScan( subgraphs->brow->ctx);

    ((SubGraphsMotif *)subgraphs)->trace_timerid = XtAppAddTimeOut(
	XtWidgetToApplicationContext( subgraphs->brow_widget), time,
	(XtTimerCallbackProc)SubGraphsMotif::trace_scan, subgraphs);
  }
}
Example #13
0
File: Eyes.c Project: aosm/X11
/* ARGSUSED */
static void draw_it (
     XtPointer client_data,
     XtIntervalId *id)		/* unused */
{
        EyesWidget	w = (EyesWidget)client_data;
	Window		rep_root, rep_child;
	int		rep_rootx, rep_rooty;
	unsigned int	rep_mask;
	int		dx, dy;
	TPoint		mouse;
	Display		*dpy = XtDisplay (w);
	Window		win = XtWindow (w);
	TPoint		newpupil[2];
	XPoint		xnewpupil, xpupil;

	if (XtIsRealized((Widget)w)) {
    		XQueryPointer (dpy, win, &rep_root, &rep_child,
 			&rep_rootx, &rep_rooty, &dx, &dy, &rep_mask);
		mouse.x = Tx(dx, dy, &w->eyes.t);
		mouse.y = Ty(dx, dy, &w->eyes.t);
		if (!TPointEqual (mouse, w->eyes.mouse)) {
			computePupils (mouse, newpupil);
			xpupil.x = Xx(w->eyes.pupil[0].x, w->eyes.pupil[0].y, &w->eyes.t);
			xpupil.y = Xy(w->eyes.pupil[0].x, w->eyes.pupil[0].y, &w->eyes.t);
			xnewpupil.x =  Xx(newpupil[0].x, newpupil[0].y, &w->eyes.t);
			xnewpupil.y =  Xy(newpupil[0].x, newpupil[0].y, &w->eyes.t);
			if (!XPointEqual (xpupil, xnewpupil)) {
			    if (w->eyes.pupil[0].x != -1000 || w->eyes.pupil[0].y != -1000)
				eyeBall (w, w->eyes.centerGC, 0);
			    w->eyes.pupil[0] = newpupil[0];
			    eyeBall (w, w->eyes.pupGC, 0);
			}
			xpupil.x = Xx(w->eyes.pupil[1].x, w->eyes.pupil[1].y, &w->eyes.t);
			xpupil.y = Xy(w->eyes.pupil[1].x, w->eyes.pupil[1].y, &w->eyes.t);
			xnewpupil.x =  Xx(newpupil[1].x, newpupil[1].y, &w->eyes.t);
			xnewpupil.y =  Xy(newpupil[1].x, newpupil[1].y, &w->eyes.t);
			if (!XPointEqual (xpupil, xnewpupil)) {
			    if (w->eyes.pupil[1].x != -1 || w->eyes.pupil[1].y != -1)
				eyeBall (w, w->eyes.centerGC, 1);
			    w->eyes.pupil[1] = newpupil[1];
			    eyeBall (w, w->eyes.pupGC, 1);
			}
			w->eyes.mouse = mouse;
			w->eyes.update = 0;
		} else {
			if (delays[w->eyes.update + 1] != 0)
				++w->eyes.update;
		}
	}
	w->eyes.interval_id =
		XtAppAddTimeOut(XtWidgetToApplicationContext((Widget) w),
				delays[w->eyes.update], draw_it, (XtPointer)w);
} /* draw_it */
Example #14
0
/* ARGSUSED */
XtTimerCallbackProc NxmBlinkTimeout ( XtIntervalId *id ) 
/************************************************************************
 * NxmBlinkTimeout                                            		*
 *                                                                      *
 * This function is the color blinking routine.				*
 *                                                                      *
 * XtTimerCallbackProc NxmBlinkTimeout(id) 				*
 *                                                                      *
 * Input parameters:                                                    *
 *	*id		XtIntervalId	blink interval			*
 *									*
 * Output parameters:                                                   *
 *                      NONE                                            *
 * Return parameters:                                                   *
 *	NxmBlinkTimeout XtTimerCallbackProc                             *
 **                                                                     *
 * Log:                                                                 *
 * ?/?		 	??/??	initial conding				*
 * E. Safford/GSC  	04/99	fix irix6 compiler warning add header   *
 * T. Piper/SAIC	07/04	Replaced ratio with COLR_SCAL 		*
 ***********************************************************************/
{
int		icolr, iret, red, green, blue;
unsigned long   wait;
/*---------------------------------------------------------------------*/

	icolr = _blinkData.color_index;

	wait = 100;

	if ( blink[icolr] == BLINK_ON) {
		
		red   = _blinkData.on_color.red/COLR_SCAL;
		green = _blinkData.on_color.green/COLR_SCAL;
		blue  = _blinkData.on_color.blue/COLR_SCAL;
		gscrgb( &icolr, &red, &green, &blue, &iret );

		blink[icolr] = BLINK_OFF;
	}
	else {
		red   = _blinkData.off_color.red/COLR_SCAL;
		green = _blinkData.off_color.green/COLR_SCAL;
		blue  = _blinkData.off_color.blue/COLR_SCAL;
		gscrgb( &icolr, &red, &green, &blue, &iret );
		blink[icolr] = BLINK_ON;
	}

      	_blinkData.timer_id = XtAppAddTimeOut(NXMapp, wait, 
		(XtTimerCallbackProc)NxmBlinkTimeout, (XtPointer)NULL);

	return (XtTimerCallbackProc)NULL;
}
Example #15
0
void MotifUI::SetAddTimeOut(TimeOutCallback timeoutCB,
			    void *callback_data,
			    long interval)
{
   if (!_w)
      return;

   TimeOutCallbackData * data = new TimeOutCallbackData;
   data->fp = timeoutCB;
   data->obj = this;
   data->callback_data = callback_data;
   XtAppAddTimeOut(appContext, (unsigned long) interval, ObjectTimeProc, data);
}
Example #16
0
static void gdbEditDoneHP(Agent *edit_agent, void *, void *)
{
    // Editor has terminated: reload current source file

    XtAppAddTimeOut(XtWidgetToApplicationContext(gdb_w), 0, 
		    gdbDeleteEditAgent, 
		    XtPointer(edit_agent));

    gdbReloadSourceCB(gdb_w, 0, 0);

    edit_agent->removeHandler(InputEOF, gdbEditDoneHP);
    edit_agent->removeHandler(Died,     gdbEditDoneHP);
}
Example #17
0
void WNavMotif::trace_scan( WNavMotif *wnav)
{
    int time = 1000;

    if ( wnav->trace_started)
    {
        brow_TraceScan( wnav->brow->ctx);

        wnav->trace_timerid = XtAppAddTimeOut(
                                  XtWidgetToApplicationContext(wnav->brow_widget) , time,
                                  (XtTimerCallbackProc)WNavMotif::trace_scan, wnav);
    }
}
Example #18
0
void WGreMotif::trace_scan( WGreMotif *gre)
{
  if ( gre->trace_started)
  {


    flow_TraceScan( gre->flow_ctx);

    gre->trace_timerid = XtAppAddTimeOut(
	XtWidgetToApplicationContext(gre->flow_widget) ,500,
	(XtTimerCallbackProc)trace_scan, gre);
  }
}
Example #19
0
/* ARGSUSED */
static void draw_it (
     XtPointer client_data,
     XtIntervalId *id)		/* unused */
{
        EyesWidget	w = (EyesWidget)client_data;

	if (XtIsRealized((Widget)w)) {
	        draw_it_core(w);
	}
	w->eyes.interval_id =
		XtAppAddTimeOut(XtWidgetToApplicationContext((Widget) w),
				delays[w->eyes.update], draw_it, (XtPointer)w);
} /* draw_it */
Example #20
0
static void DeletePlotterHP(Agent *plotter, void *client_data, void *)
{
    // Plotter has died - delete memory
    XtAppAddTimeOut(XtWidgetToApplicationContext(gdb_w), 0, 
		    DeletePlotterCB, XtPointer(plotter));

    plotter->removeHandler(Died, DeletePlotterHP, client_data);

    PlotWindowInfo *plot = (PlotWindowInfo *)client_data;
    assert(plot->plotter == 0 || plot->plotter == plotter);
    plot->plotter = 0;
    popdown_plot_shell(plot);
}
Example #21
0
/* ************************************************************* */
static void animate(XtPointer closure, XtIntervalId *id )
{
  XtInputMask maske;
  if ((maske = XtAppPending(kontext)))
    {
      XtAppProcessEvent(kontext, maske);
    } 
  else
    {
      C3D_postredisplay();
      animateID = XtAppAddTimeOut(kontext, 1, animate, 0);
    }
}
Example #22
0
void AttrNavMotif::trace_scan( AttrNav *attrnav)
{
    int time = 200;

    if ( attrnav->trace_started)
    {
        brow_TraceScan( attrnav->brow->ctx);

        ((AttrNavMotif *)attrnav)->trace_timerid = XtAppAddTimeOut(
                    XtWidgetToApplicationContext( ((AttrNavMotif *)attrnav)->brow_widget) , time,
                    (XtTimerCallbackProc)AttrNavMotif::trace_scan, attrnav);
    }
}
Example #23
0
File: alarm.c Project: juddy/edcde
extern void 
flash_it(XtPointer client_data, XtIntervalId *interval_id) {
    int		i, j;
    Calendar	*c = (Calendar *)client_data;

    if (c->view->flashes == 0) {
        c->view->flashes = 10;
        XtAppAddTimeOut(c->xcontext->app, 250, view_flasher, c);
    }

    /* if the application is busy delivering a flash reminder, 
       don't deliver another one. */
}
Example #24
0
/*!
* \ingroup	HGU_GL
* \brief	Calls the trackball animation function without setting
*		the trackball mode to HGUglwCANVASTB_MODE_ANIMATION so
*		that a single update is done.
* \param	givenW			Widget instance.
*/
void		HGUglwCanvasTbUpdate(Widget givenW)
{
  HGUglwCanvasTbWidget tbW;

  if(givenW)
  {
    tbW = (HGUglwCanvasTbWidget )givenW;
    (void )XtAppAddTimeOut(XtWidgetToApplicationContext(givenW),
			   1,
    			   HGUglwCanvasTbAnimateFn,
    			   (XtPointer )tbW);
  }
}
Example #25
0
static void wdanav_trace_scan( WdaNavMotif *wdanav)
{
    int time = 200;

    if ( wdanav->trace_started)
    {
        brow_TraceScan( wdanav->brow->ctx);

        wdanav->trace_timerid = XtAppAddTimeOut(
                                    XtWidgetToApplicationContext(wdanav->brow_widget) , time,
                                    (XtTimerCallbackProc)wdanav_trace_scan, wdanav);
    }
}
Example #26
0
void WFoeMotif::popdown_pop( Widget w, WFoe *foe, XmAnyCallbackStruct *data)
{
  XtIntervalId		TimerID;

  if ( foe->popupmenu_node != 0) {
    /* Wait some time and take away select if nobody
       else has done that */
    TimerID = XtAppAddTimeOut( 
	        XtWidgetToApplicationContext(((WFoeMotif *)foe)->parent_wid),
		300, (XtTimerCallbackProc)reset_current_node, foe);
  }
  foe->normal_cursor();	
}
Example #27
0
/****************************************************************************
  This function updates the list of servers after the server dialog has been
  displayed. LAN servers updated every 250 ms for 5 seconds, metaserver
  updated every 500 ms for 2 seconds.
****************************************************************************/
static void server_list_timer(XtPointer meta_list, XtIntervalId * id)
{
  char errbuf[128];

  if (!connectdlg_serverlist_shell) {
    return;
  }

  if (get_server_list(servers_list, errbuf, sizeof(errbuf)) != -1)  {
    XawListChange(meta_list, servers_list, 0, 0, True);
  }
/*
  else if (!lan_mode) {
    output_window_append(ftc_client, errbuf);
  }
*/
  num_lanservers_timer++;

  if (lan_mode) {
    if (num_lanservers_timer == 20) {
      server_scan_finish(lan_scan);
      lan_scan = NULL;
      num_lanservers_timer = 0;
      return;
    }
    (void)XtAppAddTimeOut(app_context, 250, server_list_timer,
                          (XtPointer)meta_list);
  } else {
    if (num_lanservers_timer == 4) {
      server_scan_finish(meta_scan);
      meta_scan = NULL;
      num_lanservers_timer = 0;
      return;
    }
    (void)XtAppAddTimeOut(app_context, 500, server_list_timer,
                          (XtPointer)meta_list);
  }
}
Example #28
0
// Veto key-based cursor movements before current line
void gdbMotionCB(Widget, XtPointer, XtPointer call_data)
{
    if (private_gdb_output)
	return;

    XmTextVerifyCallbackStruct *change = 
	(XmTextVerifyCallbackStruct *)call_data;

    if (isearch_state != ISEARCH_NONE)
    {
	if (!isearch_motion_ok)
	{
	    XtAppAddTimeOut(XtWidgetToApplicationContext(gdb_w), 0, 
			    clear_isearch_after_motion, XtPointer(0));
	}
	isearch_motion_ok = false;
    }

    if (change->event != 0
	&& (change->event->type == KeyPress 
	    || change->event->type == KeyRelease))
    {
	if (change->newInsert < promptPosition)
	{
	    // We are before the current prompt: don't change the cursor
	    // position if a key was pressed.
#if 0
	    // With Motif, this causes a core dump on Solaris.  - AZ
	    change->doit = false;
#else
	    // Make it a no-op.
	    XtCallActionProc(gdb_w, "beep", change->event, 0, 0);
	    XtAppAddTimeOut(XtWidgetToApplicationContext(gdb_w), 0, 
			    move_to_end_of_line, 0);
#endif
	}
    }
}
Example #29
0
static void motTimerRun(Ihandle *n)
{
  unsigned int time_ms;

  if(number(n) > 0) /* timer already started */
    return;
  
  time_ms = IupGetInt(n, IUP_TIME);
  if(time_ms > 0)
  {
    XtAppContext context = XtWidgetToApplicationContext(iupmot_initialwidget);
    number(n) = XtAppAddTimeOut(context, time_ms, motTimerProc, (XtPointer) n);
  }
}
Example #30
0
/*ARGSUSED*/
static void
HintsTimer(XtPointer closure, XtIntervalId *id)
{
    Arg args[1];
    xedit_hints *hints = (xedit_hints*)closure;

    hints->cur_hint = rand() % hints->num_hints;

    XtSetArg(args[0], XtNlabel, hints->hints[hints->cur_hint]);
    XtSetValues(hintswindow, args, 1);

    hints->timer = XtAppAddTimeOut(XtWidgetToApplicationContext(topwindow),
				   hints->interval, HintsTimer, closure);
}