Pulp
1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
win_surface_lifecycle.hpp
Go to the documentation of this file.
1
#pragma once
2
3
// win_surface_lifecycle.hpp — the Windows editor host's "create after reparent,
4
// destroy on detach" GPU-surface contract.
5
//
6
// Split out of win_pointer_input.hpp (WAH-9), which had accumulated three
7
// unrelated things: the pointer session, the Win32 message/key-code mappings,
8
// and this. A reader looking for how surfaces are created had no reason to open
9
// a header called "pointer input", and a reader changing pointer dispatch had
10
// no reason to expect surface lifetime to live under their hands.
11
//
12
// Kept HWND-free for the same reason the pointer decisions are: Pulp's required
13
// CI gate is macOS, so anything behind `_WIN32` is never executed by a gate.
14
// The state machine here is the part with a real invariant, so it is the part
15
// that most needs to be testable off Windows.
16
17
namespace
pulp::view::win_input
{
18
32
class
SurfaceLifecycle
{
33
public
:
36
constexpr
bool
surfaces_created
() const noexcept {
return
created_; }
37
40
constexpr
bool
note_attached
() noexcept {
41
if
(created_)
return
false
;
42
created_ =
true
;
43
return
true
;
44
}
45
49
constexpr
bool
note_detached
() noexcept {
50
if
(!created_)
return
false
;
51
created_ =
false
;
52
return
true
;
53
}
54
58
constexpr
void
note_creation_failed
() noexcept { created_ =
false
; }
59
60
private
:
61
bool
created_ =
false
;
62
};
63
64
}
// namespace pulp::view::win_input
pulp::view::win_input::SurfaceLifecycle
Tracks whether the Windows editor host currently owns a GPU/Skia surface pair.
Definition
win_surface_lifecycle.hpp:32
pulp::view::win_input::SurfaceLifecycle::note_detached
constexpr bool note_detached() noexcept
Call on detach, before the HWND leaves its parent.
Definition
win_surface_lifecycle.hpp:49
pulp::view::win_input::SurfaceLifecycle::note_creation_failed
constexpr void note_creation_failed() noexcept
Surface creation is allowed to fail (no Dawn adapter, Skia surface creation returned null).
Definition
win_surface_lifecycle.hpp:58
pulp::view::win_input::SurfaceLifecycle::surfaces_created
constexpr bool surfaces_created() const noexcept
True once note_attached() has asked for creation and no detach has reclaimed it.
Definition
win_surface_lifecycle.hpp:36
pulp::view::win_input::SurfaceLifecycle::note_attached
constexpr bool note_attached() noexcept
Call after the HWND's final parent, style, and size are in place.
Definition
win_surface_lifecycle.hpp:40
pulp::view::win_input
Definition
win_plugin_input_router.hpp:45
core
view
include
pulp
view
platform
win_surface_lifecycle.hpp
Generated by
1.15.0