mirror of
https://github.com/servo/servo.git
synced 2025-06-17 21:04:28 +00:00
Auto merge of #24095 - paulrouget:chromeless, r=jdm
Switch to chromeless mode when app opens from a servo:// link Fix #24077 There's an issue where, in chromeless mode, when clicking a link in Servo, Edge opens the link (as expected) but not in a new tab, in a new window. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24095) <!-- Reviewable:end -->
This commit is contained in:
commit
39bd45529d
7 changed files with 26 additions and 2 deletions
|
@ -71,7 +71,8 @@ void App::OnActivated(IActivatedEventArgs const &args) {
|
||||||
Frame rootFrame{nullptr};
|
Frame rootFrame{nullptr};
|
||||||
|
|
||||||
auto content = Window::Current().Content();
|
auto content = Window::Current().Content();
|
||||||
if (content == nullptr) {
|
bool isRunning = content != nullptr;
|
||||||
|
if (!isRunning) {
|
||||||
rootFrame = Frame();
|
rootFrame = Frame();
|
||||||
rootFrame.Navigate(xaml_typename<ServoApp::BrowserPage>());
|
rootFrame.Navigate(xaml_typename<ServoApp::BrowserPage>());
|
||||||
Window::Current().Content(rootFrame);
|
Window::Current().Content(rootFrame);
|
||||||
|
@ -81,6 +82,9 @@ void App::OnActivated(IActivatedEventArgs const &args) {
|
||||||
}
|
}
|
||||||
auto page = rootFrame.Content().try_as<BrowserPage>();
|
auto page = rootFrame.Content().try_as<BrowserPage>();
|
||||||
page->LoadServoURI(protocolActivatedEventArgs.Uri());
|
page->LoadServoURI(protocolActivatedEventArgs.Uri());
|
||||||
|
// If Servo was opened as a result of clicking on a servo:// URL,
|
||||||
|
// we activate transient mode.
|
||||||
|
page->SetTransientMode(!isRunning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,12 @@ void BrowserPage::LoadServoURI(Uri uri) {
|
||||||
servoControl().LoadURIOrSearch(raw2);
|
servoControl().LoadURIOrSearch(raw2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BrowserPage::SetTransientMode(bool transient) {
|
||||||
|
servoControl().SetTransientMode(transient);
|
||||||
|
navigationBar().Visibility(transient ? Visibility::Collapsed
|
||||||
|
: Visibility::Visible);
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserPage::Shutdown() { servoControl().Shutdown(); }
|
void BrowserPage::Shutdown() { servoControl().Shutdown(); }
|
||||||
|
|
||||||
/**** USER INTERACTIONS WITH UI ****/
|
/**** USER INTERACTIONS WITH UI ****/
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const &);
|
Windows::UI::Xaml::Input::KeyRoutedEventArgs const &);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void LoadServoURI(Windows::Foundation::Uri uri);
|
void LoadServoURI(Windows::Foundation::Uri uri);
|
||||||
|
void SetTransientMode(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void BindServoEvents();
|
void BindServoEvents();
|
||||||
|
|
|
@ -8,6 +8,7 @@ using namespace winrt::Windows::Graphics::Display;
|
||||||
using namespace winrt::Windows::UI::Xaml;
|
using namespace winrt::Windows::UI::Xaml;
|
||||||
using namespace winrt::Windows::UI::Core;
|
using namespace winrt::Windows::UI::Core;
|
||||||
using namespace winrt::Windows::Foundation;
|
using namespace winrt::Windows::Foundation;
|
||||||
|
using namespace winrt::Windows::System;
|
||||||
using namespace concurrency;
|
using namespace concurrency;
|
||||||
using namespace winrt::servo;
|
using namespace winrt::servo;
|
||||||
|
|
||||||
|
@ -270,7 +271,14 @@ void ServoControl::WakeUp() {
|
||||||
RunOnGLThread([=] {});
|
RunOnGLThread([=] {});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServoControl::OnServoAllowNavigation(hstring) { return true; }
|
bool ServoControl::OnServoAllowNavigation(hstring uri) {
|
||||||
|
if (mTransient) {
|
||||||
|
RunOnUIThread([=] {
|
||||||
|
Launcher::LaunchUriAsync(Uri{uri});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return !mTransient;
|
||||||
|
}
|
||||||
|
|
||||||
void ServoControl::OnServoAnimatingChanged(bool animating) {
|
void ServoControl::OnServoAnimatingChanged(bool animating) {
|
||||||
EnterCriticalSection(&mGLLock);
|
EnterCriticalSection(&mGLLock);
|
||||||
|
|
|
@ -69,6 +69,8 @@ struct ServoControl : ServoControlT<ServoControl>, public servo::ServoDelegate {
|
||||||
mOnCaptureGesturesEndedEvent.remove(token);
|
mOnCaptureGesturesEndedEvent.remove(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetTransientMode(bool transient) { mTransient = transient; }
|
||||||
|
|
||||||
virtual void WakeUp();
|
virtual void WakeUp();
|
||||||
virtual void OnServoLoadStarted();
|
virtual void OnServoLoadStarted();
|
||||||
virtual void OnServoLoadEnded();
|
virtual void OnServoLoadEnded();
|
||||||
|
@ -94,6 +96,7 @@ private:
|
||||||
|
|
||||||
float mDPI = 1;
|
float mDPI = 1;
|
||||||
hstring mInitialURL = L"https://servo.org";
|
hstring mInitialURL = L"https://servo.org";
|
||||||
|
bool mTransient = false;
|
||||||
|
|
||||||
Windows::UI::Xaml::Controls::SwapChainPanel ServoControl::Panel();
|
Windows::UI::Xaml::Controls::SwapChainPanel ServoControl::Panel();
|
||||||
void CreateRenderSurface();
|
void CreateRenderSurface();
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace ServoApp {
|
||||||
void Reload();
|
void Reload();
|
||||||
void Stop();
|
void Stop();
|
||||||
Windows.Foundation.Uri LoadURIOrSearch(String url);
|
Windows.Foundation.Uri LoadURIOrSearch(String url);
|
||||||
|
void SetTransientMode(Boolean transient);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
event EventDelegate OnLoadStarted;
|
event EventDelegate OnLoadStarted;
|
||||||
event EventDelegate OnLoadEnded;
|
event EventDelegate OnLoadEnded;
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <winrt/Windows.Perception.Spatial.h>
|
#include <winrt/Windows.Perception.Spatial.h>
|
||||||
#include <winrt/Windows.Storage.h>
|
#include <winrt/Windows.Storage.h>
|
||||||
#include <winrt/Windows.Storage.Streams.h>
|
#include <winrt/Windows.Storage.Streams.h>
|
||||||
|
#include <winrt/windows.system.h>
|
||||||
#include <winrt/Windows.UI.Core.h>
|
#include <winrt/Windows.UI.Core.h>
|
||||||
#include <winrt/Windows.UI.Input.Spatial.h>
|
#include <winrt/Windows.UI.Input.Spatial.h>
|
||||||
#include <winrt/Windows.UI.Popups.h>
|
#include <winrt/Windows.UI.Popups.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue