MayaFlux
1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Surface.cpp
Go to the documentation of this file.
1
#include "
Surface.hpp
"
2
3
#include "
Internal/Atelier.hpp
"
4
#include "
MayaFlux/Core/Backends/Windowing/Window.hpp
"
5
#include "
MayaFlux/Vruta/WindowEventSource.hpp
"
6
7
namespace
MayaFlux::Portal::Forma
{
8
9
Surface::Surface
(
SurfaceConfig
config)
10
: m_window_ownership(
std
::make_shared<
WindowOwnership
>(
std
::move(config.
window
)))
11
, m_layer(
std
::move(config.layer))
12
, m_ctx(
std
::move(config.ctx))
13
{
14
const
bool
detach = config.
should_detach_on_close
();
15
16
auto
close_ownership =
m_window_ownership
;
17
auto
close_layer =
m_layer
;
18
auto
* event_source = &close_ownership->window->get_event_source();
19
20
m_ctx
->on_close(0, [ownership = std::move(close_ownership),
layer
= std::move(close_layer), event_source, detach, on_close = std::move(config.
on_close
)]() {
21
if (on_close)
22
on_close();
23
24
if (detach) {
25
if (layer)
26
internal::atelier().bridge().stop_sync(*layer);
27
28
event_source->defer([ownership]() { ownership->window.reset(); });
29
}
30
});
31
}
32
33
}
// namespace MayaFlux::Portal::Forma
Atelier.hpp
window
std::weak_ptr< Core::Window > window
Definition
Picker.cpp:23
Surface.hpp
WindowEventSource.hpp
Window.hpp
MayaFlux::Portal::Forma::Surface::layer
Layer & layer() noexcept
Access the spatial registry.
Definition
Surface.hpp:159
MayaFlux::Portal::Forma::Surface::m_ctx
std::shared_ptr< Context > m_ctx
Definition
Surface.hpp:331
MayaFlux::Portal::Forma::Surface::m_layer
std::shared_ptr< Layer > m_layer
Definition
Surface.hpp:330
MayaFlux::Portal::Forma::Surface::Surface
Surface(SurfaceConfig config)
Construct a Surface from a SurfaceConfig.
Definition
Surface.cpp:9
MayaFlux::Portal::Forma::Surface::m_window_ownership
std::shared_ptr< WindowOwnership > m_window_ownership
Definition
Surface.hpp:329
MayaFlux::Portal::Forma
Definition
Bridge.cpp:16
std
Definition
BufferUtils.hpp:235
MayaFlux::Portal::Forma::SurfaceConfig::should_detach_on_close
bool should_detach_on_close() const noexcept
Whether the built-in detach behavior actually runs.
Definition
Surface.hpp:67
MayaFlux::Portal::Forma::SurfaceConfig::on_close
std::function< void()> on_close
Runs in addition to, never instead of, the built-in close handling.
Definition
Surface.hpp:64
MayaFlux::Portal::Forma::SurfaceConfig
The single argument every Surface-creating function in this module takes, at every level of abstracti...
Definition
Surface.hpp:26
MayaFlux::Portal::Forma::Surface::WindowOwnership
Definition
Surface.hpp:320
src
MayaFlux
Portal
Forma
Surface.cpp
Generated by
1.9.8