Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 377bf5f1 authored by Simon Chan's avatar Simon Chan
Browse files

feat(scrcpy): expose set clipboard control message

parent adfcc12a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@ export abstract class PcmPlayer<T> {
    protected abstract sourceName: string;

    #context: AudioContext;
    get outputLatency() {
        return this.#context.outputLatency;
    }

    #channelCount: number;
    #worklet: AudioWorkletNode | undefined;
    #buffers: T[] = [];
+8 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ import type { ScrcpyInjectScrollControlMessage } from "./inject-scroll.js";
import { ScrcpyInjectTextControlMessage } from "./inject-text.js";
import type { ScrcpyInjectTouchControlMessage } from "./inject-touch.js";
import { ScrcpyRotateDeviceControlMessage } from "./rotate-device.js";
import type { ScrcpySetClipboardControlMessage } from "./set-clipboard.js";
import type { AndroidScreenPowerMode } from "./set-screen-power-mode.js";
import { ScrcpySetScreenPowerModeControlMessage } from "./set-screen-power-mode.js";
import {
@@ -113,4 +114,11 @@ export class ScrcpyControlMessageSerializer {
            type: this.#typeValues.get(ScrcpyControlMessageType.RotateDevice),
        });
    }

    setClipboard(message: Omit<ScrcpySetClipboardControlMessage, "type">) {
        return this.#options.serializeSetClipboardControlMessage({
            ...message,
            type: this.#typeValues.get(ScrcpyControlMessageType.SetClipboard),
        });
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ import type {
import type { ScrcpyInjectScrollControlMessage } from "./inject-scroll.js";
import type { ScrcpyInjectTouchControlMessage } from "./inject-touch.js";
import { ScrcpyControlMessageSerializer } from "./serializer.js";
import type { ScrcpySetClipboardControlMessage } from "./set-clipboard.js";
import type { AndroidScreenPowerMode } from "./set-screen-power-mode.js";

export class ScrcpyControlMessageWriter {
@@ -87,6 +88,12 @@ export class ScrcpyControlMessageWriter {
        await this.write(this.#serializer.rotateDevice());
    }

    async setClipboard(
        message: Omit<ScrcpySetClipboardControlMessage, "type">,
    ) {
        await this.write(this.#serializer.setClipboard(message));
    }

    releaseLock() {
        this.#writer.releaseLock();
    }