Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ typedef enum _WstClient_status
WstClient_stoppedAbnormal,
WstClient_connected,
WstClient_disconnected
#ifdef WESTEROS_FIRST_FRAME_SUPPORTED
, WstClient_firstFrame
#endif //WESTEROS_FIRST_FRAME_SUPPORTED

} WstClient_status;

typedef enum _WstHints
Expand Down
5 changes: 5 additions & 0 deletions examples/pxScene2d/src/pxWayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,11 @@ void pxWayland::handleClientStatus( int status, int pid, int detail )
case WstClient_disconnected:
mEvents->clientDisconnected( pid );
break;
#ifdef WESTEROS_FIRST_FRAME_SUPPORTED
case WstClient_firstFrame:
mEvents->firstFrameRendered( pid );
break;
#endif //WESTEROS_FIRST_FRAME_SUPPORTED
default:
rtLogError("unexpected wayland client status type");
break;
Expand Down
1 change: 1 addition & 0 deletions examples/pxScene2d/src/pxWayland.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class pxWaylandEvents {
virtual void isReady( bool /*ready*/ ) {}
virtual void isRemoteReady( bool /*ready*/ ) {}
virtual void remoteDisconnected(void * /*data*/ ) {}
virtual void firstFrameRendered( int /*pid*/ ) {}
};

class pxWayland: public pxIView {
Expand Down
12 changes: 12 additions & 0 deletions examples/pxScene2d/src/pxWaylandContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pxWaylandContainer::pxWaylandContainer(pxScene2d* scene)
addListener("onClientStopped", get<rtFunctionRef>("onClientStopped"));
addListener("onClientConnected", get<rtFunctionRef>("onClientConnected"));
addListener("onClientDisconnected", get<rtFunctionRef>("onClientDisconnected"));
addListener("onFirstFrameRendered", get<rtFunctionRef>("onFirstFrameRendered"));
mRemoteReady = new rtPromise();
}

Expand Down Expand Up @@ -119,6 +120,17 @@ void pxWaylandContainer::clientDisconnected( int pid )
mEmit.send("onClientDisconnected", e);
}

void pxWaylandContainer::firstFrameRendered( int pid )
{
mClientPID= pid;

rtObjectRef e = new rtMapObject;
e.set("name", "onFirstFrameRendered");
e.set("target", this);
e.set("pid", pid );
mEmit.send("onFirstFrameRendered", e);
}

void pxWaylandContainer::clientStoppedNormal( int pid, int exitCode )
{
mClientPID= -1;
Expand Down
1 change: 1 addition & 0 deletions examples/pxScene2d/src/pxWaylandContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class pxWaylandContainer: public pxViewContainer, pxWaylandEvents {
virtual void isRemoteReady(bool ready);
virtual void remoteDisconnected(void * data);
virtual void sendPromise();
virtual void firstFrameRendered( int pid );

rtError displayName(rtString& s) const;
rtError setDisplayName(const char* s);
Expand Down
24 changes: 24 additions & 0 deletions examples/pxScene2d/src/rcvrcore/optimus.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,10 @@ function Application(props) {
_externalApp.on("onClientConnected", function () { _this.log("onClientConnected"); }); // is never called
_externalApp.on("onClientDisconnected", function () { _this.log("onClientDisconnected"); }); // is never called
_externalApp.on("onClientStopped", function () { _this.log( "onClientStopped"); }); // is never called
_externalApp.on("onFirstFrameRendered", function () {
_this.log( "onFirstFrameRendered");
_this.applicationFirstFrameRendered();
}); // is never called
_externalApp.ready.then(function() {
_this.log("successfully created Spark app: " + _this.id);
_readyBaseResolve();
Expand Down Expand Up @@ -695,6 +699,10 @@ function Application(props) {
_externalApp.on("onClientStarted", function () { _this.log("onClientStarted"); });
_externalApp.on("onClientConnected", function () { _this.log("onClientConnected"); });
_externalApp.on("onClientDisconnected", function () { _this.log("onClientDisconnected"); }); // called on client crash
_externalApp.on("onFirstFrameRendered", function () {
_this.log( "onFirstFrameRendered");
_this.applicationFirstFrameRendered();
});
_externalApp.on("onClientStopped", function () { // called on client crash
_this.log("onClientStopped");
setTimeout(function () {
Expand Down Expand Up @@ -739,6 +747,10 @@ function Application(props) {
_externalApp.on("onClientConnected", function () { _this.log("onClientConnected"); });
_externalApp.on("onClientDisconnected", function () { _this.log("onClientDisconnected"); });
_externalApp.on("onClientStopped", function () { _this.log("onClientStopped"); });
_externalApp.on("onFirstFrameRendered", function () {
_this.log( "onFirstFrameRendered");
_this.applicationFirstFrameRendered();
});
_externalApp.remoteReady.then(function(obj) {
if(obj) {
_this.log("about to create browser window");
Expand Down Expand Up @@ -803,6 +815,10 @@ function Application(props) {
_externalApp.on("onClientStarted", function () { _this.log("onClientStarted"); });
_externalApp.on("onClientConnected", function () { _this.log("onClientConnected"); });
_externalApp.on("onClientDisconnected", function () { _this.log("onClientDisconnected"); }); // called on client crash
_externalApp.on("onFirstFrameRendered", function () {
_this.log( "onFirstFrameRendered");
_this.applicationFirstFrameRendered();
});
_externalApp.on("onClientStopped", function () { // called on client crash
_this.log("onClientStopped");
setTimeout(function () {
Expand Down Expand Up @@ -905,6 +921,10 @@ Application.prototype.applicationDestroyed = function(){
this.log("applicationDestroyed");
appManager.onDestroy(this);
};
Application.prototype.applicationFirstFrameRendered = function(){
this.log("applicationFirstFrameRendered");
appManager.onFirstFrameRendered(this);
};

function Optimus() {

Expand Down Expand Up @@ -1011,6 +1031,10 @@ function Optimus() {
this.onReady = function(app){
notifyListeners("ready",app);
};
this.onFirstFrameRendered = function(app){
notifyListeners("firstFrameRendered",app);
};

this.setScene = function(s){
scene = s;
// remove reference to scene by passing null
Expand Down