Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
window_proc_delegate_manager.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/shell/platform/windows/window_proc_delegate_manager.h"
6
7#include <algorithm>
8
9#include "flutter/shell/platform/embedder/embedder.h"
10
11namespace flutter {
12
15
26
29 delegates_.erase(
30 std::remove_if(delegates_.begin(), delegates_.end(),
31 [&callback](const WindowProcDelegate& delegate) {
32 return delegate.callback == callback;
33 }),
34 delegates_.end());
35}
36
38 HWND hwnd,
40 WPARAM wparam,
41 LPARAM lparam) const {
42 std::optional<LRESULT> result;
43 for (const auto& delegate : delegates_) {
44 LPARAM handler_result;
45 // Stop as soon as any delegate indicates that it has handled the message.
46 if (delegate.callback(hwnd, message, wparam, lparam, delegate.user_data,
47 &handler_result)) {
48 result = handler_result;
49 break;
50 }
51 }
52 return result;
53}
54
55} // namespace flutter
std::optional< LRESULT > OnTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) const
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback)
void RegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback, void *user_data)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
GAsyncResult * result
bool(* FlutterDesktopWindowProcCallback)(HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)
Win32Message message
std::function< std::optional< LRESULT >(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)> WindowProcDelegate
unsigned int UINT
LONG_PTR LPARAM
UINT_PTR WPARAM