Annotation of rpl/modules/motif/XtAppMainLoop.rplc, revision 1.4
1.1 bertrand 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:
1.3 bertrand 18: ifIsExternal(appObject, APPCONTEXT) then
19: orElse
1.1 bertrand 20: executionError("Type mismatch");
21: returnOnError(freeObject(appObject));
22: endIf
23:
1.3 bertrand 24: intrinsic(pshcntxt);
25:
1.1 bertrand 26: doUntil
1.4 ! bertrand 27: if (XtAppPending(target(objectContainer(sXtAppContext,
! 28: appObject)).context) ne 0) then
! 29: XtAppNextEvent(target(objectContainer(sXtAppContext,
! 30: appObject)).context, &event);
1.1 bertrand 31:
32: if (event.type eq DestroyNotify) then
33: if (event.xdestroywindow.window eq
1.4 ! bertrand 34: XtWindow(target(objectContainer(sXtAppContext,
! 35: appObject)).widget)) then
! 36: XtAppSetExitFlag(target(objectContainer(
! 37: sXtAppContext, appObject)).context);
1.1 bertrand 38: endIf
39: endIf
40:
41: XtDispatchEvent(&event);
42: orElse
43: pollSignalsAndInterrupts();
44: usleep(10000);
45: endIf
1.4 ! bertrand 46: repeatUntil(XtAppGetExitFlag(target(
! 47: objectContainer(sXtAppContext, appObject)).context) or
1.1 bertrand 48: (stopRequest eq -1) or
49: (exitMainLoop ne 0))
50:
1.3 bertrand 51: intrinsic(pulcntxt);
52:
1.4 ! bertrand 53: XtDestroyApplicationContext(target(
! 54: objectContainer(sXtAppContext, appObject)).context);
1.1 bertrand 55: orElse
56: executionError("Application not initialized");
57: returnOnError();
58: endIf
59:
60: setFalse(initializationDone);
61: END
62: endExternalFunction
1.2 bertrand 63:
64: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>