diff options
author | Paul Rouget <me@paulrouget.com> | 2019-08-20 07:28:00 +0200 |
---|---|---|
committer | Paul Rouget <me@paulrouget.com> | 2019-08-21 11:03:19 +0200 |
commit | 5c1d130217db8ece7313d69a7e76130085d67e94 (patch) | |
tree | 292ed26562dca3f9198abdd78df4082dedf5fc33 /support/hololens/ServoApp/ServoControl/Servo.cpp | |
parent | 5f89dc87bd26ddb62931251edf7c76c782b96a94 (diff) | |
download | servo-5c1d130217db8ece7313d69a7e76130085d67e94.tar.gz servo-5c1d130217db8ece7313d69a7e76130085d67e94.zip |
Handle servo:// url
Diffstat (limited to 'support/hololens/ServoApp/ServoControl/Servo.cpp')
-rw-r--r-- | support/hololens/ServoApp/ServoControl/Servo.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/support/hololens/ServoApp/ServoControl/Servo.cpp b/support/hololens/ServoApp/ServoControl/Servo.cpp index 84077811c96..efd59e44ab6 100644 --- a/support/hololens/ServoApp/ServoControl/Servo.cpp +++ b/support/hololens/ServoApp/ServoControl/Servo.cpp @@ -32,12 +32,13 @@ void on_panic(const char *backtrace) { throw hresult_error(E_FAIL, char2hstring(backtrace)); } -Servo::Servo(GLsizei width, GLsizei height, ServoDelegate &aDelegate) +Servo::Servo(hstring url, GLsizei width, GLsizei height, + ServoDelegate &aDelegate) : mWindowHeight(height), mWindowWidth(width), mDelegate(aDelegate) { capi::CInitOptions o; o.args = "--pref dom.webxr.enabled"; - o.url = "https://servo.org"; + o.url = *hstring2char(url); o.width = mWindowWidth; o.height = mWindowHeight; o.density = 1.0; @@ -78,4 +79,13 @@ winrt::hstring char2hstring(const char *c_str) { return str3; } +std::unique_ptr<char *> hstring2char(hstring hstr) { + const wchar_t *wc = hstr.c_str(); + size_t size = hstr.size() + 1; + char *str = new char[size]; + size_t converted = 0; + wcstombs_s(&converted, str, size, wc, hstr.size()); + return std::make_unique<char*>(str); +} + } // namespace winrt::servo |