Пример #1
0
void
xevents(void)
{
	XEvent event;
	XtInputMask input_mask;
	register TScreen *screen = &term->screen;

	if(screen->scroll_amt)
		FlushScroll(screen);
	/*
	 * process timeouts, relying on the fact that XtAppProcessEvent
	 * will process the timeout and return without blockng on the
	 * XEvent queue.  Other sources i.e. the pty are handled elsewhere
	 * with select().
	 */
	while ((input_mask = XtAppPending(app_con)) & XtIMTimer)
		XtAppProcessEvent(app_con, XtIMTimer);
	/*
	 * If there's no XEvents, don't wait around...
	 */
	if ((input_mask & XtIMXEvent) != XtIMXEvent)
	    return;
	do {
		if (waitingForTrackInfo)
			return;
		XtAppNextEvent (app_con, &event);
		/*
		 * Hack to get around problems with the toolkit throwing away
		 * eventing during the exclusive grab of the menu popup.  By
		 * looking at the event ourselves we make sure that we can
		 * do the right thing.
		 */
		if(OUR_EVENT(event, EnterNotify))
		  DoSpecialEnterNotify (&event.xcrossing);
		else
		if(OUR_EVENT(event, LeaveNotify))
		  DoSpecialLeaveNotify (&event.xcrossing);
		else if ((screen->send_mouse_pos == ANY_EVENT_MOUSE
#if OPT_DEC_LOCATOR
			|| screen->send_mouse_pos == DEC_LOCATOR
#endif	/* OPT_DEC_LOCATOR */
								)
		 && event.xany.type == MotionNotify
		 && event.xcrossing.window == XtWindow(term)) {
		    SendMousePosition((Widget)term, &event);
		    continue;
		}

		if (!event.xany.send_event ||
		    screen->allowSendEvents ||
		    ((event.xany.type != KeyPress) &&
		     (event.xany.type != KeyRelease) &&
		     (event.xany.type != ButtonPress) &&
		     (event.xany.type != ButtonRelease)))
		    XtDispatchEvent(&event);
	} while ((input_mask = XtAppPending(app_con)) & XtIMXEvent);
}
Пример #2
0
static void
mf_events ()
{
  XEvent event;

  if (XtAppPending (mf_app) != 0)
    {
      while (XtAppPending (mf_app) != 0)
	{
	  XtAppNextEvent (mf_app, &event);
	  XtDispatchEvent (&event);
	}
    }
}
Пример #3
0
/*
 *	bXAUERelaxCallback
 *
 *	Author:	Christian Schafmeister (1991)
 *
 *	Callback to redisplay the UNIT every step of a minimization.
 *	Return TRUE to indicate that the minimization should continue.
 */
static BOOL
bXAUERelaxCallback( Widget wTank )
{
    XEvent		xeEvent;
    BOOL		bContinue;

    /* Redisplay the UNIT in the TANK */


    TankFastRedisplayUnit((TANK) wTank );

    /* If there is an event pending then handle it */

    bContinue = TRUE;
    while ( XtAppPending( SxtacApp ) ) {
        MESSAGE(( "There is an event pending\n" ));
        XtAppNextEvent( SxtacApp, &xeEvent );
        if ( bBasicsInterrupt() ) {
            bContinue = FALSE;
            BasicsResetInterrupt();
        }
        XtDispatchEvent( &xeEvent );
    }

    return(bContinue);
}
Пример #4
0
bool GUI_UpdateProgress(struct CTransform *ctransform,int startval,int nowval,int endval){

#if 0
  struct timeval tv;
  //  XEvent event;

  gettimeofday(&tv,NULL);

  /* Update ~50 times a second. */
  if(abs(tv.tv_usec-ctransform->lasttime)>20000){
    /*
    if(XtAppPeekEvent(app_context, &event)){
      printf("event->display: %x %x %x\n",event.xany.window,a->core.window,b->core.window);
    }
    */
    while (XtAppPending(app_context)) {
      XtAppProcessEvent(app_context,XtIMXEvent|XtIMTimer|XtIMAlternateInput);
    }
    ctransform->lasttime=tv.tv_usec;
  }
#endif

#if 1
  int pr=100*(nowval-startval)/(endval-startval);
  if(pr!=ctransform->lastprogress && getpid()==mainpid){
    XtVaSetValues(progressScale, XmNvalue, pr, NULL);
    XmUpdateDisplay(topLevel);
    ctransform->lastprogress=pr;
  }
#endif

  return true;
}
Пример #5
0
static int
WaitForEvent(
    const Tcl_Time *timePtr)		/* Maximum block time, or NULL. */
{
    int timeout;

    if (!initialized) {
	InitNotifier();
    }

    TclSetAppContext(NULL);

    if (timePtr) {
	timeout = timePtr->sec * 1000 + timePtr->usec / 1000;
	if (timeout == 0) {
	    if (XtAppPending(notifier.appContext)) {
		goto process;
	    } else {
		return 0;
	    }
	} else {
	    Tcl_SetTimer(timePtr);
	}
    }

  process:
    XtAppProcessEvent(notifier.appContext, XtIMAll);
    return 1;
}
Пример #6
0
int animation_start()
/* ************************************************************* */
{
  char c_zeit[10];
  static XtIntervalId timeid;
 XtInputMask maske;


/* setze alle Widgets insensitiv ausser Animation stop */
  setze_sensitiv_alle(FALSE);
/* setze Flagge fuer Animation auf TRUE und zeichne naechsten */
/* Zeitschritt bis Animation abgebrochen wird --------------- */
  g_animation.anim_on = TRUE;

  while (g_animation.anim_on)
  {

	 
	  if ((maske = XtAppPending(kontext)))
	  {
		  XtAppProcessEvent(kontext, maske);
	  } 
	  else
	  {
	    next_zeit_cb();
	    animateID = XtAppAddTimeOut(kontext,1, animation_start, 0);
	    //C3D_postredisplay();
	  }
	  
  }
  return (1);
}
Пример #7
0
void XSilChessWindow::DoPainting()
{
	XEvent e;
	char * data;
	XImage * img;
	int i,y,msk;

	if (IsPainting) return;
	if (!ViewWin) return;
	IsPainting=true;
	y=0;
	while (NeedPainting) {
		NeedPainting=false;
		RT.SetWorld(Machine);
		data=(char*)malloc(PixelSize*ViewWidth+1000000);
		img=XCreateImage(Disp,Vsl,VslDepth,ZPixmap,0,data,
		                 ViewWidth,1,8*PixelSize,0);
		for (msk=0x3ff; msk<ViewHeight-1; msk=(msk<<1)|1);
		for (i=0, y%=ViewHeight; i<ViewHeight; i++) {
			while (XtAppPending(App)!=0) {
				XtAppNextEvent(App,&e);
				XtDispatchEvent(&e);
			}
			if (NeedPainting) break;
			RT.RenderScanline(y,data,PixelSize,RedMask,GreenMask,BlueMask);
			XPutImage(Disp,ViewWin,ViewGC,img,0,0,0,y,ViewWidth,1);
			if (i==ViewHeight-1 || (i&7)==0) PaintSel();
			do { y=(y+269779)&msk; } while (y>=ViewHeight);
		}
		PaintSel();
		XFree(img);
		free(data);
	}
	IsPainting=false;
}
Пример #8
0
Файл: motif.c Проект: E-LLP/QuIP
static void motif_dispatch(SINGLE_QSP_ARG_DECL)
{
	XtInputMask mask;

	while( (mask = XtAppPending(globalAppContext)) != 0)
		XtAppProcessEvent(globalAppContext, mask);
}
Пример #9
0
int
XmLMessageBox(Widget w,
	      char *string,
	      Boolean okOnly)
	{
	int status = 0;
	Widget dialog, shell;
	Arg args[3];
	XtAppContext context;
	XmString str, titleStr;
	String shellTitle;
	Atom WM_DELETE_WINDOW;

	str = XmStringCreateLtoR(string, XmSTRING_DEFAULT_CHARSET);
	XtSetArg(args[0], XmNmessageString, str);
	XtSetArg(args[1], XmNdialogStyle, XmDIALOG_APPLICATION_MODAL);
	shell = XmLShellOfWidget(w);
	if (shell)
		XtVaGetValues(shell, XmNtitle, &shellTitle, NULL);
	if (shell && shellTitle)
		titleStr = XmStringCreateLtoR(shellTitle,
			XmSTRING_DEFAULT_CHARSET);
	else
		titleStr = XmStringCreateSimple("Notice");
	XtSetArg(args[2], XmNdialogTitle, titleStr);
	if (okOnly == True)
		dialog = XmCreateMessageDialog(XtParent(w), "popup", args, 3);
	else
		dialog = XmCreateQuestionDialog(XtParent(w), "popup", args, 3);
	WM_DELETE_WINDOW = XmInternAtom(XtDisplay(w), "WM_DELETE_WINDOW",
		False);
	XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW, XmLMessageBoxWMDelete,
		(caddr_t)&status);
	XmStringFree(str);
	XmStringFree(titleStr);
	XtAddCallback(dialog, XmNokCallback, XmLMessageBoxResponse,
		(XtPointer)&status);
	if (okOnly == True)
		{
		XtUnmanageChild(XmMessageBoxGetChild(dialog,
			XmDIALOG_CANCEL_BUTTON));
		XtUnmanageChild(XmMessageBoxGetChild(dialog,
			XmDIALOG_HELP_BUTTON));
		}
	else
		{
		XtAddCallback(dialog, XmNcancelCallback, XmLMessageBoxResponse,
			(XtPointer)&status);
		XtAddCallback(dialog, XmNhelpCallback, XmLMessageBoxResponse,
			(XtPointer)&status);
		}
	XtManageChild(dialog);

	context = XtWidgetToApplicationContext(w);
	while (!status ||  XtAppPending(context))
		XtAppProcessEvent(context, XtIMAll);
	XtDestroyWidget(dialog);
	return status;
	}
Пример #10
0
/*
 * Process an event (or just check for one)
 */
errr CheckEvent(bool wait)
{
	XEvent event;

	/* No events ready, and told to just check */
	if (!wait && !XtAppPending(appcon)) return 1;

	/* Process */
	while (1)
	{
		XtAppNextEvent(appcon, &event);
		XtDispatchEvent(&event);
		if (!XtAppPending(appcon)) break;
	}

	return (0);
}
Пример #11
0
void VkHypViewer::eventHandler(XEvent *event) {
  // may need to drain away events which occurred while HypView was busy
  int tossEvents = hv->getTossEvents();
  if (tossEvents) {
#ifdef HYPVK
    XtAppContext app = theApplication->appContext();
#else
    XtAppContext app = XtWidgetToApplicationContext (glxarea);
#endif
    XEvent e;
    while (XtAppPending(app)) {
      XtAppNextEvent(app, &e);     // just throw it away
      XtDispatchEvent(&e);
    }
    hv->setTossEvents(0);
    // if one of these ignored events was the rightmouse then 
    // Motif has already handed us input focus. must give it back! 
    XUngrabPointer(XtDisplay(glxarea), CurrentTime);
  }

  switch (event->type) {
  case ButtonPress:
  case ButtonRelease:
    hv->mouse(event->xbutton.button-1, 
	      event->xmotion.state&(Button1Mask|Button2Mask|Button3Mask),
	      event->xmotion.x, event->xmotion.y, 
	      event->xmotion.state&(ShiftMask), 
	      event->xmotion.state&(ControlMask)
	      );
    break;
  case MotionNotify:
    if (event->xmotion.state&(Button1Mask|Button2Mask|Button3Mask)) {
      hv->motion(event->xmotion.x, event->xmotion.y,
		 event->xmotion.state&(ShiftMask), 
		 event->xmotion.state&(ControlMask)
		 );
    } else {
      hv->passive(event->xmotion.x, event->xmotion.y,
		  event->xmotion.state&(ShiftMask), 
		  event->xmotion.state&(ControlMask)
		  );
    }
    break;
  case ConfigureNotify:
    hv->reshape(event->xconfigure.width, event->xconfigure.height);
    break;
  case Expose:
    hv->idle(1);
    hv->drawFrame();
    break;
  }
  // make the idle work right
  if (XtPending()) {
    hv->idle(0);
  }
}
Пример #12
0
void HandleEvents(void)
{
#ifdef GRAPHICS
    XEvent event;
    while(XtAppPending(app)) {
        XtAppNextEvent (app, &event); 
        XtDispatchEvent (&event);
    }
#endif
}
Пример #13
0
FlusherTousLesEvenements()
{
   XEvent theEvent;
   
   while (XtAppPending(SuperWidget.contexte))
      {
      XtAppNextEvent(SuperWidget.contexte, &(theEvent));
      XtDispatchEvent(&(theEvent));
      }

   XFlush(XtDisplay(SuperWidget.topLevel)); 
   XSync(XtDisplay(SuperWidget.topLevel), False);
   }
Пример #14
0
void XtEvents::idleProcess()
    {
    for( int i = 0;
         i < 1000; // only up to 1000 iterations, in order to avoid starving
         ++i )
        {
        XtInputMask mask = XtAppPending( context );
        mask &= ~XtIMXEvent; // these are processed in x11Event()
        if( mask == 0 )
            break;
        XtAppProcessEvent( context, mask );
        }
    }
Пример #15
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);
    }
}
Пример #16
0
    void
workshop_init(void)
{
    char_u	 buf[64];
    int		 is_dirty = FALSE;
    int		 width, height;
    XtInputMask	 mask;

    /*
     * Turn on MenuBar, ToolBar, and Footer.
     */
    STRCPY(buf, p_go);
    if (vim_strchr(p_go, GO_MENUS) == NULL)
    {
	STRCAT(buf, "m");
	is_dirty = TRUE;
    }
    if (vim_strchr(p_go, GO_TOOLBAR) == NULL)
    {
	STRCAT(buf, "T");
	is_dirty = TRUE;
    }
    if (vim_strchr(p_go, GO_FOOTER) == NULL)
    {
	STRCAT(buf, "F");
	is_dirty = TRUE;
    }
    if (is_dirty)
	set_option_value((char_u *)"go", 0L, buf, 0);

    /*
     * Set size from workshop_get_width_height().
     */
    width = height = 0;
    if (workshop_get_width_height(&width, &height))
    {
	XtVaSetValues(vimShell,
		XmNwidth, width,
		XmNheight, height,
		NULL);
    }

    /*
     * Now read in the initial messages from eserve.
     */
    while ((mask = XtAppPending(app_context))
	    && (mask & XtIMAlternateInput) && !workshopInitDone)
	XtAppProcessEvent(app_context, (XtInputMask)XtIMAlternateInput);
}
Пример #17
0
XtInputMask XETrapAppPending(XtAppContext app)
{
    TimerEventRec *te_ptr;
#ifndef VMS
    struct timeval cur_time;
#else  /* vms */
    vms_time cur_time;
    long efnMask = 0L;
    int status;
#endif /* vms */
    XtInputMask retmask = XtAppPending(app);        /* Prime XtIMEvent */

    retmask &= ~(XtIMTimer | XtIMAlternateInput);   /* clear timer & input */
    /* Now test for timer */
    te_ptr = app->timerQueue;
    while (te_ptr != NULL)
    {
#ifndef vms
        (void)gettimeofday(&cur_time, NULL);
        FIXUP_TIMEVAL(cur_time);
#else
        sys$gettim(&cur_time);
#endif /* vms */
        if (IS_AT_OR_AFTER(te_ptr->te_timer_value, cur_time))
        {   /* this timer is due to fire */
            retmask |= XtIMTimer;
            break;
        }
        te_ptr = te_ptr->te_next;
    }

    /* Now test for alternate input */
#ifndef vms
    if (app->outstandingQueue != NULL)
    {
        retmask |= XtIMAlternateInput;
    }
#else /* vms */
    if ((app->Input_EF_Mask != 0L) && ((status=SYS$READEF(1,&efnMask)) == 1))
    {   /* we have input configured & retrieved the efn cluster 0 */
        efnMask &= app->Input_EF_Mask;  /* mask out non-input */
        if (efnMask)                    /* any left? */
        {                               /* yes, an alt-input efn is set */
            retmask |= XtIMAlternateInput;
        }
    }
#endif  /* vms */
    return(retmask);
}
Пример #18
0
void
do_xevents(void)
{
	register TScreen *screen = &term->screen;

	if (XtAppPending(app_con)
	||
#if defined(VMS) || defined(__VMS)
	screen->display->qlen > 0
#else
	GetBytesAvailable (ConnectionNumber(screen->display)) > 0
#endif
	)
	xevents();
}
Пример #19
0
void GUI_GeneralPreview(Widget w,XtPointer client, XtPointer call)
{
  struct CTransform *ctransform=(struct CTransform *)client;
  struct FFTSound *copy;
  int length;

  PlayStopHard();

  if( ! DA_initialized(ctransform->fftsound)){
    fprintf(stderr,"No Sound loaded\n");
    return;
  }


  XmUpdateDisplay(w);
  SetWatchCursor(topLevel);

  if(ctransform->doprogress==true){
    XtVaSetValues(progressScale, XmNvalue, 0, NULL);
    XtManageChild(progressDialog);
  }

  while (XtAppPending(app_context)) {
     XtAppProcessEvent(app_context,XtIMXEvent|XtIMTimer|XtIMAlternateInput);
  }


  length=min(areat2-areat1,CONFIG_getMaxPreviewLength(ctransform->fftsound));

  copy=makeFFTSoundCopy(ctransform->fftsound,areat1,areat1+length);
  copyFFTSound(ctransform->fftsound,copy,areat1);
  //  copy=ctransform->fftsound;
  (*ctransform->Transform)(ctransform,ctransform->pointer,copy,0,length,areat1);

  Play(copy,0,length);


  /*
  if(pthread_create(&pthread,NULL,DoPlay,copy)!=0){
    fprintf(stderr,"Could not make pthread\n");
  }
  */

  //   RedrawWin(ctransform->fftsound);
  if(ctransform->doprogress==true) XtUnmanageChild(progressDialog);
  ResetCursor(topLevel);

}
Пример #20
0
/*! \reimp
 */
bool QXtEventLoop::processEvents( ProcessEventsFlags flags )
{
    // Qt uses posted events to do lots of delayed operations, like repaints... these
    // need to be delivered before we go to sleep
    TQApplication::sendPostedEvents();

    // make sure we fire off Qt's timers
    int ttw = timeToWait();
    if ( d->timerid != 0 ) {
	XtRemoveTimeOut( d->timerid );
    }
    d->timerid = 0;
    if ( ttw != -1 ) {
	d->timerid =
	    XtAppAddTimeOut( d->appContext, ttw,
			     qmotif_timeout_handler, 0 );
    }

    // get the pending event mask from Xt and process the next event
    XtInputMask pendingmask = XtAppPending( d->appContext );
    XtInputMask mask = pendingmask;
    if ( pendingmask & XtIMTimer ) {
	mask &= ~XtIMTimer;
	// zero timers will starve the Xt X event dispatcher... so process
	// something *instead* of a timer first...
	if ( mask != 0 )
	    XtAppProcessEvent( d->appContext, mask );
	// and process a timer afterwards
	mask = pendingmask & XtIMTimer;
    }

    if ( ( flags & WaitForMore ) )
	XtAppProcessEvent( d->appContext, XtIMAll );
    else
	XtAppProcessEvent( d->appContext, mask );

    int nevents = 0;
    if ( ! ( flags & ExcludeSocketNotifiers ) )
	nevents += activateSocketNotifiers();

    if ( d->activate_timers ) {
	nevents += activateTimers();
    }
    d->activate_timers = FALSE;

    return ( (flags & WaitForMore) || ( pendingmask != 0 ) || nevents > 0 );
}
Пример #21
0
static void
SendByte(Widget w)
{
int i;

    while ((XtAppPending(XtWidgetToApplicationContext(w)) & XtIMAlternateInput) == XtIMAlternateInput)
    {
	XtAppProcessEvent(XtWidgetToApplicationContext(w), XtIMAlternateInput);
    }
    Host_OutputId(w) = (XtIntervalId)NULL;
    if (!Host_Throttle(w))
    {
	if (Host_OutputSize(w) > 0)
	{
	    switch (Host_Type(w))
	    {
	    case XltHOST_CLIENT:
		write(Host_Fd(w), &(Host_OutputData(w)[0]), 1);
		break;
	    case XltHOST_SERVER:
		for (i = 0; i < Host_NumClients(w); i++)
		{
		    write(Host_ClientList(w)[i].fd, &(Host_OutputData(w)[0]), 1);
		}
		break;
	    default:
		break;
	    }
	    memmove(&(Host_OutputData(w)[0]), &(Host_OutputData(w)[1]), Host_OutputSize(w));
	    Host_OutputSize(w)--;
	    if (Host_OutputCallback(w))
	    {
		_XltHostCallbackStruct tmp;

		tmp.reason = XltCR_OUTPUT;
		tmp.data = NULL;
		tmp.len = Host_OutputSize(w);
		tmp.input_size = 0;
		tmp.input_need = 0;
		XtCallCallbackList(w, Host_OutputCallback(w), &tmp);
	    }
	}
    }
    Throttle(w, Host_Throttle(w));
}
Пример #22
0
void keep_playing(XtPointer data)
{
  XEvent xev;

  lasttime = NULL_XtIntervalId;

  if (playing)
  {
    while (XtAppPending(App))		/* clear out event queue */
    {					/* before adding another timeout. */
      XtAppNextEvent(App, &xev);
      XtDispatchEvent(&xev);
    }

    if (lasttime == NULL_XtIntervalId)
      lasttime = XtAppAddTimeOut(App, speed, (XtTimerCallbackProc)keep_playing, (XtPointer) NULL);

    anim_playing();
  }
}
Пример #23
0
static gboolean
xt_event_polling_timer_callback(gpointer user_data)
{
  Display * display;
  XtAppContext ac;
  int eventsToProcess = 20;

  display = (Display *)user_data;
  ac = XtDisplayToApplicationContext(display);

  /* We need to process many Xt events here. If we just process
     one event we might starve one or more Xt consumers. On the other hand
     this could hang the whole app if Xt events come pouring in. So process
     up to 20 Xt events right now and save the rest for later. This is a hack,
     but it oughta work. We *really* should have out of process plugins.
  */
  while (eventsToProcess-- && XtAppPending(ac))
    XtAppProcessEvent(ac, XtIMAll);
  return TRUE;
}
Пример #24
0
bool QNPXt::processEvents( ProcessEventsFlags flags )
{
    // Qt uses posted events to do lots of delayed operations, like
    // repaints... these need to be delivered before we go to sleep
    QApplication::sendPostedEvents();

    bool canWait = ( flags & WaitForMore );

    qnpxt_keep_alive();

    // get the pending event mask from Xt and process the next event
    XtInputMask pendingmask = XtAppPending( d->appContext );
    XtInputMask mask = pendingmask;
    if ( pendingmask & XtIMTimer ) {
	mask &= ~XtIMTimer;
	// zero timers will starve the Xt X event dispatcher... so
	// process something *instead* of a timer first...
	if ( mask != 0 )
	    XtAppProcessEvent( d->appContext, mask );
	// and process a timer afterwards
	mask = pendingmask & XtIMTimer;
    }

    if ( canWait )
	XtAppProcessEvent( d->appContext, XtIMAll );
    else
	XtAppProcessEvent( d->appContext, mask );

    int nevents = 0;
    if ( ! ( flags & ExcludeSocketNotifiers ) ) {
	nevents += activateSocketNotifiers();
	d->pending_socknots = 0;
    }

    if ( d->activate_timers ) {
	nevents += activateTimers();
    }
    d->activate_timers = FALSE;

    return ( canWait || ( pendingmask != 0 ) || nevents > 0 );
}
Пример #25
0
void XSilChessWindow::DoSearching()
{
	XEvent e;
	SilChessMachine::Move m;
	bool res;

	if (IsPainting) return;
	if (IsSearching) return;
	IsSearching=true;
	while ((!Machine->IsHumanOn() || HintWanted) &&
	       !Machine->IsMate() && !Machine->IsDraw() && !Machine->IsEndless()) {
		AbortSearching=false;
		Machine->StartSearching();
		for (;;) {
			if (Machine->ContinueSearching()) break;
			while (XtAppPending(App)) {
				XtAppNextEvent(App,&e);
				XtDispatchEvent(&e);
			}
			if (AbortSearching) break;
		}
		res=Machine->EndSearching(&m);
		if (!AbortSearching && res) {
			if (!Machine->IsHumanOn()) {
				Machine->DoMove(m);
				RT.SetWorld(Machine);
				UpdateStatusBar();
				UpdateMovesList();
				UpdateView();
			}
			else if (HintWanted) {
				HintWanted=false;
				Hint=m;
				HintValid=true;
				UpdateStatusBar();
			}
		}
	}
	IsSearching=false;
}
Пример #26
0
/******************************************************************************
 * PeriodicUpdate:
 * Description : This function will be called by CLIPS periodically 
 *               while it processes a command. This will allow user
 *               to halt the execution, change options, turn on/off watch,
 *               update the the windows during CLIPS process
 ******************************************************************************
 */
static void PeriodicUpdate(
  void *theEnv)
  {
   periodicChecking = True;
   
   while(XtAppPending(app_con) != 0)
     {
      XtAppNextEvent(app_con, &TheEvent);
      XtDispatchEvent(&TheEvent);
     }

   periodicChecking = False;

   if((Browse_status[AGENDA_WIN] == True) ? (EnvGetAgendaChanged(theEnv) == CLIPS_TRUE) : FALSE)
      {
      PrintChangedAgenda();
      EnvSetAgendaChanged(theEnv,CLIPS_FALSE);
      }
  if((Browse_status[FACT_WIN] == True) ? (EnvGetFactListChanged(theEnv) == CLIPS_TRUE) : FALSE)
      {
      PrintChangedFacts();
      EnvSetFactListChanged(theEnv,CLIPS_FALSE);
      }
 if((Browse_status[INSTANCE_WIN] == True) ? (EnvGetInstancesChanged(theEnv) == CLIPS_TRUE) : FALSE)
      {
      PrintChangedInstances();
      EnvSetInstancesChanged(theEnv,CLIPS_FALSE);
      }
 if((Browse_status[GLOBAL_WIN] == True) ? (EnvGetGlobalsChanged(theEnv) == CLIPS_TRUE) : FALSE)
      {
      PrintChangedGlobals();
      EnvSetGlobalsChanged(theEnv,CLIPS_FALSE);
      }
 if((Browse_status[FOCUS_WIN] == True) ? (EnvGetFocusChanged(theEnv) == CLIPS_TRUE) :FALSE)
     {
      PrintChangedFocus();
      EnvSetFocusChanged(theEnv,CLIPS_FALSE);
     }

}
Пример #27
0
int Gprocessevents (int waitflag, int mode) {
    int rtn;

    if (Glazyq.flag)
        Gflushlazyq ();
    rtn = 0;
    switch (waitflag) {
    case TRUE:
        XtAppProcessEvent (appcontext, XtIMAll);
        if (mode == G_ONEEVENT)
            return 1;
        rtn = 1;
        /* FALL THROUGH */
    case FALSE:
        while (XtAppPending (appcontext)) {
            XtAppProcessEvent (appcontext, XtIMAll);
            if (mode == G_ONEEVENT)
                return 1;
            rtn = 1;
        }
        break;
    }
    return rtn;
}
Пример #28
0
void GUI_GeneralOk(Widget w,XtPointer client, XtPointer call)
{
  struct CTransform *ctransform=(struct CTransform *)client;

  if( ! DA_initialized(ctransform->fftsound)){
    fprintf(stderr,"No Sound loaded\n");
    return;
  }

  XmUpdateDisplay(w);
  SetWatchCursor(topLevel);

  if(ctransform->doprogress==true){
    XtVaSetValues(progressScale, XmNvalue, 0, NULL);
    XtManageChild(progressDialog);
  }

  while (XtAppPending(app_context)) {
     XtAppProcessEvent(app_context,XtIMXEvent|XtIMTimer|XtIMAlternateInput);
  }

  UNDO_addTransform(ctransform->fftsound);

  (*ctransform->Transform)(ctransform,ctransform->pointer,ctransform->fftsound,areat1,areat2,0);

  SetVisibleFunc(1,2);
  SetVisibleFunc(2,2);
  SetVisibleFunc(3,2);

  RedrawWin(ctransform->fftsound);
  if(ctransform->doprogress==true) XtUnmanageChild(progressDialog);
  ResetCursor(topLevel);

  XtUnmanageChild(ctransform->parentwidget);

}
Пример #29
0
int main (int argc,char *argv[])
{/* Main */    
   static char FuncName[]={"prompt_user"}; 
   SUMA_GENERIC_PROG_OPTIONS_STRUCT *Opt;  
   SUMA_GENERIC_ARGV_PARSE *ps=NULL;
   char * esc_str = NULL;
   int ii;
   Widget w=NULL;
   XtAppContext    app;
   XEvent ev;
   XtInputMask pp;
   SUMA_Boolean LocalHead = NOPE;
   
   SUMA_STANDALONE_INIT;
	SUMA_mainENTRY;

   /* Allocate space for DO structure */
	SUMAg_DOv = SUMA_Alloc_DisplayObject_Struct (SUMA_MAX_DISPLAYABLE_OBJECTS);
   ps = SUMA_Parse_IO_Args(argc, argv, "");
   
   if (argc < 2) {
      usage_prompt_user(ps);
      exit (1);
   }
   
   Opt = SUMA_prompt_user_ParseInput (argv, argc, ps);

   w = XtOpenApplication(&app, "prompt_user", 
                           NULL, 0, &argc, argv,
                           SUMA_get_fallbackResources(), 
                           topLevelShellWidgetClass, NULL, 0); 
   
   switch (Opt->b1) {
      case 1:
         /* apply some escape characters     31 Jul 2009 [rickr] */
         esc_str = unescape_unix_str(Opt->in_name);
         ii = SUMA_PauseForUser(w, esc_str, SWP_POINTER_LEFT_BOTTOM, &app, 1);
         fprintf(SUMA_STDOUT,"%d\n", ii);
         break;
      default:
         SUMA_S_Err("Bad opt");
         exit(1);
         
   }
   
   /* because you have no XtAppMainLoop, you'll need to process the next 
   event for the XtDestroy command on w's child takes effect. So you'll
   just have this zombie widget that stares at you.
   In this simple command line program, the widget dies anyway when you
   exit the program, so the call below is a teaching moment for when
   functions like SUMA_PauseForUser are called from programs without an
   XtAppMainLoop. 
   See also SUMA_PAUSE_PROMPT macro */
   
   while ((pp = XtAppPending(app))) {  \
      XtAppProcessEvent(app, pp); \
   } 
   
   if (Opt->debug > 2) LocalHead = YUP;
   if (ps) SUMA_FreeGenericArgParse(ps); ps = NULL;
   if (Opt) Opt = SUMA_Free_Generic_Prog_Options_Struct(Opt);
   if (!SUMA_Free_CommonFields(SUMAg_CF)) 
      SUMA_error_message(FuncName,"SUMAg_CF Cleanup Failed!",1);

   if( esc_str ) free(esc_str);
   
   exit(0);
   
} 
Пример #30
0
ENTRYPOINT void
draw_fliptext (ModeInfo *mi)
{
  fliptext_configuration *sc = &scs[MI_SCREEN(mi)];
/*  XtAppContext app = XtDisplayToApplicationContext (sc->dpy);*/
  Display *dpy = MI_DISPLAY(mi);
  Window window = MI_WINDOW(mi);
  int i;

  if (!sc->glx_context)
    return;

  glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(sc->glx_context));

#if 0
  if (XtAppPending (app) & (XtIMTimer|XtIMAlternateInput))
    XtAppProcessEvent (app, XtIMTimer|XtIMAlternateInput);
#endif

  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  mi->polygon_count = 0;

  glPushMatrix();
  glRotatef(current_device_rotation(), 0, 0, 1);
  {
    GLfloat s = 3.0 / (sc->top_margin - sc->bottom_margin);
    glScalef(s, s, s);
  }

  glRotatef (sc->rotation.x, 1, 0, 0);
  glRotatef (sc->rotation.y, 0, 1, 0);
  glRotatef (sc->rotation.z, 0, 0, 1);

#if 0
  glDisable (GL_TEXTURE_2D);
  glColor3f (1,1,1);
  glBegin (GL_LINE_LOOP);
  glVertex3f (sc->left_margin,  sc->top_margin, 0);
  glVertex3f (sc->right_margin, sc->top_margin, 0);
  glVertex3f (sc->right_margin, sc->bottom_margin, 0);
  glVertex3f (sc->left_margin,  sc->bottom_margin, 0);
  glEnd();
  glBegin (GL_LINES);
  glVertex3f (sc->in.x,  sc->top_margin,    sc->in.z);
  glVertex3f (sc->in.x,  sc->bottom_margin, sc->in.z);
  glVertex3f (sc->mid.x, sc->top_margin,    sc->mid.z);
  glVertex3f (sc->mid.x, sc->bottom_margin, sc->mid.z);
  glVertex3f (sc->out.x, sc->top_margin,    sc->out.z);
  glVertex3f (sc->out.x, sc->bottom_margin, sc->out.z);
  glEnd();
  glEnable (GL_TEXTURE_2D);
#endif

  for (i = 0; i < sc->nlines; i++)
    {
      line *line = sc->lines[i];
      draw_line (mi, line);
      tick_line (sc, line);
    }

  for (i = sc->nlines-1; i >= 0; i--)
    {
      line *line = sc->lines[i];
      if (line->state == DEAD)
        free_line (sc, line);
    }

  if (sc->nlines == 0)
    reset_lines (mi);

  glPopMatrix();

  if (mi->fps_p) do_fps (mi);
  glFinish();
  glXSwapBuffers(dpy, window);
}