File:  [local] / rpl / modules / motif / XtAppMainLoop.rplc
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Wed Jul 5 13:53:39 2017 UTC (7 years, 10 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Premiers bouts de code pour la bibliothèque d'interface Xm.

    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:             if (subType(appObject) ne APPCONTEXT) then
   19:                 executionError("Type mismatch");
   20:                 returnOnError(freeObject(appObject));
   21:             endIf
   22: 
   23:             doUntil
   24:                 if (XtAppPending(target((sXtAppContext *)
   25:                         objectContainer(appObject)).context) ne 0) then
   26:                     XtAppNextEvent(target((sXtAppContext *)
   27:                             objectContainer(appObject)).context, &event);
   28: 
   29:                     if (event.type eq DestroyNotify) then
   30:                         if (event.xdestroywindow.window eq
   31:                                 XtWindow(target((sXtAppContext *)
   32:                                 objectContainer(appObject)).widget)) then
   33:                             XtAppSetExitFlag(target((sXtAppContext *)
   34:                                     objectContainer(appObject)).context);
   35:                         endIf
   36:                     endIf
   37: 
   38:                     XtDispatchEvent(&event);
   39:                 orElse
   40:                     pollSignalsAndInterrupts();
   41:                     usleep(10000);
   42:                 endIf
   43:             repeatUntil(XtAppGetExitFlag(target((sXtAppContext *)
   44:                     objectContainer(appObject)).context) or
   45:                     (stopRequest eq -1) or
   46:                     (exitMainLoop ne 0))
   47: 
   48:             XtDestroyApplicationContext(target((sXtAppContext *)
   49:                     objectContainer(appObject)).context);
   50:         orElse
   51:             executionError("Application not initialized");
   52:             returnOnError();
   53:         endIf
   54: 
   55:         setFalse(initializationDone);
   56:     END
   57: endExternalFunction

CVSweb interface <joel.bertrand@systella.fr>