aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-08-23 01:06:45 -0400
committerGitHub <noreply@github.com>2019-08-23 01:06:45 -0400
commit5bf00c07c2e22e05ba9643a94290b4affbc9b4be (patch)
tree3c10e82b23aa4ed25b41d5598d4474aec507e5dd
parent8672ab54471c45351ea7fa71e3d8a095ffcd74f3 (diff)
parentaaefaee5dc93bd0aa0c21e3d717e178b0145142b (diff)
downloadservo-5bf00c07c2e22e05ba9643a94290b4affbc9b4be.tar.gz
servo-5bf00c07c2e22e05ba9643a94290b4affbc9b4be.zip
Auto merge of #24013 - paulrouget:gestureCapture, r=jdm
[hololens] Gesture capture I can't reproduce #24010 but I think this should fix it. Fix #24010 Depends on #24008 <!-- 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/24013) <!-- Reviewable:end -->
-rw-r--r--support/hololens/ServoApp/BrowserPage.cpp6
-rw-r--r--support/hololens/ServoApp/BrowserPage.xaml2
-rw-r--r--support/hololens/ServoApp/ServoControl/ServoControl.cpp17
-rw-r--r--support/hololens/ServoApp/ServoControl/ServoControl.h54
-rw-r--r--support/hololens/ServoApp/ServoControl/ServoControl.idl8
5 files changed, 68 insertions, 19 deletions
diff --git a/support/hololens/ServoApp/BrowserPage.cpp b/support/hololens/ServoApp/BrowserPage.cpp
index 0db7a055cec..617ef66e27d 100644
--- a/support/hololens/ServoApp/BrowserPage.cpp
+++ b/support/hololens/ServoApp/BrowserPage.cpp
@@ -35,6 +35,12 @@ void BrowserPage::BindServoEvents() {
reloadButton().IsEnabled(true);
stopButton().IsEnabled(false);
});
+ servoControl().OnCaptureGesturesStarted([=] {
+ servoControl().Focus(FocusState::Programmatic);
+ navigationBar().IsHitTestVisible(false);
+ });
+ servoControl().OnCaptureGesturesEnded(
+ [=] { navigationBar().IsHitTestVisible(true); });
}
void BrowserPage::LoadServoURI(Uri uri) {
diff --git a/support/hololens/ServoApp/BrowserPage.xaml b/support/hololens/ServoApp/BrowserPage.xaml
index 5a99683e95d..50f5c7972ab 100644
--- a/support/hololens/ServoApp/BrowserPage.xaml
+++ b/support/hololens/ServoApp/BrowserPage.xaml
@@ -13,7 +13,7 @@
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
- <Grid Grid.Row="0">
+ <Grid Grid.Row="0" x:Name="navigationBar">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
diff --git a/support/hololens/ServoApp/ServoControl/ServoControl.cpp b/support/hololens/ServoApp/ServoControl/ServoControl.cpp
index d0fcde7681f..4c01dac15f8 100644
--- a/support/hololens/ServoApp/ServoControl/ServoControl.cpp
+++ b/support/hololens/ServoApp/ServoControl/ServoControl.cpp
@@ -32,9 +32,22 @@ void ServoControl::Shutdown() {
}
void ServoControl::OnLoaded(IInspectable const &, RoutedEventArgs const &) {
- Panel().PointerReleased(
+ auto panel = Panel();
+ panel.PointerReleased(
std::bind(&ServoControl::OnSurfaceClicked, this, _1, _2));
- Panel().ManipulationDelta(
+ panel.ManipulationStarted(
+ [=](IInspectable const &,
+ Input::ManipulationStartedRoutedEventArgs const &e) {
+ mOnCaptureGesturesStartedEvent();
+ e.Handled(true);
+ });
+ panel.ManipulationCompleted(
+ [=](IInspectable const &,
+ Input::ManipulationCompletedRoutedEventArgs const &e) {
+ mOnCaptureGesturesEndedEvent();
+ e.Handled(true);
+ });
+ panel.ManipulationDelta(
std::bind(&ServoControl::OnSurfaceManipulationDelta, this, _1, _2));
InitializeConditionVariable(&mGLCondVar);
InitializeCriticalSection(&mGLLock);
diff --git a/support/hololens/ServoApp/ServoControl/ServoControl.h b/support/hololens/ServoApp/ServoControl/ServoControl.h
index f8159ca8d6c..5d571830490 100644
--- a/support/hololens/ServoApp/ServoControl/ServoControl.h
+++ b/support/hololens/ServoApp/ServoControl/ServoControl.h
@@ -15,34 +15,59 @@ struct ServoControl : ServoControlT<ServoControl>, public servo::ServoDelegate {
void Shutdown();
Windows::Foundation::Uri LoadURIOrSearch(hstring);
- void OnLoaded(IInspectable const &, Windows::UI::Xaml::RoutedEventArgs const &);
+ void OnLoaded(IInspectable const &,
+ Windows::UI::Xaml::RoutedEventArgs const &);
winrt::event_token
- OnURLChanged(Windows::Foundation::EventHandler<hstring> const &handler){
+ OnURLChanged(Windows::Foundation::EventHandler<hstring> const &handler) {
return mOnURLChangedEvent.add(handler);
};
- void OnURLChanged(winrt::event_token const& token) noexcept { mOnURLChangedEvent.remove(token); }
+ void OnURLChanged(winrt::event_token const &token) noexcept {
+ mOnURLChangedEvent.remove(token);
+ }
winrt::event_token
- OnTitleChanged(Windows::Foundation::EventHandler<hstring> const &handler){
+ OnTitleChanged(Windows::Foundation::EventHandler<hstring> const &handler) {
return mOnTitleChangedEvent.add(handler);
};
- void OnTitleChanged(winrt::event_token const& token) noexcept { mOnTitleChangedEvent.remove(token); }
+ void OnTitleChanged(winrt::event_token const &token) noexcept {
+ mOnTitleChangedEvent.remove(token);
+ }
- winrt::event_token OnHistoryChanged(HistoryChangedDelegate const &handler){
+ winrt::event_token OnHistoryChanged(HistoryChangedDelegate const &handler) {
return mOnHistoryChangedEvent.add(handler);
};
- void OnHistoryChanged(winrt::event_token const& token) noexcept { mOnHistoryChangedEvent.remove(token); }
+ void OnHistoryChanged(winrt::event_token const &token) noexcept {
+ mOnHistoryChangedEvent.remove(token);
+ }
- winrt::event_token OnLoadStarted(LoadStatusChangedDelegate const &handler){
+ winrt::event_token OnLoadStarted(EventDelegate const &handler) {
return mOnLoadStartedEvent.add(handler);
};
- void OnLoadStarted(winrt::event_token const& token) noexcept { mOnLoadStartedEvent.remove(token); }
+ void OnLoadStarted(winrt::event_token const &token) noexcept {
+ mOnLoadStartedEvent.remove(token);
+ }
- winrt::event_token OnLoadEnded(LoadStatusChangedDelegate const &handler){
+ winrt::event_token OnLoadEnded(EventDelegate const &handler) {
return mOnLoadEndedEvent.add(handler);
};
- void OnLoadEnded(winrt::event_token const& token) noexcept { mOnLoadEndedEvent.remove(token); }
+ void OnLoadEnded(winrt::event_token const &token) noexcept {
+ mOnLoadEndedEvent.remove(token);
+ }
+
+ winrt::event_token OnCaptureGesturesStarted(EventDelegate const &handler) {
+ return mOnCaptureGesturesStartedEvent.add(handler);
+ };
+ void OnCaptureGesturesStarted(winrt::event_token const &token) noexcept {
+ mOnCaptureGesturesStartedEvent.remove(token);
+ }
+
+ winrt::event_token OnCaptureGesturesEnded(EventDelegate const &handler) {
+ return mOnCaptureGesturesEndedEvent.add(handler);
+ };
+ void OnCaptureGesturesEnded(winrt::event_token const &token) noexcept {
+ mOnCaptureGesturesEndedEvent.remove(token);
+ }
virtual void WakeUp();
virtual void OnServoLoadStarted();
@@ -62,8 +87,11 @@ private:
winrt::event<Windows::Foundation::EventHandler<hstring>> mOnURLChangedEvent;
winrt::event<Windows::Foundation::EventHandler<hstring>> mOnTitleChangedEvent;
winrt::event<HistoryChangedDelegate> mOnHistoryChangedEvent;
- winrt::event<LoadStatusChangedDelegate> mOnLoadStartedEvent;
- winrt::event<LoadStatusChangedDelegate> mOnLoadEndedEvent;
+ winrt::event<EventDelegate> mOnLoadStartedEvent;
+ winrt::event<EventDelegate> mOnLoadEndedEvent;
+ winrt::event<EventDelegate> mOnCaptureGesturesStartedEvent;
+ winrt::event<EventDelegate> mOnCaptureGesturesEndedEvent;
+
hstring mInitialURL = L"https://servo.org";
Windows::UI::Xaml::Controls::SwapChainPanel ServoControl::Panel();
diff --git a/support/hololens/ServoApp/ServoControl/ServoControl.idl b/support/hololens/ServoApp/ServoControl/ServoControl.idl
index dcdc9e051f3..f392b1fcbf8 100644
--- a/support/hololens/ServoApp/ServoControl/ServoControl.idl
+++ b/support/hololens/ServoApp/ServoControl/ServoControl.idl
@@ -1,6 +1,6 @@
namespace ServoApp {
- delegate void LoadStatusChangedDelegate();
+ delegate void EventDelegate();
delegate void HistoryChangedDelegate(Boolean back, Boolean forward);
runtimeclass ServoControl : Windows.UI.Xaml.Controls.Control {
@@ -11,8 +11,10 @@ namespace ServoApp {
void Stop();
Windows.Foundation.Uri LoadURIOrSearch(String url);
void Shutdown();
- event LoadStatusChangedDelegate OnLoadStarted;
- event LoadStatusChangedDelegate OnLoadEnded;
+ event EventDelegate OnLoadStarted;
+ event EventDelegate OnLoadEnded;
+ event EventDelegate OnCaptureGesturesStarted;
+ event EventDelegate OnCaptureGesturesEnded;
event HistoryChangedDelegate OnHistoryChanged;
event Windows.Foundation.EventHandler<String> OnTitleChanged;
event Windows.Foundation.EventHandler<String> OnURLChanged;