Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resize support #24030

Merged
merged 2 commits into from Aug 23, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Resize Servo on surface resize

  • Loading branch information
paulrouget committed Aug 23, 2019
commit b2c56940ebe4ac5ec8875616ec7bd07765cd4be8
@@ -51,6 +51,8 @@ void ServoControl::OnLoaded(IInspectable const &, RoutedEventArgs const &) {
});
panel.ManipulationDelta(
std::bind(&ServoControl::OnSurfaceManipulationDelta, this, _1, _2));
Panel().SizeChanged(
std::bind(&ServoControl::OnSurfaceResized, this, _1, _2));
InitializeConditionVariable(&mGLCondVar);
InitializeCriticalSection(&mGLLock);
CreateRenderSurface();
@@ -100,6 +102,14 @@ void ServoControl::OnSurfaceClicked(IInspectable const &,
e.Handled(true);
}

void ServoControl::OnSurfaceResized(IInspectable const &,
SizeChangedEventArgs const &e) {
auto size = e.NewSize();
auto w = size.Width * mDPI;
auto h = size.Height * mDPI;
RunOnGLThread([=] { mServo->SetSize(w, h); });
}

void ServoControl::GoBack() {
RunOnGLThread([=] { mServo->GoBack(); });
}
@@ -62,7 +62,7 @@ struct ServoControl : ServoControlT<ServoControl>, public servo::ServoDelegate {
mOnCaptureGesturesStartedEvent.remove(token);
}

winrt::event_token OnCaptureGesturesEnded(EventDelegate const &handler) {
winrt::event_token OnCaptureGesturesEnded(EventDelegate const &handler) {
return mOnCaptureGesturesEndedEvent.add(handler);
};
void OnCaptureGesturesEnded(winrt::event_token const &token) noexcept {
@@ -118,7 +118,10 @@ struct ServoControl : ServoControlT<ServoControl>, public servo::ServoDelegate {

void OnSurfaceManipulationDelta(
IInspectable const &,
Windows::UI::Xaml::Input::ManipulationDeltaRoutedEventArgs const &e);
Windows::UI::Xaml::Input::ManipulationDeltaRoutedEventArgs const &);

void OnSurfaceResized(IInspectable const &,
Windows::UI::Xaml::SizeChangedEventArgs const &);

template <typename Callable> void RunOnUIThread(Callable);
void RunOnGLThread(std::function<void()>);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.