blob: c233c59060725f765b46c32d9c226020bccb7504 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.ui.scenic;
using fuchsia.images;
using fuchsia.mem;
using fuchsia.ui.gfx;
using fuchsia.ui.views;
using zx;
/// Scenic.TakeScreenshot() returns a raw BGRA formatted image in
/// sRGB color space and with a non-linear transfer function in this
/// struct.
struct ScreenshotData {
fuchsia.images.ImageInfo info;
fuchsia.mem.Buffer data;
};
[Discoverable]
protocol Scenic {
/// Create a new Session, which is the primary way to interact with Scenic.
CreateSession(request<Session> session, SessionListener? listener);
/// Create a new Session, which is the primary way to interact with Scenic.
///
/// In this variant, the caller may register a request for focus management.
/// The `view_focuser`'s client is coupled to the requested `session`, and
/// this coupling acts as a security boundary: the ViewRef used as the basis
/// for authority by `view_focuser` must come from `session`.
[Transitional]
CreateSession2(request<Session> session, SessionListener? listener,
request<fuchsia.ui.views.Focuser>? view_focuser);
/// Get information about the Scenic's primary display.
// TODO(SCN-453): in the future there will probably be a DisplayManager, and
// info about which displays to use will be provided to the Scenic.
GetDisplayInfo() -> (fuchsia.ui.gfx.DisplayInfo info);
/// Gets an event signaled with displayOwnedSignal or displayNotOwnedSignal
/// when display ownership changes.
GetDisplayOwnershipEvent() -> (zx.handle:EVENT ownership_event);
/// Take a screenshot and return the data in `img_data`. `img_data` will
/// not contain BGRA data if `success` is false.
// TODO(SCN-678): The permissions here are too wide (anyone can take a
// screenshot), we should narrow them.
TakeScreenshot() -> (ScreenshotData img_data, bool success);
};
const uint32 displayOwnedSignal = 0x02000000;
const uint32 displayNotOwnedSignal = 0x01000000;