Flutter Engine
win32_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/win32_window_proc_delegate_manager.h"
6 
7 #include "flutter/shell/platform/embedder/embedder.h"
8 
9 namespace flutter {
10 
13 
16  void* user_data) {
17  top_level_window_proc_handlers_[delegate] = user_data;
18 }
19 
22  top_level_window_proc_handlers_.erase(delegate);
23 }
24 
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
std::optional< LRESULT > OnTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
G_BEGIN_DECLS FlValue gpointer user_data
bool(* FlutterDesktopWindowProcCallback)(HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate)
void RegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate, void *user_data)