| Flutter Windows Embedder |

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 "flutter/shell/platform/embedder/embedder.h"
8
9 namespace flutter {
10
11 WindowProcDelegateManager::WindowProcDelegateManager() = default;
12 WindowProcDelegateManager::~WindowProcDelegateManager() = default;
13
14 void WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate(
15 FlutterDesktopWindowProcCallback delegate,
16 void* user_data) {
17 top_level_window_proc_handlers_[delegate] = user_data;
18 }
19
20 void WindowProcDelegateManager::UnregisterTopLevelWindowProcDelegate(
21 FlutterDesktopWindowProcCallback delegate) {
22 top_level_window_proc_handlers_.erase(delegate);
23 }
24
25 std::optional<LRESULT> WindowProcDelegateManager::OnTopLevelWindowProc(
26 HWND hwnd,
27 UINT message,
28 WPARAM wparam,
29 LPARAM lparam) {
30 std::optional<LRESULT> result;
31 for (const auto& [handler, user_data] : top_level_window_proc_handlers_) {
32 LPARAM handler_result;
33 // Stop as soon as any delegate indicates that it has handled the message.
34 if (handler(hwnd, message, wparam, lparam, user_data, &handler_result)) {
35 result = handler_result;
36 break;
37 }
38 }
39 return result;
40 }
41
42 } // namespace flutter
window_proc_delegate_manager.h
flutter::WindowProcDelegateManager::WindowProcDelegateManager
WindowProcDelegateManager()
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:47
flutter::WindowProcDelegateManager::OnTopLevelWindowProc
std::optional< LRESULT > OnTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: window_proc_delegate_manager.cc:25
flutter::WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate
void RegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate, void *user_data)
Definition: window_proc_delegate_manager.cc:14
flutter::WindowProcDelegateManager::~WindowProcDelegateManager
~WindowProcDelegateManager()
flutter::WindowProcDelegateManager::UnregisterTopLevelWindowProcDelegate
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate)
Definition: window_proc_delegate_manager.cc:20
flutter
Definition: accessibility_bridge_windows.cc:11
message
Win32Message message
Definition: keyboard_unittests.cc:137
FlutterDesktopWindowProcCallback
bool(* FlutterDesktopWindowProcCallback)(HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)
Definition: flutter_windows.h:238