Skip to content

Commit

Permalink
Fire sessionavailable if in transient mode
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrouget committed Jul 23, 2020
1 parent 5f31dbf commit b42d441
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion support/hololens/ServoApp/ServoControl/Servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const char *prompt_input(const char *message, const char *default,

Servo::Servo(std::optional<hstring> initUrl, hstring args, GLsizei width,
GLsizei height, EGLNativeWindowType eglNativeWindow, float dpi,
ServoDelegate &aDelegate)
ServoDelegate &aDelegate, bool transient)
: mWindowHeight(height), mWindowWidth(width), mDelegate(aDelegate) {
ApplicationDataContainer localSettings =
ApplicationData::Current().LocalSettings();
Expand Down Expand Up @@ -192,6 +192,14 @@ Servo::Servo(std::optional<hstring> initUrl, hstring args, GLsizei width,
#endif
}

if (transient) {
capi::CPref cpref;
cpref.key = "dom.webxr.sessionavailable";
cpref.pref_type = capi::CPrefType::Bool;
cpref.value = &transient;
cprefs.push_back(cpref);
}

capi::CPrefList prefsList = {cprefs.size(), cprefs.data()};

capi::CInitOptions o;
Expand Down
2 changes: 1 addition & 1 deletion support/hololens/ServoApp/ServoControl/Servo.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ServoDelegate;
class Servo {
public:
Servo(std::optional<hstring>, hstring, GLsizei, GLsizei, EGLNativeWindowType,
float, ServoDelegate &);
float, ServoDelegate &, bool);
~Servo();
ServoDelegate &Delegate() { return mDelegate; }

Expand Down
2 changes: 1 addition & 1 deletion support/hololens/ServoApp/ServoControl/ServoControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ void ServoControl::Loop() {
ServoDelegate *sd = static_cast<ServoDelegate *>(this);
EGLNativeWindowType win = GetNativeWindow();
mServo = std::make_unique<Servo>(mInitUrl, mArgs, mPanelWidth, mPanelHeight,
win, mDPI, *sd);
win, mDPI, *sd, mTransient);
} else {
// FIXME: this will fail since create_task didn't pick the thread
// where Servo was running initially.
Expand Down

0 comments on commit b42d441

Please sign in to comment.