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/ServoControl.cpp | |
parent | 5f89dc87bd26ddb62931251edf7c76c782b96a94 (diff) | |
download | servo-5c1d130217db8ece7313d69a7e76130085d67e94.tar.gz servo-5c1d130217db8ece7313d69a7e76130085d67e94.zip |
Handle servo:// url
Diffstat (limited to 'support/hololens/ServoApp/ServoControl/ServoControl.cpp')
-rw-r--r-- | support/hololens/ServoApp/ServoControl/ServoControl.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/support/hololens/ServoApp/ServoControl/ServoControl.cpp b/support/hololens/ServoApp/ServoControl/ServoControl.cpp index bc2823d37af..9de129c1e4e 100644 --- a/support/hololens/ServoApp/ServoControl/ServoControl.cpp +++ b/support/hololens/ServoApp/ServoControl/ServoControl.cpp @@ -44,8 +44,7 @@ void ServoControl::OnLoaded(IInspectable const &, RoutedEventArgs const &) { Controls::SwapChainPanel ServoControl::Panel() { // FIXME: is there a better way of doing this? - return GetTemplateChild(L"swapChainPanel") - .as<Controls::SwapChainPanel>(); + return GetTemplateChild(L"swapChainPanel").as<Controls::SwapChainPanel>(); } void ServoControl::CreateRenderSurface() { @@ -105,12 +104,17 @@ Uri ServoControl::LoadURIOrSearch(hstring input) { hstring input2 = L"https://" + input; uri = TryParseURI(input2); if (uri == std::nullopt || !has_dot) { - hstring input3 = L"https://duckduckgo.com/html/?q=" + Uri::EscapeComponent(input); + hstring input3 = + L"https://duckduckgo.com/html/?q=" + Uri::EscapeComponent(input); uri = TryParseURI(input3); } } auto finalUri = uri.value(); - RunOnGLThread([=] { mServo->LoadUri(finalUri.ToString()); }); + if (!mLooping) { + mInitialURL = finalUri.ToString(); + } else { + RunOnGLThread([=] { mServo->LoadUri(finalUri.ToString()); }); + } return finalUri; } @@ -136,7 +140,7 @@ void ServoControl::Loop() { if (mServo == nullptr) { log("Entering loop"); ServoDelegate *sd = static_cast<ServoDelegate *>(this); - mServo = std::make_unique<Servo>(panelWidth, panelHeight, *sd); + mServo = std::make_unique<Servo>(mInitialURL, panelWidth, panelHeight, *sd); } else { // FIXME: this will fail since create_task didn't pick the thread // where Servo was running initially. |