File:  [local] / rpl / modules / motif / XtAppMainLoop.rplc
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Mon Jul 17 21:35:32 2017 UTC (6 years, 10 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Ajout de XtRemoveCallback.rplc et correction de bogues.

    1: #include "src/rplexternals.h"
    2: #include "motif.h"
    3: 
    4: declareExternalFunction(XtAppMainLoop)
    5:     XEvent      event;
    6: 
    7:     declareObject(appObject);
    8: 
    9:     HEADER
   10:         declareHelpString("Main loop of a Motif application\n"
   11:                 "    1: AppContext\n");
   12:         numberOfArguments(1);
   13:     FUNCTION
   14:         if (initializationDone eq true) then
   15:             pullFromStack(appObject, external);
   16:             returnOnError(freeObject(appObject));
   17: 
   18:             ifIsExternal(appObject, APPCONTEXT) then
   19:             orElse
   20:                 executionError("Type mismatch");
   21:                 returnOnError(freeObject(appObject));
   22:             endIf
   23: 
   24:             intrinsic(pshcntxt);
   25: 
   26:             doUntil
   27:                 if (XtAppPending(target((sXtAppContext *)
   28:                         objectContainer(appObject)).context) ne 0) then
   29:                     XtAppNextEvent(target((sXtAppContext *)
   30:                             objectContainer(appObject)).context, &event);
   31: 
   32:                     if (event.type eq DestroyNotify) then
   33:                         if (event.xdestroywindow.window eq
   34:                                 XtWindow(target((sXtAppContext *)
   35:                                 objectContainer(appObject)).widget)) then
   36:                             XtAppSetExitFlag(target((sXtAppContext *)
   37:                                     objectContainer(appObject)).context);
   38:                         endIf
   39:                     endIf
   40: 
   41:                     XtDispatchEvent(&event);
   42:                 orElse
   43:                     pollSignalsAndInterrupts();
   44:                     usleep(10000);
   45:                 endIf
   46:             repeatUntil(XtAppGetExitFlag(target((sXtAppContext *)
   47:                     objectContainer(appObject)).context) or
   48:                     (stopRequest eq -1) or
   49:                     (exitMainLoop ne 0))
   50: 
   51:             intrinsic(pulcntxt);
   52: 
   53:             XtDestroyApplicationContext(target((sXtAppContext *)
   54:                     objectContainer(appObject)).context);
   55:         orElse
   56:             executionError("Application not initialized");
   57:             returnOnError();
   58:         endIf
   59: 
   60:         setFalse(initializationDone);
   61:     END
   62: endExternalFunction
   63: 
   64: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>