Fire sessionavailable if in transient mode

This commit is contained in:
Paul Rouget 2020-07-20 12:05:55 +02:00
parent 5f31dbf993
commit b42d441732
3 changed files with 11 additions and 3 deletions

View file

@ -136,7 +136,7 @@ const char *prompt_input(const char *message, const char *default,
Servo::Servo(std::optional<hstring> initUrl, hstring args, GLsizei width, Servo::Servo(std::optional<hstring> initUrl, hstring args, GLsizei width,
GLsizei height, EGLNativeWindowType eglNativeWindow, float dpi, GLsizei height, EGLNativeWindowType eglNativeWindow, float dpi,
ServoDelegate &aDelegate) ServoDelegate &aDelegate, bool transient)
: mWindowHeight(height), mWindowWidth(width), mDelegate(aDelegate) { : mWindowHeight(height), mWindowWidth(width), mDelegate(aDelegate) {
ApplicationDataContainer localSettings = ApplicationDataContainer localSettings =
ApplicationData::Current().LocalSettings(); ApplicationData::Current().LocalSettings();
@ -192,6 +192,14 @@ Servo::Servo(std::optional<hstring> initUrl, hstring args, GLsizei width,
#endif #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::CPrefList prefsList = {cprefs.size(), cprefs.data()};
capi::CInitOptions o; capi::CInitOptions o;

View file

@ -28,7 +28,7 @@ class ServoDelegate;
class Servo { class Servo {
public: public:
Servo(std::optional<hstring>, hstring, GLsizei, GLsizei, EGLNativeWindowType, Servo(std::optional<hstring>, hstring, GLsizei, GLsizei, EGLNativeWindowType,
float, ServoDelegate &); float, ServoDelegate &, bool);
~Servo(); ~Servo();
ServoDelegate &Delegate() { return mDelegate; } ServoDelegate &Delegate() { return mDelegate; }

View file

@ -407,7 +407,7 @@ void ServoControl::Loop() {
ServoDelegate *sd = static_cast<ServoDelegate *>(this); ServoDelegate *sd = static_cast<ServoDelegate *>(this);
EGLNativeWindowType win = GetNativeWindow(); EGLNativeWindowType win = GetNativeWindow();
mServo = std::make_unique<Servo>(mInitUrl, mArgs, mPanelWidth, mPanelHeight, mServo = std::make_unique<Servo>(mInitUrl, mArgs, mPanelWidth, mPanelHeight,
win, mDPI, *sd); win, mDPI, *sd, mTransient);
} else { } else {
// FIXME: this will fail since create_task didn't pick the thread // FIXME: this will fail since create_task didn't pick the thread
// where Servo was running initially. // where Servo was running initially.