internal/pipewire: move Core wrapper methods under Core
All checks were successful
Test / Create distribution (push) Successful in 37s
Test / Sandbox (push) Successful in 2m35s
Test / Hpkg (push) Successful in 4m31s
Test / Sandbox (race detector) (push) Successful in 4m37s
Test / Hakurei (race detector) (push) Successful in 5m31s
Test / Hakurei (push) Successful in 2m30s
Test / Flake checks (push) Successful in 1m42s

These do not belong under Context, and is an early implementation limitation that carried over.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-12-14 05:35:27 +09:00
parent de0467a65e
commit ffbec828e1
2 changed files with 10 additions and 10 deletions

View File

@@ -424,10 +424,10 @@ func (c *CoreHello) MarshalBinary() ([]byte, error) { return Marshal(c) }
// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. // UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal].
func (c *CoreHello) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) } func (c *CoreHello) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) }
// coreHello queues a [CoreHello] message for the PipeWire server. // hello queues a [CoreHello] message for the PipeWire server.
// This method should not be called directly, the New function queues this message. // This method should not be called directly, the [New] function queues this message.
func (ctx *Context) coreHello() error { func (core *Core) hello() error {
return ctx.writeMessage( return core.ctx.writeMessage(
PW_ID_CORE, PW_ID_CORE,
&CoreHello{PW_VERSION_CORE}, &CoreHello{PW_VERSION_CORE},
) )
@@ -463,12 +463,12 @@ func (c *CoreSync) MarshalBinary() ([]byte, error) { return Marshal(c) }
// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. // UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal].
func (c *CoreSync) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) } func (c *CoreSync) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) }
// coreSync queues a [CoreSync] message for the PipeWire server. // sync queues a [CoreSync] message for the PipeWire server.
// This is not safe to use directly, callers should use Sync instead. // This is not safe to use directly, callers should use Sync instead.
func (ctx *Context) coreSync(id Int) error { func (core *Core) sync(id Int) error {
return ctx.writeMessage( return core.ctx.writeMessage(
PW_ID_CORE, PW_ID_CORE,
&CoreSync{id, CoreSyncSequenceOffset + Int(ctx.sequence)}, &CoreSync{id, CoreSyncSequenceOffset + Int(core.ctx.sequence)},
) )
} }
@@ -485,7 +485,7 @@ const (
// Sync queues a [CoreSync] message for the PipeWire server and initiates a Roundtrip. // Sync queues a [CoreSync] message for the PipeWire server and initiates a Roundtrip.
func (core *Core) Sync() error { func (core *Core) Sync() error {
core.done = false core.done = false
if err := core.ctx.coreSync(roundtripSyncID); err != nil { if err := core.sync(roundtripSyncID); err != nil {
return err return err
} }
deadline := time.Now().Add(syncTimeout) deadline := time.Now().Add(syncTimeout)

View File

@@ -122,7 +122,7 @@ func New(conn Conn, props SPADict) (*Context, error) {
} }
ctx.nextId = Int(len(ctx.proxy)) ctx.nextId = Int(len(ctx.proxy))
if err := ctx.coreHello(); err != nil { if err := ctx.core.hello(); err != nil {
return nil, err return nil, err
} }
if err := ctx.clientUpdateProperties(props); err != nil { if err := ctx.clientUpdateProperties(props); err != nil {