Ocideck/third_party/desktop_multi_window/windows/flutter_window.h
Brenno de Winter 2aca44365a Add dual-screen presenter mode (slide on beamer, notes on laptop)
When a second display is connected (macOS), presenting now opens a
borderless audience window on the beamer showing the slide, while the
main window shows the presenter view (current/next slide, speaker notes,
clock, controls) on the laptop. The two windows stay in sync over method
channels: navigation, blank screen, audio-complete and beamer clicks are
forwarded between them, and media plays only on the beamer to avoid
double audio. Falls back to the existing single-window presenter when
there is one display or the second window can't be created.

- Vendors a fork of desktop_multi_window in third_party/ that re-adds the
  native macOS window geometry/fullscreen calls (coverScreen, setFrame,
  close) the published 0.3.0 dropped; wired via a path dependency.
- Registers the app's plugins for sub-windows in MainFlutterWindow so
  video/image rendering works on the beamer.
- Routes the multi_window dart entrypoint to a minimal AudienceWindowApp.

Compiles (flutter analyze + macOS debug build) and all tests pass;
runtime two-screen behaviour still needs verification on real hardware.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 21:25:34 +02:00

44 lines
1.2 KiB
C++

#ifndef DESKTOP_MULTI_WINDOW_WINDOWS_FLUTTER_WINDOW_H_
#define DESKTOP_MULTI_WINDOW_WINDOWS_FLUTTER_WINDOW_H_
#include <Windows.h>
#include <flutter/flutter_view_controller.h>
#include <memory>
#include <string>
#include "win32_window.h"
#include "window_configuration.h"
class FlutterWindow : public Win32Window {
public:
FlutterWindow(const std::string& id, const WindowConfiguration config);
~FlutterWindow() override;
std::string GetWindowId() const { return id_; }
std::string GetWindowArgument() const { return window_argument_; }
flutter::FlutterViewController* GetFlutterViewController() const {
return flutter_controller_.get();
}
protected:
// Win32Window overrides
bool OnCreate() override;
void OnDestroy() override;
LRESULT MessageHandler(HWND hwnd,
UINT const message,
WPARAM const wparam,
LPARAM const lparam) noexcept override;
private:
std::string id_;
std::string window_argument_;
// The Flutter instance hosted by this window.
std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
};
#endif // DESKTOP_MULTI_WINDOW_WINDOWS_FLUTTER_WINDOW_H_