Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
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 175 of file direct_manipulation.cc.

176 : window_(window) {}
GLFWwindow * window
Definition: main.cc:45

◆ ~DirectManipulationOwner()

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

Member Function Documentation

◆ Destroy()

void flutter::DirectManipulationOwner::Destroy ( )

Definition at line 215 of file direct_manipulation.cc.

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

◆ Init()

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

Definition at line 178 of file direct_manipulation.cc.

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

◆ ResizeViewport()

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

Definition at line 207 of file direct_manipulation.cc.

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

◆ SetBindingHandlerDelegate()

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

Definition at line 244 of file direct_manipulation.cc.

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

◆ SetContact()

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

Definition at line 238 of file direct_manipulation.cc.

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

◆ Update()

void flutter::DirectManipulationOwner::Update ( )

Definition at line 249 of file direct_manipulation.cc.

249 {
250 if (updateManager_) {
251 HRESULT hr = updateManager_->Update(nullptr);
252 if (FAILED(hr)) {
253 FML_LOG(ERROR) << "updateManager_->Update failed";
254 auto error = GetLastError();
255 FML_LOG(ERROR) << error;
256 LPWSTR message = nullptr;
257 size_t size = FormatMessageW(
258 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
259 FORMAT_MESSAGE_IGNORE_INSERTS,
260 NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
261 reinterpret_cast<LPWSTR>(&message), 0, NULL);
263 }
264 }
265}
const uint8_t uint32_t uint32_t GError ** error
#define FML_LOG(severity)
Definition: logging.h:82
Win32Message message
it will be possible to load the file into Perfetto s trace viewer 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
Definition: switches.h:259
#define ERROR(message)
Definition: elf_loader.cc:260
WINBASEAPI _Check_return_ _Post_equals_last_error_ DWORD WINAPI GetLastError(VOID)
#define FAILED(hr)

Member Data Documentation

◆ binding_handler_delegate

WindowBindingHandlerDelegate* flutter::DirectManipulationOwner::binding_handler_delegate

Definition at line 46 of file direct_manipulation.h.


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