Flutter Engine
 
Loading...
Searching...
No Matches
flutter::DirectManipulationOwner Class Reference

#include <direct_manipulation.h>

Inheritance diagram for flutter::DirectManipulationOwner:
flutter::testing::MockDirectManipulationOwner

Public Member Functions

 DirectManipulationOwner (FlutterWindow *window)
 
virtual ~DirectManipulationOwner ()=default
 
int Init (unsigned int width, unsigned int height)
 
void ResizeViewport (unsigned int width, unsigned int height)
 
void SetBindingHandlerDelegate (WindowBindingHandlerDelegate *binding_handler_delegate)
 
virtual void SetContact (UINT contactId)
 
void Update ()
 
void Destroy ()
 

Public Attributes

WindowBindingHandlerDelegatebinding_handler_delegate
 

Detailed Description

Definition at line 22 of file direct_manipulation.h.

Constructor & Destructor Documentation

◆ DirectManipulationOwner()

flutter::DirectManipulationOwner::DirectManipulationOwner ( FlutterWindow window)
explicit

Definition at line 176 of file direct_manipulation.cc.

177 : window_(window) {}
GLFWwindow * window
Definition main.cc:60

◆ ~DirectManipulationOwner()

virtual flutter::DirectManipulationOwner::~DirectManipulationOwner ( )
virtualdefault

References Init().

Member Function Documentation

◆ Destroy()

void flutter::DirectManipulationOwner::Destroy ( )

Definition at line 216 of file direct_manipulation.cc.

216 {
217 if (handler_) {
218 handler_->owner_ = nullptr;
219 }
220
221 if (viewport_) {
222 WARN_IF_FAILED(viewport_->Disable());
223 WARN_IF_FAILED(viewport_->Disable());
224 WARN_IF_FAILED(viewport_->RemoveEventHandler(viewportHandlerCookie_));
225 WARN_IF_FAILED(viewport_->Abandon());
226 }
227
228 if (window_ && manager_) {
229 WARN_IF_FAILED(manager_->Deactivate(window_->GetWindowHandle()));
230 }
231
232 handler_ = nullptr;
233 viewport_ = nullptr;
234 updateManager_ = nullptr;
235 manager_ = nullptr;
236 window_ = nullptr;
237}
virtual HWND GetWindowHandle() override
#define WARN_IF_FAILED(operation)

References flutter::FlutterWindow::GetWindowHandle(), and WARN_IF_FAILED.

◆ Init()

int flutter::DirectManipulationOwner::Init ( unsigned int  width,
unsigned int  height 
)

Definition at line 179 of file direct_manipulation.cc.

179 {
180 RETURN_IF_FAILED(CoCreateInstance(CLSID_DirectManipulationManager, nullptr,
181 CLSCTX_INPROC_SERVER,
182 IID_IDirectManipulationManager, &manager_));
183 RETURN_IF_FAILED(manager_->GetUpdateManager(
184 IID_IDirectManipulationUpdateManager, &updateManager_));
185 RETURN_IF_FAILED(manager_->CreateViewport(nullptr, window_->GetWindowHandle(),
186 IID_IDirectManipulationViewport,
187 &viewport_));
188 DIRECTMANIPULATION_CONFIGURATION configuration =
189 DIRECTMANIPULATION_CONFIGURATION_INTERACTION |
190 DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_X |
191 DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_Y |
192 DIRECTMANIPULATION_CONFIGURATION_SCALING |
193 DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_INERTIA;
194 RETURN_IF_FAILED(viewport_->ActivateConfiguration(configuration));
195 RETURN_IF_FAILED(viewport_->SetViewportOptions(
196 DIRECTMANIPULATION_VIEWPORT_OPTIONS_MANUALUPDATE));
197 handler_ = fml::MakeRefCounted<DirectManipulationEventHandler>(this);
198 RETURN_IF_FAILED(viewport_->AddEventHandler(
199 window_->GetWindowHandle(), handler_.get(), &viewportHandlerCookie_));
200 RECT rect = {0, 0, (LONG)width, (LONG)height};
201 RETURN_IF_FAILED(viewport_->SetViewportRect(&rect));
202 RETURN_IF_FAILED(manager_->Activate(window_->GetWindowHandle()));
203 RETURN_IF_FAILED(viewport_->Enable());
204 RETURN_IF_FAILED(updateManager_->Update(nullptr));
205 return 0;
206}
#define RETURN_IF_FAILED(operation)
int32_t height
int32_t width
long LONG

References flutter::FlutterWindow::GetWindowHandle(), height, RETURN_IF_FAILED, and width.

Referenced by ~DirectManipulationOwner().

◆ ResizeViewport()

void flutter::DirectManipulationOwner::ResizeViewport ( unsigned int  width,
unsigned int  height 
)

Definition at line 208 of file direct_manipulation.cc.

209 {
210 if (viewport_) {
211 RECT rect = {0, 0, (LONG)width, (LONG)height};
212 WARN_IF_FAILED(viewport_->SetViewportRect(&rect));
213 }
214}

References height, WARN_IF_FAILED, and width.

◆ SetBindingHandlerDelegate()

void flutter::DirectManipulationOwner::SetBindingHandlerDelegate ( WindowBindingHandlerDelegate binding_handler_delegate)

Definition at line 245 of file direct_manipulation.cc.

246 {
247 binding_handler_delegate = delegate;
248}
WindowBindingHandlerDelegate * binding_handler_delegate

References binding_handler_delegate.

◆ SetContact()

void flutter::DirectManipulationOwner::SetContact ( UINT  contactId)
virtual

Definition at line 239 of file direct_manipulation.cc.

239 {
240 if (viewport_) {
241 viewport_->SetContact(contactId);
242 }
243}

◆ Update()

void flutter::DirectManipulationOwner::Update ( )

Definition at line 250 of file direct_manipulation.cc.

250 {
251 if (updateManager_) {
252 HRESULT hr = updateManager_->Update(nullptr);
253 if (FAILED(hr)) {
254 FML_LOG(ERROR) << "updateManager_->Update failed";
255 auto error = GetLastError();
256 FML_LOG(ERROR) << error;
257 LPWSTR message = nullptr;
258 size_t size = FormatMessageW(
259 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
260 FORMAT_MESSAGE_IGNORE_INSERTS,
261 NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
262 reinterpret_cast<LPWSTR>(&message), 0, NULL);
264 }
265 }
266}
G_BEGIN_DECLS GBytes * message
const uint8_t uint32_t uint32_t GError ** error
#define FML_LOG(severity)
Definition logging.h:101
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
std::string WCharBufferToString(const wchar_t *wstr)
Convert a null terminated wchar_t buffer to a std::string using Windows utilities.
Definition wchar_util.cc:11
WINBASEAPI _Check_return_ _Post_equals_last_error_ DWORD WINAPI GetLastError(VOID)
#define FAILED(hr)

References error, FAILED, FML_LOG, GetLastError(), message, flutter::size, and flutter::WCharBufferToString().

Member Data Documentation

◆ binding_handler_delegate


The documentation for this class was generated from the following files: